make BZ2File and LZMAFile instantiable (#2115)

Part of #1476.
This commit is contained in:
Jelle Zijlstra
2018-06-11 13:59:38 -07:00
committed by Guido van Rossum
parent 764ee4eeec
commit a33a124537
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import io
import sys
from typing import Any, BinaryIO, IO, Optional, Union
from typing import Any, IO, Optional, Union
if sys.version_info >= (3, 6):
from os import PathLike
@@ -20,7 +21,7 @@ if sys.version_info >= (3, 3):
errors: Optional[str] = ...,
newline: Optional[str] = ...) -> IO[Any]: ...
class BZ2File(BinaryIO):
class BZ2File(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#5027
def __init__(self,
filename: _PathOrFile,
mode: str = ...,

View File

@@ -67,7 +67,7 @@ class LZMACompressor(object):
class LZMAError(Exception): ...
class LZMAFile(BinaryIO):
class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#5027
def __init__(self,
filename: Optional[_PathOrFile] = ...,
mode: str = ...,
@@ -84,7 +84,7 @@ class LZMAFile(BinaryIO):
def readable(self) -> bool: ...
def writable(self) -> bool: ...
def peek(self, size: int = ...) -> bytes: ...
def read(self, size: int = ...) -> bytes: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
def readline(self, size: int = ...) -> bytes: ...
def write(self, data: bytes) -> int: ...