INNER CODE UNIT · Python
__init__
metatypedev/metatype · src/pyrt_wit_wire/main.py:153
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:
self._pkgs.add(dirname)
dirname = os.path.dirname(dirname)
self._mod_names = {ThePathFinder.path_to_module(path): path for path in modules}
self._pkg_names = {
ThePathFinder.path_to_module(path): path for path in self._pkgs
}
# Look for a spec under a certain module name
# https://peps.python.org/pep-0302/
# https://peps.python.org/pep-0451/
def find_spec(self, fullname: str, _path, target=None):