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

Method exists

Lib/pathlib/__init__.py:654–669  ·  view source on GitHub ↗

Whether this path exists.

(self, *, follow_symlinks=True)

Source from the content-addressed store, hash-verified

652 return self._lstat_result
653
654 def exists(self, *, follow_symlinks=True):
655 """Whether this path exists."""
656 if self._entry:
657 if not follow_symlinks:
658 return True
659 if follow_symlinks:
660 if self._stat_result is _STAT_RESULT_ERROR:
661 return False
662 else:
663 if self._lstat_result is _STAT_RESULT_ERROR:
664 return False
665 try:
666 self._stat(follow_symlinks=follow_symlinks)
667 except (OSError, ValueError):
668 return False
669 return True
670
671 def is_dir(self, *, follow_symlinks=True):
672 """Whether this path is a directory."""

Callers

nothing calls this directly

Calls 1

_statMethod · 0.95

Tested by

no test coverage detected