@@ -412,7 +412,6 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
412
412
third_party_inline_dirs : PackageDirs = []
413
413
third_party_stubs_dirs : PackageDirs = []
414
414
found_possible_third_party_missing_type_hints = False
415
- need_installed_stubs = False
416
415
# Third-party stub/typed packages
417
416
candidate_package_dirs = {
418
417
package_dir [0 ]
@@ -455,9 +454,6 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
455
454
third_party_inline_dirs .append (non_stub_match )
456
455
self ._update_ns_ancestors (components , non_stub_match )
457
456
458
- if approved_stub_package_exists (id ):
459
- need_installed_stubs = True
460
-
461
457
if self .options and self .options .use_builtins_fixtures :
462
458
# Everything should be in fixtures.
463
459
third_party_inline_dirs .clear ()
@@ -556,7 +552,7 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
556
552
if ancestor is not None :
557
553
return ancestor
558
554
559
- if need_installed_stubs :
555
+ if approved_stub_package_exists ( id ) :
560
556
return ModuleNotFoundReason .APPROVED_STUBS_NOT_INSTALLED
561
557
elif found_possible_third_party_missing_type_hints :
562
558
return ModuleNotFoundReason .FOUND_WITHOUT_TYPE_HINTS
0 commit comments