42
42
from tensorflow_datasets .core import dataset_builder
43
43
from tensorflow_datasets .core import dataset_info
44
44
from tensorflow_datasets .core import download
45
- from tensorflow_datasets .core import naming
46
45
from tensorflow_datasets .core import split_builder as split_builder_lib
47
46
from tensorflow_datasets .core import splits as splits_lib
48
47
from tensorflow_datasets .core .features import feature as feature_lib
49
48
from tensorflow_datasets .core .features import features_dict
50
49
from tensorflow_datasets .core .features import image_feature
51
50
from tensorflow_datasets .core .features import sequence_feature
52
51
from tensorflow_datasets .core .features import text_feature
53
- from tensorflow_datasets .core .utils import py_utils
52
+ from tensorflow_datasets .core .utils import huggingface_utils
54
53
from tensorflow_datasets .core .utils import type_utils
55
54
from tensorflow_datasets .core .utils import version as version_utils
56
55
from tensorflow_datasets .core .utils .lazy_imports_utils import mlcroissant as mlc
@@ -174,9 +173,7 @@ def __init__(
174
173
if mapping is None :
175
174
mapping = {}
176
175
self .dataset = mlc .Dataset (jsonld , mapping = mapping )
177
- self .name = py_utils .make_valid_name (
178
- naming .camelcase_to_snakecase (self .dataset .metadata .name )
179
- )
176
+ self .name = huggingface_utils .convert_hf_name (self .dataset .metadata .name )
180
177
self .metadata = self .dataset .metadata
181
178
182
179
# In TFDS, version is a mandatory attribute, while in Croissant it is only a
@@ -192,7 +189,7 @@ def __init__(
192
189
record_set .id for record_set in self .metadata .record_sets
193
190
]
194
191
config_names = [
195
- py_utils . make_valid_name ( naming . camelcase_to_snakecase ( record_set ) )
192
+ huggingface_utils . convert_hf_name ( record_set )
196
193
for record_set in record_set_ids
197
194
]
198
195
self .BUILDER_CONFIGS : Sequence [dataset_builder .BuilderConfig ] = [ # pylint: disable=invalid-name
@@ -228,7 +225,7 @@ def _info(self) -> dataset_info.DatasetInfo:
228
225
def get_record_set (self , record_set_id : str ):
229
226
"""Returns the desired record set from self.metadata."""
230
227
for record_set in self .dataset .metadata .record_sets :
231
- if py_utils . make_valid_name (record_set .id ) == record_set_id :
228
+ if huggingface_utils . convert_hf_name (record_set .id ) == record_set_id :
232
229
return record_set
233
230
raise ValueError (
234
231
f'Did not find any record set with the name { record_set_id } .'
0 commit comments