Skip to content

Commit df781bb

Browse files
author
The TensorFlow Datasets Authors
committed
Raise an error when there are no record sets in Croissant metadata.
PiperOrigin-RevId: 761081562
1 parent 2034928 commit df781bb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tensorflow_datasets/core/dataset_builders/croissant_builder.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ def __init__(
270270
the values should be the values to filter by. If a record matches all
271271
the filters, it will be included in the dataset.
272272
**kwargs: kwargs to pass to GeneratorBasedBuilder directly.
273+
274+
Raises:
275+
ValueError: If no record sets are found in the Croissant JSON-LD.
273276
"""
274277
if mapping is None:
275278
mapping = {}
@@ -293,6 +296,12 @@ def __init__(
293296
conversion_utils.to_tfds_name(record_set_id)
294297
for record_set_id in record_set_ids
295298
]
299+
if not config_names:
300+
raise ValueError(
301+
'No record sets found in the Croissant JSON-LD. At least one record'
302+
' set is required to be able to download and prepare the dataset.'
303+
)
304+
296305
self.BUILDER_CONFIGS: list[dataset_builder.BuilderConfig] = [ # pylint: disable=invalid-name
297306
dataset_builder.BuilderConfig(name=config_name)
298307
for config_name in config_names

0 commit comments

Comments
 (0)