@@ -194,7 +194,7 @@ def default_flush_errors(new_messages: List[str], is_serious: bool) -> None:
194
194
raise
195
195
196
196
197
- # python_path is usercode , mypy_path is set via config or environment variable,
197
+ # python_path is user code , mypy_path is set via config or environment variable,
198
198
# package_path is calculated by _get_site_packages_dirs, and typeshed_path points
199
199
# to typeshed. Each is a tuple of paths to be searched in find_module()
200
200
SearchPaths = NamedTuple ('SearchPaths' ,
@@ -676,7 +676,7 @@ def __init__(self, data_dir: str,
676
676
self .cache_enabled = options .incremental and (
677
677
not options .fine_grained_incremental or options .use_fine_grained_cache )
678
678
self .fscache = fscache
679
- self .find_module_cache = FindModuleCache (self .fscache )
679
+ self .find_module_cache = FindModuleCache (self .fscache , self . options )
680
680
681
681
# a mapping from source files to their corresponding shadow files
682
682
# for efficient lookup
@@ -854,12 +854,14 @@ class FindModuleCache:
854
854
cleared by client code.
855
855
"""
856
856
857
- def __init__ (self , fscache : Optional [FileSystemCache ] = None ) -> None :
857
+ def __init__ (self , fscache : Optional [FileSystemCache ] = None ,
858
+ options : Optional [Options ] = None ) -> None :
858
859
self .fscache = fscache or FileSystemCache ()
859
860
# Cache find_lib_path_dirs: (dir_chain, search_paths) -> list(package_dirs, should_verify)
860
861
self .dirs = {} # type: Dict[Tuple[str, Tuple[str, ...]], PackageDirs]
861
862
# Cache find_module: (id, search_paths, python_version) -> result.
862
863
self .results = {} # type: Dict[Tuple[str, SearchPaths, Optional[str]], Optional[str]]
864
+ self .options = options
863
865
864
866
def clear (self ) -> None :
865
867
self .results .clear ()
@@ -935,6 +937,10 @@ def _find_module(self, id: str, search_paths: SearchPaths,
935
937
elif fscache .isfile (typed_file ):
936
938
path = os .path .join (pkg_dir , dir_chain )
937
939
third_party_inline_dirs .append ((path , True ))
940
+ if self .options and self .options .use_builtins_fixtures :
941
+ # Everything should be in fixtures.
942
+ third_party_inline_dirs .clear ()
943
+ third_party_stubs_dirs .clear ()
938
944
python_mypy_path = search_paths .python_path + search_paths .mypy_path
939
945
candidate_base_dirs = self .find_lib_path_dirs (dir_chain , python_mypy_path ) + \
940
946
third_party_stubs_dirs + third_party_inline_dirs + \
0 commit comments