Improve pathlib stubs (#7181)

This commit is contained in:
Alex Waygood
2022-02-13 02:42:04 +00:00
committed by GitHub
parent 2ce1844905
commit 03dbe2206c
7 changed files with 42 additions and 6 deletions

View File

@@ -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):