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

Method is_dir

Lib/pathlib/__init__.py:671–688  ·  view source on GitHub ↗

Whether this path is a directory.

(self, *, follow_symlinks=True)

Source from the content-addressed store, hash-verified

669 return True
670
671 def is_dir(self, *, follow_symlinks=True):
672 """Whether this path is a directory."""
673 if self._entry:
674 try:
675 return self._entry.is_dir(follow_symlinks=follow_symlinks)
676 except OSError:
677 return False
678 if follow_symlinks:
679 if self._stat_result is _STAT_RESULT_ERROR:
680 return False
681 else:
682 if self._lstat_result is _STAT_RESULT_ERROR:
683 return False
684 try:
685 st = self._stat(follow_symlinks=follow_symlinks)
686 except (OSError, ValueError):
687 return False
688 return S_ISDIR(st.st_mode)
689
690 def is_file(self, *, follow_symlinks=True):
691 """Whether this path is a regular file."""

Callers

nothing calls this directly

Calls 3

_statMethod · 0.95
S_ISDIRFunction · 0.90
is_dirMethod · 0.45

Tested by

no test coverage detected