-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-127647: Add typing.Reader and Writer protocols #127648
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b45fec0
1525e05
7867ec1
6a22a02
5d632a3
4d50c2e
1e1ea41
56a38a0
f2c331b
6764b6a
022acaa
b86073d
65eb040
2b9159d
1f42b21
0325f5a
632511a
3b384f9
5bdb4cc
35dcaf4
5584a57
af81301
5a8b915
b1593fa
577b893
cedfa42
a0b9e47
53a2250
03aa3a2
ca72c19
3b5975e
96080fe
3723370
76003a8
43e23f0
c644770
bfab2fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Small improvements to the docstrings and signature
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2821,8 +2821,21 @@ decorated with :func:`@runtime_checkable <runtime_checkable>`. | |||
|
||||
.. class:: Reader[T] | ||||
|
||||
Protocol for reading from a file or other input stream. Implementations | ||||
must support the ``read``, ``readline``, and ``__iter__`` methods. | ||||
Protocol for reading from a file or other input stream. | ||||
|
||||
.. method:: read(size=...) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(Same for other methods) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was unsure of how much of the signature to document. For example, would it also make sense to add argument and/or return types? I've added the slashes for now. |
||||
|
||||
Read data from the input stream and return it. If ``size`` is | ||||
srittau marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
specified, at most ``size`` items (bytes/characters) will be read. | ||||
|
||||
.. method:: readline(size=...) | ||||
|
||||
Read a line of data from the input stream and return it. If ``size`` is | ||||
specified, at most ``size`` items (bytes/characters) will be read. | ||||
|
||||
.. method:: __iter__() | ||||
|
||||
Read a line of data from the input stream and return it. | ||||
srittau marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
For example:: | ||||
|
||||
|
@@ -2833,8 +2846,12 @@ decorated with :func:`@runtime_checkable <runtime_checkable>`. | |||
|
||||
.. class:: Writer[T] | ||||
|
||||
Protocol for writing to a file or other output stream. Implementations | ||||
must support the ``write`` method. | ||||
Protocol for writing to a file or other output stream. | ||||
|
||||
.. method:: write(data) | ||||
|
||||
Write data to the output stream and return number of items | ||||
(bytes/characters) written. | ||||
|
||||
For example:: | ||||
|
||||
|
Uh oh!
There was an error while loading. Please reload this page.