@@ -282,7 +282,7 @@ def increase_load_count(name: str):
282
282
283
283
def _download_additional_modules (
284
284
name : str , base_path : str , imports : Tuple [str , str , str , str ], download_config : Optional [DownloadConfig ]
285
- ) -> List [Tuple [str , str ]]:
285
+ ) -> Tuple [ List [Tuple [str , str ]], List [ Tuple [ str , str ] ]]:
286
286
"""
287
287
Download additional module for a module <name>.py at URL (or local path) <base_path>/<name>.py
288
288
The imports must have been parsed first using ``get_imports``.
@@ -324,7 +324,7 @@ def _download_additional_modules(
324
324
local_import_path = os .path .join (local_import_path , sub_directory )
325
325
local_imports .append ((import_name , local_import_path ))
326
326
327
- return local_imports
327
+ return local_imports , library_imports
328
328
329
329
330
330
def _check_library_imports (name : str , library_imports : List [Tuple [str , str ]]) -> None :
@@ -725,7 +725,7 @@ def get_module(self) -> DatasetModule:
725
725
dataset_infos_path = Path (self .path ).parent / config .DATASETDICT_INFOS_FILENAME
726
726
dataset_readme_path = Path (self .path ).parent / config .REPOCARD_FILENAME
727
727
imports = get_imports (self .path )
728
- local_imports = _download_additional_modules (
728
+ local_imports , library_imports = _download_additional_modules (
729
729
name = self .name ,
730
730
base_path = str (Path (self .path ).parent ),
731
731
imports = imports ,
@@ -764,7 +764,7 @@ def get_module(self) -> DatasetModule:
764
764
" repo on your local machine. Make sure you have read the code there to avoid malicious use, then"
765
765
" set the option `trust_remote_code=True` to remove this error."
766
766
)
767
- _check_library_imports (name = self .name , local_imports = local_imports )
767
+ _check_library_imports (name = self .name , library_imports = library_imports )
768
768
module_path , hash = _load_importable_file (
769
769
dynamic_modules_path = dynamic_modules_path ,
770
770
module_namespace = "datasets" ,
@@ -1289,7 +1289,7 @@ def get_module(self) -> DatasetModule:
1289
1289
dataset_infos_path = self .download_dataset_infos_file ()
1290
1290
dataset_readme_path = self .download_dataset_readme_file ()
1291
1291
imports = get_imports (local_path )
1292
- local_imports = _download_additional_modules (
1292
+ local_imports , library_imports = _download_additional_modules (
1293
1293
name = self .name ,
1294
1294
base_path = hf_dataset_url (self .name , "" , revision = self .revision ),
1295
1295
imports = imports ,
@@ -1328,7 +1328,7 @@ def get_module(self) -> DatasetModule:
1328
1328
" repo on your local machine. Make sure you have read the code there to avoid malicious use, then"
1329
1329
" set the option `trust_remote_code=True` to remove this error."
1330
1330
)
1331
- _check_library_imports (name = self .name , local_imports = local_imports )
1331
+ _check_library_imports (name = self .name , library_imports = library_imports )
1332
1332
module_path , hash = _load_importable_file (
1333
1333
dynamic_modules_path = dynamic_modules_path ,
1334
1334
module_namespace = "datasets" ,
0 commit comments