MCPcopy Create free account
hub / github.com/twisted/twisted / _smartPath

Method _smartPath

src/twisted/python/modules.py:659–677  ·  view source on GitHub ↗

Given a path entry from sys.path which may refer to an importer, return the appropriate FilePath-like instance. @param pathName: a str describing the path. @return: a FilePath-like object.

(self, pathName)

Source from the content-addressed store, hash-verified

657 return rval
658
659 def _smartPath(self, pathName):
660 """
661 Given a path entry from sys.path which may refer to an importer,
662 return the appropriate FilePath-like instance.
663
664 @param pathName: a str describing the path.
665
666 @return: a FilePath-like object.
667 """
668 importr = self.importerCache.get(pathName, _nothing)
669 if importr is _nothing:
670 for hook in self.sysPathHooks:
671 try:
672 importr = hook(pathName)
673 except ImportError:
674 pass
675 if importr is _nothing: # still
676 importr = None
677 return IPathImportMapper(importr, _theDefaultMapper).mapPath(pathName)
678
679 def iterEntries(self):
680 """

Callers 3

iterEntriesMethod · 0.95
__getitem__Method · 0.95
_packagePathsMethod · 0.80

Calls 3

IPathImportMapperClass · 0.85
getMethod · 0.45
mapPathMethod · 0.45

Tested by

no test coverage detected