MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / resolve

Method resolve

tools/python-3.11.9-amd64/Lib/pathlib.py:981–1006  ·  view source on GitHub ↗

Make the path absolute, resolving all symlinks on the way and also normalizing it.

(self, strict=False)

Source from the content-addressed store, hash-verified

979 return self._from_parts([self.cwd()] + self._parts)
980
981 def resolve(self, strict=False):
982 """
983 Make the path absolute, resolving all symlinks on the way and also
984 normalizing it.
985 """
986
987 def check_eloop(e):
988 winerror = getattr(e, 'winerror', 0)
989 if e.errno == ELOOP or winerror == _WINERROR_CANT_RESOLVE_FILENAME:
990 raise RuntimeError("Symlink loop from %r" % e.filename)
991
992 try:
993 s = os.path.realpath(self, strict=strict)
994 except OSError as e:
995 check_eloop(e)
996 raise
997 p = self._from_parts((s,))
998
999 # In non-strict mode, realpath() doesn't raise on symlink loops.
1000 # Ensure we get an exception by calling stat()
1001 if not strict:
1002 try:
1003 p.stat()
1004 except OSError as e:
1005 check_eloop(e)
1006 return p
1007
1008 def stat(self, *, follow_symlinks=True):
1009 """

Callers 2

_absolute_rootFunction · 0.95
compile_fileFunction · 0.45

Calls 3

realpathMethod · 0.80
_from_partsMethod · 0.80
statMethod · 0.45

Tested by

no test coverage detected