Creates a dynamic module in the cache directory for modules.
(name: str | os.PathLike)
| 65 | |
| 66 | |
| 67 | def create_dynamic_module(name: str | os.PathLike): |
| 68 | """ |
| 69 | Creates a dynamic module in the cache directory for modules. |
| 70 | """ |
| 71 | init_hf_modules() |
| 72 | dynamic_module_path = Path(HF_MODULES_CACHE) / name |
| 73 | # If the parent module does not exist yet, recursively create it. |
| 74 | if not dynamic_module_path.parent.exists(): |
| 75 | create_dynamic_module(dynamic_module_path.parent) |
| 76 | os.makedirs(dynamic_module_path, exist_ok=True) |
| 77 | init_path = dynamic_module_path / "__init__.py" |
| 78 | if not init_path.exists(): |
| 79 | init_path.touch() |
| 80 | |
| 81 | |
| 82 | def get_relative_imports(module_file): |
no test coverage detected
searching dependent graphs…