2 from _typeshed import ReadableBuffer, Self, StrOrBytesPath
3 from typing import IO, Any, Mapping, Sequence, TextIO, Union, overload
4 from typing_extensions import Literal, final
6 _OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"]
7 _OpenTextWritingMode = Literal["wt", "xt", "at"]
9 _PathOrFile = Union[StrOrBytesPath, IO[bytes]]
11 _FilterChain = Sequence[Mapping[str, Any]]
44 class LZMADecompressor(object):
45 def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
46 def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
48 def check(self) -> int: ...
50 def eof(self) -> bool: ...
52 def unused_data(self) -> bytes: ...
54 def needs_input(self) -> bool: ...
58 class LZMACompressor(object):
60 self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
62 def compress(self, __data: bytes) -> bytes: ...
63 def flush(self) -> bytes: ...
65 class LZMAError(Exception): ...
67 class LZMAFile(io.BufferedIOBase, IO[bytes]):
70 filename: _PathOrFile | None = ...,
73 format: int | None = ...,
75 preset: int | None = ...,
76 filters: _FilterChain | None = ...,
78 def __enter__(self: Self) -> Self: ...
79 def close(self) -> None: ...
81 def closed(self) -> bool: ...
82 def fileno(self) -> int: ...
83 def seekable(self) -> bool: ...
84 def readable(self) -> bool: ...
85 def writable(self) -> bool: ...
86 def peek(self, size: int = ...) -> bytes: ...
87 def read(self, size: int | None = ...) -> bytes: ...
88 def read1(self, size: int = ...) -> bytes: ...
89 def readline(self, size: int | None = ...) -> bytes: ...
90 def write(self, data: ReadableBuffer) -> int: ...
91 def seek(self, offset: int, whence: int = ...) -> int: ...
92 def tell(self) -> int: ...
96 filename: _PathOrFile,
97 mode: Literal["r", "rb"] = ...,
99 format: int | None = ...,
100 check: Literal[-1] = ...,
102 filters: _FilterChain | None = ...,
103 encoding: None = ...,
109 filename: _PathOrFile,
110 mode: _OpenBinaryWritingMode,
112 format: int | None = ...,
114 preset: int | None = ...,
115 filters: _FilterChain | None = ...,
116 encoding: None = ...,
122 filename: StrOrBytesPath,
125 format: int | None = ...,
126 check: Literal[-1] = ...,
128 filters: _FilterChain | None = ...,
129 encoding: str | None = ...,
130 errors: str | None = ...,
131 newline: str | None = ...,
135 filename: StrOrBytesPath,
136 mode: _OpenTextWritingMode,
138 format: int | None = ...,
140 preset: int | None = ...,
141 filters: _FilterChain | None = ...,
142 encoding: str | None = ...,
143 errors: str | None = ...,
144 newline: str | None = ...,
148 filename: _PathOrFile,
151 format: int | None = ...,
153 preset: int | None = ...,
154 filters: _FilterChain | None = ...,
155 encoding: str | None = ...,
156 errors: str | None = ...,
157 newline: str | None = ...,
158 ) -> LZMAFile | TextIO: ...
160 data: bytes, format: int = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
162 def decompress(data: bytes, format: int = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> bytes: ...
163 def is_check_supported(__check_id: int) -> bool: ...