mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Improve pathlib stubs (#7181)
This commit is contained in:
@@ -54,7 +54,7 @@ class PurePath(PathLike[str]):
|
||||
def parents(self: Self) -> Sequence[Self]: ...
|
||||
@property
|
||||
def parent(self: Self) -> Self: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
if sys.version_info >= (3, 9) and sys.version_info < (3, 11):
|
||||
def __class_getitem__(cls, type: Any) -> GenericAlias: ...
|
||||
|
||||
class PurePosixPath(PurePath): ...
|
||||
@@ -77,12 +77,8 @@ class Path(PurePath):
|
||||
|
||||
def exists(self) -> bool: ...
|
||||
def glob(self: Self, pattern: str) -> Generator[Self, None, None]: ...
|
||||
def group(self) -> str: ...
|
||||
def is_dir(self) -> bool: ...
|
||||
def is_file(self) -> bool: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def is_mount(self) -> bool: ...
|
||||
|
||||
def is_symlink(self) -> bool: ...
|
||||
def is_socket(self) -> bool: ...
|
||||
def is_fifo(self) -> bool: ...
|
||||
@@ -147,7 +143,14 @@ class Path(PurePath):
|
||||
def open(
|
||||
self, mode: str, buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., newline: str | None = ...
|
||||
) -> IO[Any]: ...
|
||||
def owner(self) -> str: ...
|
||||
if sys.platform != "win32":
|
||||
# These methods do "exist" on Windows, but they always raise NotImplementedError,
|
||||
# so it's safer to pretend they don't exist
|
||||
def owner(self) -> str: ...
|
||||
def group(self) -> str: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def is_mount(self) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def readlink(self: Self) -> Self: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
Reference in New Issue
Block a user