Skip to content

Commit 0c4d6c6

Browse files
authored
Merge pull request #415 from layday/fix-simplepath-proto
Instrument `SimplePath` protocol with generic support
2 parents dcaa2d9 + c7d639e commit 0c4d6c6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CHANGES.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v5.1.0
2+
======
3+
4+
* #415: Instrument ``SimplePath`` with generic support.
5+
16
v5.0.0
27
======
38

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)