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

Method is_symlink

Lib/pathlib/__init__.py:709–722  ·  view source on GitHub ↗

Whether this path is a symbolic link.

(self)

Source from the content-addressed store, hash-verified

707 return S_ISREG(st.st_mode)
708
709 def is_symlink(self):
710 """Whether this path is a symbolic link."""
711 if self._entry:
712 try:
713 return self._entry.is_symlink()
714 except OSError:
715 return False
716 if self._lstat_result is _STAT_RESULT_ERROR:
717 return False
718 try:
719 st = self._stat(follow_symlinks=False)
720 except (OSError, ValueError):
721 return False
722 return S_ISLNK(st.st_mode)
723
724 def _posix_permissions(self, *, follow_symlinks=True):
725 """Return the POSIX file permissions."""

Callers

nothing calls this directly

Calls 3

_statMethod · 0.95
S_ISLNKFunction · 0.90
is_symlinkMethod · 0.45

Tested by

no test coverage detected