@@ -334,10 +334,11 @@ def _typeshed_has_version(self, module: str) -> bool:
334334 return version >= min_version and (max_version is None or version <= max_version )
335335
336336 def _find_module_non_stub_helper (
337- self , components : list [ str ] , pkg_dir : str
337+ self , id : str , pkg_dir : str
338338 ) -> OnePackageDir | ModuleNotFoundReason :
339339 plausible_match = False
340340 dir_path = pkg_dir
341+ components = id .split ("." )
341342 for index , component in enumerate (components ):
342343 dir_path = os_path_join (dir_path , component )
343344 if self .fscache .isfile (os_path_join (dir_path , "py.typed" )):
@@ -350,6 +351,10 @@ def _find_module_non_stub_helper(
350351 if not self .fscache .isdir (dir_path ):
351352 break
352353 if plausible_match :
354+ if self .options :
355+ module_specific_options = self .options .clone_for_module (id )
356+ if module_specific_options .follow_untyped_imports :
357+ return os .path .join (pkg_dir , * components [:- 1 ]), False
353358 return ModuleNotFoundReason .FOUND_WITHOUT_TYPE_HINTS
354359 else :
355360 return ModuleNotFoundReason .NOT_FOUND
@@ -463,7 +468,7 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
463468 third_party_stubs_dirs .append ((path , True ))
464469 else :
465470 third_party_stubs_dirs .append ((path , True ))
466- non_stub_match = self ._find_module_non_stub_helper (components , pkg_dir )
471+ non_stub_match = self ._find_module_non_stub_helper (id , pkg_dir )
467472 if isinstance (non_stub_match , ModuleNotFoundReason ):
468473 if non_stub_match is ModuleNotFoundReason .FOUND_WITHOUT_TYPE_HINTS :
469474 found_possible_third_party_missing_type_hints = True
0 commit comments