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

Function join

Lib/posixpath.py:72–92  ·  view source on GitHub ↗

Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.

(a, *p)

Source from the content-addressed store, hash-verified

70# Insert a '/' unless the first part is empty or already ends in '/'.
71
72def join(a, *p):
73 """Join two or more pathname components, inserting '/' as needed.
74 If any component is an absolute path, all previous path components
75 will be discarded. An empty last part will result in a path that
76 ends with a separator."""
77 a = os.fspath(a)
78 sep = _get_sep(a)
79 path = a
80 try:
81 for b in p:
82 b = os.fspath(b)
83 if b.startswith(sep) or not path:
84 path = b
85 elif path.endswith(sep):
86 path += b
87 else:
88 path += sep + b
89 except (TypeError, AttributeError, BytesWarning):
90 genericpath._check_arg_types('join', a, *p)
91 raise
92 return path
93
94
95# Split a path in head (everything up to the last '/') and tail (the

Callers 2

ismountFunction · 0.70
abspathFunction · 0.70

Calls 3

_get_sepFunction · 0.85
startswithMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected