1 # Stubs for pathlib (Python 3.4)
\r
3 from typing import Any, Generator, IO, Optional, Sequence, Tuple, Type, TypeVar, Union, List
\r
4 from types import TracebackType
\r
8 _P = TypeVar('_P', bound='PurePath')
\r
10 if sys.version_info >= (3, 6):
\r
11 _PurePathBase = os.PathLike[str]
\r
13 _PurePathBase = object
\r
15 class PurePath(_PurePathBase):
\r
16 parts = ... # type: Tuple[str, ...]
\r
17 drive = ... # type: str
\r
18 root = ... # type: str
\r
19 anchor = ... # type: str
\r
20 name = ... # type: str
\r
21 suffix = ... # type: str
\r
22 suffixes = ... # type: List[str]
\r
23 stem = ... # type: str
\r
24 if sys.version_info < (3, 5):
\r
25 def __init__(self, *pathsegments: str) -> None: ...
\r
26 elif sys.version_info < (3, 6):
\r
27 def __new__(cls: Type[_P], *args: Union[str, PurePath]) -> _P: ...
\r
29 def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]]) -> _P: ...
\r
30 def __hash__(self) -> int: ...
\r
31 def __lt__(self, other: PurePath) -> bool: ...
\r
32 def __le__(self, other: PurePath) -> bool: ...
\r
33 def __gt__(self, other: PurePath) -> bool: ...
\r
34 def __ge__(self, other: PurePath) -> bool: ...
\r
35 def __truediv__(self: _P, key: Union[str, PurePath]) -> _P: ...
\r
36 def __bytes__(self) -> bytes: ...
\r
37 def as_posix(self) -> str: ...
\r
38 def as_uri(self) -> str: ...
\r
39 def is_absolute(self) -> bool: ...
\r
40 def is_reserved(self) -> bool: ...
\r
41 def match(self, path_pattern: str) -> bool: ...
\r
42 def relative_to(self: _P, *other: Union[str, PurePath]) -> _P: ...
\r
43 def with_name(self: _P, name: str) -> _P: ...
\r
44 def with_suffix(self: _P, suffix: str) -> _P: ...
\r
45 def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ...
\r
48 def parents(self: _P) -> Sequence[_P]: ...
\r
50 def parent(self: _P) -> _P: ...
\r
52 class PurePosixPath(PurePath): ...
\r
53 class PureWindowsPath(PurePath): ...
\r
55 class Path(PurePath):
\r
56 def __enter__(self) -> Path: ...
\r
57 def __exit__(self, exc_type: Optional[Type[BaseException]],
\r
58 exc_value: Optional[BaseException],
\r
59 traceback: Optional[TracebackType]) -> Optional[bool]: ...
\r
61 def cwd(cls: Type[_P]) -> _P: ...
\r
62 def stat(self) -> os.stat_result: ...
\r
63 def chmod(self, mode: int) -> None: ...
\r
64 def exists(self) -> bool: ...
\r
65 def glob(self, pattern: str) -> Generator[Path, None, None]: ...
\r
66 def group(self) -> str: ...
\r
67 def is_dir(self) -> bool: ...
\r
68 def is_file(self) -> bool: ...
\r
69 def is_symlink(self) -> bool: ...
\r
70 def is_socket(self) -> bool: ...
\r
71 def is_fifo(self) -> bool: ...
\r
72 def is_block_device(self) -> bool: ...
\r
73 def is_char_device(self) -> bool: ...
\r
74 def iterdir(self) -> Generator[Path, None, None]: ...
\r
75 def lchmod(self, mode: int) -> None: ...
\r
76 def lstat(self) -> os.stat_result: ...
\r
77 if sys.version_info < (3, 5):
\r
78 def mkdir(self, mode: int = ...,
\r
79 parents: bool = ...) -> None: ...
\r
81 def mkdir(self, mode: int = ..., parents: bool = ...,
\r
82 exist_ok: bool = ...) -> None: ...
\r
83 def open(self, mode: str = ..., buffering: int = ...,
\r
84 encoding: Optional[str] = ..., errors: Optional[str] = ...,
\r
85 newline: Optional[str] = ...) -> IO[Any]: ...
\r
86 def owner(self) -> str: ...
\r
87 def rename(self, target: Union[str, PurePath]) -> None: ...
\r
88 def replace(self, target: Union[str, PurePath]) -> None: ...
\r
89 if sys.version_info < (3, 6):
\r
90 def resolve(self: _P) -> _P: ...
\r
92 def resolve(self: _P, strict: bool = ...) -> _P: ...
\r
93 def rglob(self, pattern: str) -> Generator[Path, None, None]: ...
\r
94 def rmdir(self) -> None: ...
\r
95 def symlink_to(self, target: Union[str, Path],
\r
96 target_is_directory: bool = ...) -> None: ...
\r
97 def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ...
\r
98 def unlink(self) -> None: ...
\r
100 if sys.version_info >= (3, 5):
\r
102 def home(cls: Type[_P]) -> _P: ...
\r
103 if sys.version_info < (3, 6):
\r
104 def __new__(cls: Type[_P], *args: Union[str, PurePath],
\r
105 **kwargs: Any) -> _P: ...
\r
107 def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]],
\r
108 **kwargs: Any) -> _P: ...
\r
110 def absolute(self: _P) -> _P: ...
\r
111 def expanduser(self: _P) -> _P: ...
\r
112 def read_bytes(self) -> bytes: ...
\r
113 def read_text(self, encoding: Optional[str] = ...,
\r
114 errors: Optional[str] = ...) -> str: ...
\r
115 def samefile(self, other_path: Union[str, bytes, int, Path]) -> bool: ...
\r
116 def write_bytes(self, data: bytes) -> int: ...
\r
117 def write_text(self, data: str, encoding: Optional[str] = ...,
\r
118 errors: Optional[str] = ...) -> int: ...
\r
121 class PosixPath(Path, PurePosixPath): ...
\r
122 class WindowsPath(Path, PureWindowsPath): ...
\r