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

Function as_file

Lib/importlib/resources/_common.py:166–171  ·  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

164
165@functools.singledispatch
166def as_file(path):
167 """
168 Given a Traversable object, return that object as a
169 path on the local file system in a context manager.
170 """
171 return _temp_dir(path) if _is_present_dir(path) else _temp_file(path)
172
173
174@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