@@ -48,7 +48,6 @@ def flush(self) -> None:
48
48
self .read_cache = {} # type: Dict[str, bytes]
49
49
self .read_error_cache = {} # type: Dict[str, Exception]
50
50
self .hash_cache = {} # type: Dict[str, str]
51
- self .fake_package_cache = set () # type: Set[str]
52
51
53
52
def stat (self , path : str ) -> os .stat_result :
54
53
if path in self .stat_cache :
@@ -68,11 +67,7 @@ def stat(self, path: str) -> os.stat_result:
68
67
def listdir (self , path : str ) -> List [str ]:
69
68
path = os .path .normpath (path )
70
69
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 ]
76
71
if path in self .listdir_error_cache :
77
72
raise copy_os_error (self .listdir_error_cache [path ])
78
73
try :
@@ -82,9 +77,6 @@ def listdir(self, path: str) -> List[str]:
82
77
self .listdir_error_cache [path ] = copy_os_error (err )
83
78
raise err
84
79
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' )
88
80
return results
89
81
90
82
def isfile (self , path : str ) -> bool :
@@ -160,16 +152,12 @@ def read(self, path: str) -> bytes:
160
152
161
153
dirname , basename = os .path .split (path )
162
154
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
173
161
174
162
self .read_cache [path ] = data
175
163
self .hash_cache [path ] = hash_digest (data )
0 commit comments