MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_importer

Function get_importer

tools/python-3.11.9-amd64/Lib/pkgutil.py:407–429  ·  view source on GitHub ↗

Retrieve a finder for the given path item The returned finder is cached in sys.path_importer_cache if it was newly created by a path hook. The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary.

(path_item)

Source from the content-addressed store, hash-verified

405
406
407def get_importer(path_item):
408 """Retrieve a finder for the given path item
409
410 The returned finder is cached in sys.path_importer_cache
411 if it was newly created by a path hook.
412
413 The cache (or part of it) can be cleared manually if a
414 rescan of sys.path_hooks is necessary.
415 """
416 path_item = os.fsdecode(path_item)
417 try:
418 importer = sys.path_importer_cache[path_item]
419 except KeyError:
420 for path_hook in sys.path_hooks:
421 try:
422 importer = path_hook(path_item)
423 sys.path_importer_cache.setdefault(path_item, importer)
424 break
425 except ImportError:
426 pass
427 else:
428 importer = None
429 return importer
430
431
432def iter_importers(fullname=""):

Callers 7

run_pathFunction · 0.90
find_distributionsFunction · 0.90
_handle_nsFunction · 0.90
find_distributionsFunction · 0.90
_handle_nsFunction · 0.90
iter_importersFunction · 0.85
extend_pathFunction · 0.85

Calls 1

setdefaultMethod · 0.45

Tested by

no test coverage detected