Imports the module name "com" as a namespace package. This ensures our namespace detection considers sys.meta_path, which is important to support all possible ways a module can be imported (for example editable installs).
| 1606 | """ |
| 1607 | |
| 1608 | class CustomImporter(importlib.abc.MetaPathFinder): |
| 1609 | """ |
| 1610 | Imports the module name "com" as a namespace package. |
| 1611 | |
| 1612 | This ensures our namespace detection considers sys.meta_path, which is important |
| 1613 | to support all possible ways a module can be imported (for example editable installs). |
| 1614 | """ |
| 1615 | |
| 1616 | def find_spec( |
| 1617 | self, name: str, path: Any = None, target: Any = None |
| 1618 | ) -> importlib.machinery.ModuleSpec | None: |
| 1619 | if name == "com": |
| 1620 | spec = importlib.machinery.ModuleSpec("com", loader=None) |
| 1621 | spec.submodule_search_locations = [str(com_root_2), str(com_root_1)] |
| 1622 | return spec |
| 1623 | return None |
| 1624 | |
| 1625 | # Setup directories without configuring sys.path. |
| 1626 | models_py, _algorithms_py = self.setup_directories( |
no outgoing calls