(*, path: str, name: str = "example")
| 92 | |
| 93 | |
| 94 | def _load_module(*, path: str, name: str = "example") -> ModuleType: |
| 95 | spec = importlib.util.spec_from_file_location(name, path) |
| 96 | assert spec is not None and spec.loader is not None # for static type checkers |
| 97 | module = importlib.util.module_from_spec(spec) |
| 98 | spec.loader.exec_module(module) |
| 99 | return module |
| 100 | |
| 101 | |
| 102 | @contextlib.contextmanager |