3.14: PEP-784 compression except zstd (#13992)

This commit is contained in:
Rogdham
2025-05-11 15:23:20 +02:00
committed by GitHub
parent a8fa1ab0d9
commit 78fc518ab8
15 changed files with 64 additions and 17 deletions
View File
+25
View File
@@ -0,0 +1,25 @@
from _typeshed import Incomplete, WriteableBuffer
from collections.abc import Callable
from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase
from typing import Any, Protocol
BUFFER_SIZE = DEFAULT_BUFFER_SIZE
class _Reader(Protocol):
def read(self, n: int, /) -> bytes: ...
def seekable(self) -> bool: ...
def seek(self, n: int, /) -> Any: ...
class BaseStream(BufferedIOBase): ...
class DecompressReader(RawIOBase):
def __init__(
self,
fp: _Reader,
decomp_factory: Callable[..., Incomplete], # Consider backporting changes to _compression
trailing_error: type[Exception] | tuple[type[Exception], ...] = (),
**decomp_args: Any, # These are passed to decomp_factory.
) -> None: ...
def readinto(self, b: WriteableBuffer) -> int: ...
def read(self, size: int = -1) -> bytes: ...
def seek(self, offset: int, whence: int = 0) -> int: ...
+1
View File
@@ -0,0 +1 @@
from bz2 import *
+1
View File
@@ -0,0 +1 @@
from gzip import *
+1
View File
@@ -0,0 +1 @@
from lzma import *
+1
View File
@@ -0,0 +1 @@
from zlib import *