Skip to content
Closed
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
10 changes: 8 additions & 2 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,16 @@ TYPE_CHECKING: bool
# This differs from runtime, but better reflects the fact that in reality
# classes deriving from IO use different names for the arguments.
class IO(Iterator[AnyStr], Generic[AnyStr]):
# TODO use abstract properties
@property
@abstractmethod
def mode(self) -> str: ...
@property
@abstractmethod
def name(self) -> str: ...
@abstractmethod
def close(self) -> None: ...
@property
@abstractmethod
def closed(self) -> bool: ...
@abstractmethod
def fileno(self) -> int: ...
Expand Down Expand Up @@ -690,16 +692,20 @@ class BinaryIO(IO[bytes]):
def __enter__(self) -> BinaryIO: ...

class TextIO(IO[str]):
# TODO use abstractproperty
@property
@abstractmethod
def buffer(self) -> BinaryIO: ...
@property
@abstractmethod
def encoding(self) -> str: ...
@property
@abstractmethod
def errors(self) -> str | None: ...
@property
@abstractmethod
def line_buffering(self) -> int: ... # int on PyPy, bool on CPython
@property
@abstractmethod
def newlines(self) -> Any: ... # None, str or tuple
@abstractmethod
def __enter__(self) -> TextIO: ...
Expand Down