Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename STUBS_NOT_INSTALLED to APPROVED_STUBS_NOT_INSTALLED #10558

Merged
merged 1 commit into from May 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/build.py
Expand Up @@ -2555,7 +2555,7 @@ def module_not_found(manager: BuildManager, line: int, caller_state: State,
if '{stub_dist}' in note:
note = note.format(stub_dist=legacy_bundled_packages[top_level])
errors.report(line, 0, note, severity='note', only_once=True, code=codes.IMPORT)
if reason is ModuleNotFoundReason.STUBS_NOT_INSTALLED:
if reason is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED:
manager.missing_stub_packages.add(legacy_bundled_packages[top_level])
errors.set_import_context(save_import_context)

Expand Down
10 changes: 5 additions & 5 deletions mypy/modulefinder.py
Expand Up @@ -57,7 +57,7 @@ class ModuleNotFoundReason(Enum):
WRONG_WORKING_DIRECTORY = 2

# Stub PyPI package (typically types-pkgname) known to exist but not installed.
STUBS_NOT_INSTALLED = 3
APPROVED_STUBS_NOT_INSTALLED = 3

def error_message_templates(self, daemon: bool) -> Tuple[str, List[str]]:
doc_link = "See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports"
Expand All @@ -71,7 +71,7 @@ def error_message_templates(self, daemon: bool) -> Tuple[str, List[str]]:
elif self is ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS:
msg = 'Skipping analyzing "{module}": found module but no type hints or library stubs'
notes = [doc_link]
elif self is ModuleNotFoundReason.STUBS_NOT_INSTALLED:
elif self is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED:
msg = (
'Library stubs not installed for "{module}" (or incompatible with Python {pyver})'
)
Expand Down Expand Up @@ -231,7 +231,7 @@ def _find_module_non_stub_helper(self, components: List[str],
or self.fscache.isfile(dir_path + ".py")):
plausible_match = True
if components[0] in legacy_bundled_packages:
return ModuleNotFoundReason.STUBS_NOT_INSTALLED
return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
elif plausible_match:
return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS
else:
Expand Down Expand Up @@ -311,7 +311,7 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
if isinstance(non_stub_match, ModuleNotFoundReason):
if non_stub_match is ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS:
found_possible_third_party_missing_type_hints = True
elif non_stub_match is ModuleNotFoundReason.STUBS_NOT_INSTALLED:
elif non_stub_match is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED:
need_installed_stubs = True
else:
third_party_inline_dirs.append(non_stub_match)
Expand Down Expand Up @@ -413,7 +413,7 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
return ancestor

if need_installed_stubs:
return ModuleNotFoundReason.STUBS_NOT_INSTALLED
return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
elif found_possible_third_party_missing_type_hints:
return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS
else:
Expand Down