diff --git a/stdlib/2/_io.pyi b/stdlib/2/_io.pyi index e85da3317..6e144bcf6 100644 --- a/stdlib/2/_io.pyi +++ b/stdlib/2/_io.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional, Iterable, Tuple, List, Union +from typing import Any, BinaryIO, Optional, Iterable, Tuple, List, Union DEFAULT_BUFFER_SIZE = ... # type: int @@ -9,29 +9,11 @@ class BlockingIOError(IOError): class UnsupportedOperation(ValueError, IOError): ... -class _IOBase(object): - closed = ... # type: bool - def __enter__(self) -> "_IOBase": ... - def __exit__(self, type, value, traceback) -> bool: ... - def __iter__(self) -> "_IOBase": ... +class _IOBase(BinaryIO): def _checkClosed(self) -> None: ... def _checkReadable(self) -> None: ... def _checkSeekable(self) -> None: ... def _checkWritable(self) -> None: ... - def close(self) -> None: ... - def fileno(self) -> int: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def next(self) -> str: ... - def readable(self) -> bool: ... - def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... - def seek(self, offset: int, whence: int = ...) -> None: ... - def seekable(self) -> bool: ... - def tell(self) -> int: ... - def truncate(self, size: int = ...) -> int: ... - def writable(self) -> bool: ... - def writelines(self, lines: Iterable[str]) -> None: ... class _BufferedIOBase(_IOBase): def read1(self, n: int) -> str: ... @@ -87,8 +69,6 @@ class _TextIOBase(_IOBase): newlines = ... # type: Union[str, unicode] encoding = ... # type: Optional[str] def read(self, n: int = ...) -> str: ... - def write(self) -> None: - raise UnsupportedOperation def detach(self) -> None: raise UnsupportedOperation diff --git a/stdlib/2/io.pyi b/stdlib/2/io.pyi index 330b9843a..18bf7b593 100644 --- a/stdlib/2/io.pyi +++ b/stdlib/2/io.pyi @@ -5,6 +5,7 @@ # Only a subset of functionality is included. from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union, Optional +import _io DEFAULT_BUFFER_SIZE = 0 @@ -13,9 +14,7 @@ def open(file: Union[str, unicode, int], errors: unicode = ..., newline: unicode = ..., closefd: bool = ...) -> IO[Any]: ... -class IOBase: - # TODO - ... +class IOBase(_io._IOBase): ... class BytesIO(BinaryIO): def __init__(self, initial_bytes: str = ...) -> None: ...