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

Function isabs

Lib/ntpath.py:80–95  ·  view source on GitHub ↗

Test whether a path is absolute

(s, /)

Source from the content-addressed store, hash-verified

78
79
80def isabs(s, /):
81 """Test whether a path is absolute"""
82 s = os.fspath(s)
83 if isinstance(s, bytes):
84 sep = b'\\'
85 altsep = b'/'
86 colon_sep = b':\\'
87 double_sep = b'\\\\'
88 else:
89 sep = '\\'
90 altsep = '/'
91 colon_sep = ':\\'
92 double_sep = '\\\\'
93 s = s[:3].replace(altsep, sep)
94 # Absolute: UNC, device, and paths with a drive and root.
95 return s.startswith(colon_sep, 1) or s.startswith(double_sep)
96
97
98# Join two (or more) paths.

Callers 3

abspathFunction · 0.70
_readlink_deepFunction · 0.70
realpathFunction · 0.70

Calls 2

replaceMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…