Skip to content

Make io._IOBase and its descendents concrete. #1172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion stdlib/2/_io.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/2/io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...