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

Function exists

Lib/genericpath.py:16–22  ·  view source on GitHub ↗

Test whether a path exists. Returns False for broken symbolic links

(path)

Source from the content-addressed store, hash-verified

14# Does a path exist?
15# This is false for dangling symbolic links on systems that support them.
16def exists(path):
17 """Test whether a path exists. Returns False for broken symbolic links"""
18 try:
19 os.stat(path)
20 except (OSError, ValueError):
21 return False
22 return True
23
24
25# Being true for dangling symbolic links is also useful.

Callers

nothing calls this directly

Calls 1

statMethod · 0.45

Tested by

no test coverage detected