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

Method locate_file

Lib/importlib/metadata/__init__.py:434–449  ·  view source on GitHub ↗

Given a path to a file in this distribution, return a SimplePath to it. This method is used by callers of ``Distribution.files()`` to locate files within the distribution. If it's possible for a Distribution to represent files in the distribution as

(self, path: str | os.PathLike[str])

Source from the content-addressed store, hash-verified

432
433 @abc.abstractmethod
434 def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
435 """
436 Given a path to a file in this distribution, return a SimplePath
437 to it.
438
439 This method is used by callers of ``Distribution.files()`` to
440 locate files within the distribution. If it's possible for a
441 Distribution to represent files in the distribution as
442 ``SimplePath`` objects, it should implement this method
443 to resolve such objects.
444
445 Some Distribution providers may elect not to resolve SimplePath
446 objects within the distribution by raising a
447 NotImplementedError, but consumers of such a Distribution would
448 be unable to invoke ``Distribution.files()``.
449 """
450
451 @classmethod
452 def from_name(cls, name: str) -> Distribution:

Callers 4

test_filesMethod · 0.45
test_filesMethod · 0.45
locateMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_filesMethod · 0.36
test_filesMethod · 0.36