@@ -320,7 +320,7 @@ I/O Base Classes
320
320
Note that it's already possible to iterate on file objects using ``for
321
321
line in file: ... `` without calling ``file.readlines() ``.
322
322
323
- .. method :: seek(offset, whence=SEEK_SET)
323
+ .. method :: seek(offset, whence=SEEK_SET, / )
324
324
325
325
Change the stream position to the given byte *offset *. *offset * is
326
326
interpreted relative to the position indicated by *whence *. The default
@@ -352,7 +352,7 @@ I/O Base Classes
352
352
353
353
Return the current stream position.
354
354
355
- .. method :: truncate(size=None)
355
+ .. method :: truncate(size=None, / )
356
356
357
357
Resize the stream to the given *size * in bytes (or the current position
358
358
if *size * is not specified). The current stream position isn't changed.
@@ -369,7 +369,7 @@ I/O Base Classes
369
369
Return ``True `` if the stream supports writing. If ``False ``,
370
370
:meth: `write ` and :meth: `truncate ` will raise :exc: `OSError `.
371
371
372
- .. method :: writelines(lines)
372
+ .. method :: writelines(lines, / )
373
373
374
374
Write a list of lines to the stream. Line separators are not added, so it
375
375
is usual for each of the lines provided to have a line separator at the
@@ -413,15 +413,15 @@ I/O Base Classes
413
413
Read and return all the bytes from the stream until EOF, using multiple
414
414
calls to the stream if necessary.
415
415
416
- .. method :: readinto(b)
416
+ .. method :: readinto(b, / )
417
417
418
418
Read bytes into a pre-allocated, writable
419
419
:term: `bytes-like object ` *b *, and return the
420
420
number of bytes read. For example, *b * might be a :class: `bytearray `.
421
421
If the object is in non-blocking mode and no bytes
422
422
are available, ``None `` is returned.
423
423
424
- .. method :: write(b)
424
+ .. method :: write(b, / )
425
425
426
426
Write the given :term: `bytes-like object `, *b *, to the
427
427
underlying raw stream, and return the number of
@@ -478,7 +478,7 @@ I/O Base Classes
478
478
479
479
.. versionadded :: 3.1
480
480
481
- .. method :: read(size=-1)
481
+ .. method :: read(size=-1, / )
482
482
483
483
Read and return up to *size * bytes. If the argument is omitted, ``None ``,
484
484
or negative, data is read and returned until EOF is reached. An empty
@@ -493,7 +493,7 @@ I/O Base Classes
493
493
A :exc: `BlockingIOError ` is raised if the underlying raw stream is in
494
494
non blocking-mode, and has no data available at the moment.
495
495
496
- .. method :: read1([ size] )
496
+ .. method :: read1(size=-1, / )
497
497
498
498
Read and return up to *size * bytes, with at most one call to the
499
499
underlying raw stream's :meth: `~RawIOBase.read ` (or
@@ -528,7 +528,7 @@ I/O Base Classes
528
528
529
529
.. versionadded :: 3.5
530
530
531
- .. method :: write(b)
531
+ .. method :: write(b, / )
532
532
533
533
Write the given :term: `bytes-like object `, *b *, and return the number
534
534
of bytes written (always equal to the length of *b * in bytes, since if
@@ -611,7 +611,7 @@ Buffered Streams
611
611
Buffered I/O streams provide a higher-level interface to an I/O device
612
612
than raw I/O does.
613
613
614
- .. class :: BytesIO([ initial_bytes] )
614
+ .. class :: BytesIO(initial_bytes=b'' )
615
615
616
616
A binary stream using an in-memory bytes buffer. It inherits
617
617
:class: `BufferedIOBase `. The buffer is discarded when the
@@ -646,14 +646,14 @@ than raw I/O does.
646
646
Return :class: `bytes ` containing the entire contents of the buffer.
647
647
648
648
649
- .. method :: read1([ size] , /)
649
+ .. method :: read1(size=-1 , /)
650
650
651
651
In :class: `BytesIO `, this is the same as :meth: `~BufferedIOBase.read `.
652
652
653
653
.. versionchanged :: 3.7
654
654
The *size * argument is now optional.
655
655
656
- .. method :: readinto1(b)
656
+ .. method :: readinto1(b, / )
657
657
658
658
In :class: `BytesIO `, this is the same as :meth: `~BufferedIOBase.readinto `.
659
659
@@ -676,18 +676,18 @@ than raw I/O does.
676
676
:class: `BufferedReader ` provides or overrides these methods in addition to
677
677
those from :class: `BufferedIOBase ` and :class: `IOBase `:
678
678
679
- .. method :: peek([ size] )
679
+ .. method :: peek(size=0, / )
680
680
681
681
Return bytes from the stream without advancing the position. At most one
682
682
single read on the raw stream is done to satisfy the call. The number of
683
683
bytes returned may be less or more than requested.
684
684
685
- .. method :: read([ size] )
685
+ .. method :: read(size=-1, / )
686
686
687
687
Read and return *size * bytes, or if *size * is not given or negative, until
688
688
EOF or if the read call would block in non-blocking mode.
689
689
690
- .. method :: read1([ size] )
690
+ .. method :: read1(size=-1, / )
691
691
692
692
Read and return up to *size * bytes with only one call on the raw stream.
693
693
If at least one byte is buffered, only buffered bytes are returned.
@@ -819,14 +819,14 @@ Text I/O
819
819
Read and return at most *size * characters from the stream as a single
820
820
:class: `str `. If *size * is negative or ``None ``, reads until EOF.
821
821
822
- .. method :: readline(size=-1)
822
+ .. method :: readline(size=-1, / )
823
823
824
824
Read until newline or EOF and return a single ``str ``. If the stream is
825
825
already at EOF, an empty string is returned.
826
826
827
827
If *size * is specified, at most *size * characters will be read.
828
828
829
- .. method :: seek(offset, whence=SEEK_SET)
829
+ .. method :: seek(offset, whence=SEEK_SET, / )
830
830
831
831
Change the stream position to the given *offset *. Behaviour depends on
832
832
the *whence * parameter. The default value for *whence * is
@@ -853,7 +853,7 @@ Text I/O
853
853
does not usually represent a number of bytes in the underlying
854
854
binary storage.
855
855
856
- .. method :: write(s)
856
+ .. method :: write(s, / )
857
857
858
858
Write the string *s * to the stream and return the number of characters
859
859
written.
0 commit comments