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

Method __init__

Lib/pathlib/__init__.py:137–157  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

135 return object.__new__(cls)
136
137 def __init__(self, *args):
138 paths = []
139 for arg in args:
140 if isinstance(arg, PurePath):
141 if arg.parser is not self.parser:
142 # GH-103631: Convert separators for backwards compatibility.
143 paths.append(arg.as_posix())
144 else:
145 paths.extend(arg._raw_paths)
146 else:
147 try:
148 path = os.fspath(arg)
149 except TypeError:
150 path = arg
151 if not isinstance(path, str):
152 raise TypeError(
153 "argument should be a str or an os.PathLike "
154 "object where __fspath__ returns a str, "
155 f"not {type(path).__name__!r}")
156 paths.append(path)
157 self._raw_paths = paths
158
159 def with_segments(self, *pathsegments):
160 """Construct a new path object from any number of path-like objects.

Callers

nothing calls this directly

Calls 3

as_posixMethod · 0.80
appendMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected