Skip to content

Commit e16916f

Browse files
committed
Fix SimplePath protocol
This makes `pathlib.Path`s and `zipfile.Path`s assignable to the protocol.
1 parent dcaa2d9 commit e16916f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: importlib_metadata/_meta.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ def json(self) -> Dict[str, Union[str, List[str]]]:
3030
"""
3131

3232

33-
class SimplePath(Protocol):
33+
class SimplePath(Protocol[_T]):
3434
"""
3535
A minimal subset of pathlib.Path required by PathDistribution.
3636
"""
3737

38-
def joinpath(self) -> 'SimplePath':
38+
def joinpath(self) -> _T:
3939
... # pragma: no cover
4040

41-
def __truediv__(self) -> 'SimplePath':
41+
def __truediv__(self, other: Union[str, _T]) -> _T:
4242
... # pragma: no cover
4343

44-
def parent(self) -> 'SimplePath':
44+
@property
45+
def parent(self) -> _T:
4546
... # pragma: no cover
4647

4748
def read_text(self) -> str:

0 commit comments

Comments
 (0)