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

Function as_file

Lib/importlib/resources/_common.py:132–137  ·  view source on GitHub ↗

Given a Traversable object, return that object as a path on the local file system in a context manager.

(path)

Source from the content-addressed store, hash-verified

130
131@functools.singledispatch
132def as_file(path):
133 """
134 Given a Traversable object, return that object as a
135 path on the local file system in a context manager.
136 """
137 return _temp_dir(path) if _is_present_dir(path) else _temp_file(path)
138
139
140@as_file.register(pathlib.Path)

Callers 1

pathFunction · 0.85

Calls 3

_temp_dirFunction · 0.85
_is_present_dirFunction · 0.85
_temp_fileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…