summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
authorslateny <46876382+slateny@users.noreply.github.com>2022-04-30 15:22:33 (GMT)
committerGitHub <noreply@github.com>2022-04-30 15:22:33 (GMT)
commit3a8e2b6e65fea1252477f6e29a384fa9a492ed06 (patch)
tree5afd4564ce8aa6f6547d8374cef0419c72a1be66 /Doc/library/io.rst
parent9ea9078ec715ffc92c10c61321f3b1184fa3cac9 (diff)
downloadcpython-3a8e2b6e65fea1252477f6e29a384fa9a492ed06.zip
cpython-3a8e2b6e65fea1252477f6e29a384fa9a492ed06.tar.gz
cpython-3a8e2b6e65fea1252477f6e29a384fa9a492ed06.tar.bz2
gh-85864: io docs: Add missing position-only parameters (#91950)
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst34
1 files changed, 17 insertions, 17 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 8275753..ecd8c80 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -401,7 +401,7 @@ I/O Base Classes
Note that it's already possible to iterate on file objects using ``for
line in file: ...`` without calling ``file.readlines()``.
- .. method:: seek(offset, whence=SEEK_SET)
+ .. method:: seek(offset, whence=SEEK_SET, /)
Change the stream position to the given byte *offset*. *offset* is
interpreted relative to the position indicated by *whence*. The default
@@ -433,7 +433,7 @@ I/O Base Classes
Return the current stream position.
- .. method:: truncate(size=None)
+ .. method:: truncate(size=None, /)
Resize the stream to the given *size* in bytes (or the current position
if *size* is not specified). The current stream position isn't changed.
@@ -450,7 +450,7 @@ I/O Base Classes
Return ``True`` if the stream supports writing. If ``False``,
:meth:`write` and :meth:`truncate` will raise :exc:`OSError`.
- .. method:: writelines(lines)
+ .. method:: writelines(lines, /)
Write a list of lines to the stream. Line separators are not added, so it
is usual for each of the lines provided to have a line separator at the
@@ -494,7 +494,7 @@ I/O Base Classes
Read and return all the bytes from the stream until EOF, using multiple
calls to the stream if necessary.
- .. method:: readinto(b)
+ .. method:: readinto(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, and return the
@@ -502,7 +502,7 @@ I/O Base Classes
If the object is in non-blocking mode and no bytes
are available, ``None`` is returned.
- .. method:: write(b)
+ .. method:: write(b, /)
Write the given :term:`bytes-like object`, *b*, to the
underlying raw stream, and return the number of
@@ -559,7 +559,7 @@ I/O Base Classes
.. versionadded:: 3.1
- .. method:: read(size=-1)
+ .. method:: read(size=-1, /)
Read and return up to *size* bytes. If the argument is omitted, ``None``,
or negative, data is read and returned until EOF is reached. An empty
@@ -574,7 +574,7 @@ I/O Base Classes
A :exc:`BlockingIOError` is raised if the underlying raw stream is in
non blocking-mode, and has no data available at the moment.
- .. method:: read1([size])
+ .. method:: read1(size=-1, /)
Read and return up to *size* bytes, with at most one call to the
underlying raw stream's :meth:`~RawIOBase.read` (or
@@ -609,7 +609,7 @@ I/O Base Classes
.. versionadded:: 3.5
- .. method:: write(b)
+ .. method:: write(b, /)
Write the given :term:`bytes-like object`, *b*, and return the number
of bytes written (always equal to the length of *b* in bytes, since if
@@ -692,7 +692,7 @@ Buffered Streams
Buffered I/O streams provide a higher-level interface to an I/O device
than raw I/O does.
-.. class:: BytesIO([initial_bytes])
+.. class:: BytesIO(initial_bytes=b'')
A binary stream using an in-memory bytes buffer. It inherits
:class:`BufferedIOBase`. The buffer is discarded when the
@@ -727,14 +727,14 @@ than raw I/O does.
Return :class:`bytes` containing the entire contents of the buffer.
- .. method:: read1([size], /)
+ .. method:: read1(size=-1, /)
In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.read`.
.. versionchanged:: 3.7
The *size* argument is now optional.
- .. method:: readinto1(b)
+ .. method:: readinto1(b, /)
In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.readinto`.
@@ -757,18 +757,18 @@ than raw I/O does.
:class:`BufferedReader` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`:
- .. method:: peek([size])
+ .. method:: peek(size=0, /)
Return bytes from the stream without advancing the position. At most one
single read on the raw stream is done to satisfy the call. The number of
bytes returned may be less or more than requested.
- .. method:: read([size])
+ .. method:: read(size=-1, /)
Read and return *size* bytes, or if *size* is not given or negative, until
EOF or if the read call would block in non-blocking mode.
- .. method:: read1([size])
+ .. method:: read1(size=-1, /)
Read and return up to *size* bytes with only one call on the raw stream.
If at least one byte is buffered, only buffered bytes are returned.
@@ -900,14 +900,14 @@ Text I/O
Read and return at most *size* characters from the stream as a single
:class:`str`. If *size* is negative or ``None``, reads until EOF.
- .. method:: readline(size=-1)
+ .. method:: readline(size=-1, /)
Read until newline or EOF and return a single ``str``. If the stream is
already at EOF, an empty string is returned.
If *size* is specified, at most *size* characters will be read.
- .. method:: seek(offset, whence=SEEK_SET)
+ .. method:: seek(offset, whence=SEEK_SET, /)
Change the stream position to the given *offset*. Behaviour depends on
the *whence* parameter. The default value for *whence* is
@@ -934,7 +934,7 @@ Text I/O
does not usually represent a number of bytes in the underlying
binary storage.
- .. method:: write(s)
+ .. method:: write(s, /)
Write the string *s* to the stream and return the number of characters
written.