File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 4
4
*/.tox/*
5
5
*/_itertools.py
6
6
*/_legacy.py
7
+ */simple.py
7
8
8
9
[report]
9
10
show_missing = True
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ class Traversable(Protocol):
55
55
"""
56
56
An object with a subset of pathlib.Path methods suitable for
57
57
traversing directories and opening files.
58
+
59
+ Any exceptions that occur when accessing the backing resource
60
+ may propagate unaltered.
58
61
"""
59
62
60
63
@abc .abstractmethod
@@ -90,9 +93,13 @@ def is_file(self) -> bool:
90
93
"""
91
94
92
95
@abc .abstractmethod
93
- def joinpath (self , child : StrPath ) -> "Traversable" :
96
+ def joinpath (self , * descendants : StrPath ) -> "Traversable" :
94
97
"""
95
- Return Traversable child in self
98
+ Return Traversable resolved with any descendants applied.
99
+
100
+ Each descendant should be a path segment relative to self
101
+ and each may contain multiple levels separated by
102
+ ``posixpath.sep`` (``/``).
96
103
"""
97
104
98
105
def __truediv__ (self , child : StrPath ) -> "Traversable" :
Original file line number Diff line number Diff line change @@ -99,10 +99,13 @@ def iterdir(self):
99
99
def open (self , * args , ** kwargs ):
100
100
raise IsADirectoryError ()
101
101
102
- def joinpath (self , name ):
102
+ def joinpath (self , * names ):
103
+ if not names :
104
+ return self
105
+ name , rest = names [0 ], names [1 :]
103
106
return next (
104
107
traversable for traversable in self .iterdir () if traversable .name == name
105
- )
108
+ ). joinpath ( * rest )
106
109
107
110
108
111
class TraversableReader (TraversableResources , SimpleReader ):
You can’t perform that action at this time.
0 commit comments