| 1 |
from _typeshed import StrPath |
| 2 |
from collections.abc import Iterator, Sequence |
| 3 |
from io import TextIOWrapper |
| 4 |
from os import PathLike |
| 5 |
from typing import IO, Literal, TypeVar, overload |
| 6 |
from typing_extensions import Self |
| 7 |
from zipfile import ZipFile |
| 8 |
|
| 9 |
_ZF = TypeVar("_ZF", bound=ZipFile) |
| 10 |
|
| 11 |
__all__ = ["Path"] |
| 12 |
|
| 13 |
class InitializedState: |
| 14 |
def __init__(self, *args: object, **kwargs: object) -> None: ... |
| 15 |
def __getstate__(self) -> tuple[list[object], dict[object, object]]: ... |
| 16 |
def __setstate__(self, state: Sequence[tuple[list[object], dict[object, object]]]) -> None: ... |
| 17 |
|
| 18 |
class CompleteDirs(InitializedState, ZipFile): |
| 19 |
def resolve_dir(self, name: str) -> str: ... |
| 20 |
@overload |
| 21 |
@classmethod |
| 22 |
def make(cls, source: ZipFile) -> CompleteDirs: ... |
| 23 |
@overload |
| 24 |
@classmethod |
| 25 |
def make(cls, source: StrPath | IO[bytes]) -> Self: ... |
| 26 |
@classmethod |
| 27 |
def inject(cls, zf: _ZF) -> _ZF: ... |
| 28 |
|
| 29 |
class Path: |
| 30 |
root: CompleteDirs |
| 31 |
at: str |
| 32 |
def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: ... |
| 33 |
@property |
| 34 |
def name(self) -> str: ... |
| 35 |
@property |
| 36 |
def parent(self) -> PathLike[str]: ... # undocumented |
| 37 |
@property |
| 38 |
def filename(self) -> PathLike[str]: ... # undocumented |
| 39 |
@property |
| 40 |
def suffix(self) -> str: ... |
| 41 |
@property |
| 42 |
def suffixes(self) -> list[str]: ... |
| 43 |
@property |
| 44 |
def stem(self) -> str: ... |
| 45 |
@overload |
| 46 |
def open( |
| 47 |
self, |
| 48 |
mode: Literal["r", "w"] = "r", |
| 49 |
encoding: str | None = None, |
| 50 |
errors: str | None = None, |
| 51 |
newline: str | None = None, |
| 52 |
line_buffering: bool = False, |
| 53 |
write_through: bool = False, |
| 54 |
*, |
| 55 |
pwd: bytes | None = None, |
| 56 |
) -> TextIOWrapper: ... |
| 57 |
@overload |
| 58 |
def open(self, mode: Literal["rb", "wb"], *, pwd: bytes | None = None) -> IO[bytes]: ... |
| 59 |
def iterdir(self) -> Iterator[Self]: ... |
| 60 |
def is_dir(self) -> bool: ... |
| 61 |
def is_file(self) -> bool: ... |
| 62 |
def exists(self) -> bool: ... |
| 63 |
def read_text( |
| 64 |
self, |
| 65 |
encoding: str | None = None, |
| 66 |
errors: str | None = None, |
| 67 |
newline: str | None = None, |
| 68 |
line_buffering: bool = False, |
| 69 |
write_through: bool = False, |
| 70 |
) -> str: ... |
| 71 |
def read_bytes(self) -> bytes: ... |
| 72 |
def joinpath(self, *other: StrPath) -> Path: ... |
| 73 |
def glob(self, pattern: str) -> Iterator[Self]: ... |
| 74 |
def rglob(self, pattern: str) -> Iterator[Self]: ... |
| 75 |
def is_symlink(self) -> Literal[False]: ... |
| 76 |
def relative_to(self, other: Path, *extra: StrPath) -> str: ... |
| 77 |
def match(self, path_pattern: str) -> bool: ... |
| 78 |
def __eq__(self, other: object) -> bool: ... |
| 79 |
def __hash__(self) -> int: ... |
| 80 |
def __truediv__(self, add: StrPath) -> Path: ... |