Improve types and bytes usage of pathlib (#9016)

This commit is contained in:
Nikita Sobolev
2022-10-28 22:45:41 +03:00
committed by GitHub
parent 093c58bfa2
commit d3a87eb45d

View File

@@ -5,7 +5,9 @@ from _typeshed import (
OpenBinaryModeUpdating,
OpenBinaryModeWriting,
OpenTextMode,
ReadableBuffer,
Self,
StrOrBytesPath,
StrPath,
)
from collections.abc import Callable, Generator, Iterator, Sequence
@@ -188,16 +190,16 @@ class Path(PurePath):
def expanduser(self: Self) -> Self: ...
def read_bytes(self) -> bytes: ...
def read_text(self, encoding: str | None = ..., errors: str | None = ...) -> str: ...
def samefile(self, other_path: str | bytes | int | Path) -> bool: ...
def write_bytes(self, data: bytes) -> int: ...
def samefile(self, other_path: StrPath) -> bool: ...
def write_bytes(self, data: ReadableBuffer) -> int: ...
if sys.version_info >= (3, 10):
def write_text(
self, data: str, encoding: str | None = ..., errors: str | None = ..., newline: str | None = ...
) -> int: ...
else:
def write_text(self, data: str, encoding: str | None = ..., errors: str | None = ...) -> int: ...
if sys.version_info >= (3, 8):
def link_to(self, target: StrPath | bytes) -> None: ...
if sys.version_info >= (3, 8) and sys.version_info < (3, 12):
def link_to(self, target: StrOrBytesPath) -> None: ...
if sys.version_info >= (3, 12):
def walk(
self: Self, top_down: bool = ..., on_error: Callable[[OSError], object] | None = ..., follow_symlinks: bool = ...