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

Method global_cache

Lib/_pyrepl/_module_completer.py:265–271  ·  view source on GitHub ↗

Global module cache

(self)

Source from the content-addressed store, hash-verified

263
264 @property
265 def global_cache(self) -> list[pkgutil.ModuleInfo]:
266 """Global module cache"""
267 if not self._global_cache or self._curr_sys_path != sys.path:
268 self._curr_sys_path = sys.path[:]
269 self._global_cache = list(pkgutil.iter_modules())
270 self._failed_imports.clear() # retry on sys.path change
271 return self._global_cache
272
273 def _maybe_import_module(self, fqname: str) -> ModuleType | None:
274 if any(pattern.fullmatch(fqname) for pattern in AUTO_IMPORT_DENYLIST):

Callers

nothing calls this directly

Calls 2

listClass · 0.85
clearMethod · 0.45

Tested by

no test coverage detected