improve unexposed zlib types (#13032)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Stephen Morton
2024-11-17 23:40:30 -08:00
committed by GitHub
parent 2419d7520b
commit 631c9924cf

View File

@@ -1,6 +1,7 @@
import sys
from _typeshed import ReadableBuffer
from typing import Final
from typing import Any, Final, final, type_check_only
from typing_extensions import Self
DEFLATED: Final = 8
DEF_MEM_LEVEL: int # can change
@@ -27,17 +28,30 @@ Z_TREES: Final = 6
class error(Exception): ...
# This class is not exposed at runtime. It calls itself zlib.Compress.
@final
@type_check_only
class _Compress:
def compress(self, data: ReadableBuffer) -> bytes: ...
def flush(self, mode: int = ...) -> bytes: ...
def __copy__(self) -> Self: ...
def __deepcopy__(self, memo: Any, /) -> Self: ...
def compress(self, data: ReadableBuffer, /) -> bytes: ...
def flush(self, mode: int = 4, /) -> bytes: ...
def copy(self) -> _Compress: ...
# This class is not exposed at runtime. It calls itself zlib.Decompress.
@final
@type_check_only
class _Decompress:
unused_data: bytes
unconsumed_tail: bytes
eof: bool
def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ...
def flush(self, length: int = ...) -> bytes: ...
@property
def unused_data(self) -> bytes: ...
@property
def unconsumed_tail(self) -> bytes: ...
@property
def eof(self) -> bool: ...
def __copy__(self) -> Self: ...
def __deepcopy__(self, memo: Any, /) -> Self: ...
def decompress(self, data: ReadableBuffer, /, max_length: int = 0) -> bytes: ...
def flush(self, length: int = 16384, /) -> bytes: ...
def copy(self) -> _Decompress: ...
def adler32(data: ReadableBuffer, value: int = 1, /) -> int: ...