File: pathlib.pyi

package info (click to toggle)
mypy 0.470-complete-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,864 kB
  • ctags: 3,264
  • sloc: python: 21,838; makefile: 18
file content (111 lines) | stat: -rw-r--r-- 4,320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Stubs for pathlib (Python 3.4)

from typing import Any, Generator, IO, Optional, Sequence, Tuple, Type, TypeVar, Union
import os
import sys

_P = TypeVar('_P', bound='PurePath')

if sys.version_info >= (3, 6):
    _PurePathBase = os.PathLike
else:
    _PurePathBase = object

class PurePath(_PurePathBase):
    parts = ...  # type: Tuple[str, ...]
    drive = ...  # type: str
    root = ...  # type: str
    anchor = ...  # type: str
    name = ...  # type: str
    suffix = ...  # type: str
    suffixes = ...  # type: List[str]
    stem = ...  # type: str
    if sys.version_info < (3, 5):
        def __init__(self, *pathsegments: str) -> None: ...
    else:
        def __new__(cls: Type[_P], *args: Union[str, 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 __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: ...

    @property
    def parents(self: _P) -> Sequence[_P]: ...
    @property
    def parent(self: _P) -> _P: ...

class PurePosixPath(PurePath): ...
class PureWindowsPath(PurePath): ...

class Path(PurePath):
    @classmethod
    def cwd(cls: Type[_P]) -> _P: ...
    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: ...
    if sys.version_info <= (3, 4):
        def mkdir(self, mode: int = ...,
                  parents: bool = ...) -> None: ...
    else:
        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 rename(self, target: Union[str, PurePath]) -> None: ...
    def replace(self, target: Union[str, PurePath]) -> None: ...
    if sys.version_info <= (3, 5):
        def resolve(self: _P) -> _P: ...
    else:
        def resolve(self: _P, strict: bool = ...) -> _P: ...
    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: ...

    if sys.version_info >= (3, 5):
        @classmethod
        def home(cls: Type[_P]) -> _P: ...
        def __new__(cls: Type[_P], *args: Union[str, PurePath],
                    **kwargs: Any) -> _P: ...

        def absolute(self: _P) -> _P: ...
        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 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): ...