MCPcopy Index your code
hub / github.com/python/mypy / find_module_path_using_sys_path

Function find_module_path_using_sys_path

mypy/stubutil.py:96–106  ·  view source on GitHub ↗
(module: str, sys_path: list[str])

Source from the content-addressed store, hash-verified

94
95
96def find_module_path_using_sys_path(module: str, sys_path: list[str]) -> str | None:
97 relative_candidates = (
98 module.replace(".", "/") + ".py",
99 os.path.join(module.replace(".", "/"), "__init__.py"),
100 )
101 for base in sys_path:
102 for relative_path in relative_candidates:
103 path = os.path.join(base, relative_path)
104 if os.path.isfile(path):
105 return path
106 return None
107
108
109def find_module_path_and_all_py3(

Callers 1

Calls 3

replaceMethod · 0.80
joinMethod · 0.45
isfileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…