Debian Codegraph @

jedi/third_party/typeshed/stdlib/lzma.pyi

raw symbols SCIP
1 import sys
2 from _lzma import (
3 CHECK_CRC32 as CHECK_CRC32,
4 CHECK_CRC64 as CHECK_CRC64,
5 CHECK_ID_MAX as CHECK_ID_MAX,
6 CHECK_NONE as CHECK_NONE,
7 CHECK_SHA256 as CHECK_SHA256,
8 CHECK_UNKNOWN as CHECK_UNKNOWN,
9 FILTER_ARM as FILTER_ARM,
10 FILTER_ARMTHUMB as FILTER_ARMTHUMB,
11 FILTER_DELTA as FILTER_DELTA,
12 FILTER_IA64 as FILTER_IA64,
13 FILTER_LZMA1 as FILTER_LZMA1,
14 FILTER_LZMA2 as FILTER_LZMA2,
15 FILTER_POWERPC as FILTER_POWERPC,
16 FILTER_SPARC as FILTER_SPARC,
17 FILTER_X86 as FILTER_X86,
18 FORMAT_ALONE as FORMAT_ALONE,
19 FORMAT_AUTO as FORMAT_AUTO,
20 FORMAT_RAW as FORMAT_RAW,
21 FORMAT_XZ as FORMAT_XZ,
22 MF_BT2 as MF_BT2,
23 MF_BT3 as MF_BT3,
24 MF_BT4 as MF_BT4,
25 MF_HC3 as MF_HC3,
26 MF_HC4 as MF_HC4,
27 MODE_FAST as MODE_FAST,
28 MODE_NORMAL as MODE_NORMAL,
29 PRESET_DEFAULT as PRESET_DEFAULT,
30 PRESET_EXTREME as PRESET_EXTREME,
31 LZMACompressor as LZMACompressor,
32 LZMADecompressor as LZMADecompressor,
33 LZMAError as LZMAError,
34 _FilterChain,
35 is_check_supported as is_check_supported,
36 )
37 from _typeshed import ReadableBuffer, StrOrBytesPath
38 from io import TextIOWrapper
39 from typing import IO, Literal, overload
40 from typing_extensions import Self, TypeAlias
41
42 if sys.version_info >= (3, 14):
43 from compression._common._streams import BaseStream
44 else:
45 from _compression import BaseStream
46
47 __all__ = [
48 "CHECK_NONE",
49 "CHECK_CRC32",
50 "CHECK_CRC64",
51 "CHECK_SHA256",
52 "CHECK_ID_MAX",
53 "CHECK_UNKNOWN",
54 "FILTER_LZMA1",
55 "FILTER_LZMA2",
56 "FILTER_DELTA",
57 "FILTER_X86",
58 "FILTER_IA64",
59 "FILTER_ARM",
60 "FILTER_ARMTHUMB",
61 "FILTER_POWERPC",
62 "FILTER_SPARC",
63 "FORMAT_AUTO",
64 "FORMAT_XZ",
65 "FORMAT_ALONE",
66 "FORMAT_RAW",
67 "MF_HC3",
68 "MF_HC4",
69 "MF_BT2",
70 "MF_BT3",
71 "MF_BT4",
72 "MODE_FAST",
73 "MODE_NORMAL",
74 "PRESET_DEFAULT",
75 "PRESET_EXTREME",
76 "LZMACompressor",
77 "LZMADecompressor",
78 "LZMAFile",
79 "LZMAError",
80 "open",
81 "compress",
82 "decompress",
83 "is_check_supported",
84 ]
85
86 _OpenBinaryWritingMode: TypeAlias = Literal["w", "wb", "x", "xb", "a", "ab"]
87 _OpenTextWritingMode: TypeAlias = Literal["wt", "xt", "at"]
88
89 _PathOrFile: TypeAlias = StrOrBytesPath | IO[bytes]
90
91 class LZMAFile(BaseStream, IO[bytes]): # type: ignore[misc] # incompatible definitions of writelines in the base classes
92 def __init__(
93 self,
94 filename: _PathOrFile | None = None,
95 mode: str = "r",
96 *,
97 format: int | None = None,
98 check: int = -1,
99 preset: int | None = None,
100 filters: _FilterChain | None = None,
101 ) -> None: ...
102 def __enter__(self) -> Self: ...
103 def peek(self, size: int = -1) -> bytes: ...
104 def read(self, size: int | None = -1) -> bytes: ...
105 def read1(self, size: int = -1) -> bytes: ...
106 def readline(self, size: int | None = -1) -> bytes: ...
107 def write(self, data: ReadableBuffer) -> int: ...
108 def seek(self, offset: int, whence: int = 0) -> int: ...
109
110 @overload
111 def open(
112 filename: _PathOrFile,
113 mode: Literal["r", "rb"] = "rb",
114 *,
115 format: int | None = None,
116 check: Literal[-1] = -1,
117 preset: None = None,
118 filters: _FilterChain | None = None,
119 encoding: None = None,
120 errors: None = None,
121 newline: None = None,
122 ) -> LZMAFile: ...
123 @overload
124 def open(
125 filename: _PathOrFile,
126 mode: _OpenBinaryWritingMode,
127 *,
128 format: int | None = None,
129 check: int = -1,
130 preset: int | None = None,
131 filters: _FilterChain | None = None,
132 encoding: None = None,
133 errors: None = None,
134 newline: None = None,
135 ) -> LZMAFile: ...
136 @overload
137 def open(
138 filename: StrOrBytesPath,
139 mode: Literal["rt"],
140 *,
141 format: int | None = None,
142 check: Literal[-1] = -1,
143 preset: None = None,
144 filters: _FilterChain | None = None,
145 encoding: str | None = None,
146 errors: str | None = None,
147 newline: str | None = None,
148 ) -> TextIOWrapper: ...
149 @overload
150 def open(
151 filename: StrOrBytesPath,
152 mode: _OpenTextWritingMode,
153 *,
154 format: int | None = None,
155 check: int = -1,
156 preset: int | None = None,
157 filters: _FilterChain | None = None,
158 encoding: str | None = None,
159 errors: str | None = None,
160 newline: str | None = None,
161 ) -> TextIOWrapper: ...
162 @overload
163 def open(
164 filename: _PathOrFile,
165 mode: str,
166 *,
167 format: int | None = None,
168 check: int = -1,
169 preset: int | None = None,
170 filters: _FilterChain | None = None,
171 encoding: str | None = None,
172 errors: str | None = None,
173 newline: str | None = None,
174 ) -> LZMAFile | TextIOWrapper: ...
175 def compress(
176 data: ReadableBuffer, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None
177 ) -> bytes: ...
178 def decompress(
179 data: ReadableBuffer, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None
180 ) -> bytes: ...