MCPcopy
hub / github.com/python/mypy / verify_module

Function verify_module

mypy/modulefinder.py:758–769  ·  view source on GitHub ↗

Check that all packages containing id have a __init__ file.

(fscache: FileSystemCache, id: str, path: str, prefix: str)

Source from the content-addressed store, hash-verified

756
757
758def verify_module(fscache: FileSystemCache, id: str, path: str, prefix: str) -> bool:
759 """Check that all packages containing id have a __init__ file."""
760 if is_init_file(path):
761 path = os.path.dirname(path)
762 for i in range(id.count(".")):
763 path = os.path.dirname(path)
764 if not any(
765 fscache.isfile_case(os_path_join(path, f"__init__{extension}"), prefix)
766 for extension in PYTHON_EXTENSIONS
767 ):
768 return False
769 return True
770
771
772def highest_init_level(fscache: FileSystemCache, id: str, path: str, prefix: str) -> int:

Callers 1

_find_moduleMethod · 0.85

Calls 6

os_path_joinFunction · 0.90
is_init_fileFunction · 0.85
rangeClass · 0.85
anyFunction · 0.85
countMethod · 0.45
isfile_caseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…