Debian Codegraph @

src/python/backports/zstd/zipfile/_path/__init__.pyi

raw symbols SCIP
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
21 @overload
22 @classmethod
23 def make(cls, source: ZipFile) -> CompleteDirs: ...
24 @overload
25 @classmethod
26 def make(cls, source: StrPath | IO[bytes]) -> Self: ...
27
28 @classmethod
29 def inject(cls, zf: _ZF) -> _ZF: ...
30
31 class Path:
32 root: CompleteDirs
33 at: str
34 def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: ...
35 @property
36 def name(self) -> str: ...
37 @property
38 def parent(self) -> PathLike[str]: ... # undocumented
39 @property
40 def filename(self) -> PathLike[str]: ... # undocumented
41 @property
42 def suffix(self) -> str: ...
43 @property
44 def suffixes(self) -> list[str]: ...
45 @property
46 def stem(self) -> str: ...
47
48 @overload
49 def open(
50 self,
51 mode: Literal["r", "w"] = "r",
52 encoding: str | None = None,
53 errors: str | None = None,
54 newline: str | None = None,
55 line_buffering: bool = False,
56 write_through: bool = False,
57 *,
58 pwd: bytes | None = None,
59 ) -> TextIOWrapper: ...
60 @overload
61 def open(self, mode: Literal["rb", "wb"], *, pwd: bytes | None = None) -> IO[bytes]: ...
62
63 def iterdir(self) -> Iterator[Self]: ...
64 def is_dir(self) -> bool: ...
65 def is_file(self) -> bool: ...
66 def exists(self) -> bool: ...
67 def read_text(
68 self,
69 encoding: str | None = None,
70 errors: str | None = None,
71 newline: str | None = None,
72 line_buffering: bool = False,
73 write_through: bool = False,
74 ) -> str: ...
75 def read_bytes(self) -> bytes: ...
76 def joinpath(self, *other: StrPath) -> Path: ...
77 def glob(self, pattern: str) -> Iterator[Self]: ...
78 def rglob(self, pattern: str) -> Iterator[Self]: ...
79 def is_symlink(self) -> Literal[False]: ...
80 def relative_to(self, other: Path, *extra: StrPath) -> str: ...
81 def match(self, path_pattern: str) -> bool: ...
82 def __eq__(self, other: object) -> bool: ...
83 def __hash__(self) -> int: ...
84 def __truediv__(self, add: StrPath) -> Path: ...