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

Method path_hook

Lib/importlib/_bootstrap_external.py:1435–1450  ·  view source on GitHub ↗

A class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised.

(cls, *loader_details)

Source from the content-addressed store, hash-verified

1433
1434 @classmethod
1435 def path_hook(cls, *loader_details):
1436 """A class method which returns a closure to use on sys.path_hook
1437 which will return an instance using the specified loaders and the path
1438 called on the closure.
1439
1440 If the path called on the closure is not a directory, ImportError is
1441 raised.
1442
1443 """
1444 def path_hook_for_FileFinder(path):
1445 """Path hook for importlib.machinery.FileFinder."""
1446 if not _path_isdir(path):
1447 raise ImportError('only directories are supported', path=path)
1448 return cls(path, *loader_details)
1449
1450 return path_hook_for_FileFinder
1451
1452 def _find_children(self):
1453 with _os.scandir(self.path) as scan_iterator:

Callers 4

_installFunction · 0.45
source_wo_bytecodeFunction · 0.45
source_writing_bytecodeFunction · 0.45
source_using_bytecodeFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected