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

Method parents

Lib/pathlib/types.py:225–235  ·  view source on GitHub ↗

A sequence of this path's logical parents.

(self)

Source from the content-addressed store, hash-verified

223
224 @property
225 def parents(self):
226 """A sequence of this path's logical parents."""
227 split = self.parser.split
228 path = vfspath(self)
229 parent = split(path)[0]
230 parents = []
231 while path != parent:
232 parents.append(self.with_segments(parent))
233 path = parent
234 parent = split(path)[0]
235 return tuple(parents)
236
237 def relative_to(self, other, *, walk_up=False):
238 """Return the relative path to another path identified by the passed

Callers

nothing calls this directly

Calls 4

with_segmentsMethod · 0.95
vfspathFunction · 0.90
splitFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected