MCPcopy Index your code
hub / github.com/RustPython/RustPython / split

Function split

Lib/posixpath.py:100–109  ·  view source on GitHub ↗

Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.

(p)

Source from the content-addressed store, hash-verified

98# Trailing '/'es are stripped from head unless it is the root.
99
100def split(p):
101 """Split a pathname. Returns tuple "(head, tail)" where "tail" is
102 everything after the final slash. Either part may be empty."""
103 p = os.fspath(p)
104 sep = _get_sep(p)
105 i = p.rfind(sep) + 1
106 head, tail = p[:i], p[i:]
107 if head and head != sep*len(head):
108 head = head.rstrip(sep)
109 return head, tail
110
111
112# Split a path in root and extension.

Callers

nothing calls this directly

Calls 4

_get_sepFunction · 0.85
lenFunction · 0.85
rfindMethod · 0.45
rstripMethod · 0.45

Tested by

no test coverage detected