MCPcopy Index your code
hub / github.com/RustPython/RustPython / getabsfile

Function getabsfile

Lib/inspect.py:886–893  ·  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

884 return filename
885
886def getabsfile(object, _filename=None):
887 """Return an absolute path to the source or compiled file for an object.
888
889 The idea is for each object to have a unique origin, so this routine
890 normalizes the result as much as possible."""
891 if _filename is None:
892 _filename = getsourcefile(object) or getfile(object)
893 return os.path.normcase(os.path.abspath(_filename))
894
895modulesbyfile = {}
896_filesbymodname = {}

Callers 1

getmoduleFunction · 0.85

Calls 3

getsourcefileFunction · 0.85
getfileFunction · 0.85
normcaseMethod · 0.80

Tested by

no test coverage detected