mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 09:33:25 +08:00
More fixes related to PathLike (#1061)
* Make DirEntry generic over AnyStr, and inherit from PathLike if it exists * Make pathlib require PathLike[str] (when it exists)
This commit is contained in:
committed by
Jelle Zijlstra
parent
7587e7f1c1
commit
af2fadc180
@@ -7,7 +7,7 @@ import sys
|
||||
_P = TypeVar('_P', bound='PurePath')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_PurePathBase = os.PathLike
|
||||
_PurePathBase = os.PathLike[str]
|
||||
else:
|
||||
_PurePathBase = object
|
||||
|
||||
@@ -25,7 +25,7 @@ class PurePath(_PurePathBase):
|
||||
elif sys.version_info < (3, 6):
|
||||
def __new__(cls: Type[_P], *args: Union[str, PurePath]) -> _P: ...
|
||||
else:
|
||||
def __new__(cls: Type[_P], *args: Union[str, os.PathLike]) -> _P: ...
|
||||
def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]]) -> _P: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __lt__(self, other: PurePath) -> bool: ...
|
||||
def __le__(self, other: PurePath) -> bool: ...
|
||||
@@ -99,7 +99,7 @@ class Path(PurePath):
|
||||
def __new__(cls: Type[_P], *args: Union[str, PurePath],
|
||||
**kwargs: Any) -> _P: ...
|
||||
else:
|
||||
def __new__(cls: Type[_P], *args: Union[str, os.PathLike],
|
||||
def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]],
|
||||
**kwargs: Any) -> _P: ...
|
||||
|
||||
def absolute(self: _P) -> _P: ...
|
||||
|
||||
Reference in New Issue
Block a user