Skip to content

Commit e323361

Browse files
authored
Fix check_library_imports (#7026)
fix check_library_imports
1 parent c5fdb68 commit e323361

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/datasets/load.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ def _download_additional_modules(
324324
local_import_path = os.path.join(local_import_path, sub_directory)
325325
local_imports.append((import_name, local_import_path))
326326

327+
return local_imports
328+
329+
330+
def _check_library_imports(name: str, library_imports: List[Tuple[str, str]]) -> None:
327331
# Check library imports
328332
needs_to_be_installed = {}
329333
for library_import_name, library_import_path in library_imports:
@@ -344,7 +348,6 @@ def _download_additional_modules(
344348
f"{', '.join(needs_to_be_installed)}.\nPlease install {_them_str} using 'pip install "
345349
f"{' '.join(needs_to_be_installed.values())}' for instance."
346350
)
347-
return local_imports
348351

349352

350353
def _copy_script_and_other_resources_in_importable_dir(
@@ -761,6 +764,7 @@ def get_module(self) -> DatasetModule:
761764
" repo on your local machine. Make sure you have read the code there to avoid malicious use, then"
762765
" set the option `trust_remote_code=True` to remove this error."
763766
)
767+
_check_library_imports(name=self.name, local_imports=local_imports)
764768
module_path, hash = _load_importable_file(
765769
dynamic_modules_path=dynamic_modules_path,
766770
module_namespace="datasets",

0 commit comments

Comments
 (0)