Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass mypy, update Self #233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 69 additions & 71 deletions path/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ from typing import (
Iterator,
)

from _typeshed import (
Self,
)
from typing_extensions import Self

from . import classes

Expand All @@ -44,72 +42,72 @@ class Path(str):
def using_module(cls, module: ModuleType) -> type[Path]: ...
@classes.ClassProperty
@classmethod
def _next_class(cls: type[Self]) -> type[Self]: ...
def _next_class(cls) -> type[Self]: ...
def __repr__(self) -> str: ...
def __add__(self: Self, more: str) -> Self: ...
def __radd__(self: Self, other: str) -> Self: ...
def __div__(self: Self, rel: str) -> Self: ...
def __truediv__(self: Self, rel: str) -> Self: ...
def __rdiv__(self: Self, rel: str) -> Self: ...
def __rtruediv__(self: Self, rel: str) -> Self: ...
def __enter__(self: Self) -> Self: ...
def __add__(self, more: str) -> Self: ...
def __radd__(self, other: str) -> Self: ...
def __div__(self, rel: str) -> Self: ...
def __truediv__(self, rel: str) -> Self: ...
def __rdiv__(self, rel: str) -> Self: ...
def __rtruediv__(self, rel: str) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None: ...
def absolute(self: Self) -> Self: ...
def normcase(self: Self) -> Self: ...
def normpath(self: Self) -> Self: ...
def realpath(self: Self) -> Self: ...
def expanduser(self: Self) -> Self: ...
def expandvars(self: Self) -> Self: ...
def dirname(self: Self) -> Self: ...
def basename(self: Self) -> Self: ...
def expand(self: Self) -> Self: ...
def absolute(self) -> Self: ...
def normcase(self) -> Self: ...
def normpath(self) -> Self: ...
def realpath(self) -> Self: ...
def expanduser(self) -> Self: ...
def expandvars(self) -> Self: ...
def dirname(self) -> Self: ...
def basename(self) -> Self: ...
def expand(self) -> Self: ...
@property
def stem(self) -> str: ...
def with_stem(self: Self, stem: str) -> Self: ...
def with_stem(self, stem: str) -> Self: ...
@property
def suffix(self: Self) -> Self: ...
def with_suffix(self: Self, suffix: str) -> Self: ...
def suffix(self) -> Self: ...
def with_suffix(self, suffix: str) -> Self: ...
@property
def drive(self: Self) -> Self: ...
def drive(self) -> Self: ...
@property
def parent(self: Self) -> Self: ...
def parent(self) -> Self: ...
@property
def name(self: Self) -> Self: ...
def with_name(self: Self, name: str) -> Self: ...
def splitpath(self: Self) -> tuple[Self, str]: ...
def splitdrive(self: Self) -> tuple[Self, Self]: ...
def splitext(self: Self) -> tuple[Self, str]: ...
def stripext(self: Self) -> Self: ...
def name(self) -> Self: ...
def with_name(self, name: str) -> Self: ...
def splitpath(self) -> tuple[Self, str]: ...
def splitdrive(self) -> tuple[Self, Self]: ...
def splitext(self) -> tuple[Self, str]: ...
def stripext(self) -> Self: ...
@classes.multimethod
def joinpath(cls: Self, first: str, *others: str) -> Self: ...
def splitall(self: Self) -> list[Self | str]: ...
def parts(self: Self) -> tuple[Self | str, ...]: ...
def _parts(self: Self) -> Iterator[Self | str]: ...
def _parts_iter(self: Self) -> Iterator[Self | str]: ...
def relpath(self: Self, start: str = ...) -> Self: ...
def relpathto(self: Self, dest: str) -> Self: ...
def joinpath(cls, first: str, *others: str) -> Self: ...
def splitall(self) -> list[Self | str]: ...
def parts(self) -> tuple[Self | str, ...]: ...
def _parts(self) -> Iterator[Self | str]: ...
def _parts_iter(self) -> Iterator[Self | str]: ...
def relpath(self, start: str = ...) -> Self: ...
def relpathto(self, dest: str) -> Self: ...

