fill out bz2 stub (#1728)

- add a default value to ...
- add some missing version checks
- add some missing arguments
This commit is contained in:
Jelle Zijlstra
2017-11-13 06:55:43 -08:00
committed by Matthias Kramm
parent 87fca814b1
commit 0080017d02

View File

@@ -1,20 +1,29 @@
# Stubs for bz2
import sys
from typing import Any, BinaryIO, IO, Optional, Union
from typing import Any, BinaryIO, TextIO, IO, Optional, Union
if sys.version_info >= (3, 6):
from os import PathLike
_PathOrFile = Union[str, bytes, IO[Any], PathLike[Any]]
elif sys.version_info >= (3, 3):
_PathOrFile = Union[str, bytes, IO[Any]]
else:
_PathOrFile = str
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
def decompress(data: bytes) -> bytes: ...
def open(filename: Union[str, bytes, IO[Any]],
mode: str = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...) -> IO[Any]: ...
if sys.version_info >= (3, 3):
def open(filename: _PathOrFile,
mode: str = ...,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...) -> IO[Any]: ...
class BZ2File(BinaryIO):
def __init__(self,
filename: Union[str, bytes, IO[Any]],
mode: str = "r",
filename: _PathOrFile,
mode: str = ...,
buffering: Optional[Any] = ...,
compresslevel: int = ...) -> None: ...
@@ -24,10 +33,15 @@ class BZ2Compressor(object):
def flush(self) -> bytes: ...
class BZ2Decompressor(object):
def decompress(self, data: bytes) -> bytes: ...
@property
def eof(self) -> bool: ...
@property
def needs_input(self) -> bool: ...
if sys.version_info >= (3, 5):
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
else:
def decompress(self, data: bytes) -> bytes: ...
if sys.version_info >= (3, 3):
@property
def eof(self) -> bool: ...
if sys.version_info >= (3, 5):
@property
def needs_input(self) -> bool: ...
@property
def unused_data(self) -> bytes: ...