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

Function _parents

Lib/zipfile/_path/__init__.py:25–41  ·  view source on GitHub ↗

Given a path with elements separated by posixpath.sep, generate all parents of that path. >>> list(_parents('b/d')) ['b'] >>> list(_parents('/b/d/')) ['/b'] >>> list(_parents('b/d/f/')) ['b/d', 'b'] >>> list(_parents('b')) [] >>> list(_parents('')) [

(path)

Source from the content-addressed store, hash-verified

23
24
25def _parents(path):
26 """
27 Given a path with elements separated by
28 posixpath.sep, generate all parents of that path.
29
30 >>> list(_parents('b/d'))
31 ['b']
32 >>> list(_parents('/b/d/'))
33 ['/b']
34 >>> list(_parents('b/d/f/'))
35 ['b/d', 'b']
36 >>> list(_parents('b'))
37 []
38 >>> list(_parents(''))
39 []
40 """
41 return itertools.islice(_ancestry(path), 1, None)
42
43
44def _ancestry(path):

Callers

nothing calls this directly

Calls 2

_ancestryFunction · 0.85
isliceMethod · 0.80

Tested by

no test coverage detected