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

Function exist_added_packages

mypy/build.py:3809–3838  ·  view source on GitHub ↗

Find if there are any newly added packages that were previously suppressed. Exclude everything not in build for follow-imports=skip.

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

Source from the content-addressed store, hash-verified

3807
3808
3809def exist_added_packages(suppressed: list[str], manager: BuildManager) -> bool:
3810 """Find if there are any newly added packages that were previously suppressed.
3811
3812 Exclude everything not in build for follow-imports=skip.
3813 """
3814 for dep in suppressed:
3815 if dep in manager.source_set.source_modules:
3816 # We don't need to add any special logic for this. If a module
3817 # is added to build, importers will be invalidated by normal mechanism.
3818 continue
3819 path = find_module_simple(dep, manager)
3820 if not path:
3821 continue
3822 options = manager.options.clone_for_module(dep)
3823 # Technically this is not 100% correct, since we can have:
3824 # from pkg import mod
3825 # with
3826 # [mypy-pkg]
3827 # follow-import = silent
3828 # [mypy-pkg.mod]
3829 # follow-imports = normal
3830 # But such cases are extremely rare, and this allows us to avoid
3831 # massive performance impact in much more common situations.
3832 if options.follow_imports in ("skip", "error") and (
3833 not path.endswith(".pyi") or options.follow_imports_for_stubs
3834 ):
3835 continue
3836 if os.path.basename(path) in ("__init__.py", "__init__.pyi"):
3837 return True
3838 return False
3839
3840
3841def exist_removed_submodules(dependencies: list[str], manager: BuildManager) -> bool:

Callers 1

new_stateMethod · 0.85

Calls 3

find_module_simpleFunction · 0.85
clone_for_moduleMethod · 0.80
endswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…