mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 21:01:52 +08:00
Use self-type for parent[s] properties too (#667)
This is possible now that python/mypy#2404 has landed.
This commit is contained in:
@@ -10,8 +10,6 @@ class PurePath:
|
||||
drive = ... # type: str
|
||||
root = ... # type: str
|
||||
anchor = ... # type: str
|
||||
parents = ... # type: Sequence[PurePath]
|
||||
parent = ... # type: PurePath
|
||||
name = ... # type: str
|
||||
suffix = ... # type: str
|
||||
suffixes = ... # type: List[str]
|
||||
@@ -33,6 +31,8 @@ class PurePath:
|
||||
def with_name(self: _P, name: str) -> _P: ...
|
||||
def with_suffix(self: _P, suffix: str) -> _P: ...
|
||||
def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ...
|
||||
def parents(self: _P) -> Sequence[_P]: ...
|
||||
def parent(self: _P) -> _P: ...
|
||||
|
||||
class PurePosixPath(PurePath): ...
|
||||
class PureWindowsPath(PurePath): ...
|
||||
@@ -83,11 +83,6 @@ class Path(PurePath):
|
||||
def write_text(self, data: str, encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...) -> int: ...
|
||||
|
||||
# The following are repeated here even though they only actually exist in the base
|
||||
# class so that they return Path when used on a Path, rather than returning PurePath.
|
||||
parents = ... # type: Sequence[Path]
|
||||
parent = ... # type: Path
|
||||
|
||||
|
||||
class PosixPath(Path, PurePosixPath): ...
|
||||
class WindowsPath(Path, PureWindowsPath): ...
|
||||
|
||||
Reference in New Issue
Block a user