diff --git a/stdlib/2/_io.pyi b/stdlib/2/_io.pyi index 6e144bcf67eb..959d1d128434 100644 --- a/stdlib/2/_io.pyi +++ b/stdlib/2/_io.pyi @@ -1,4 +1,4 @@ -from typing import Any, BinaryIO, Optional, Iterable, Tuple, List, Union +from typing import Any, BinaryIO, IO, Iterable, Iterator, List, Optional, Type, Tuple, Union DEFAULT_BUFFER_SIZE = ... # type: int @@ -14,6 +14,28 @@ class _IOBase(BinaryIO): def _checkReadable(self) -> None: ... def _checkSeekable(self) -> None: ... def _checkWritable(self) -> None: ... + # All these methods are concrete here (you can instantiate this) + def close(self) -> None: ... + def fileno(self) -> int: ... + def flush(self) -> None: ... + def isatty(self) -> bool: ... + def read(self, n: int = ...) -> bytes: ... + def readable(self) -> bool: ... + def readline(self, limit: int = ...) -> bytes: ... + def readlines(self, hint: int = ...) -> list[bytes]: ... + def seek(self, offset: int, whence: int = ...) -> int: ... + def seekable(self) -> bool: ... + def tell(self) -> int: ... + def truncate(self, size: Optional[int] = ...) -> int: ... + def writable(self) -> bool: ... + def write(self, s: bytes) -> int: ... + def writelines(self, lines: Iterable[bytes]) -> None: ... + def next(self) -> bytes: ... + def __iter__(self) -> Iterator[bytes]: ... + def __enter__(self) -> '_IOBase': ... + def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], + # TODO: traceback should be TracebackType but that's defined in types + traceback: Optional[Any]) -> bool: ... class _BufferedIOBase(_IOBase): def read1(self, n: int) -> str: ... diff --git a/stdlib/2/io.pyi b/stdlib/2/io.pyi index 18bf7b5938d5..03cd38e0bbcd 100644 --- a/stdlib/2/io.pyi +++ b/stdlib/2/io.pyi @@ -101,4 +101,4 @@ class TextIOWrapper(TextIO): def __enter__(self) -> StringIO: ... def __exit__(self, type, value, traceback) -> bool: ... -class BufferedIOBase(IOBase): ... +class BufferedIOBase(_io._BufferedIOBase, IOBase): ...