# --- Listing, searching, walking, and matching
def iterdir(self: Self, match: _Match = ...) -> Iterator[Self]: ...
def dirs(self: Self, match: _Match = ...) -> list[Self]: ...
def files(self: Self, match: _Match = ...) -> list[Self]: ...
def iterdir(self, match: _Match = ...) -> Iterator[Self]: ...
def dirs(self, match: _Match = ...) -> list[Self]: ...
def files(self, match: _Match = ...) -> list[Self]: ...
def walk(
self: Self,
self,
match: _Match = ...,
errors: str = ...,
) -> Generator[Self, Callable[[], bool] | None, None]: ...
def walkdirs(
self: Self,
self,
match: _Match = ...,
errors: str = ...,
) -> Iterator[Self]: ...
def walkfiles(
self: Self,
self,
match: _Match = ...,
errors: str = ...,
) -> Iterator[Self]: ...
Expand All @@ -118,8 +116,8 @@ class Path(str):
pattern: Path | str,
normcase: Callable[[str], str] | None = ...,
) -> bool: ...
def glob(self: Self, pattern: str) -> list[Self]: ...
def iglob(self: Self, pattern: str) -> Iterator[Self]: ...
def glob(self, pattern: str) -> list[Self]: ...
def iglob(self, pattern: str) -> Iterator[Self]: ...
def bytes(self) -> builtins.bytes: ...
def write_bytes(self, bytes: builtins.bytes, append: bool = ...) -> None: ...
def read_text(
Expand Down Expand Up @@ -188,30 +186,30 @@ class Path(str):
dir_fd: int | None = ...,
follow_symlinks: bool = ...,
) -> Path: ...
def chmod(self: Self, mode: str | int) -> Self: ...
def chmod(self, mode: str | int) -> Self: ...

if sys.platform != 'win32':
def chown(self: Self, uid: int | str = ..., gid: int | str = ...) -> Self: ...
def chown(self, uid: int | str = ..., gid: int | str = ...) -> Self: ...

def rename(self: Self, new: str) -> Self: ...
def renames(self: Self, new: str) -> Self: ...
def mkdir(self: Self, mode: int = ...) -> Self: ...
def mkdir_p(self: Self, mode: int = ...) -> Self: ...
def makedirs(self: Self, mode: int = ...) -> Self: ...
def makedirs_p(self: Self, mode: int = ...) -> Self: ...
def rmdir(self: Self) -> Self: ...
def rmdir_p(self: Self) -> Self: ...
def removedirs(self: Self) -> Self: ...
def removedirs_p(self: Self) -> Self: ...
def touch(self: Self) -> Self: ...
def remove(self: Self) -> Self: ...
def remove_p(self: Self) -> Self: ...
def unlink(self: Self) -> Self: ...
def unlink_p(self: Self) -> Self: ...
def link(self: Self, newpath: str) -> Self: ...
def symlink(self: Self, newlink: str | None = ...) -> Self: ...
def readlink(self: Self) -> Self: ...
def readlinkabs(self: Self) -> Self: ...
def rename(self, new: str) -> Self: ...
def renames(self, new: str) -> Self: ...
def mkdir(self, mode: int = ...) -> Self: ...
def mkdir_p(self, mode: int = ...) -> Self: ...
def makedirs(self, mode: int = ...) -> Self: ...
def makedirs_p(self, mode: int = ...) -> Self: ...
def rmdir(self) -> Self: ...
def rmdir_p(self) -> Self: ...
def removedirs(self) -> Self: ...
def removedirs_p(self) -> Self: ...
def touch(self) -> Self: ...
def remove(self) -> Self: ...
def remove_p(self) -> Self: ...
def unlink(self) -> Self: ...
def unlink_p(self) -> Self: ...
def link(self, newpath: str) -> Self: ...
def symlink(self, newlink: str | None = ...) -> Self: ...
def readlink(self) -> Self: ...
def readlinkabs(self) -> Self: ...
def copyfile(self, dst: str, *, follow_symlinks: bool = ...) -> str: ...
def copymode(self, dst: str, *, follow_symlinks: bool = ...) -> None: ...
def copystat(self, dst: str, *, follow_symlinks: bool = ...) -> None: ...
Expand All @@ -234,7 +232,7 @@ class Path(str):
ignore_errors: bool = ...,
onerror: Callable[[Any, Any, Any], Any] | None = ...,
) -> None: ...
def rmtree_p(self: Self) -> Self: ...
def rmtree_p(self) -> Self: ...
def chdir(self) -> None: ...
def cd(self) -> None: ...
def merge_tree(
Expand All @@ -250,7 +248,7 @@ class Path(str):
def chroot(self) -> None: ...

if sys.platform == 'win32':
def startfile(self: Self, operation: str | None = ...) -> Self: ...
def startfile(self, operation: str | None = ...) -> Self: ...

@contextlib.contextmanager
def in_place(
Expand Down Expand Up @@ -313,13 +311,13 @@ class TempDir(Path):
@classmethod
def _next_class(cls) -> type[Path]: ...
def __new__(
cls: type[Self],
cls,
suffix: AnyStr | None = ...,
prefix: AnyStr | None = ...,
dir: AnyStr | os.PathLike[AnyStr] | None = ...,
) -> Self: ...
def __init__(self) -> None: ...
def __enter__(self) -> Path: ... # type: ignore
def __enter__(self) -> Self: ...
def __exit__(
self,
exc_type: type[BaseException] | None,
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,3 @@ type = [


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143
Loading