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

Function exist_removed_submodules

mypy/build.py:3841–3858  ·  view source on GitHub ↗

Find if there are any submodules of packages that are now missing. This is conceptually an inverse of exist_added_packages().

(dependencies: list[str], manager: BuildManager)

Source from the content-addressed store, hash-verified

3839
3840
3841def exist_removed_submodules(dependencies: list[str], manager: BuildManager) -> bool:
3842 """Find if there are any submodules of packages that are now missing.
3843
3844 This is conceptually an inverse of exist_added_packages().
3845 """
3846 dependencies_set = set(dependencies)
3847 for dep in dependencies:
3848 if "." not in dep:
3849 continue
3850 if dep in manager.source_set.source_modules:
3851 # We still know it is definitely a module.
3852 continue
3853 direct_ancestor, _ = dep.rsplit(".", maxsplit=1)
3854 if direct_ancestor not in dependencies_set:
3855 continue
3856 if find_module_simple(dep, manager) is None:
3857 return True
3858 return False
3859
3860
3861def find_module_simple(id: str, manager: BuildManager) -> str | None:

Callers 1

new_stateMethod · 0.85

Calls 3

setClass · 0.85
find_module_simpleFunction · 0.85
rsplitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…