Files
typeshed/stdlib/@python2/bz2.pyi
Sebastian Rittau f0bf6eebbd AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
2021-05-17 20:45:48 +02:00

35 lines
1.4 KiB
Python

import io
from _typeshed import ReadableBuffer, WriteableBuffer
from typing import IO, Any, Iterable, List, Optional, Text, TypeVar, Union
from typing_extensions import SupportsIndex
_PathOrFile = Union[Text, IO[bytes]]
_T = TypeVar("_T")
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
def decompress(data: bytes) -> bytes: ...
class BZ2File(io.BufferedIOBase, IO[bytes]):
def __enter__(self: _T) -> _T: ...
def __init__(
self, filename: _PathOrFile, mode: str = ..., buffering: Optional[Any] = ..., compresslevel: int = ...
) -> None: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore
def readinto(self, b: WriteableBuffer) -> int: ...
def readlines(self, size: SupportsIndex = ...) -> List[bytes]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def write(self, data: ReadableBuffer) -> int: ...
def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ...
class BZ2Compressor(object):
def __init__(self, compresslevel: int = ...) -> None: ...
def compress(self, __data: bytes) -> bytes: ...
def flush(self) -> bytes: ...
class BZ2Decompressor(object):
def decompress(self, data: bytes) -> bytes: ...
@property
def unused_data(self) -> bytes: ...