chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
597a3e34-9c3f-4a88-b80d-3264573cb0b0 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,110 | supabase-export-v2 | bcdabac949368e69 | deals with the reading and writing of bytes to a stream. :class:`FileIO` subclasses :class:`RawIOBase` to provide an interface to files in the machine's file system.
The :class:`BufferedIOBase` ABC extends :class:`IOBase`. It deals with
buffering on a raw binary stream (:class:`RawIOBase`). Its subclasses,
:class:`Buff... | trusted_official_docs | CPython Docs | deals with the reading and writing of bytes to a stream. :class:`FileIO` subclasses :class:`RawIOBase` to provide an interface to files in the machine's file system.
The :class:`BufferedIOBase` ABC extends :class:`IOBase`. It deals with
buffering on a raw binary stream (:class:`RawIOBase`). Its subclasses,
:class:`Buff... | deals with the reading and writing of bytes to a stream. :class:`FileIO` subclasses :class:`RawIOBase` to provide an interface to files in the machine's file system.
The :class:`BufferedIOBase` ABC extends :class:`IOBase`. It deals with
buffering on a raw binary stream (:class:`RawIOBase`). Its subclasses,
:class:`Buff... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b20b0d8-d1e1-4076-945a-dfd39e2ea1ca | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,386 | supabase-export-v2 | a4adda8d915cb3cb | noticeable handling huge amounts of text data like large log files. Also, :meth:`~TextIOBase.tell` and :meth:`~TextIOBase.seek` are both quite slow due to the reconstruction algorithm used.
:class:`StringIO`, however, is a native in-memory unicode container and will
exhibit similar speed to :class:`BytesIO`. | trusted_official_docs | CPython Docs | noticeable handling huge amounts of text data like large log files. Also, :meth:`~TextIOBase.tell` and :meth:`~TextIOBase.seek` are both quite slow due to the reconstruction algorithm used.
:class:`StringIO`, however, is a native in-memory unicode container and will
exhibit similar speed to :class:`BytesIO`. | noticeable handling huge amounts of text data like large log files. Also, :meth:`~TextIOBase.tell` and :meth:`~TextIOBase.seek` are both quite slow due to the reconstruction algorithm used.
:class:`StringIO`, however, is a native in-memory unicode container and will
exhibit similar speed to :class:`BytesIO`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5cfef82e-0db8-4170-97ae-e9aacecc5dc6 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,053 | supabase-export-v2 | 89b13ec311dd8e34 | Binary I/O ^^^^^^^^^^
Binary I/O (also called *buffered I/O*) expects
:term:`bytes-like objects <bytes-like object>` and produces :class:`bytes`
objects. No encoding, decoding, or newline translation is performed. This
category of streams can be used for all kinds of non-text data, and also when
manual control over the... | trusted_official_docs | CPython Docs | Binary I/O ^^^^^^^^^^
Binary I/O (also called *buffered I/O*) expects
:term:`bytes-like objects <bytes-like object>` and produces :class:`bytes`
objects. No encoding, decoding, or newline translation is performed. This
category of streams can be used for all kinds of non-text data, and also when
manual control over the... | Binary I/O ^^^^^^^^^^
Binary I/O (also called *buffered I/O*) expects
:term:`bytes-like objects <bytes-like object>` and produces :class:`bytes`
objects. No encoding, decoding, or newline translation is performed. This
category of streams can be used for all kinds of non-text data, and also when
manual control over the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e6e80b0-2c0f-420f-9b11-fee3e0dcd18e | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,254 | supabase-export-v2 | 5ea267c2494baf3e | The constructor creates a :class:`BufferedReader` for the given readable *raw* stream and *buffer_size*. If *buffer_size* is omitted, :data:`DEFAULT_BUFFER_SIZE` is used.
:class:`BufferedReader` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`: | trusted_official_docs | CPython Docs | The constructor creates a :class:`BufferedReader` for the given readable *raw* stream and *buffer_size*. If *buffer_size* is omitted, :data:`DEFAULT_BUFFER_SIZE` is used.
:class:`BufferedReader` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`: | The constructor creates a :class:`BufferedReader` for the given readable *raw* stream and *buffer_size*. If *buffer_size* is omitted, :data:`DEFAULT_BUFFER_SIZE` is used.
:class:`BufferedReader` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5f9c353d-6eda-441b-93b3-db4dd2afa216 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,093 | supabase-export-v2 | 19fb6c10015c24ec | This function emits an :class:`EncodingWarning` if :data:`sys.flags.warn_default_encoding <sys.flags>` is true and *encoding* is ``None``. *stacklevel* specifies where the warning is emitted. For example::
def read_text(path, encoding=None):
encoding = io.text_encoding(encoding) # stacklevel=2
with open(path, encodin... | trusted_official_docs | CPython Docs | This function emits an :class:`EncodingWarning` if :data:`sys.flags.warn_default_encoding <sys.flags>` is true and *encoding* is ``None``. *stacklevel* specifies where the warning is emitted. For example::
def read_text(path, encoding=None):
encoding = io.text_encoding(encoding) # stacklevel=2
with open(path, encodin... | This function emits an :class:`EncodingWarning` if :data:`sys.flags.warn_default_encoding <sys.flags>` is true and *encoding* is ``None``. *stacklevel* specifies where the warning is emitted. For example::
def read_text(path, encoding=None):
encoding = io.text_encoding(encoding) # stacklevel=2
with open(path, encodin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
621068fc-c50b-4321-8c9a-e0487b9d5fc1 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,352 | supabase-export-v2 | b5642a67ed88fad3 | The text buffer is discarded when the :meth:`~IOBase.close` method is called.
The initial value of the buffer can be set by providing *initial_value*. If newline translation is enabled, newlines will be encoded as if by
:meth:`~TextIOBase.write`. The stream is positioned at the start of the
buffer which emulates open... | trusted_official_docs | CPython Docs | The text buffer is discarded when the :meth:`~IOBase.close` method is called.
The initial value of the buffer can be set by providing *initial_value*. If newline translation is enabled, newlines will be encoded as if by
:meth:`~TextIOBase.write`. The stream is positioned at the start of the
buffer which emulates open... | The text buffer is discarded when the :meth:`~IOBase.close` method is called.
The initial value of the buffer can be set by providing *initial_value*. If newline translation is enabled, newlines will be encoded as if by
:meth:`~TextIOBase.write`. The stream is positioned at the start of the
buffer which emulates open... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
65354a42-7f0b-4298-a544-60a8ea4cd546 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,306 | supabase-export-v2 | c32eacdbc888a2d0 | (all other values are unsupported). * :data:`!SEEK_END` or ``2``: seek to the end of the stream; *offset* must be zero (all other values are unsupported).
Return the new absolute position as an opaque number. | trusted_official_docs | CPython Docs | (all other values are unsupported). * :data:`!SEEK_END` or ``2``: seek to the end of the stream; *offset* must be zero (all other values are unsupported).
Return the new absolute position as an opaque number. | (all other values are unsupported). * :data:`!SEEK_END` or ``2``: seek to the end of the stream; *offset* must be zero (all other values are unsupported).
Return the new absolute position as an opaque number. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6561d075-0963-4847-8618-2028b1ead30c | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,278 | supabase-export-v2 | 6bb14429ed7ebc6f | A buffered binary stream providing higher-level access to two non seekable :class:`RawIOBase` raw binary streams---one readable, the other writeable. It inherits from :class:`BufferedIOBase`.
*reader* and *writer* are :class:`RawIOBase` objects that are readable and
writeable respectively. If the *buffer_size* is omit... | trusted_official_docs | CPython Docs | A buffered binary stream providing higher-level access to two non seekable :class:`RawIOBase` raw binary streams---one readable, the other writeable. It inherits from :class:`BufferedIOBase`.
*reader* and *writer* are :class:`RawIOBase` objects that are readable and
writeable respectively. If the *buffer_size* is omit... | A buffered binary stream providing higher-level access to two non seekable :class:`RawIOBase` raw binary streams---one readable, the other writeable. It inherits from :class:`BufferedIOBase`.
*reader* and *writer* are :class:`RawIOBase` objects that are readable and
writeable respectively. If the *buffer_size* is omit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b8d83e9-f5d7-4fc2-999f-8b97c190620c | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,115 | supabase-export-v2 | c549742ece4150a9 | .. tabularcolumns:: |l|l|L|L|
========================= ================== ======================== ==================================================
ABC Inherits Stub Methods Mixin Methods and Properties
========================= ================== ======================== ============================================... | trusted_official_docs | CPython Docs | .. tabularcolumns:: |l|l|L|L|
========================= ================== ======================== ==================================================
ABC Inherits Stub Methods Mixin Methods and Properties
========================= ================== ======================== ============================================... | .. tabularcolumns:: |l|l|L|L|
========================= ================== ======================== ==================================================
ABC Inherits Stub Methods Mixin Methods and Properties
========================= ================== ======================== ============================================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6bb1f9a1-7d5f-4e21-b2a9-cb0163a2058c | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,267 | supabase-export-v2 | e8c4664cca9a3bd2 | The constructor creates a :class:`BufferedWriter` for the given writeable *raw* stream. If the *buffer_size* is not given, it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedWriter` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`: | trusted_official_docs | CPython Docs | The constructor creates a :class:`BufferedWriter` for the given writeable *raw* stream. If the *buffer_size* is not given, it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedWriter` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`: | The constructor creates a :class:`BufferedWriter` for the given writeable *raw* stream. If the *buffer_size* is not given, it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedWriter` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d273180-f996-4d7e-8be3-41d05a41e3e2 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,142 | supabase-export-v2 | 3518b6bcbd4e7614 | Read and return one line from the stream. If *size* is specified, at most *size* bytes will be read.
The line terminator is always ``b'\n'`` for binary files; for text files,
the *newline* argument to :func:`open` can be used to select the line
terminator(s) recognized. | trusted_official_docs | CPython Docs | Read and return one line from the stream. If *size* is specified, at most *size* bytes will be read.
The line terminator is always ``b'\n'`` for binary files; for text files,
the *newline* argument to :func:`open` can be used to select the line
terminator(s) recognized. | Read and return one line from the stream. If *size* is specified, at most *size* bytes will be read.
The line terminator is always ``b'\n'`` for binary files; for text files,
the *newline* argument to :func:`open` can be used to select the line
terminator(s) recognized. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6ec63205-b67e-493e-89f3-9eb38ce5b63b | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,183 | supabase-export-v2 | 27d15e45eb6a48dc | system returns would block :meth:`write` will raise :exc:`BlockingIOError` with :attr:`BlockingIOError.characters_written` and :meth:`read` will return data read so far or ``None`` if no data is available.
Besides, the :meth:`read` method does not have a default
implementation that defers to :meth:`readinto`. | trusted_official_docs | CPython Docs | system returns would block :meth:`write` will raise :exc:`BlockingIOError` with :attr:`BlockingIOError.characters_written` and :meth:`read` will return data read so far or ``None`` if no data is available.
Besides, the :meth:`read` method does not have a default
implementation that defers to :meth:`readinto`. | system returns would block :meth:`write` will raise :exc:`BlockingIOError` with :attr:`BlockingIOError.characters_written` and :meth:`read` will return data read so far or ``None`` if no data is available.
Besides, the :meth:`read` method does not have a default
implementation that defers to :meth:`readinto`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6f6a7417-c7a6-43e6-80dd-15e0a70ad1e5 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,318 | supabase-export-v2 | 80966487fb6cfbff | *newline* controls how line endings are handled. It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
* When reading input from the stream, if *newline* is ``None``,
:term:`universal newlines` mode is enabled. Lines in the input can end in
``'\n'``, ``'\r'``, or ``'\r\n'``, and these a... | trusted_official_docs | CPython Docs | *newline* controls how line endings are handled. It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
* When reading input from the stream, if *newline* is ``None``,
:term:`universal newlines` mode is enabled. Lines in the input can end in
``'\n'``, ``'\r'``, or ``'\r\n'``, and these a... | *newline* controls how line endings are handled. It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
* When reading input from the stream, if *newline* is ``None``,
:term:`universal newlines` mode is enabled. Lines in the input can end in
``'\n'``, ``'\r'``, or ``'\r\n'``, and these a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7105fc55-2dc2-45ee-8ad6-0e315e07d893 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,344 | supabase-export-v2 | 25c70a28996db8f1 | be** a number returned by :meth:`tell`. * ``seek(0, SEEK_END)``: Fast-forward to the end of the stream. * ``seek(0, SEEK_CUR)``: Leave the current stream position unchanged.
Any other argument combinations are invalid,
and may raise exceptions. | trusted_official_docs | CPython Docs | be** a number returned by :meth:`tell`. * ``seek(0, SEEK_END)``: Fast-forward to the end of the stream. * ``seek(0, SEEK_CUR)``: Leave the current stream position unchanged.
Any other argument combinations are invalid,
and may raise exceptions. | be** a number returned by :meth:`tell`. * ``seek(0, SEEK_END)``: Fast-forward to the end of the stream. * ``seek(0, SEEK_CUR)``: Leave the current stream position unchanged.
Any other argument combinations are invalid,
and may raise exceptions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
72825196-e9a2-49d1-8add-13506ae11fe1 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,305 | supabase-export-v2 | 2ec82e5770beeea4 | Change the stream position to the given *offset*. Behaviour depends on the *whence* parameter. The default value for *whence* is :data:`!SEEK_SET`.
* :data:`!SEEK_SET` or ``0``: seek from the start of the stream
(the default); *offset* must either be a number returned by
:meth:`TextIOBase.tell`, or zero. Any other *o... | trusted_official_docs | CPython Docs | Change the stream position to the given *offset*. Behaviour depends on the *whence* parameter. The default value for *whence* is :data:`!SEEK_SET`.
* :data:`!SEEK_SET` or ``0``: seek from the start of the stream
(the default); *offset* must either be a number returned by
:meth:`TextIOBase.tell`, or zero. Any other *o... | Change the stream position to the given *offset*. Behaviour depends on the *whence* parameter. The default value for *whence* is :data:`!SEEK_SET`.
* :data:`!SEEK_SET` or ``0``: seek from the start of the stream
(the default); *offset* must either be a number returned by
:meth:`TextIOBase.tell`, or zero. Any other *o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73ce4931-de69-49e4-b5dd-bbdf0b1feb32 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,274 | supabase-export-v2 | 3db53d292ff210cd | A buffered binary stream providing higher-level access to a seekable :class:`RawIOBase` raw binary stream. It inherits from :class:`BufferedReader` and :class:`BufferedWriter`.
The constructor creates a reader and writer for a seekable raw stream, given
in the first argument. If the *buffer_size* is omitted it default... | trusted_official_docs | CPython Docs | A buffered binary stream providing higher-level access to a seekable :class:`RawIOBase` raw binary stream. It inherits from :class:`BufferedReader` and :class:`BufferedWriter`.
The constructor creates a reader and writer for a seekable raw stream, given
in the first argument. If the *buffer_size* is omitted it default... | A buffered binary stream providing higher-level access to a seekable :class:`RawIOBase` raw binary stream. It inherits from :class:`BufferedReader` and :class:`BufferedWriter`.
The constructor creates a reader and writer for a seekable raw stream, given
in the first argument. If the *buffer_size* is omitted it default... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
768ad924-15c7-474a-b585-7db526a7fe7d | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,171 | supabase-export-v2 | c2fcd62d81d03aaa | Otherwise, only one system call is ever made. Fewer than *size* bytes may be returned if the operating system call returns fewer than *size* bytes.
If 0 bytes are returned, and *size* was not 0, this indicates end of file. If the object is in non-blocking mode and no bytes are available,
``None`` is returned. | trusted_official_docs | CPython Docs | Otherwise, only one system call is ever made. Fewer than *size* bytes may be returned if the operating system call returns fewer than *size* bytes.
If 0 bytes are returned, and *size* was not 0, this indicates end of file. If the object is in non-blocking mode and no bytes are available,
``None`` is returned. | Otherwise, only one system call is ever made. Fewer than *size* bytes may be returned if the operating system call returns fewer than *size* bytes.
If 0 bytes are returned, and *size* was not 0, this indicates end of file. If the object is in non-blocking mode and no bytes are available,
``None`` is returned. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7865568e-ecf4-4123-b0dd-6fac2bff17bd | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,045 | supabase-export-v2 | 148402e3e77de403 | (such as in the case of a file), encoding and decoding of data is made transparently as well as optional translation of platform-specific newline characters.
The easiest way to create a text stream is with :meth:`open`, optionally
specifying an encoding:: | trusted_official_docs | CPython Docs | (such as in the case of a file), encoding and decoding of data is made transparently as well as optional translation of platform-specific newline characters.
The easiest way to create a text stream is with :meth:`open`, optionally
specifying an encoding:: | (such as in the case of a file), encoding and decoding of data is made transparently as well as optional translation of platform-specific newline characters.
The easiest way to create a text stream is with :meth:`open`, optionally
specifying an encoding:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7aff9e96-3605-4ea8-9a38-4c0180fdf098 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,275 | supabase-export-v2 | 3eada43add2c933d | constructor creates a reader and writer for a seekable raw stream, given in the first argument. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedRandom` is capable of anything :class:`BufferedReader` or
:class:`BufferedWriter` can do. In addition, :meth:`~IOBase.seek` and
:m... | trusted_official_docs | CPython Docs | constructor creates a reader and writer for a seekable raw stream, given in the first argument. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedRandom` is capable of anything :class:`BufferedReader` or
:class:`BufferedWriter` can do. In addition, :meth:`~IOBase.seek` and
:m... | constructor creates a reader and writer for a seekable raw stream, given in the first argument. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedRandom` is capable of anything :class:`BufferedReader` or
:class:`BufferedWriter` can do. In addition, :meth:`~IOBase.seek` and
:m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7cb3ad24-00db-4e9a-9ba4-6a4391f3062e | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,360 | supabase-export-v2 | 3fd3f18eac8cd26b | # Retrieve file contents -- this will be # 'First line.\nSecond line.\n' contents = output.getvalue()
# Close object and discard memory buffer --
# .getvalue() will now raise an exception. output.close() | trusted_official_docs | CPython Docs | # Retrieve file contents -- this will be # 'First line.\nSecond line.\n' contents = output.getvalue()
# Close object and discard memory buffer --
# .getvalue() will now raise an exception. output.close() | # Retrieve file contents -- this will be # 'First line.\nSecond line.\n' contents = output.getvalue()
# Close object and discard memory buffer --
# .getvalue() will now raise an exception. output.close() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8038857c-1b27-4892-94d9-8773838b7b72 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,200 | supabase-export-v2 | 32eddd228ffd65af | .. method:: read1(size=-1, /)
Read and return up to *size* bytes, calling :meth:`~RawIOBase.readinto`
which may retry if :py:const:`~errno.EINTR` is encountered per
:pep:`475`. If *size* is ``-1`` or not provided, the implementation will
choose an arbitrary value for *size*. | trusted_official_docs | CPython Docs | .. method:: read1(size=-1, /)
Read and return up to *size* bytes, calling :meth:`~RawIOBase.readinto`
which may retry if :py:const:`~errno.EINTR` is encountered per
:pep:`475`. If *size* is ``-1`` or not provided, the implementation will
choose an arbitrary value for *size*. | .. method:: read1(size=-1, /)
Read and return up to *size* bytes, calling :meth:`~RawIOBase.readinto`
which may retry if :py:const:`~errno.EINTR` is encountered per
:pep:`475`. If *size* is ``-1`` or not provided, the implementation will
choose an arbitrary value for *size*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80902812-d07f-43f8-8b86-28cc193f4b2b | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,374 | supabase-export-v2 | 5f5c4f6a8450d023 | .. class:: Writer[T]
Generic protocol for writing to a file or other output stream. ``T`` will
usually be :class:`str` or :class:`bytes`, but can be any type that can be
written to the stream. | trusted_official_docs | CPython Docs | .. class:: Writer[T]
Generic protocol for writing to a file or other output stream. ``T`` will
usually be :class:`str` or :class:`bytes`, but can be any type that can be
written to the stream. | .. class:: Writer[T]
Generic protocol for writing to a file or other output stream. ``T`` will
usually be :class:`str` or :class:`bytes`, but can be any type that can be
written to the stream. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
859e7506-26ee-46f1-afbb-2b471318e2c9 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,256 | supabase-export-v2 | 7900be2ebe10bfdc | .. method:: peek(size=0, /)
Return bytes from the stream without advancing the position. The number of
bytes returned may be less or more than requested. If the underlying raw
stream is non-blocking and the operation would block, returns empty bytes. | trusted_official_docs | CPython Docs | .. method:: peek(size=0, /)
Return bytes from the stream without advancing the position. The number of
bytes returned may be less or more than requested. If the underlying raw
stream is non-blocking and the operation would block, returns empty bytes. | .. method:: peek(size=0, /)
Return bytes from the stream without advancing the position. The number of
bytes returned may be less or more than requested. If the underlying raw
stream is non-blocking and the operation would block, returns empty bytes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a4fda18-fe47-47e0-bdc3-3cd84880595a | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,195 | supabase-export-v2 | 403b6de07a3cdb52 | Read and return up to *size* bytes. If the argument is omitted, ``None``, or negative read as much as possible.
Fewer bytes may be returned than requested. An empty :class:`bytes` object
is returned if the stream is already at EOF. More than one read may be
made and calls may be retried if specific errors are encount... | trusted_official_docs | CPython Docs | Read and return up to *size* bytes. If the argument is omitted, ``None``, or negative read as much as possible.
Fewer bytes may be returned than requested. An empty :class:`bytes` object
is returned if the stream is already at EOF. More than one read may be
made and calls may be retried if specific errors are encount... | Read and return up to *size* bytes. If the argument is omitted, ``None``, or negative read as much as possible.
Fewer bytes may be returned than requested. An empty :class:`bytes` object
is returned if the stream is already at EOF. More than one read may be
made and calls may be retried if specific errors are encount... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b8fe304-08c5-4f2a-b808-b6da887256ec | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,091 | supabase-export-v2 | 497410800aeea7dc | This is a helper function for callables that use :func:`open` or :class:`TextIOWrapper` and have an ``encoding=None`` parameter.
This function returns *encoding* if it is not ``None``. Otherwise, it returns ``"locale"`` or ``"utf-8"`` depending on
:ref:`UTF-8 Mode <utf8-mode>`. | trusted_official_docs | CPython Docs | This is a helper function for callables that use :func:`open` or :class:`TextIOWrapper` and have an ``encoding=None`` parameter.
This function returns *encoding* if it is not ``None``. Otherwise, it returns ``"locale"`` or ``"utf-8"`` depending on
:ref:`UTF-8 Mode <utf8-mode>`. | This is a helper function for callables that use :func:`open` or :class:`TextIOWrapper` and have an ``encoding=None`` parameter.
This function returns *encoding* if it is not ``None``. Otherwise, it returns ``"locale"`` or ``"utf-8"`` depending on
:ref:`UTF-8 Mode <utf8-mode>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8bf3082a-08cf-4038-b5a7-d9946f3bd383 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,059 | supabase-export-v2 | 55d6ac92758fa8ce | The binary stream API is described in detail in the docs of :class:`BufferedIOBase`.
Other library modules may provide additional ways to create text or binary
streams. See :meth:`socket.socket.makefile` for example. | trusted_official_docs | CPython Docs | The binary stream API is described in detail in the docs of :class:`BufferedIOBase`.
Other library modules may provide additional ways to create text or binary
streams. See :meth:`socket.socket.makefile` for example. | The binary stream API is described in detail in the docs of :class:`BufferedIOBase`.
Other library modules may provide additional ways to create text or binary
streams. See :meth:`socket.socket.makefile` for example. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c60334c-0327-41dc-9a30-e9a28d3d254a | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,211 | supabase-export-v2 | 8d5a8f32d00b1dc9 | .. 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
the write fails an :exc:`OSError` will be raised). Depending on the
actual implementation, these bytes may be readily written to the
underlying stream,... | trusted_official_docs | CPython Docs | .. 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
the write fails an :exc:`OSError` will be raised). Depending on the
actual implementation, these bytes may be readily written to the
underlying stream,... | .. 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
the write fails an :exc:`OSError` will be raised). Depending on the
actual implementation, these bytes may be readily written to the
underlying stream,... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d694abd-f97f-4224-be8e-1dfa1a872d7e | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,041 | supabase-export-v2 | 77fef2a3bdef87f0 | allow arbitrary random access (seeking forwards or backwards to any location), or only sequential access (for example in the case of a socket or pipe).
All streams are careful about the type of data you give to them. For example
giving a :class:`str` object to the :meth:`!write` method of a binary stream
will raise a :... | trusted_official_docs | CPython Docs | allow arbitrary random access (seeking forwards or backwards to any location), or only sequential access (for example in the case of a socket or pipe).
All streams are careful about the type of data you give to them. For example
giving a :class:`str` object to the :meth:`!write` method of a binary stream
will raise a :... | allow arbitrary random access (seeking forwards or backwards to any location), or only sequential access (for example in the case of a socket or pipe).
All streams are careful about the type of data you give to them. For example
giving a :class:`str` object to the :meth:`!write` method of a binary stream
will raise a :... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d97a935-594d-4a70-ab8a-bf3cc8deca4f | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,235 | supabase-export-v2 | 08df96216c76fedb | A binary stream using an in-memory bytes buffer. It inherits from :class:`BufferedIOBase`. The buffer is discarded when the :meth:`~IOBase.close` method is called.
The optional argument *initial_bytes* is a :term:`bytes-like object` that
contains initial data. | trusted_official_docs | CPython Docs | A binary stream using an in-memory bytes buffer. It inherits from :class:`BufferedIOBase`. The buffer is discarded when the :meth:`~IOBase.close` method is called.
The optional argument *initial_bytes* is a :term:`bytes-like object` that
contains initial data. | A binary stream using an in-memory bytes buffer. It inherits from :class:`BufferedIOBase`. The buffer is discarded when the :meth:`~IOBase.close` method is called.
The optional argument *initial_bytes* is a :term:`bytes-like object` that
contains initial data. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
94cf26dd-2efb-4096-bca2-24235ff6bea6 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,315 | supabase-export-v2 | a5c1b2133b44702c | this defaults to UTF-8. Otherwise, it defaults to :func:`locale.getencoding`. ``encoding="locale"`` can be used to specify the current locale's encoding explicitly. See :ref:`io-text-encoding` for more information.
*errors* is an optional string that specifies how encoding and decoding
errors are to be handled. Pass `... | trusted_official_docs | CPython Docs | this defaults to UTF-8. Otherwise, it defaults to :func:`locale.getencoding`. ``encoding="locale"`` can be used to specify the current locale's encoding explicitly. See :ref:`io-text-encoding` for more information.
*errors* is an optional string that specifies how encoding and decoding
errors are to be handled. Pass `... | this defaults to UTF-8. Otherwise, it defaults to :func:`locale.getencoding`. ``encoding="locale"`` can be used to specify the current locale's encoding explicitly. See :ref:`io-text-encoding` for more information.
*errors* is an optional string that specifies how encoding and decoding
errors are to be handled. Pass `... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
972231e4-6143-428e-a2a8-0fbbc25cb814 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,128 | supabase-export-v2 | 3f230cc91c06dd94 | .. method:: close()
Flush and close this stream. This method has no effect if the file is
already closed. Once the file is closed, any operation on the file
(e.g. reading or writing) will raise a :exc:`ValueError`. | trusted_official_docs | CPython Docs | .. method:: close()
Flush and close this stream. This method has no effect if the file is
already closed. Once the file is closed, any operation on the file
(e.g. reading or writing) will raise a :exc:`ValueError`. | .. method:: close()
Flush and close this stream. This method has no effect if the file is
already closed. Once the file is closed, any operation on the file
(e.g. reading or writing) will raise a :exc:`ValueError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
97e0b9fb-73b1-4279-9726-ee842b1b3346 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,044 | supabase-export-v2 | 8a3093c55b16e803 | Text I/O ^^^^^^^^
Text I/O expects and produces :class:`str` objects. This means that whenever
the backing store is natively made of bytes (such as in the case of a file),
encoding and decoding of data is made transparently as well as optional
translation of platform-specific newline characters. | trusted_official_docs | CPython Docs | Text I/O ^^^^^^^^
Text I/O expects and produces :class:`str` objects. This means that whenever
the backing store is natively made of bytes (such as in the case of a file),
encoding and decoding of data is made transparently as well as optional
translation of platform-specific newline characters. | Text I/O ^^^^^^^^
Text I/O expects and produces :class:`str` objects. This means that whenever
the backing store is natively made of bytes (such as in the case of a file),
encoding and decoding of data is made transparently as well as optional
translation of platform-specific newline characters. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
987f778b-6b90-4865-b930-103cdb883f8d | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,184 | supabase-export-v2 | e1e04424de8c5614 | Besides, the :meth:`read` method does not have a default implementation that defers to :meth:`readinto`.
A typical :class:`BufferedIOBase` implementation should not inherit from a
:class:`RawIOBase` implementation, but wrap one, like
:class:`BufferedWriter` and :class:`BufferedReader` do. | trusted_official_docs | CPython Docs | Besides, the :meth:`read` method does not have a default implementation that defers to :meth:`readinto`.
A typical :class:`BufferedIOBase` implementation should not inherit from a
:class:`RawIOBase` implementation, but wrap one, like
:class:`BufferedWriter` and :class:`BufferedReader` do. | Besides, the :meth:`read` method does not have a default implementation that defers to :meth:`readinto`.
A typical :class:`BufferedIOBase` implementation should not inherit from a
:class:`RawIOBase` implementation, but wrap one, like
:class:`BufferedWriter` and :class:`BufferedReader` do. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a1a6f55-901e-4d9a-9cab-abbf8123e178 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,083 | supabase-export-v2 | 1861155a891ffe58 | .. audit-event:: open path,mode,flags io.open
This function raises an :ref:`auditing event <auditing>` ``open`` with
arguments *path*, *mode* and *flags*. The *mode* and *flags*
arguments may have been modified or inferred from the original call. | trusted_official_docs | CPython Docs | .. audit-event:: open path,mode,flags io.open
This function raises an :ref:`auditing event <auditing>` ``open`` with
arguments *path*, *mode* and *flags*. The *mode* and *flags*
arguments may have been modified or inferred from the original call. | .. audit-event:: open path,mode,flags io.open
This function raises an :ref:`auditing event <auditing>` ``open`` with
arguments *path*, *mode* and *flags*. The *mode* and *flags*
arguments may have been modified or inferred from the original call. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ac2367c-878c-4634-ae43-fb79ed75534a | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,042 | supabase-export-v2 | 0d6f2c8a8b0ba610 | the :meth:`!write` method of a binary stream will raise a :exc:`TypeError`. So will giving a :class:`bytes` object to the :meth:`!write` method of a text stream.
.. versionchanged:: 3.3
Operations that used to raise :exc:`IOError` now raise :exc:`OSError`, since
:exc:`IOError` is now an alias of :exc:`OSError`. | trusted_official_docs | CPython Docs | the :meth:`!write` method of a binary stream will raise a :exc:`TypeError`. So will giving a :class:`bytes` object to the :meth:`!write` method of a text stream.
.. versionchanged:: 3.3
Operations that used to raise :exc:`IOError` now raise :exc:`OSError`, since
:exc:`IOError` is now an alias of :exc:`OSError`. | the :meth:`!write` method of a binary stream will raise a :exc:`TypeError`. So will giving a :class:`bytes` object to the :meth:`!write` method of a text stream.
.. versionchanged:: 3.3
Operations that used to raise :exc:`IOError` now raise :exc:`OSError`, since
:exc:`IOError` is now an alias of :exc:`OSError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9b0b786a-4d1e-4e9a-bc38-d736d2bf8ebc | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,107 | supabase-export-v2 | f956fe5ebc06ef4a | .. note::
The abstract base classes also provide default implementations of some
methods in order to help implementation of concrete stream classes. For
example, :class:`BufferedIOBase` provides unoptimized implementations of
:meth:`!readinto` and :meth:`!readline`. | trusted_official_docs | CPython Docs | .. note::
The abstract base classes also provide default implementations of some
methods in order to help implementation of concrete stream classes. For
example, :class:`BufferedIOBase` provides unoptimized implementations of
:meth:`!readinto` and :meth:`!readline`. | .. note::
The abstract base classes also provide default implementations of some
methods in order to help implementation of concrete stream classes. For
example, :class:`BufferedIOBase` provides unoptimized implementations of
:meth:`!readinto` and :meth:`!readline`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9d5fd0a9-c720-41fb-a59e-b4c26de126cf | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,146 | supabase-export-v2 | f7ea06bc47371b02 | *hint* values of ``0`` or less, as well as ``None``, are treated as no hint.
Note that it's already possible to iterate on file objects using ``for
line in file: ...`` without calling :meth:`!file.readlines`. | trusted_official_docs | CPython Docs | *hint* values of ``0`` or less, as well as ``None``, are treated as no hint.
Note that it's already possible to iterate on file objects using ``for
line in file: ...`` without calling :meth:`!file.readlines`. | *hint* values of ``0`` or less, as well as ``None``, are treated as no hint.
Note that it's already possible to iterate on file objects using ``for
line in file: ...`` without calling :meth:`!file.readlines`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f3ff1e5-3c20-489e-b0ae-15a9ecc97651 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,314 | supabase-export-v2 | 04fdd698349347d1 | A buffered text stream providing higher-level access to a :class:`BufferedIOBase` buffered binary stream. It inherits from :class:`TextIOBase`.
*encoding* gives the name of the encoding that the stream will be decoded or
encoded with. In :ref:`UTF-8 Mode <utf8-mode>`, this defaults to UTF-8. Otherwise, it defaults to ... | trusted_official_docs | CPython Docs | A buffered text stream providing higher-level access to a :class:`BufferedIOBase` buffered binary stream. It inherits from :class:`TextIOBase`.
*encoding* gives the name of the encoding that the stream will be decoded or
encoded with. In :ref:`UTF-8 Mode <utf8-mode>`, this defaults to UTF-8. Otherwise, it defaults to ... | A buffered text stream providing higher-level access to a :class:`BufferedIOBase` buffered binary stream. It inherits from :class:`TextIOBase`.
*encoding* gives the name of the encoding that the stream will be decoded or
encoded with. In :ref:`UTF-8 Mode <utf8-mode>`, this defaults to UTF-8. Otherwise, it defaults to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a011911b-7c9f-4fa9-b583-fc4796bf7980 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,385 | supabase-export-v2 | 739b5a4a0eac4c89 | Text I/O ^^^^^^^^
Text I/O over a binary storage (such as a file) is significantly slower than
binary I/O over the same storage, because it requires conversions between
unicode and binary data using a character codec. This can become noticeable
handling huge amounts of text data like large log files. Also,
:meth:`~Text... | trusted_official_docs | CPython Docs | Text I/O ^^^^^^^^
Text I/O over a binary storage (such as a file) is significantly slower than
binary I/O over the same storage, because it requires conversions between
unicode and binary data using a character codec. This can become noticeable
handling huge amounts of text data like large log files. Also,
:meth:`~Text... | Text I/O ^^^^^^^^
Text I/O over a binary storage (such as a file) is significantly slower than
binary I/O over the same storage, because it requires conversions between
unicode and binary data using a character codec. This can become noticeable
handling huge amounts of text data like large log files. Also,
:meth:`~Text... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a08a9578-1203-4dcc-9ae3-47a90f2b24b5 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,157 | supabase-export-v2 | fe792d8f633a6fc9 | .. 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. This resizing can extend or reduce the current file size. In case of
extension, the contents of the new file area depend on the platform
(... | trusted_official_docs | CPython Docs | .. 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. This resizing can extend or reduce the current file size. In case of
extension, the contents of the new file area depend on the platform
(... | .. 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. This resizing can extend or reduce the current file size. In case of
extension, the contents of the new file area depend on the platform
(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0f55986-5961-463f-b5b5-1d9978ef9e16 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,320 | supabase-export-v2 | 4726c9ea34a78239 | or ``'\n'``, no translation takes place. If *newline* is any of the other legal values, any ``'\n'`` characters written are translated to the given string.
If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a call to
write contains a newline character or a carriage return. | trusted_official_docs | CPython Docs | or ``'\n'``, no translation takes place. If *newline* is any of the other legal values, any ``'\n'`` characters written are translated to the given string.
If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a call to
write contains a newline character or a carriage return. | or ``'\n'``, no translation takes place. If *newline* is any of the other legal values, any ``'\n'`` characters written are translated to the given string.
If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a call to
write contains a newline character or a carriage return. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a33c2441-aea6-48e5-a6be-fab1b8f86fe3 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,176 | supabase-export-v2 | c30714fb65c6c581 | .. method:: readinto(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, and return the
number of bytes read. For example, *b* might be a :class:`bytearray`. If the object is in non-blocking mode and no bytes
are available, ``None`` is returned. | trusted_official_docs | CPython Docs | .. method:: readinto(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, and return the
number of bytes read. For example, *b* might be a :class:`bytearray`. If the object is in non-blocking mode and no bytes
are available, ``None`` is returned. | .. method:: readinto(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, and return the
number of bytes read. For example, *b* might be a :class:`bytearray`. If the object is in non-blocking mode and no bytes
are available, ``None`` is returned. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3a31b7b-b2cd-4bd2-ab7c-bd6fdfe85fca | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,086 | supabase-export-v2 | 34174da7260debe3 | Opens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code.
*path* should be a :class:`str` and an absolute path. | trusted_official_docs | CPython Docs | Opens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code.
*path* should be a :class:`str` and an absolute path. | Opens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code.
*path* should be a :class:`str` and an absolute path. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a749c930-4271-4f19-9522-03e689dba3e2 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,066 | supabase-export-v2 | bc1a340753e692b4 | The default encoding of :class:`TextIOWrapper` and :func:`open` is locale-specific (:func:`locale.getencoding`).
However, many developers forget to specify the encoding when opening text files
encoded in UTF-8 (e.g. JSON, TOML, Markdown, etc...) since most Unix
platforms use UTF-8 locale by default. This causes bugs be... | trusted_official_docs | CPython Docs | The default encoding of :class:`TextIOWrapper` and :func:`open` is locale-specific (:func:`locale.getencoding`).
However, many developers forget to specify the encoding when opening text files
encoded in UTF-8 (e.g. JSON, TOML, Markdown, etc...) since most Unix
platforms use UTF-8 locale by default. This causes bugs be... | The default encoding of :class:`TextIOWrapper` and :func:`open` is locale-specific (:func:`locale.getencoding`).
However, many developers forget to specify the encoding when opening text files
encoded in UTF-8 (e.g. JSON, TOML, Markdown, etc...) since most Unix
platforms use UTF-8 locale by default. This causes bugs be... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aacf2320-7ac5-4a74-8ab0-fcbfee21c326 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,185 | supabase-export-v2 | 8a3e3aec9e9667e2 | A typical :class:`BufferedIOBase` implementation should not inherit from a :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do.
:class:`BufferedIOBase` provides or overrides these data attributes and
methods in addition to those from :class:`IOBase`: | trusted_official_docs | CPython Docs | A typical :class:`BufferedIOBase` implementation should not inherit from a :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do.
:class:`BufferedIOBase` provides or overrides these data attributes and
methods in addition to those from :class:`IOBase`: | A typical :class:`BufferedIOBase` implementation should not inherit from a :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do.
:class:`BufferedIOBase` provides or overrides these data attributes and
methods in addition to those from :class:`IOBase`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aafe55b8-acd7-41f6-a04e-d1b379f6b22d | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,205 | supabase-export-v2 | d9a9d8e0232f3914 | Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and return the number of bytes read. For example, *b* might be a :class:`bytearray`.
Like :meth:`read`, multiple reads may be issued to the underlying raw
stream, unless the latter is interactive. | trusted_official_docs | CPython Docs | Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and return the number of bytes read. For example, *b* might be a :class:`bytearray`.
Like :meth:`read`, multiple reads may be issued to the underlying raw
stream, unless the latter is interactive. | Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and return the number of bytes read. For example, *b* might be a :class:`bytearray`.
Like :meth:`read`, multiple reads may be issued to the underlying raw
stream, unless the latter is interactive. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ac6175c8-2b4c-4194-a9c1-60825ca90926 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,062 | supabase-export-v2 | 6b1088b35dc845f2 | directly manipulate a raw stream from user code. Nevertheless, you can create a raw stream by opening a file in binary mode with buffering disabled::
f = open("myfile.jpg", "rb", buffering=0) | trusted_official_docs | CPython Docs | directly manipulate a raw stream from user code. Nevertheless, you can create a raw stream by opening a file in binary mode with buffering disabled::
f = open("myfile.jpg", "rb", buffering=0) | directly manipulate a raw stream from user code. Nevertheless, you can create a raw stream by opening a file in binary mode with buffering disabled::
f = open("myfile.jpg", "rb", buffering=0) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aeef2726-6ea8-4179-8435-f3b23c3284a0 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,290 | supabase-export-v2 | 5e3679e0791b5a28 | .. attribute:: newlines
A string, a tuple of strings, or ``None``, indicating the newlines
translated so far. Depending on the implementation and the initial
constructor flags, this may not be available. | trusted_official_docs | CPython Docs | .. attribute:: newlines
A string, a tuple of strings, or ``None``, indicating the newlines
translated so far. Depending on the implementation and the initial
constructor flags, this may not be available. | .. attribute:: newlines
A string, a tuple of strings, or ``None``, indicating the newlines
translated so far. Depending on the implementation and the initial
constructor flags, this may not be available. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b480ebae-b0f6-405c-939b-95d999ea1d6e | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,167 | supabase-export-v2 | 453ac3e72c37484e | Base class for raw binary streams. It inherits from :class:`IOBase`.
Raw binary streams typically provide low-level access to an underlying OS
device or API, and do not try to encapsulate it in high-level primitives
(this functionality is done at a higher-level in buffered binary streams and text streams, described l... | trusted_official_docs | CPython Docs | Base class for raw binary streams. It inherits from :class:`IOBase`.
Raw binary streams typically provide low-level access to an underlying OS
device or API, and do not try to encapsulate it in high-level primitives
(this functionality is done at a higher-level in buffered binary streams and text streams, described l... | Base class for raw binary streams. It inherits from :class:`IOBase`.
Raw binary streams typically provide low-level access to an underlying OS
device or API, and do not try to encapsulate it in high-level primitives
(this functionality is done at a higher-level in buffered binary streams and text streams, described l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b9e08bfc-8bce-4be9-8aeb-0f0b6fd8eb90 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,222 | supabase-export-v2 | 355abecc04669533 | obtained by calling *opener* with (*name*, *flags*). *opener* must return an open file descriptor (passing :mod:`os.open` as *opener* results in functionality similar to passing ``None``).
The newly created file is :ref:`non-inheritable <fd_inheritance>`. | trusted_official_docs | CPython Docs | obtained by calling *opener* with (*name*, *flags*). *opener* must return an open file descriptor (passing :mod:`os.open` as *opener* results in functionality similar to passing ``None``).
The newly created file is :ref:`non-inheritable <fd_inheritance>`. | obtained by calling *opener* with (*name*, *flags*). *opener* must return an open file descriptor (passing :mod:`os.open` as *opener* results in functionality similar to passing ``None``).
The newly created file is :ref:`non-inheritable <fd_inheritance>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ba2d0c73-a020-427e-9328-ed2c124f5f11 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,129 | supabase-export-v2 | 79bd1b5e6d497e7f | effect if the file is already closed. Once the file is closed, any operation on the file (e.g. reading or writing) will raise a :exc:`ValueError`.
As a convenience, it is allowed to call this method more than once;
only the first call, however, will have an effect. | trusted_official_docs | CPython Docs | effect if the file is already closed. Once the file is closed, any operation on the file (e.g. reading or writing) will raise a :exc:`ValueError`.
As a convenience, it is allowed to call this method more than once;
only the first call, however, will have an effect. | effect if the file is already closed. Once the file is closed, any operation on the file (e.g. reading or writing) will raise a :exc:`ValueError`.
As a convenience, it is allowed to call this method more than once;
only the first call, however, will have an effect. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bedec856-9ec4-44fe-8005-fe786b60b630 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,158 | supabase-export-v2 | 9920d1e33fe6b9e7 | extension, the contents of the new file area depend on the platform (on most systems, additional bytes are zero-filled). The new file size is returned.
.. versionchanged:: 3.5
Windows will now zero-fill files when extending. | trusted_official_docs | CPython Docs | extension, the contents of the new file area depend on the platform (on most systems, additional bytes are zero-filled). The new file size is returned.
.. versionchanged:: 3.5
Windows will now zero-fill files when extending. | extension, the contents of the new file area depend on the platform (on most systems, additional bytes are zero-filled). The new file size is returned.
.. versionchanged:: 3.5
Windows will now zero-fill files when extending. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c1003278-6df4-430c-959a-a1988332b38e | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,253 | supabase-export-v2 | 4e9b691c15efa1a2 | may be requested from the underlying raw stream, and kept in an internal buffer. The buffered data can then be returned directly on subsequent reads.
The constructor creates a :class:`BufferedReader` for the given readable
*raw* stream and *buffer_size*. If *buffer_size* is omitted,
:data:`DEFAULT_BUFFER_SIZE` is use... | trusted_official_docs | CPython Docs | may be requested from the underlying raw stream, and kept in an internal buffer. The buffered data can then be returned directly on subsequent reads.
The constructor creates a :class:`BufferedReader` for the given readable
*raw* stream and *buffer_size*. If *buffer_size* is omitted,
:data:`DEFAULT_BUFFER_SIZE` is use... | may be requested from the underlying raw stream, and kept in an internal buffer. The buffered data can then be returned directly on subsequent reads.
The constructor creates a :class:`BufferedReader` for the given readable
*raw* stream and *buffer_size*. If *buffer_size* is omitted,
:data:`DEFAULT_BUFFER_SIZE` is use... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c277c9b1-e9e2-4943-bb3f-2dd63a499800 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,336 | supabase-export-v2 | 3e8fc458ea6282dc | Parameters not specified keep current settings, except ``errors='strict'`` is used when *encoding* is specified but *errors* is not specified.
It is not possible to change the encoding or newline if some data
has already been read from the stream. On the other hand, changing
encoding after write is possible. | trusted_official_docs | CPython Docs | Parameters not specified keep current settings, except ``errors='strict'`` is used when *encoding* is specified but *errors* is not specified.
It is not possible to change the encoding or newline if some data
has already been read from the stream. On the other hand, changing
encoding after write is possible. | Parameters not specified keep current settings, except ``errors='strict'`` is used when *encoding* is specified but *errors* is not specified.
It is not possible to change the encoding or newline if some data
has already been read from the stream. On the other hand, changing
encoding after write is possible. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c407d5ab-4d80-444f-aa07-66863ce5d096 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,181 | supabase-export-v2 | 2780a4fee55f23c0 | Base class for binary streams that support some kind of buffering. It inherits from :class:`IOBase`.
The main difference with :class:`RawIOBase` is that methods :meth:`read`,
:meth:`readinto` and :meth:`write` will try (respectively) to read
as much input as requested or to emit all provided data. | trusted_official_docs | CPython Docs | Base class for binary streams that support some kind of buffering. It inherits from :class:`IOBase`.
The main difference with :class:`RawIOBase` is that methods :meth:`read`,
:meth:`readinto` and :meth:`write` will try (respectively) to read
as much input as requested or to emit all provided data. | Base class for binary streams that support some kind of buffering. It inherits from :class:`IOBase`.
The main difference with :class:`RawIOBase` is that methods :meth:`read`,
:meth:`readinto` and :meth:`write` will try (respectively) to read
as much input as requested or to emit all provided data. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c82d5737-c230-4d16-89ec-5cdcbc3f1d58 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,124 | supabase-export-v2 | 82c932a43c7b1cbc | are defined slightly differently depending on whether the stream is a binary stream (yielding bytes), or a text stream (yielding character strings). See :meth:`~IOBase.readline` below.
:class:`IOBase` is also a context manager and therefore supports the
:keyword:`with` statement. In this example, *file* is closed afte... | trusted_official_docs | CPython Docs | are defined slightly differently depending on whether the stream is a binary stream (yielding bytes), or a text stream (yielding character strings). See :meth:`~IOBase.readline` below.
:class:`IOBase` is also a context manager and therefore supports the
:keyword:`with` statement. In this example, *file* is closed afte... | are defined slightly differently depending on whether the stream is a binary stream (yielding bytes), or a text stream (yielding character strings). See :meth:`~IOBase.readline` below.
:class:`IOBase` is also a context manager and therefore supports the
:keyword:`with` statement. In this example, *file* is closed afte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9d5503d-4328-4f3f-8195-25943d328306 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,178 | supabase-export-v2 | d010939facb36c80 | .. method:: write(b, /)
Write the given :term:`bytes-like object`, *b*, to the
underlying raw stream, and return the number of
bytes written. This can be less than the length of *b* in
bytes, depending on specifics of the underlying raw
stream, and especially if it is in non-blocking mode. ``None`` is
returned if ... | trusted_official_docs | CPython Docs | .. method:: write(b, /)
Write the given :term:`bytes-like object`, *b*, to the
underlying raw stream, and return the number of
bytes written. This can be less than the length of *b* in
bytes, depending on specifics of the underlying raw
stream, and especially if it is in non-blocking mode. ``None`` is
returned if ... | .. method:: write(b, /)
Write the given :term:`bytes-like object`, *b*, to the
underlying raw stream, and return the number of
bytes written. This can be less than the length of *b* in
bytes, depending on specifics of the underlying raw
stream, and especially if it is in non-blocking mode. ``None`` is
returned if ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb3e7d55-8231-4f37-8eec-e1dd24b69c3b | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,208 | supabase-export-v2 | b593450756e7018e | .. method:: readinto1(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, using at most one call to
the underlying raw stream's :meth:`~RawIOBase.read` (or
:meth:`~RawIOBase.readinto`) method. Return the number of bytes read. | trusted_official_docs | CPython Docs | .. method:: readinto1(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, using at most one call to
the underlying raw stream's :meth:`~RawIOBase.read` (or
:meth:`~RawIOBase.readinto`) method. Return the number of bytes read. | .. method:: readinto1(b, /)
Read bytes into a pre-allocated, writable
:term:`bytes-like object` *b*, using at most one call to
the underlying raw stream's :meth:`~RawIOBase.read` (or
:meth:`~RawIOBase.readinto`) method. Return the number of bytes read. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cf733da3-7b33-4dc1-be3f-6479bf6c0e94 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,389 | supabase-export-v2 | f6289dabcd9445fd | :class:`FileIO` objects are thread-safe to the extent that the operating system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-safe too.
Binary buffered objects (instances of :class:`BufferedReader`,
:class:`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`)
protect their internal... | trusted_official_docs | CPython Docs | :class:`FileIO` objects are thread-safe to the extent that the operating system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-safe too.
Binary buffered objects (instances of :class:`BufferedReader`,
:class:`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`)
protect their internal... | :class:`FileIO` objects are thread-safe to the extent that the operating system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-safe too.
Binary buffered objects (instances of :class:`BufferedReader`,
:class:`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`)
protect their internal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d2b90bd6-c62a-441c-a9a8-245dd5af1dc9 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,296 | supabase-export-v2 | a568440a1bef0f1a | After the underlying buffer has been detached, the :class:`TextIOBase` is in an unusable state.
Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not
have the concept of an underlying buffer and calling this method will
raise :exc:`UnsupportedOperation`. | trusted_official_docs | CPython Docs | After the underlying buffer has been detached, the :class:`TextIOBase` is in an unusable state.
Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not
have the concept of an underlying buffer and calling this method will
raise :exc:`UnsupportedOperation`. | After the underlying buffer has been detached, the :class:`TextIOBase` is in an unusable state.
Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not
have the concept of an underlying buffer and calling this method will
raise :exc:`UnsupportedOperation`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3c4c360-5ab5-4bf2-b411-c28d172b12dd | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,284 | supabase-export-v2 | 4b73250e2e51ec59 | Base class for text streams. This class provides a character and line based interface to stream I/O. It inherits from :class:`IOBase`.
:class:`TextIOBase` provides or overrides these data attributes and
methods in addition to those from :class:`IOBase`: | trusted_official_docs | CPython Docs | Base class for text streams. This class provides a character and line based interface to stream I/O. It inherits from :class:`IOBase`.
:class:`TextIOBase` provides or overrides these data attributes and
methods in addition to those from :class:`IOBase`: | Base class for text streams. This class provides a character and line based interface to stream I/O. It inherits from :class:`IOBase`.
:class:`TextIOBase` provides or overrides these data attributes and
methods in addition to those from :class:`IOBase`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d582a607-fd23-4170-a040-c8c94d36e46c | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,113 | supabase-export-v2 | 75167b45cc9bd2b8 | Argument names are not part of the specification, and only the arguments of :func:`open` are intended to be used as keyword arguments.
The following table summarizes the ABCs provided by the :mod:`!io` module: | trusted_official_docs | CPython Docs | Argument names are not part of the specification, and only the arguments of :func:`open` are intended to be used as keyword arguments.
The following table summarizes the ABCs provided by the :mod:`!io` module: | Argument names are not part of the specification, and only the arguments of :func:`open` are intended to be used as keyword arguments.
The following table summarizes the ABCs provided by the :mod:`!io` module: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df46899e-63cc-4705-a63c-03e247e80ba3 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,133 | supabase-export-v2 | e90c0c5ce0db1465 | .. method:: fileno()
Return the underlying file descriptor (an integer) of the stream if it
exists. An :exc:`OSError` is raised if the IO object does not use a file
descriptor. | trusted_official_docs | CPython Docs | .. method:: fileno()
Return the underlying file descriptor (an integer) of the stream if it
exists. An :exc:`OSError` is raised if the IO object does not use a file
descriptor. | .. method:: fileno()
Return the underlying file descriptor (an integer) of the stream if it
exists. An :exc:`OSError` is raised if the IO object does not use a file
descriptor. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e1ec56be-3d38-46f3-b377-d105b41490a8 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,068 | supabase-export-v2 | 03f8733b7cf1894f | # May not work on Windows when non-ASCII characters in the file. with open("README.md") as f: long_description = f.read()
Accordingly, it is highly recommended that you specify the encoding
explicitly when opening text files. If you want to use UTF-8, pass
``encoding="utf-8"``. To use the current locale encoding,
``enc... | trusted_official_docs | CPython Docs | # May not work on Windows when non-ASCII characters in the file. with open("README.md") as f: long_description = f.read()
Accordingly, it is highly recommended that you specify the encoding
explicitly when opening text files. If you want to use UTF-8, pass
``encoding="utf-8"``. To use the current locale encoding,
``enc... | # May not work on Windows when non-ASCII characters in the file. with open("README.md") as f: long_description = f.read()
Accordingly, it is highly recommended that you specify the encoding
explicitly when opening text files. If you want to use UTF-8, pass
``encoding="utf-8"``. To use the current locale encoding,
``enc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e55eda05-a4d5-4d6f-bcd6-047d5fb61a38 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,279 | supabase-export-v2 | 2d20a0594be2cba1 | *reader* and *writer* are :class:`RawIOBase` objects that are readable and writeable respectively. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\'s methods
except for :meth:`~BufferedIOBase.detach`, which raises
:exc:`Unsu... | trusted_official_docs | CPython Docs | *reader* and *writer* are :class:`RawIOBase` objects that are readable and writeable respectively. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\'s methods
except for :meth:`~BufferedIOBase.detach`, which raises
:exc:`Unsu... | *reader* and *writer* are :class:`RawIOBase` objects that are readable and writeable respectively. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`.
:class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\'s methods
except for :meth:`~BufferedIOBase.detach`, which raises
:exc:`Unsu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e7ae843d-2e7d-424e-a698-723ca868e04b | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,149 | supabase-export-v2 | e09eefffb75901af | stream position to the given byte *offset*, interpreted relative to the position indicated by *whence*, and return the new absolute position. Values for *whence* are:
* :data:`os.SEEK_SET` or ``0`` -- start of the stream (the default);
*offset* should be zero or positive
* :data:`os.SEEK_CUR` or ``1`` -- current stre... | trusted_official_docs | CPython Docs | stream position to the given byte *offset*, interpreted relative to the position indicated by *whence*, and return the new absolute position. Values for *whence* are:
* :data:`os.SEEK_SET` or ``0`` -- start of the stream (the default);
*offset* should be zero or positive
* :data:`os.SEEK_CUR` or ``1`` -- current stre... | stream position to the given byte *offset*, interpreted relative to the position indicated by *whence*, and return the new absolute position. Values for *whence* are:
* :data:`os.SEEK_SET` or ``0`` -- start of the stream (the default);
*offset* should be zero or positive
* :data:`os.SEEK_CUR` or ``1`` -- current stre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e9719575-0bf9-43cf-bded-e2794628e605 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,145 | supabase-export-v2 | 7ac1f4cfbaf0709c | control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds *hint*.
*hint* values of ``0`` or less, as well as ``None``, are treated as no
hint. | trusted_official_docs | CPython Docs | control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds *hint*.
*hint* values of ``0`` or less, as well as ``None``, are treated as no
hint. | control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds *hint*.
*hint* values of ``0`` or less, as well as ``None``, are treated as no
hint. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f29a4836-a68e-4b02-9dc0-07ab24fccf15 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,323 | supabase-export-v2 | 34be31991e6d0e63 | .. versionchanged:: 3.3 The *write_through* argument has been added.
.. versionchanged:: 3.3
The default *encoding* is now ``locale.getpreferredencoding(False)``
instead of ``locale.getpreferredencoding()``. Don't change temporary the
locale encoding using :func:`locale.setlocale`, use the current locale
encoding i... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.3 The *write_through* argument has been added.
.. versionchanged:: 3.3
The default *encoding* is now ``locale.getpreferredencoding(False)``
instead of ``locale.getpreferredencoding()``. Don't change temporary the
locale encoding using :func:`locale.setlocale`, use the current locale
encoding i... | .. versionchanged:: 3.3 The *write_through* argument has been added.
.. versionchanged:: 3.3
The default *encoding* is now ``locale.getpreferredencoding(False)``
instead of ``locale.getpreferredencoding()``. Don't change temporary the
locale encoding using :func:`locale.setlocale`, use the current locale
encoding i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f4ed5bf4-10c3-4615-a8fa-e241f15dbe98 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,390 | supabase-export-v2 | 0b96ff53b27cfb65 | of :class:`BufferedReader`, :class:`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) protect their internal structures using a lock; it is therefore safe to call them from multiple threads at once.
:class:`TextIOWrapper` objects are not thread-safe. | trusted_official_docs | CPython Docs | of :class:`BufferedReader`, :class:`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) protect their internal structures using a lock; it is therefore safe to call them from multiple threads at once.
:class:`TextIOWrapper` objects are not thread-safe. | of :class:`BufferedReader`, :class:`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) protect their internal structures using a lock; it is therefore safe to call them from multiple threads at once.
:class:`TextIOWrapper` objects are not thread-safe. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6595090-c000-4c44-8a6a-0d0e8ee32caf | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,182 | supabase-export-v2 | d48465e52a61da6f | with :class:`RawIOBase` is that methods :meth:`read`, :meth:`readinto` and :meth:`write` will try (respectively) to read as much input as requested or to emit all provided data.
In addition, if the underlying raw stream is in non-blocking mode, when the
system returns would block :meth:`write` will raise :exc:`Blockin... | trusted_official_docs | CPython Docs | with :class:`RawIOBase` is that methods :meth:`read`, :meth:`readinto` and :meth:`write` will try (respectively) to read as much input as requested or to emit all provided data.
In addition, if the underlying raw stream is in non-blocking mode, when the
system returns would block :meth:`write` will raise :exc:`Blockin... | with :class:`RawIOBase` is that methods :meth:`read`, :meth:`readinto` and :meth:`write` will try (respectively) to read as much input as requested or to emit all provided data.
In addition, if the underlying raw stream is in non-blocking mode, when the
system returns would block :meth:`write` will raise :exc:`Blockin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9089ba2-4fb9-4fcb-ae50-efdde9de3e63 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,324 | supabase-export-v2 | 8f6475d8ef5bb38e | is now ``locale.getpreferredencoding(False)`` instead of ``locale.getpreferredencoding()``. Don't change temporary the locale encoding using :func:`locale.setlocale`, use the current locale encoding instead of the user preferred encoding.
.. versionchanged:: 3.10
The *encoding* argument now supports the ``"locale"`` d... | trusted_official_docs | CPython Docs | is now ``locale.getpreferredencoding(False)`` instead of ``locale.getpreferredencoding()``. Don't change temporary the locale encoding using :func:`locale.setlocale`, use the current locale encoding instead of the user preferred encoding.
.. versionchanged:: 3.10
The *encoding* argument now supports the ``"locale"`` d... | is now ``locale.getpreferredencoding(False)`` instead of ``locale.getpreferredencoding()``. Don't change temporary the locale encoding using :func:`locale.setlocale`, use the current locale encoding instead of the user preferred encoding.
.. versionchanged:: 3.10
The *encoding* argument now supports the ``"locale"`` d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9428c89-e121-4b9e-818b-8548161a978b | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,353 | supabase-export-v2 | c77c04eea78fc34b | To emulate opening a file in an ``a+`` mode ready for appending, use ``f.seek(0, io.SEEK_END)`` to reposition the stream at the end of the buffer.
The *newline* argument works like that of :class:`TextIOWrapper`,
except that when writing output to the stream, if *newline* is ``None``,
newlines are written as ``\n`` o... | trusted_official_docs | CPython Docs | To emulate opening a file in an ``a+`` mode ready for appending, use ``f.seek(0, io.SEEK_END)`` to reposition the stream at the end of the buffer.
The *newline* argument works like that of :class:`TextIOWrapper`,
except that when writing output to the stream, if *newline* is ``None``,
newlines are written as ``\n`` o... | To emulate opening a file in an ``a+`` mode ready for appending, use ``f.seek(0, io.SEEK_END)`` to reposition the stream at the end of the buffer.
The *newline* argument works like that of :class:`TextIOWrapper`,
except that when writing output to the stream, if *newline* is ``None``,
newlines are written as ``\n`` o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc6d6fa7-5972-4a96-8fa4-9455ef01985e | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,039 | supabase-export-v2 | 17c6942666ffacee | .. index:: single: file object; io module
The :mod:`!io` module provides Python's main facilities for dealing with various
types of I/O. There are three main types of I/O: *text I/O*, *binary I/O*
and *raw I/O*. These are generic categories, and various backing stores can
be used for each of them. A concrete object bel... | trusted_official_docs | CPython Docs | .. index:: single: file object; io module
The :mod:`!io` module provides Python's main facilities for dealing with various
types of I/O. There are three main types of I/O: *text I/O*, *binary I/O*
and *raw I/O*. These are generic categories, and various backing stores can
be used for each of them. A concrete object bel... | .. index:: single: file object; io module
The :mod:`!io` module provides Python's main facilities for dealing with various
types of I/O. There are three main types of I/O: *text I/O*, *binary I/O*
and *raw I/O*. These are generic categories, and various backing stores can
be used for each of them. A concrete object bel... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe68e27a-38e7-4005-b474-2cd7194b85e4 | CPython Docs | file://datasets/cpython/Doc/library/io.rst | unknown | 276b2877-761c-4c60-8688-e120997fe113 | 17,327 | supabase-export-v2 | 3855486433d17072 | When the underlying raw stream is non-blocking, a :exc:`BlockingIOError` may be raised if a read operation cannot be completed immediately.
:class:`TextIOWrapper` provides these data attributes and methods in
addition to those from :class:`TextIOBase` and :class:`IOBase`: | trusted_official_docs | CPython Docs | When the underlying raw stream is non-blocking, a :exc:`BlockingIOError` may be raised if a read operation cannot be completed immediately.
:class:`TextIOWrapper` provides these data attributes and methods in
addition to those from :class:`TextIOBase` and :class:`IOBase`: | When the underlying raw stream is non-blocking, a :exc:`BlockingIOError` may be raised if a read operation cannot be completed immediately.
:class:`TextIOWrapper` provides these data attributes and methods in
addition to those from :class:`TextIOBase` and :class:`IOBase`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
60eab984-c0c9-4993-b628-26114dd893ab | CPython Docs | file://datasets/cpython/Doc/library/imghdr.rst | unknown | 0e44c6b0-83f2-4cf1-8462-f6aeea8266d9 | 17,398 | supabase-export-v2 | 1fb0f4e03efbb975 | part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`.
Possible replacements are third-party libraries from PyPI:
:pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or... | trusted_official_docs | CPython Docs | part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`.
Possible replacements are third-party libraries from PyPI:
:pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or... | part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`.
Possible replacements are third-party libraries from PyPI:
:pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b881a191-b8a6-4834-891f-7223756d6fda | CPython Docs | file://datasets/cpython/Doc/library/imghdr.rst | unknown | 0e44c6b0-83f2-4cf1-8462-f6aeea8266d9 | 17,399 | supabase-export-v2 | 9d9b613ea59a6c7b | Possible replacements are third-party libraries from PyPI: :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or maintained by the Python core team.
The last version of Python that provided the :mod:`!imghdr` module was
`Python 3.12 <https://docs.python.org/3.12/library/imghdr.html>`_... | trusted_official_docs | CPython Docs | Possible replacements are third-party libraries from PyPI: :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or maintained by the Python core team.
The last version of Python that provided the :mod:`!imghdr` module was
`Python 3.12 <https://docs.python.org/3.12/library/imghdr.html>`_... | Possible replacements are third-party libraries from PyPI: :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or maintained by the Python core team.
The last version of Python that provided the :mod:`!imghdr` module was
`Python 3.12 <https://docs.python.org/3.12/library/imghdr.html>`_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0012a3e8-b60a-44bd-8ce7-1070682aa76c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,411 | supabase-export-v2 | 9edb3b84414c52fc | In addition to enabling the debug mode, consider also:
* setting the log level of the :ref:`asyncio logger <asyncio-logger>` to
:py:const:`logging.DEBUG`, for example the following snippet of code
can be run at startup of the application:: | trusted_official_docs | CPython Docs | In addition to enabling the debug mode, consider also:
* setting the log level of the :ref:`asyncio logger <asyncio-logger>` to
:py:const:`logging.DEBUG`, for example the following snippet of code
can be run at startup of the application:: | In addition to enabling the debug mode, consider also:
* setting the log level of the :ref:`asyncio logger <asyncio-logger>` to
:py:const:`logging.DEBUG`, for example the following snippet of code
can be run at startup of the application:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0cca68f3-e051-4f17-9778-a79e65ebf02b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,492 | supabase-export-v2 | 03a52841202fe571 | async def main(): async with contextlib.aclosing(cursor()) as cursor_gen: async for c in cursor_gen: async with contextlib.aclosing(rows()) as rows_gen: async for r in rows_gen: break break
Create asynchronous generators only when the event loop is running
---------------------------------------------------------------... | trusted_official_docs | CPython Docs | async def main(): async with contextlib.aclosing(cursor()) as cursor_gen: async for c in cursor_gen: async with contextlib.aclosing(rows()) as rows_gen: async for r in rows_gen: break break
Create asynchronous generators only when the event loop is running
---------------------------------------------------------------... | async def main(): async with contextlib.aclosing(cursor()) as cursor_gen: async for c in cursor_gen: async with contextlib.aclosing(rows()) as rows_gen: async for r in rows_gen: break break
Create asynchronous generators only when the event loop is running
---------------------------------------------------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15bd0efb-6987-49ba-94ec-011371a3ac6b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,483 | supabase-export-v2 | 0fc5337824eb0471 | async def rows(): global work_done try: yield 2 finally: await asyncio.sleep(0.1) # imitate some async work work_done = True
async def main():
async for c in cursor():
async for r in rows():
break
break | trusted_official_docs | CPython Docs | async def rows(): global work_done try: yield 2 finally: await asyncio.sleep(0.1) # imitate some async work work_done = True
async def main():
async for c in cursor():
async for r in rows():
break
break | async def rows(): global work_done try: yield 2 finally: await asyncio.sleep(0.1) # imitate some async work work_done = True
async def main():
async for c in cursor():
async for r in rows():
break
break | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1693d1a4-01c0-4700-ad52-d8dbf149dcfc | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,480 | supabase-export-v2 | 9738071c5edc42c8 | cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous generator can occur in an unexpected order::
import asyncio
work_done = False | trusted_official_docs | CPython Docs | cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous generator can occur in an unexpected order::
import asyncio
work_done = False | cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous generator can occur in an unexpected order::
import asyncio
work_done = False | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2549813d-b722-498a-bd08-e5d5368bfb3a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,431 | supabase-export-v2 | a8240b0e8975961d | with a :class:`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures.InterpreterPoolExecutor` to execute blocking code in a different OS thread without blocking the OS thread that the event loop runs in.
There is currently no way to schedule coroutines or callbacks directly
from a different process (suc... | trusted_official_docs | CPython Docs | with a :class:`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures.InterpreterPoolExecutor` to execute blocking code in a different OS thread without blocking the OS thread that the event loop runs in.
There is currently no way to schedule coroutines or callbacks directly
from a different process (suc... | with a :class:`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures.InterpreterPoolExecutor` to execute blocking code in a different OS thread without blocking the OS thread that the event loop runs in.
There is currently no way to schedule coroutines or callbacks directly
from a different process (suc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d503342-2dde-41ac-bacd-b7c5a6d66e9b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,486 | supabase-export-v2 | 90c04c11247794dc | For this example, we get the following output::
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()>
Traceback (most recent call last):
File "example.py", line 6, in cursor
yield 1
asyncio.exceptions.Canc... | trusted_official_docs | CPython Docs | For this example, we get the following output::
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()>
Traceback (most recent call last):
File "example.py", line 6, in cursor
yield 1
asyncio.exceptions.Canc... | For this example, we get the following output::
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()>
Traceback (most recent call last):
File "example.py", line 6, in cursor
yield 1
asyncio.exceptions.Canc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f4089c9-75fb-4cb9-bbe0-0eddcdac53f3 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,494 | supabase-export-v2 | 4b3da58832ef52e3 | It is recommended to create :term:`asynchronous generators <asynchronous generator iterator>` only after the event loop has been created.
To ensure that asynchronous generators close reliably, the event loop uses the
:func:`sys.set_asyncgen_hooks` function to register callback functions. These
callbacks update the list... | trusted_official_docs | CPython Docs | It is recommended to create :term:`asynchronous generators <asynchronous generator iterator>` only after the event loop has been created.
To ensure that asynchronous generators close reliably, the event loop uses the
:func:`sys.set_asyncgen_hooks` function to register callback functions. These
callbacks update the list... | It is recommended to create :term:`asynchronous generators <asynchronous generator iterator>` only after the event loop has been created.
To ensure that asynchronous generators close reliably, the event loop uses the
:func:`sys.set_asyncgen_hooks` function to register callback functions. These
callbacks update the list... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f15af19-2bff-4cdf-a04e-f94a26017571 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,426 | supabase-export-v2 | 2836b566f1d749ca | To schedule a coroutine object from a different OS thread, the :func:`run_coroutine_threadsafe` function should be used. It returns a :class:`concurrent.futures.Future` to access the result::
async def coro_func():
return await asyncio.sleep(1, 42) | trusted_official_docs | CPython Docs | To schedule a coroutine object from a different OS thread, the :func:`run_coroutine_threadsafe` function should be used. It returns a :class:`concurrent.futures.Future` to access the result::
async def coro_func():
return await asyncio.sleep(1, 42) | To schedule a coroutine object from a different OS thread, the :func:`run_coroutine_threadsafe` function should be used. It returns a :class:`concurrent.futures.Future` to access the result::
async def coro_func():
return await asyncio.sleep(1, 42) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46d110b4-a954-4a4f-af2b-af14bc6a4188 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,496 | supabase-export-v2 | eabed05a396be155 | When the :meth:`loop.shutdown_asyncgens() <asyncio.loop.shutdown_asyncgens>` function is called, the running generators are stopped gracefully and the list is cleared.
The asynchronous generator invokes the corresponding system hook during its
first iteration. At the same time, the generator records that the hook has
b... | trusted_official_docs | CPython Docs | When the :meth:`loop.shutdown_asyncgens() <asyncio.loop.shutdown_asyncgens>` function is called, the running generators are stopped gracefully and the list is cleared.
The asynchronous generator invokes the corresponding system hook during its
first iteration. At the same time, the generator records that the hook has
b... | When the :meth:`loop.shutdown_asyncgens() <asyncio.loop.shutdown_asyncgens>` function is called, the running generators are stopped gracefully and the list is cleared.
The asynchronous generator invokes the corresponding system hook during its
first iteration. At the same time, the generator records that the hook has
b... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52c693f4-e2ee-4d8b-86c8-a27c3e4969d4 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,509 | supabase-export-v2 | dcec4b75bee897ae | Avoid concurrent iteration and closure of the same generator ------------------------------------------------------------
Async generators may be reentered while another
:meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in
progress. This may lead to an inconsistent state of the async generat... | trusted_official_docs | CPython Docs | Avoid concurrent iteration and closure of the same generator ------------------------------------------------------------
Async generators may be reentered while another
:meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in
progress. This may lead to an inconsistent state of the async generat... | Avoid concurrent iteration and closure of the same generator ------------------------------------------------------------
Async generators may be reentered while another
:meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in
progress. This may lead to an inconsistent state of the async generat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5307c8e9-bcba-4f5b-89ac-e767b84996c4 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,503 | supabase-export-v2 | 86cfa8d957a4709a | generator <async_generator object agenfn at 0x000002F71CD10D70>: Traceback (most recent call last): File "example.py", line 13, in <module> del agen ^^^^ RuntimeError: async generator ignored GeneratorExit
This example can be fixed as follows:: | trusted_official_docs | CPython Docs | generator <async_generator object agenfn at 0x000002F71CD10D70>: Traceback (most recent call last): File "example.py", line 13, in <module> del agen ^^^^ RuntimeError: async generator ignored GeneratorExit
This example can be fixed as follows:: | generator <async_generator object agenfn at 0x000002F71CD10D70>: Traceback (most recent call last): File "example.py", line 13, in <module> del agen ^^^^ RuntimeError: async generator ignored GeneratorExit
This example can be fixed as follows:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
54596120-4a2f-4b7f-85d8-43ea3ceab8df | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,435 | supabase-export-v2 | 321330c2b323d5f4 | For example, if a function performs a CPU-intensive calculation for 1 second, all concurrent asyncio Tasks and IO operations would be delayed by 1 second.
An executor can be used to run a task in a different thread,
including in a different interpreter, or even in
a different process to avoid blocking the OS thread wit... | trusted_official_docs | CPython Docs | For example, if a function performs a CPU-intensive calculation for 1 second, all concurrent asyncio Tasks and IO operations would be delayed by 1 second.
An executor can be used to run a task in a different thread,
including in a different interpreter, or even in
a different process to avoid blocking the OS thread wit... | For example, if a function performs a CPU-intensive calculation for 1 second, all concurrent asyncio Tasks and IO operations would be delayed by 1 second.
An executor can be used to run a task in a different thread,
including in a different interpreter, or even in
a different process to avoid blocking the OS thread wit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
64341a2f-4e18-4586-a03c-f6aa08a8dda2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,474 | supabase-export-v2 | 11b23202a23c4d4f | This can occur after the tasks it depends on have completed, or during the event loop shutdown when the async-generator's garbage collection hook is called.
To avoid this, explicitly close the generator by calling its
:meth:`~agen.aclose` method, or use the :func:`contextlib.aclosing`
context manager:: | trusted_official_docs | CPython Docs | This can occur after the tasks it depends on have completed, or during the event loop shutdown when the async-generator's garbage collection hook is called.
To avoid this, explicitly close the generator by calling its
:meth:`~agen.aclose` method, or use the :func:`contextlib.aclosing`
context manager:: | This can occur after the tasks it depends on have completed, or during the event loop shutdown when the async-generator's garbage collection hook is called.
To avoid this, explicitly close the generator by calling its
:meth:`~agen.aclose` method, or use the :func:`contextlib.aclosing`
context manager:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
69c25e14-81c8-4b48-882f-ed75cf44e91f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,517 | supabase-export-v2 | 4e446e88bb176eb2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "Lib/asyncio/base_events.py", line 719, in run_until_complete return future.result() ~~~~~~~~~~~~~^^ File "test.py", line 36, in amain await fb RuntimeError: anext(): asynchronous generator is already running
Therefore, it is recommended to avoid using asynchronous generators in... | trusted_official_docs | CPython Docs | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "Lib/asyncio/base_events.py", line 719, in run_until_complete return future.result() ~~~~~~~~~~~~~^^ File "test.py", line 36, in amain await fb RuntimeError: anext(): asynchronous generator is already running
Therefore, it is recommended to avoid using asynchronous generators in... | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "Lib/asyncio/base_events.py", line 719, in run_until_complete return future.result() ~~~~~~~~~~~~~^^ File "test.py", line 36, in amain await fb RuntimeError: anext(): asynchronous generator is already running
Therefore, it is recommended to avoid using asynchronous generators in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d2c58d4-bb4e-47b6-b301-2998626ad868 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,421 | supabase-export-v2 | fef7f13faaba6844 | run in the same thread. When a Task executes an ``await`` expression, the running Task gets suspended, and the event loop executes the next Task.
To schedule a :term:`callback` from another OS thread, the
:meth:`loop.call_soon_threadsafe` method should be used. Example:: | trusted_official_docs | CPython Docs | run in the same thread. When a Task executes an ``await`` expression, the running Task gets suspended, and the event loop executes the next Task.
To schedule a :term:`callback` from another OS thread, the
:meth:`loop.call_soon_threadsafe` method should be used. Example:: | run in the same thread. When a Task executes an ``await`` expression, the running Task gets suspended, and the event loop executes the next Task.
To schedule a :term:`callback` from another OS thread, the
:meth:`loop.call_soon_threadsafe` method should be used. Example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84d9b20d-e7b4-4562-b9cc-e581d52231c7 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,510 | supabase-export-v2 | 5679a62e60e01ff9 | another :meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in progress. This may lead to an inconsistent state of the async generator and can cause errors.
Let's consider the following example:: | trusted_official_docs | CPython Docs | another :meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in progress. This may lead to an inconsistent state of the async generator and can cause errors.
Let's consider the following example:: | another :meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in progress. This may lead to an inconsistent state of the async generator and can cause errors.
Let's consider the following example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b87d44f-7f07-4d15-b9bc-35e5fee792e0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,420 | supabase-export-v2 | 8fddd7355bf83e19 | Concurrency and Multithreading ==============================
An event loop runs in a thread (typically the main thread) and executes
all callbacks and Tasks in its thread. While a Task is running in the
event loop, no other Tasks can run in the same thread. When a Task
executes an ``await`` expression, the running Tas... | trusted_official_docs | CPython Docs | Concurrency and Multithreading ==============================
An event loop runs in a thread (typically the main thread) and executes
all callbacks and Tasks in its thread. While a Task is running in the
event loop, no other Tasks can run in the same thread. When a Task
executes an ``await`` expression, the running Tas... | Concurrency and Multithreading ==============================
An event loop runs in a thread (typically the main thread) and executes
all callbacks and Tasks in its thread. While a Task is running in the
event loop, no other Tasks can run in the same thread. When a Task
executes an ``await`` expression, the running Tas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
93a8bb9c-a078-4d12-8386-db970620c19b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,463 | supabase-export-v2 | 30f0d2767cc34f50 | Traceback (most recent call last): File "test.py", line 4, in bug raise Exception("not consumed") Exception: not consumed
:ref:`Enable the debug mode <asyncio-debug-mode>` to get the
traceback where the task was created:: | trusted_official_docs | CPython Docs | Traceback (most recent call last): File "test.py", line 4, in bug raise Exception("not consumed") Exception: not consumed
:ref:`Enable the debug mode <asyncio-debug-mode>` to get the
traceback where the task was created:: | Traceback (most recent call last): File "test.py", line 4, in bug raise Exception("not consumed") Exception: not consumed
:ref:`Enable the debug mode <asyncio-debug-mode>` to get the
traceback where the task was created:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
94159e72-3594-4961-b161-c565e6c6d7b2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,467 | supabase-export-v2 | 148b36c372e8383a | Task exception was never retrieved future: <Task finished coro=<bug() done, defined at test.py:3> exception=Exception('not consumed') created at asyncio/tasks.py:321>
source_traceback: Object created at (most recent call last):
File "../t.py", line 9, in <module>
asyncio.run(main(), debug=True) | trusted_official_docs | CPython Docs | Task exception was never retrieved future: <Task finished coro=<bug() done, defined at test.py:3> exception=Exception('not consumed') created at asyncio/tasks.py:321>
source_traceback: Object created at (most recent call last):
File "../t.py", line 9, in <module>
asyncio.run(main(), debug=True) | Task exception was never retrieved future: <Task finished coro=<bug() done, defined at test.py:3> exception=Exception('not consumed') created at asyncio/tasks.py:321>
source_traceback: Object created at (most recent call last):
File "../t.py", line 9, in <module>
asyncio.run(main(), debug=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9bf6d290-0755-4fdb-8d63-174456ad2542 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,430 | supabase-export-v2 | a40d8feb674f0c54 | To handle signals the event loop must be run in the main thread.
The :meth:`loop.run_in_executor` method can be used with a
:class:`concurrent.futures.ThreadPoolExecutor` or
:class:`~concurrent.futures.InterpreterPoolExecutor` to execute
blocking code in a different OS thread without blocking the OS thread
that the eve... | trusted_official_docs | CPython Docs | To handle signals the event loop must be run in the main thread.
The :meth:`loop.run_in_executor` method can be used with a
:class:`concurrent.futures.ThreadPoolExecutor` or
:class:`~concurrent.futures.InterpreterPoolExecutor` to execute
blocking code in a different OS thread without blocking the OS thread
that the eve... | To handle signals the event loop must be run in the main thread.
The :meth:`loop.run_in_executor` method can be used with a
:class:`concurrent.futures.ThreadPoolExecutor` or
:class:`~concurrent.futures.InterpreterPoolExecutor` to execute
blocking code in a different OS thread without blocking the OS thread
that the eve... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0856931-3a61-4f14-aff5-e52d2970e458 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,462 | supabase-export-v2 | 79c8240cd59f1e3b | Task exception was never retrieved future: <Task finished coro=<bug() done, defined at test.py:3> exception=Exception('not consumed')>
Traceback (most recent call last):
File "test.py", line 4, in bug
raise Exception("not consumed")
Exception: not consumed | trusted_official_docs | CPython Docs | Task exception was never retrieved future: <Task finished coro=<bug() done, defined at test.py:3> exception=Exception('not consumed')>
Traceback (most recent call last):
File "test.py", line 4, in bug
raise Exception("not consumed")
Exception: not consumed | Task exception was never retrieved future: <Task finished coro=<bug() done, defined at test.py:3> exception=Exception('not consumed')>
Traceback (most recent call last):
File "test.py", line 4, in bug
raise Exception("not consumed")
Exception: not consumed | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a5ad4895-442b-490f-99a3-2c074123aca2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,502 | supabase-export-v2 | d236b748fae05edc | Output::
10
Exception ignored while closing generator <async_generator object agenfn at 0x000002F71CD10D70>:
Traceback (most recent call last):
File "example.py", line 13, in <module>
del agen
^^^^
RuntimeError: async generator ignored GeneratorExit | trusted_official_docs | CPython Docs | Output::
10
Exception ignored while closing generator <async_generator object agenfn at 0x000002F71CD10D70>:
Traceback (most recent call last):
File "example.py", line 13, in <module>
del agen
^^^^
RuntimeError: async generator ignored GeneratorExit | Output::
10
Exception ignored while closing generator <async_generator object agenfn at 0x000002F71CD10D70>:
Traceback (most recent call last):
File "example.py", line 13, in <module>
del agen
^^^^
RuntimeError: async generator ignored GeneratorExit | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a907b090-4524-471a-8a4e-ad02c953cc7d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,416 | supabase-export-v2 | 9d2680f5f6a5e324 | * Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:`loop.call_at` methods) raise an exception if they are called from a wrong thread.
* The execution time of the I/O selector is logged if it takes too long to
perform an I/O operation. | trusted_official_docs | CPython Docs | * Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:`loop.call_at` methods) raise an exception if they are called from a wrong thread.
* The execution time of the I/O selector is logged if it takes too long to
perform an I/O operation. | * Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:`loop.call_at` methods) raise an exception if they are called from a wrong thread.
* The execution time of the I/O selector is logged if it takes too long to
perform an I/O operation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
acd6b4cf-d790-48a9-932d-9833727feb43 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,417 | supabase-export-v2 | f791a8b787d49f5b | * The execution time of the I/O selector is logged if it takes too long to perform an I/O operation.
* Callbacks taking longer than 100 milliseconds are logged. The
:attr:`loop.slow_callback_duration` attribute can be used to set the
minimum execution duration in seconds that is considered "slow". | trusted_official_docs | CPython Docs | * The execution time of the I/O selector is logged if it takes too long to perform an I/O operation.
* Callbacks taking longer than 100 milliseconds are logged. The
:attr:`loop.slow_callback_duration` attribute can be used to set the
minimum execution duration in seconds that is considered "slow". | * The execution time of the I/O selector is logged if it takes too long to perform an I/O operation.
* Callbacks taking longer than 100 milliseconds are logged. The
:attr:`loop.slow_callback_duration` attribute can be used to set the
minimum execution duration in seconds that is considered "slow". | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.