Skip to content

Commit 1f42b21

Browse files
committed
Remove Reader.__iter__() and readline()
1 parent 2b9159d commit 1f42b21

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

Doc/library/typing.rst

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,22 +2830,11 @@ decorated with :func:`@runtime_checkable <runtime_checkable>`.
28302830
Read data from the input stream and return it. If ``size`` is
28312831
specified, at most ``size`` items (bytes/characters) will be read.
28322832

2833-
.. method:: readline(size=..., /)
2834-
2835-
Read a line of data from the input stream and return it. If ``size`` is
2836-
specified, at most ``size`` items (bytes/characters) will be read.
2837-
2838-
.. method:: __iter__()
2839-
2840-
Return an :class:`collections.abc.Iterator` over the lines of data
2841-
in the input stream.
2842-
28432833
For example::
28442834

28452835
def read_it(reader: Reader[str]):
2846-
assert reader.read(11) == "--marker--\n"
2847-
for line in reader:
2848-
print(line)
2836+
data = reader.read(11)
2837+
assert isinstance(data, str)
28492838

28502839
.. class:: Writer[T]
28512840

Lib/typing.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,7 +2931,7 @@ def __round__(self, ndigits: int = 0) -> T:
29312931
pass
29322932

29332933

2934-
class Reader[T](Iterable[T], Protocol):
2934+
class Reader[T](Protocol):
29352935
"""Protocol for simple I/O reader instances.
29362936
29372937
This protocol only supports blocking I/O.
@@ -2947,14 +2947,6 @@ def read(self, size: int = ..., /) -> T:
29472947
read.
29482948
"""
29492949

2950-
@abstractmethod
2951-
def readline(self, size: int = ..., /) -> T:
2952-
"""Read a line of data from the input stream and return it.
2953-
2954-
If "size" is specified, at most "size" items (bytes/characters) will be
2955-
read.
2956-
"""
2957-
29582950

29592951
class Writer[T](Protocol):
29602952
"""Protocol for simple I/O writer instances.

0 commit comments

Comments
 (0)