Skip to content

zlib: improve bytes handling #9036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions stdlib/zlib.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
from array import array
from typing import Any
from _typeshed import ReadableBuffer
from typing_extensions import Literal

DEFLATED: Literal[8]
Expand Down Expand Up @@ -29,29 +28,34 @@ Z_TREES: Literal[6]
class error(Exception): ...

class _Compress:
def compress(self, data: bytes) -> bytes: ...
def compress(self, data: ReadableBuffer) -> bytes: ...
def flush(self, mode: int = ...) -> bytes: ...
def copy(self) -> _Compress: ...

class _Decompress:
unused_data: bytes
unconsumed_tail: bytes
eof: bool
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ...
def flush(self, length: int = ...) -> bytes: ...
def copy(self) -> _Decompress: ...

def adler32(__data: bytes, __value: int = ...) -> int: ...
def adler32(__data: ReadableBuffer, __value: int = ...) -> int: ...

if sys.version_info >= (3, 11):
def compress(__data: bytes, level: int = ..., wbits: int = ...) -> bytes: ...
def compress(__data: ReadableBuffer, level: int = ..., wbits: int = ...) -> bytes: ...

else:
def compress(__data: bytes, level: int = ...) -> bytes: ...
def compress(__data: ReadableBuffer, level: int = ...) -> bytes: ...

def compressobj(
level: int = ..., method: int = ..., wbits: int = ..., memLevel: int = ..., strategy: int = ..., zdict: bytes | None = ...
level: int = ...,
method: int = ...,
wbits: int = ...,
memLevel: int = ...,
strategy: int = ...,
zdict: ReadableBuffer | None = ...,
) -> _Compress: ...
def crc32(__data: array[Any] | bytes, __value: int = ...) -> int: ...
def decompress(__data: bytes, wbits: int = ..., bufsize: int = ...) -> bytes: ...
def decompressobj(wbits: int = ..., zdict: bytes = ...) -> _Decompress: ...
def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ...
def decompress(__data: ReadableBuffer, wbits: int = ..., bufsize: int = ...) -> bytes: ...
def decompressobj(wbits: int = ..., zdict: ReadableBuffer = ...) -> _Decompress: ...