Return Traversable resolved with any descendants applied. Each descendant should be a path segment relative to self and each may contain multiple levels separated by ``posixpath.sep`` (``/``).
(self, *descendants: StrPath)
| 102 | """ |
| 103 | |
| 104 | def joinpath(self, *descendants: StrPath) -> "Traversable": |
| 105 | """ |
| 106 | Return Traversable resolved with any descendants applied. |
| 107 | |
| 108 | Each descendant should be a path segment relative to self |
| 109 | and each may contain multiple levels separated by |
| 110 | ``posixpath.sep`` (``/``). |
| 111 | """ |
| 112 | if not descendants: |
| 113 | return self |
| 114 | names = itertools.chain.from_iterable( |
| 115 | path.parts for path in map(pathlib.PurePosixPath, descendants) |
| 116 | ) |
| 117 | target = next(names) |
| 118 | matches = ( |
| 119 | traversable for traversable in self.iterdir() if traversable.name == target |
| 120 | ) |
| 121 | try: |
| 122 | match = next(matches) |
| 123 | except StopIteration: |
| 124 | raise TraversalError( |
| 125 | "Target not found during traversal.", target, list(names) |
| 126 | ) |
| 127 | return match.joinpath(*names) |
| 128 | |
| 129 | def __truediv__(self, child: StrPath) -> "Traversable": |
| 130 | """ |
no test coverage detected