1
1
import sys
2
2
from _typeshed import ReadableBuffer
3
- from typing import Final
3
+ from typing import Any , Final , final , type_check_only
4
+ from typing_extensions import Self
4
5
5
6
DEFLATED : Final = 8
6
7
DEF_MEM_LEVEL : int # can change
@@ -27,17 +28,30 @@ Z_TREES: Final = 6
27
28
28
29
class error (Exception ): ...
29
30
31
+ # This class is not exposed at runtime. It calls itself zlib.Compress.
32
+ @final
33
+ @type_check_only
30
34
class _Compress :
31
- def compress (self , data : ReadableBuffer ) -> bytes : ...
32
- def flush (self , mode : int = ...) -> bytes : ...
35
+ def __copy__ (self ) -> Self : ...
36
+ def __deepcopy__ (self , memo : Any , / ) -> Self : ...
37
+ def compress (self , data : ReadableBuffer , / ) -> bytes : ...
38
+ def flush (self , mode : int = 4 , / ) -> bytes : ...
33
39
def copy (self ) -> _Compress : ...
34
40
41
+ # This class is not exposed at runtime. It calls itself zlib.Decompress.
42
+ @final
43
+ @type_check_only
35
44
class _Decompress :
36
- unused_data : bytes
37
- unconsumed_tail : bytes
38
- eof : bool
39
- def decompress (self , data : ReadableBuffer , max_length : int = ...) -> bytes : ...
40
- def flush (self , length : int = ...) -> bytes : ...
45
+ @property
46
+ def unused_data (self ) -> bytes : ...
47
+ @property
48
+ def unconsumed_tail (self ) -> bytes : ...
49
+ @property
50
+ def eof (self ) -> bool : ...
51
+ def __copy__ (self ) -> Self : ...
52
+ def __deepcopy__ (self , memo : Any , / ) -> Self : ...
53
+ def decompress (self , data : ReadableBuffer , / , max_length : int = 0 ) -> bytes : ...
54
+ def flush (self , length : int = 16384 , / ) -> bytes : ...
41
55
def copy (self ) -> _Decompress : ...
42
56
43
57
def adler32 (data : ReadableBuffer , value : int = 1 , / ) -> int : ...
0 commit comments