@@ -412,7 +412,6 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
412412 third_party_inline_dirs : PackageDirs = []
413413 third_party_stubs_dirs : PackageDirs = []
414414 found_possible_third_party_missing_type_hints = False
415- need_installed_stubs = False
416415 # Third-party stub/typed packages
417416 candidate_package_dirs = {
418417 package_dir [0 ]
@@ -455,9 +454,6 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
455454 third_party_inline_dirs .append (non_stub_match )
456455 self ._update_ns_ancestors (components , non_stub_match )
457456
458- if approved_stub_package_exists (id ):
459- need_installed_stubs = True
460-
461457 if self .options and self .options .use_builtins_fixtures :
462458 # Everything should be in fixtures.
463459 third_party_inline_dirs .clear ()
@@ -556,7 +552,7 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
556552 if ancestor is not None :
557553 return ancestor
558554
559- if need_installed_stubs :
555+ if approved_stub_package_exists ( id ) :
560556 return ModuleNotFoundReason .APPROVED_STUBS_NOT_INSTALLED
561557 elif found_possible_third_party_missing_type_hints :
562558 return ModuleNotFoundReason .FOUND_WITHOUT_TYPE_HINTS
0 commit comments