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)
| 3807 | |
| 3808 | |
| 3809 | def 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 | |
| 3841 | def exist_removed_submodules(dependencies: list[str], manager: BuildManager) -> bool: |
no test coverage detected
searching dependent graphs…