From ff2b92f340b1a8981457603b76db07266f04ac36 Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Mon, 5 Jul 2021 13:47:18 +0300 Subject: [PATCH] pathlib2: most of the methods support the "unicode" type. (#5727) Closes: #5726 --- stubs/pathlib2/@python2/pathlib2.pyi | 34 ++++++++++++++-------------- stubs/pathlib2/METADATA.toml | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/stubs/pathlib2/@python2/pathlib2.pyi b/stubs/pathlib2/@python2/pathlib2.pyi index 31d171dd6..da13b975a 100644 --- a/stubs/pathlib2/@python2/pathlib2.pyi +++ b/stubs/pathlib2/@python2/pathlib2.pyi @@ -15,25 +15,25 @@ class PurePath(_PurePathBase): suffix: str suffixes: List[str] stem: str - def __new__(cls: Type[_P], *args: Union[str, PurePath]) -> _P: ... + def __new__(cls: Type[_P], *args: Union[Text, PurePath]) -> _P: ... def __hash__(self) -> int: ... def __lt__(self, other: PurePath) -> bool: ... def __le__(self, other: PurePath) -> bool: ... def __gt__(self, other: PurePath) -> bool: ... def __ge__(self, other: PurePath) -> bool: ... - def __truediv__(self: _P, key: Union[str, PurePath]) -> _P: ... - def __rtruediv__(self: _P, key: Union[str, PurePath]) -> _P: ... - def __div__(self: _P, key: Union[str, PurePath]) -> _P: ... + def __truediv__(self: _P, key: Union[Text, PurePath]) -> _P: ... + def __rtruediv__(self: _P, key: Union[Text, PurePath]) -> _P: ... + def __div__(self: _P, key: Union[Text, PurePath]) -> _P: ... def __bytes__(self) -> bytes: ... def as_posix(self) -> str: ... def as_uri(self) -> str: ... def is_absolute(self) -> bool: ... def is_reserved(self) -> bool: ... - def match(self, path_pattern: str) -> bool: ... - def relative_to(self: _P, *other: Union[str, PurePath]) -> _P: ... - 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 match(self, path_pattern: Text) -> bool: ... + def relative_to(self: _P, *other: Union[Text, PurePath]) -> _P: ... + def with_name(self: _P, name: Text) -> _P: ... + def with_suffix(self: _P, suffix: Text) -> _P: ... + def joinpath(self: _P, *other: Union[Text, PurePath]) -> _P: ... @property def parents(self: _P) -> Sequence[_P]: ... @property @@ -43,7 +43,7 @@ class PurePosixPath(PurePath): ... class PureWindowsPath(PurePath): ... class Path(PurePath): - def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ... + def __new__(cls: Type[_P], *args: Union[Text, PurePath], **kwargs: Any) -> _P: ... def __enter__(self) -> Path: ... def __exit__( self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType] @@ -53,7 +53,7 @@ class Path(PurePath): def stat(self) -> os.stat_result: ... def chmod(self, mode: int) -> None: ... def exists(self) -> bool: ... - def glob(self, pattern: str) -> Generator[Path, None, None]: ... + def glob(self, pattern: Text) -> Generator[Path, None, None]: ... def group(self) -> str: ... def is_dir(self) -> bool: ... def is_file(self) -> bool: ... @@ -76,12 +76,12 @@ class Path(PurePath): newline: Optional[Text] = ..., ) -> IO[Any]: ... def owner(self) -> str: ... - def rename(self, target: Union[str, PurePath]) -> None: ... - def replace(self, target: Union[str, PurePath]) -> None: ... + def rename(self, target: Union[Text, PurePath]) -> None: ... + def replace(self, target: Union[Text, PurePath]) -> None: ... def resolve(self: _P) -> _P: ... - def rglob(self, pattern: str) -> Generator[Path, None, None]: ... + def rglob(self, pattern: Text) -> Generator[Path, None, None]: ... def rmdir(self) -> None: ... - def symlink_to(self, target: Union[str, Path], target_is_directory: bool = ...) -> None: ... + def symlink_to(self, target: Union[Text, Path], target_is_directory: bool = ...) -> None: ... def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... def unlink(self) -> None: ... @classmethod @@ -90,9 +90,9 @@ class Path(PurePath): def expanduser(self: _P) -> _P: ... def read_bytes(self) -> bytes: ... def read_text(self, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ... - def samefile(self, other_path: Union[str, bytes, int, Path]) -> bool: ... + def samefile(self, other_path: Union[Text, bytes, int, Path]) -> bool: ... def write_bytes(self, data: bytes) -> int: ... - def write_text(self, data: str, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> int: ... + def write_text(self, data: Text, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> int: ... class PosixPath(Path, PurePosixPath): ... class WindowsPath(Path, PureWindowsPath): ... diff --git a/stubs/pathlib2/METADATA.toml b/stubs/pathlib2/METADATA.toml index 31f638bf3..b86002dc8 100644 --- a/stubs/pathlib2/METADATA.toml +++ b/stubs/pathlib2/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.1" +version = "2.2" python2 = true