|
1 | 1 | from _compression import BaseStream |
| 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 | +) |
2 | 37 | from _typeshed import ReadableBuffer, StrOrBytesPath |
3 | | -from collections.abc import Mapping, Sequence |
4 | | -from typing import IO, Any, Final, Literal, TextIO, final, overload |
| 38 | +from typing import IO, Literal, TextIO, overload |
5 | 39 | from typing_extensions import Self, TypeAlias |
6 | 40 |
|
7 | 41 | __all__ = [ |
@@ -48,62 +82,6 @@ _OpenTextWritingMode: TypeAlias = Literal["wt", "xt", "at"] |
48 | 82 |
|
49 | 83 | _PathOrFile: TypeAlias = StrOrBytesPath | IO[bytes] |
50 | 84 |
|
51 | | -_FilterChain: TypeAlias = Sequence[Mapping[str, Any]] |
52 | | - |
53 | | -FORMAT_AUTO: Final = 0 |
54 | | -FORMAT_XZ: Final = 1 |
55 | | -FORMAT_ALONE: Final = 2 |
56 | | -FORMAT_RAW: Final = 3 |
57 | | -CHECK_NONE: Final = 0 |
58 | | -CHECK_CRC32: Final = 1 |
59 | | -CHECK_CRC64: Final = 4 |
60 | | -CHECK_SHA256: Final = 10 |
61 | | -CHECK_ID_MAX: Final = 15 |
62 | | -CHECK_UNKNOWN: Final = 16 |
63 | | -FILTER_LZMA1: int # v big number |
64 | | -FILTER_LZMA2: Final = 33 |
65 | | -FILTER_DELTA: Final = 3 |
66 | | -FILTER_X86: Final = 4 |
67 | | -FILTER_IA64: Final = 6 |
68 | | -FILTER_ARM: Final = 7 |
69 | | -FILTER_ARMTHUMB: Final = 8 |
70 | | -FILTER_SPARC: Final = 9 |
71 | | -FILTER_POWERPC: Final = 5 |
72 | | -MF_HC3: Final = 3 |
73 | | -MF_HC4: Final = 4 |
74 | | -MF_BT2: Final = 18 |
75 | | -MF_BT3: Final = 19 |
76 | | -MF_BT4: Final = 20 |
77 | | -MODE_FAST: Final = 1 |
78 | | -MODE_NORMAL: Final = 2 |
79 | | -PRESET_DEFAULT: Final = 6 |
80 | | -PRESET_EXTREME: int # v big number |
81 | | - |
82 | | -# from _lzma.c |
83 | | -@final |
84 | | -class LZMADecompressor: |
85 | | - def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... |
86 | | - def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... |
87 | | - @property |
88 | | - def check(self) -> int: ... |
89 | | - @property |
90 | | - def eof(self) -> bool: ... |
91 | | - @property |
92 | | - def unused_data(self) -> bytes: ... |
93 | | - @property |
94 | | - def needs_input(self) -> bool: ... |
95 | | - |
96 | | -# from _lzma.c |
97 | | -@final |
98 | | -class LZMACompressor: |
99 | | - def __init__( |
100 | | - self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... |
101 | | - ) -> None: ... |
102 | | - def compress(self, data: ReadableBuffer, /) -> bytes: ... |
103 | | - def flush(self) -> bytes: ... |
104 | | - |
105 | | -class LZMAError(Exception): ... |
106 | | - |
107 | 85 | class LZMAFile(BaseStream, IO[bytes]): # type: ignore[misc] # incompatible definitions of writelines in the base classes |
108 | 86 | def __init__( |
109 | 87 | self, |
@@ -194,4 +172,3 @@ def compress( |
194 | 172 | def decompress( |
195 | 173 | data: ReadableBuffer, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None |
196 | 174 | ) -> bytes: ... |
197 | | -def is_check_supported(check_id: int, /) -> bool: ... |
0 commit comments