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

Method _path_importer_cache

Lib/importlib/_bootstrap_external.py:1212–1231  ·  view source on GitHub ↗

Get the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None.

(cls, path)

Source from the content-addressed store, hash-verified

1210
1211 @classmethod
1212 def _path_importer_cache(cls, path):
1213 """Get the finder for the path entry from sys.path_importer_cache.
1214
1215 If the path entry is not in the cache, find the appropriate finder
1216 and cache it. If no finder is available, store None.
1217
1218 """
1219 if path == '':
1220 try:
1221 path = _os.getcwd()
1222 except (FileNotFoundError, PermissionError):
1223 # Don't cache the failure as the cwd can easily change to
1224 # a valid directory later on.
1225 return None
1226 try:
1227 finder = sys.path_importer_cache[path]
1228 except KeyError:
1229 finder = cls._path_hooks(path)
1230 sys.path_importer_cache[path] = finder
1231 return finder
1232
1233 @classmethod
1234 def _get_spec(cls, fullname, path, target=None):

Callers 2

_get_specMethod · 0.80
discoverMethod · 0.80

Calls 1

_path_hooksMethod · 0.80

Tested by

no test coverage detected