Creates the cache directory for modules with an init, and adds it to the Python path.
()
| 48 | |
| 49 | |
| 50 | def init_hf_modules(): |
| 51 | """ |
| 52 | Creates the cache directory for modules with an init, and adds it to the Python path. |
| 53 | """ |
| 54 | # This function has already been executed if HF_MODULES_CACHE already is in the Python path. |
| 55 | if HF_MODULES_CACHE in sys.path: |
| 56 | return |
| 57 | |
| 58 | sys.path.append(HF_MODULES_CACHE) |
| 59 | os.makedirs(HF_MODULES_CACHE, exist_ok=True) |
| 60 | init_path = Path(HF_MODULES_CACHE) / "__init__.py" |
| 61 | if not init_path.exists(): |
| 62 | init_path.touch() |
| 63 | |
| 64 | |
| 65 | def create_dynamic_module(name: Union[str, os.PathLike]): |
no outgoing calls
no test coverage detected