Skip to content
Open
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
32 changes: 20 additions & 12 deletions zstandard/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@

import os
from typing import (
IO,
BinaryIO,
ByteString,
Generator,
Iterable,
List,
Optional,
Protocol,
Set,
Tuple,
Union,
)


class _Writable(Protocol):
def write(self, data: bytes, /) -> int: ...


class _Readable(Protocol):
def read(self, size: int = ..., /) -> bytes: ...

FLUSH_BLOCK: int
FLUSH_FRAME: int

Expand Down Expand Up @@ -278,23 +286,23 @@ class ZstdCompressor(object):
) -> ZstdCompressionChunker: ...
def copy_stream(
self,
ifh: IO[bytes],
ofh: IO[bytes],
ifh: _Readable,
ofh: _Writable,
size: int = ...,
read_size: int = ...,
write_size: int = ...,
) -> Tuple[int, int]: ...
def stream_reader(
self,
source: Union[IO[bytes], ByteString],
source: Union[ByteString, _Readable],
size: int = ...,
read_size: int = ...,
*,
closefd: bool = ...,
) -> ZstdCompressionReader: ...
def stream_writer(
self,
writer: IO[bytes],
writer: _Writable,
size: int = ...,
write_size: int = ...,
write_return_read: bool = ...,
Expand All @@ -303,7 +311,7 @@ class ZstdCompressor(object):
) -> ZstdCompressionWriter: ...
def read_to_iter(
self,
reader: Union[IO[bytes], ByteString],
reader: Union[ByteString, _Readable],
size: int = ...,
read_size: int = ...,
write_size: int = ...,
Expand Down Expand Up @@ -396,34 +404,34 @@ class ZstdDecompressor(object):
) -> bytes: ...
def stream_reader(
self,
source: Union[IO[bytes], ByteString],
source: Union[ByteString, _Readable],
read_size: int = ...,
read_across_frames: bool = ...,
*,
closefd=False,
closefd: bool = ...,
) -> ZstdDecompressionReader: ...
def decompressobj(
self, write_size: int = ..., read_across_frames: bool = False
) -> ZstdDecompressionObj: ...
def read_to_iter(
self,
reader: Union[IO[bytes], ByteString],
reader: Union[ByteString, _Readable],
read_size: int = ...,
write_size: int = ...,
skip_bytes: int = ...,
) -> Generator[bytes, None, None]: ...
def stream_writer(
self,
writer: IO[bytes],
writer: _Writable,
write_size: int = ...,
write_return_read: bool = ...,
*,
closefd: bool = ...,
) -> ZstdDecompressionWriter: ...
def copy_stream(
self,
ifh: IO[bytes],
ofh: IO[bytes],
ifh: _Readable,
ofh: _Writable,
read_size: int = ...,
write_size: int = ...,
) -> Tuple[int, int]: ...
Expand Down