Elron commited on
Commit
de6938d
1 Parent(s): 334775e

Upload hf_utils.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. hf_utils.py +6 -3
hf_utils.py CHANGED
@@ -30,12 +30,15 @@ class HFCachingContextManager:
30
  disable_caching()
31
 
32
 
33
- def get_missing_imports(file, exclude=[]):
 
 
34
  src_dir = Path(__file__).parent
35
  python_files = get_all_files_in_dir(src_dir, file_extension=".py")
36
  # get only the file without the path and extension
37
  required_modules = [Path(p).stem for p in python_files]
38
  imports = get_imports(file)
39
  imported_modules = [i[1] for i in imports if i[0] == "internal"]
40
- missing_imports = [i for i in required_modules if i not in imported_modules and i not in exclude]
41
- return missing_imports
 
 
30
  disable_caching()
31
 
32
 
33
+ def get_missing_imports(file, exclude=None):
34
+ if exclude is None:
35
+ exclude = []
36
  src_dir = Path(__file__).parent
37
  python_files = get_all_files_in_dir(src_dir, file_extension=".py")
38
  # get only the file without the path and extension
39
  required_modules = [Path(p).stem for p in python_files]
40
  imports = get_imports(file)
41
  imported_modules = [i[1] for i in imports if i[0] == "internal"]
42
+ return [
43
+ i for i in required_modules if i not in imported_modules and i not in exclude
44
+ ]