INNER CODE UNIT · Python
ThePathFinder
metatypedev/metatype · src/pyrt_wit_wire/main.py:142
class ThePathFinder(importlib.abc.MetaPathFinder):
@staticmethod
def path_to_module(path: str):
return os.path.splitext((os.path.normpath(path)))[0].replace("/", ".")
def debug(self):
print("= Loaded modules summary == == == ==")
print(f" modules: {self._mod_names}")
print(f" packages: {self._pkg_names}")
print("== == == == == == == == == == == ==")
def __init__(self, modules: Dict[str, str]):
self._mods_raw = modules
self._pkgs = set()
for path in self._mods_raw:
dirname = os.path.dirname(path)
while dirname != "/" and dirname != "" and dirname != ".":
if dirname not in self._mods_raw: