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

Function abs_paths

Lib/site.py:115–131  ·  view source on GitHub ↗

Set __file__ to an absolute path.

()

Source from the content-addressed store, hash-verified

113
114
115def abs_paths():
116 """Set __file__ to an absolute path."""
117 for m in set(sys.modules.values()):
118 loader_module = None
119 try:
120 loader_module = m.__loader__.__module__
121 except AttributeError:
122 try:
123 loader_module = m.__spec__.loader.__module__
124 except AttributeError:
125 pass
126 if loader_module not in {'_frozen_importlib', '_frozen_importlib_external'}:
127 continue # don't mess with a PEP 302-supplied __file__
128 try:
129 m.__file__ = os.path.abspath(m.__file__)
130 except (AttributeError, OSError, TypeError):
131 pass
132
133
134def removeduppaths():

Callers 1

mainFunction · 0.85

Calls 3

setFunction · 0.85
valuesMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…