MCPcopy Index your code
hub / github.com/python/cpython / invalidate_caches

Method invalidate_caches

Lib/importlib/_bootstrap_external.py:1181–1196  ·  view source on GitHub ↗

Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_cache (where implemented).

()

Source from the content-addressed store, hash-verified

1179
1180 @staticmethod
1181 def invalidate_caches():
1182 """Call the invalidate_caches() method on all path entry finders
1183 stored in sys.path_importer_cache (where implemented)."""
1184 for name, finder in list(sys.path_importer_cache.items()):
1185 # Drop entry if finder name is a relative path. The current
1186 # working directory may have changed.
1187 if finder is None or not _path_isabs(name):
1188 del sys.path_importer_cache[name]
1189 elif hasattr(finder, 'invalidate_caches'):
1190 finder.invalidate_caches()
1191 # Also invalidate the caches of NamespacePaths
1192 # https://bugs.python.org/issue45703
1193 NamespacePath._epoch += 1
1194
1195 from importlib.metadata import MetadataPathFinder
1196 MetadataPathFinder.invalidate_caches()
1197
1198 @staticmethod
1199 def _path_hooks(path):

Callers

nothing calls this directly

Calls 3

listClass · 0.85
_path_isabsFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected