Skip to content

Commit

Permalink
Fix SimplePath protocol
Browse files Browse the repository at this point in the history
This makes `pathlib.Path`s and `zipfile.Path`s assignable
to the protocol.
  • Loading branch information
layday committed Nov 16, 2022
1 parent dcaa2d9 commit e16916f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions importlib_metadata/_meta.py
Expand Up @@ -30,18 +30,19 @@ def json(self) -> Dict[str, Union[str, List[str]]]:
"""


class SimplePath(Protocol):
class SimplePath(Protocol[_T]):
"""
A minimal subset of pathlib.Path required by PathDistribution.
"""

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

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

def parent(self) -> 'SimplePath':
@property
def parent(self) -> _T:
... # pragma: no cover

def read_text(self) -> str:
Expand Down

0 comments on commit e16916f

Please sign in to comment.