@@ -48,7 +48,6 @@ def flush(self) -> None:
4848 self .read_cache = {} # type: Dict[str, bytes]
4949 self .read_error_cache = {} # type: Dict[str, Exception]
5050 self .hash_cache = {} # type: Dict[str, str]
51- self .fake_package_cache = set () # type: Set[str]
5251
5352 def stat (self , path : str ) -> os .stat_result :
5453 if path in self .stat_cache :
@@ -68,11 +67,7 @@ def stat(self, path: str) -> os.stat_result:
6867 def listdir (self , path : str ) -> List [str ]:
6968 path = os .path .normpath (path )
7069 if path in self .listdir_cache :
71- res = self .listdir_cache [path ]
72- # Check the fake cache.
73- if path in self .fake_package_cache and '__init__.py' not in res :
74- res .append ('__init__.py' ) # Updates the result as well as the cache
75- return res
70+ return self .listdir_cache [path ]
7671 if path in self .listdir_error_cache :
7772 raise copy_os_error (self .listdir_error_cache [path ])
7873 try :
@@ -82,9 +77,6 @@ def listdir(self, path: str) -> List[str]:
8277 self .listdir_error_cache [path ] = copy_os_error (err )
8378 raise err
8479 self .listdir_cache [path ] = results
85- # Check the fake cache.
86- if path in self .fake_package_cache and '__init__.py' not in results :
87- results .append ('__init__.py' )
8880 return results
8981
9082 def isfile (self , path : str ) -> bool :
@@ -160,16 +152,12 @@ def read(self, path: str) -> bytes:
160152
161153 dirname , basename = os .path .split (path )
162154 dirname = os .path .normpath (dirname )
163- # Check the fake cache.
164- if basename == '__init__.py' and dirname in self .fake_package_cache :
165- data = b''
166- else :
167- try :
168- with open (path , 'rb' ) as f :
169- data = f .read ()
170- except OSError as err :
171- self .read_error_cache [path ] = err
172- raise
155+ try :
156+ with open (path , 'rb' ) as f :
157+ data = f .read ()
158+ except OSError as err :
159+ self .read_error_cache [path ] = err
160+ raise
173161
174162 self .read_cache [path ] = data
175163 self .hash_cache [path ] = hash_digest (data )
0 commit comments