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

Function getabsfile

Lib/inspect.py:910–917  ·  view source on GitHub ↗

Return an absolute path to the source or compiled file for an object. The idea is for each object to have a unique origin, so this routine normalizes the result as much as possible.

(object, _filename=None)

Source from the content-addressed store, hash-verified

908 return filename
909
910def getabsfile(object, _filename=None):
911 """Return an absolute path to the source or compiled file for an object.
912
913 The idea is for each object to have a unique origin, so this routine
914 normalizes the result as much as possible."""
915 if _filename is None:
916 _filename = getsourcefile(object) or getfile(object)
917 return os.path.normcase(os.path.abspath(_filename))
918
919modulesbyfile = {}
920_filesbymodname = {}

Callers 1

getmoduleFunction · 0.85

Calls 4

getsourcefileFunction · 0.85
getfileFunction · 0.85
normcaseMethod · 0.80
abspathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…