Skip to content

Commit b99c9d6

Browse files
committed
Refine SimplePath to allow for os.PathLike on input and SimplePath on output.
1 parent 200cf45 commit b99c9d6

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/conf.py

-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,4 @@
7171
('py:class', '_T'),
7272
# Other workarounds
7373
('py:class', 'importlib_metadata.DeprecatedNonAbstract'),
74-
# Workaround needed for #480
75-
('py:obj', 'importlib_metadata._meta._T'),
7674
]

importlib_metadata/_meta.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from __future__ import annotations
2+
3+
import os
14
from typing import Protocol
25
from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union, overload
36

@@ -44,19 +47,19 @@ def json(self) -> Dict[str, Union[str, List[str]]]:
4447
"""
4548

4649

47-
class SimplePath(Protocol[_T]):
50+
class SimplePath(Protocol):
4851
"""
4952
A minimal subset of pathlib.Path required by Distribution.
5053
"""
5154

52-
def joinpath(self, other: Union[str, _T]) -> _T:
55+
def joinpath(self, other: Union[str, os.PathLike[str]]) -> SimplePath:
5356
... # pragma: no cover
5457

55-
def __truediv__(self, other: Union[str, _T]) -> _T:
58+
def __truediv__(self, other: Union[str, os.PathLike[str]]) -> SimplePath:
5659
... # pragma: no cover
5760

5861
@property
59-
def parent(self) -> _T:
62+
def parent(self) -> SimplePath:
6063
... # pragma: no cover
6164

6265
def read_text(self, encoding=None) -> str:

0 commit comments

Comments
 (0)