diff --git a/stdlib/3.4/pathlib.pyi b/stdlib/3.4/pathlib.pyi index dc0aeb303..b66e62820 100644 --- a/stdlib/3.4/pathlib.pyi +++ b/stdlib/3.4/pathlib.pyi @@ -1,164 +1,72 @@ # Stubs for pathlib (Python 3.4) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any -from collections import Sequence - -class _Flavour: - join = ... # type: Any - def __init__(self) -> None: ... - def parse_parts(self, parts): ... - def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2): ... - -class _WindowsFlavour(_Flavour): - sep = ... # type: Any - altsep = ... # type: Any - has_drv = ... # type: Any - pathmod = ... # type: Any - is_supported = ... # type: Any - drive_letters = ... # type: Any - ext_namespace_prefix = ... # type: Any - reserved_names = ... # type: Any - def splitroot(self, part, sep=...): ... - def casefold(self, s): ... - def casefold_parts(self, parts): ... - def resolve(self, path): ... - def is_reserved(self, parts): ... - def make_uri(self, path): ... - -class _PosixFlavour(_Flavour): - sep = ... # type: Any - altsep = ... # type: Any - has_drv = ... # type: Any - pathmod = ... # type: Any - is_supported = ... # type: Any - def splitroot(self, part, sep=...): ... - def casefold(self, s): ... - def casefold_parts(self, parts): ... - def resolve(self, path): ... - def is_reserved(self, parts): ... - def make_uri(self, path): ... - -class _Accessor: ... - -class _NormalAccessor(_Accessor): - stat = ... # type: Any - lstat = ... # type: Any - open = ... # type: Any - listdir = ... # type: Any - chmod = ... # type: Any - lchmod = ... # type: Any - mkdir = ... # type: Any - unlink = ... # type: Any - rmdir = ... # type: Any - rename = ... # type: Any - replace = ... # type: Any - def symlink(a, b, target_is_directory): ... - utime = ... # type: Any - def readlink(self, path): ... - -class _Selector: - child_parts = ... # type: Any - successor = ... # type: Any - def __init__(self, child_parts) -> None: ... - def select_from(self, parent_path): ... - -class _TerminatingSelector: ... - -class _PreciseSelector(_Selector): - name = ... # type: Any - def __init__(self, name, child_parts) -> None: ... - -class _WildcardSelector(_Selector): - pat = ... # type: Any - def __init__(self, pat, child_parts) -> None: ... - -class _RecursiveWildcardSelector(_Selector): - def __init__(self, pat, child_parts) -> None: ... - -class _PathParents(Sequence): - def __init__(self, path) -> None: ... - def __len__(self): ... - def __getitem__(self, idx): ... +from typing import Any, Generator, IO, Optional, Sequence, Tuple, Union +import os class PurePath: - def __init__(self, *args) -> None: ... - def __reduce__(self): ... - def as_posix(self): ... - def __bytes__(self): ... - def as_uri(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __hash__(self): ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __gt__(self, other): ... - def __ge__(self, other): ... - drive = ... # type: Any - root = ... # type: Any - @property - def anchor(self): ... - @property - def name(self): ... - @property - def suffix(self): ... - @property - def suffixes(self): ... - @property - def stem(self): ... - def with_name(self, name): ... - def with_suffix(self, suffix): ... - def relative_to(self, *other): ... - @property - def parts(self): ... - def joinpath(self, *args): ... - def __truediv__(self, key): ... - def __rtruediv__(self, key): ... - @property - def parent(self): ... - @property - def parents(self): ... - def is_absolute(self): ... - def is_reserved(self): ... - def match(self, path_pattern): ... + parts = ... # type: Tuple[str, ...] + drive = ... # type: str + root = ... # type: str + anchor = ... # type: str + parents = ... # type: Sequence[PurePath] + parent = ... # type: PurePath + name = ... # type: str + suffix = ... # type: str + suffixes = ... # type: List[str] + stem = ... # type: str + def __init__(self, *pathsegments: str) -> None: ... + 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, key: Union[str, PurePath]) -> PurePath: ... + 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, *other: str) -> PurePath: ... + def with_name(self, name: str) -> PurePath: ... + def with_suffix(self, suffix: str) -> PurePath: ... + def joinpath(self, *other: Union[str, PurePath]) -> PurePath: ... class PurePosixPath(PurePath): ... class PureWindowsPath(PurePath): ... class Path(PurePath): - def __init__(self, *args, **kwargs) -> None: ... - def __enter__(self): ... - def __exit__(self, t, v, tb): ... @classmethod - def cwd(cls): ... - def iterdir(self): ... - def glob(self, pattern): ... - def rglob(self, pattern): ... - def absolute(self): ... - def resolve(self): ... - def stat(self): ... - def owner(self): ... - def group(self): ... - def open(self, mode=..., buffering=..., encoding=..., errors=..., newline=...): ... - def touch(self, mode=..., exist_ok=...): ... - def mkdir(self, mode=..., parents=...): ... - def chmod(self, mode): ... - def lchmod(self, mode): ... - def unlink(self): ... - def rmdir(self): ... - def lstat(self): ... - def rename(self, target): ... - def replace(self, target): ... - def symlink_to(self, target, target_is_directory=...): ... - def exists(self): ... - def is_dir(self): ... - def is_file(self): ... - def is_symlink(self): ... - def is_block_device(self): ... - def is_char_device(self): ... - def is_fifo(self): ... - def is_socket(self): ... + def cwd(cls) -> Path: ... + 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 group(self) -> str: ... + def is_dir(self) -> bool: ... + def is_file(self) -> bool: ... + def is_symlink(self) -> bool: ... + def is_socket(self) -> bool: ... + def is_fifo(self) -> bool: ... + def is_block_device(self) -> bool: ... + def is_char_device(self) -> bool: ... + def iterdir(self) -> Generator[Path, None, None]: ... + def lchmod(self, mode: int) -> None: ... + def lstat(self) -> os.stat_result: ... + def mkdir(self, mode: int = ..., parents: bool = ...) -> None: ... + def open(self, mode: str = ..., buffering: int = ..., + encoding: Optional[str] = ..., errors: Optional[str] = ..., + newline: Optional[str] = ...) -> IO[Any]: ... + def owner(self) -> str: ... + def rename(self, target: Union[str, Path]) -> None: ... + def replace(self, target: Union[str, Path]) -> None: ... + def resolve(self) -> Path: ... + def rglob(self, pattern: str) -> Generator[Path, None, None]: ... + def rmdir(self) -> None: ... + def symlink_to(self, target: Union[str, Path], + target_is_directory: bool = ...) -> None: ... + def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... + def unlink(self) -> None: ... class PosixPath(Path, PurePosixPath): ... class WindowsPath(Path, PureWindowsPath): ... diff --git a/stdlib/3.5/pathlib.pyi b/stdlib/3.5/pathlib.pyi new file mode 100644 index 000000000..7b4fdb984 --- /dev/null +++ b/stdlib/3.5/pathlib.pyi @@ -0,0 +1,83 @@ +# Stubs for pathlib (Python 3.4) + +from typing import Any, Generator, IO, Optional, Sequence, Tuple, Union +import os + +class PurePath: + parts = ... # type: Tuple[str, ...] + drive = ... # type: str + root = ... # type: str + anchor = ... # type: str + parents = ... # type: Sequence[PurePath] + parent = ... # type: PurePath + name = ... # type: str + suffix = ... # type: str + suffixes = ... # type: List[str] + stem = ... # type: str + def __init__(self, *pathsegments: str) -> None: ... + 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, key: Union[str, PurePath]) -> PurePath: ... + 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, *other: str) -> PurePath: ... + def with_name(self, name: str) -> PurePath: ... + def with_suffix(self, suffix: str) -> PurePath: ... + def joinpath(self, *other: Union[str, PurePath]) -> PurePath: ... + +class PurePosixPath(PurePath): ... +class PureWindowsPath(PurePath): ... + +class Path(PurePath): + @classmethod + def cwd(cls) -> Path: ... + @classmethod + def home(cls) -> Path: ... + def stat(self) -> os.stat_result: ... + def chmod(self, mode: int) -> None: ... + def exists(self) -> bool: ... + def expanduser(self) -> Path: ... + def glob(self, pattern: str) -> Generator[Path, None, None]: ... + def group(self) -> str: ... + def is_dir(self) -> bool: ... + def is_file(self) -> bool: ... + def is_symlink(self) -> bool: ... + def is_socket(self) -> bool: ... + def is_fifo(self) -> bool: ... + def is_block_device(self) -> bool: ... + def is_char_device(self) -> bool: ... + def iterdir(self) -> Generator[Path, None, None]: ... + def lchmod(self, mode: int) -> None: ... + def lstat(self) -> os.stat_result: ... + def mkdir(self, mode: int = ..., parents: bool = ..., + exist_ok: bool = ...) -> None: ... + def open(self, mode: str = ..., buffering: int = ..., + encoding: Optional[str] = ..., errors: Optional[str] = ..., + newline: Optional[str] = ...) -> IO[Any]: ... + def owner(self) -> str: ... + def read_bytes(self) -> bytes: ... + def read_text(self, encoding: Optional[str] = ..., + errors: Optional[str] = ...) -> bytes: ... + def rename(self, target: Union[str, Path]) -> None: ... + def replace(self, target: Union[str, Path]) -> None: ... + def resolve(self) -> Path: ... + def rglob(self, pattern: str) -> Generator[Path, None, None]: ... + def rmdir(self) -> None: ... + def samefile(self, other_path: Union[str, Path]) -> bool: ... + def symlink_to(self, target: Union[str, Path], + target_is_directory: bool = ...) -> None: ... + def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... + def unlink(self) -> None: ... + def write_bytes(self, data: bytes) -> int: ... + def write_text(self, data: str, encoding: Optional[str] = ..., + errors: Optional[str] = ...) -> int: ... + +class PosixPath(Path, PurePosixPath): ... +class WindowsPath(Path, PureWindowsPath): ...