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

Method find_spec

Lib/importlib/_bootstrap_external.py:703–722  ·  view source on GitHub ↗
(cls, fullname, path=None, target=None)

Source from the content-addressed store, hash-verified

701
702 @classmethod
703 def find_spec(cls, fullname, path=None, target=None):
704 _warnings.warn('importlib.machinery.WindowsRegistryFinder is '
705 'deprecated; use site configuration instead. '
706 'Future versions of Python may not enable this '
707 'finder by default.',
708 DeprecationWarning, stacklevel=2)
709
710 filepath = cls._search_registry(fullname)
711 if filepath is None:
712 return None
713 try:
714 _path_stat(filepath)
715 except OSError:
716 return None
717 for loader, suffixes in _get_supported_file_loaders():
718 if filepath.endswith(tuple(suffixes)):
719 spec = _bootstrap.spec_from_loader(fullname,
720 loader(fullname, filepath),
721 origin=filepath)
722 return spec
723
724
725class _LoaderBasics:

Callers

nothing calls this directly

Calls 5

_path_statFunction · 0.85
_search_registryMethod · 0.80
warnMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected