File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,6 @@ def __init__(self, path):
90
90
91
91
if path not in _zip_directory_cache :
92
92
_zip_directory_cache [path ] = _read_directory (path )
93
- self ._cache_is_valid = True
94
93
self .archive = path
95
94
# a prefix directory following the ZIP file path.
96
95
self .prefix = _bootstrap_external ._path_join (* prefix [::- 1 ])
@@ -267,24 +266,23 @@ def get_resource_reader(self, fullname):
267
266
268
267
def _get_files (self ):
269
268
"""Return the files within the archive path."""
270
- if not self ._cache_is_valid :
271
- try :
272
- _zip_directory_cache [self .archive ] = _read_directory (self .archive )
273
- except ZipImportError :
274
- _zip_directory_cache .pop (self .archive , None )
275
- self ._cache_is_valid = True
276
-
277
269
try :
278
270
files = _zip_directory_cache [self .archive ]
279
271
except KeyError :
280
- files = {}
272
+ try :
273
+ files = _zip_directory_cache [self .archive ] = _read_directory (self .archive )
274
+ except ZipImportError :
275
+ files = _zip_directory_cache .pop (self .archive , {})
281
276
282
277
return files
283
278
284
279
285
280
def invalidate_caches (self ):
286
281
"""Invalidates the cache of file data of the archive path."""
287
- self ._cache_is_valid = False
282
+ try :
283
+ del _zip_directory_cache [self .archive ]
284
+ except KeyError :
285
+ pass
288
286
289
287
290
288
def __repr__ (self ):
You can’t perform that action at this time.
0 commit comments