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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47bbcdd1-b8bf-412d-9823-a69d4d72997a | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,755 | supabase-export-v2 | b0e1dacb4c73cb1f | specify the image subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised.
Optional *_encoder* is a callable (i.e. function) which will perform the actual
encoding of the image data for transport. This callable takes one argument,
which... | trusted_official_docs | CPython Docs | specify the image subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised.
Optional *_encoder* is a callable (i.e. function) which will perform the actual
encoding of the image data for transport. This callable takes one argument,
which... | specify the image subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised.
Optional *_encoder* is a callable (i.e. function) which will perform the actual
encoding of the image data for transport. This callable takes one argument,
which... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b2c979d-85cf-4f8d-ac02-ebc439900b93 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,769 | supabase-export-v2 | 7ac6e8b48cfdfc8b | Module: :mod:`email.mime.text`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEText` class is used to create MIME objects of major type
:mimetype:`text`. *_text* is the string for the payload. *_subtype* is the
minor type and defaults to :mimetype:`plain`. *_charset* is the characte... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.text`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEText` class is used to create MIME objects of major type
:mimetype:`text`. *_text* is the string for the payload. *_subtype* is the
minor type and defaults to :mimetype:`plain`. *_charset* is the characte... | Module: :mod:`email.mime.text`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEText` class is used to create MIME objects of major type
:mimetype:`text`. *_text* is the string for the payload. *_subtype* is the
minor type and defaults to :mimetype:`plain`. *_charset* is the characte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e6ed825-759c-4c6e-932b-dcbab57502af | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,719 | supabase-export-v2 | 7768b60f37579f91 | :mimetype:`image`), and *_subtype* is the :mailheader:`Content-Type` minor type (e.g. :mimetype:`plain` or :mimetype:`gif`). *_params* is a parameter key/value dictionary and is passed directly to :meth:`Message.add_header <email.message.Message.add_header>`.
If *policy* is specified, (defaults to the
:class:`compat32... | trusted_official_docs | CPython Docs | :mimetype:`image`), and *_subtype* is the :mailheader:`Content-Type` minor type (e.g. :mimetype:`plain` or :mimetype:`gif`). *_params* is a parameter key/value dictionary and is passed directly to :meth:`Message.add_header <email.message.Message.add_header>`.
If *policy* is specified, (defaults to the
:class:`compat32... | :mimetype:`image`), and *_subtype* is the :mailheader:`Content-Type` minor type (e.g. :mimetype:`plain` or :mimetype:`gif`). *_params* is a parameter key/value dictionary and is passed directly to :meth:`Message.add_header <email.message.Message.add_header>`.
If *policy* is specified, (defaults to the
:class:`compat32... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
684f4deb-735b-4584-a134-30edfec4167c | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,717 | supabase-export-v2 | 3d2edb529bc5a643 | Module: :mod:`email.mime.base`
This is the base class for all the MIME-specific subclasses of
:class:`~email.message.Message`. Ordinarily you won't create instances
specifically of :class:`MIMEBase`, although you could. :class:`MIMEBase`
is provided primarily as a convenient base class for more specific
MIME-aware ... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.base`
This is the base class for all the MIME-specific subclasses of
:class:`~email.message.Message`. Ordinarily you won't create instances
specifically of :class:`MIMEBase`, although you could. :class:`MIMEBase`
is provided primarily as a convenient base class for more specific
MIME-aware ... | Module: :mod:`email.mime.base`
This is the base class for all the MIME-specific subclasses of
:class:`~email.message.Message`. Ordinarily you won't create instances
specifically of :class:`MIMEBase`, although you could. :class:`MIMEBase`
is provided primarily as a convenient base class for more specific
MIME-aware ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
744155aa-5934-483d-93d4-a6bcb5bfed4d | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,711 | supabase-export-v2 | 3f115b05984fcc86 | --------------
This module is part of the legacy (``Compat32``) email API. Its functionality
is partially replaced by the :mod:`~email.contentmanager` in the new API, but
in certain applications these classes may still be useful, even in non-legacy
code. | trusted_official_docs | CPython Docs | --------------
This module is part of the legacy (``Compat32``) email API. Its functionality
is partially replaced by the :mod:`~email.contentmanager` in the new API, but
in certain applications these classes may still be useful, even in non-legacy
code. | --------------
This module is part of the legacy (``Compat32``) email API. Its functionality
is partially replaced by the :mod:`~email.contentmanager` in the new API, but
in certain applications these classes may still be useful, even in non-legacy
code. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
79625da8-834d-4628-8686-11aa60bc7830 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,770 | supabase-export-v2 | ad6c1ea96828d390 | defaults to ``us-ascii`` if the string contains only ``ascii`` code points, and ``utf-8`` otherwise. The *_charset* parameter accepts either a string or a :class:`~email.charset.Charset` instance.
Unless the *_charset* argument is explicitly set to ``None``, the
MIMEText object created will have both a :mailheader:`Co... | trusted_official_docs | CPython Docs | defaults to ``us-ascii`` if the string contains only ``ascii`` code points, and ``utf-8`` otherwise. The *_charset* parameter accepts either a string or a :class:`~email.charset.Charset` instance.
Unless the *_charset* argument is explicitly set to ``None``, the
MIMEText object created will have both a :mailheader:`Co... | defaults to ``us-ascii`` if the string contains only ``ascii`` code points, and ``utf-8`` otherwise. The *_charset* parameter accepts either a string or a :class:`~email.charset.Charset` instance.
Unless the *_charset* argument is explicitly set to ``None``, the
MIMEText object created will have both a :mailheader:`Co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a95263d-6280-486c-8d71-9e4350713bc1 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,754 | supabase-export-v2 | 7a9941b6f2ecb7c5 | Module: :mod:`email.mime.image`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEImage` class is used to create MIME message objects of major type
:mimetype:`image`. *_imagedata* contains the bytes for the raw image data. If
this data type can be detected (jpeg, png, gif, tiff, rgb, ... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.image`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEImage` class is used to create MIME message objects of major type
:mimetype:`image`. *_imagedata* contains the bytes for the raw image data. If
this data type can be detected (jpeg, png, gif, tiff, rgb, ... | Module: :mod:`email.mime.image`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEImage` class is used to create MIME message objects of major type
:mimetype:`image`. *_imagedata* contains the bytes for the raw image data. If
this data type can be detected (jpeg, png, gif, tiff, rgb, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ea5e3c4-b1f7-40d9-89e6-3d360f9fe4ee | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,747 | supabase-export-v2 | ad848b99a378f32e | specify the audio subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised.
Optional *_encoder* is a callable (i.e. function) which will perform the actual
encoding of the audio data for transport. This callable takes one argument,
which... | trusted_official_docs | CPython Docs | specify the audio subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised.
Optional *_encoder* is a callable (i.e. function) which will perform the actual
encoding of the audio data for transport. This callable takes one argument,
which... | specify the audio subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised.
Optional *_encoder* is a callable (i.e. function) which will perform the actual
encoding of the audio data for transport. This callable takes one argument,
which... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9fdd8864-582e-4451-b389-71d09d5aa579 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,720 | supabase-export-v2 | f8daa6865dee929c | If *policy* is specified, (defaults to the :class:`compat32 <email.policy.Compat32>` policy) it will be passed to :class:`~email.message.Message`.
The :class:`MIMEBase` class always adds a :mailheader:`Content-Type` header
(based on *_maintype*, *_subtype*, and *_params*), and a
:mailheader:`MIME-Version` header (alw... | trusted_official_docs | CPython Docs | If *policy* is specified, (defaults to the :class:`compat32 <email.policy.Compat32>` policy) it will be passed to :class:`~email.message.Message`.
The :class:`MIMEBase` class always adds a :mailheader:`Content-Type` header
(based on *_maintype*, *_subtype*, and *_params*), and a
:mailheader:`MIME-Version` header (alw... | If *policy* is specified, (defaults to the :class:`compat32 <email.policy.Compat32>` policy) it will be passed to :class:`~email.message.Message`.
The :class:`MIMEBase` class always adds a :mailheader:`Content-Type` header
(based on *_maintype*, *_subtype*, and *_params*), and a
:mailheader:`MIME-Version` header (alw... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa4fdd78-c537-4a25-b11b-a7ea2aa5a70d | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,729 | supabase-export-v2 | 4c895a49738af02e | Module: :mod:`email.mime.multipart`
A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
class for MIME messages that are :mimetype:`multipart`. Optional *_subtype*
defaults to :mimetype:`mixed`, but can be used to specify the subtype of the
message. A :mailheader:`Content-Type` header of :... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.multipart`
A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
class for MIME messages that are :mimetype:`multipart`. Optional *_subtype*
defaults to :mimetype:`mixed`, but can be used to specify the subtype of the
message. A :mailheader:`Content-Type` header of :... | Module: :mod:`email.mime.multipart`
A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
class for MIME messages that are :mimetype:`multipart`. Optional *_subtype*
defaults to :mimetype:`mixed`, but can be used to specify the subtype of the
message. A :mailheader:`Content-Type` header of :... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad666bca-389e-49e7-a14e-0221fbaeaed1 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,740 | supabase-export-v2 | 093be9541fe7e55b | or other headers to the message object as necessary. The default encoding is base64. See the :mod:`email.encoders` module for a list of the built-in encoders.
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | trusted_official_docs | CPython Docs | or other headers to the message object as necessary. The default encoding is base64. See the :mod:`email.encoders` module for a list of the built-in encoders.
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | or other headers to the message object as necessary. The default encoding is base64. See the :mod:`email.encoders` module for a list of the built-in encoders.
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b2287f0d-1efd-4f5c-a3e7-4af86ca48b42 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,746 | supabase-export-v2 | ab0bc0a80255c6d6 | Module: :mod:`email.mime.audio`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEAudio` class is used to create MIME message objects of major type
:mimetype:`audio`. *_audiodata* contains the bytes for the raw audio data. If
this data can be decoded as au, wav, aiff, or aifc, then th... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.audio`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEAudio` class is used to create MIME message objects of major type
:mimetype:`audio`. *_audiodata* contains the bytes for the raw audio data. If
this data can be decoded as au, wav, aiff, or aifc, then th... | Module: :mod:`email.mime.audio`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEAudio` class is used to create MIME message objects of major type
:mimetype:`audio`. *_audiodata* contains the bytes for the raw audio data. If
this data can be decoded as au, wav, aiff, or aifc, then th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
be8b453c-f9c2-43c6-bafa-95325d09545e | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,732 | supabase-export-v2 | 44c32bd7acb20023 | must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the :meth:`Message.attach <email.message.Message.attach>` method.
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | trusted_official_docs | CPython Docs | must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the :meth:`Message.attach <email.message.Message.attach>` method.
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the :meth:`Message.attach <email.message.Message.attach>` method.
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cc68ce03-9869-4fa2-84af-7af78a574c7c | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,725 | supabase-export-v2 | dffaf085b75e2fb8 | Module: :mod:`email.mime.nonmultipart`
A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
class for MIME messages that are not :mimetype:`multipart`. The primary
purpose of this class is to prevent the use of the
:meth:`~email.message.Message.attach` method, which only makes sense for
:m... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.nonmultipart`
A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
class for MIME messages that are not :mimetype:`multipart`. The primary
purpose of this class is to prevent the use of the
:meth:`~email.message.Message.attach` method, which only makes sense for
:m... | Module: :mod:`email.mime.nonmultipart`
A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
class for MIME messages that are not :mimetype:`multipart`. The primary
purpose of this class is to prevent the use of the
:meth:`~email.message.Message.attach` method, which only makes sense for
:m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d01d8998-3882-4491-a732-237d11619dd0 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,731 | supabase-export-v2 | 8abd337aad8c9d08 | Optional *boundary* is the multipart boundary string. When ``None`` (the default), the boundary is calculated when needed (for example, when the message is serialized).
*_subparts* is a sequence of initial subparts for the payload. It must be
possible to convert this sequence to a list. You can always attach new subpa... | trusted_official_docs | CPython Docs | Optional *boundary* is the multipart boundary string. When ``None`` (the default), the boundary is calculated when needed (for example, when the message is serialized).
*_subparts* is a sequence of initial subparts for the payload. It must be
possible to convert this sequence to a list. You can always attach new subpa... | Optional *boundary* is the multipart boundary string. When ``None`` (the default), the boundary is calculated when needed (for example, when the message is serialized).
*_subparts* is a sequence of initial subparts for the payload. It must be
possible to convert this sequence to a list. You can always attach new subpa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d5e20215-3091-4074-9291-b809e49dca08 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,771 | supabase-export-v2 | 4d6b574cb69521c5 | "reset" this behavior by deleting the ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call will automatically encode the new payload (and add a new :mailheader:`Content-Transfer-Encoding` header).
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | trusted_official_docs | CPython Docs | "reset" this behavior by deleting the ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call will automatically encode the new payload (and add a new :mailheader:`Content-Transfer-Encoding` header).
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | "reset" this behavior by deleting the ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call will automatically encode the new payload (and add a new :mailheader:`Content-Transfer-Encoding` header).
Optional *policy* argument defaults to :class:`compat32 <email.policy.Compat32>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea149704-016a-4d31-a570-ef01a444cd6e | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,738 | supabase-export-v2 | d5947326341aac1e | Module: :mod:`email.mime.application`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEApplication` class is used to represent MIME message objects of
major type :mimetype:`application`. *_data* contains the bytes for the raw
application data. Optional *_subtype* specifies the MIME s... | trusted_official_docs | CPython Docs | Module: :mod:`email.mime.application`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEApplication` class is used to represent MIME message objects of
major type :mimetype:`application`. *_data* contains the bytes for the raw
application data. Optional *_subtype* specifies the MIME s... | Module: :mod:`email.mime.application`
A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the
:class:`MIMEApplication` class is used to represent MIME message objects of
major type :mimetype:`application`. *_data* contains the bytes for the raw
application data. Optional *_subtype* specifies the MIME s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ecf97ed6-b203-4ae5-8d10-2a4174bb66d0 | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,730 | supabase-export-v2 | e69bb48fc8a66de2 | specify the subtype of the message. A :mailheader:`Content-Type` header of :mimetype:`multipart/_subtype` will be added to the message object. A :mailheader:`MIME-Version` header will also be added.
Optional *boundary* is the multipart boundary string. When ``None`` (the
default), the boundary is calculated when neede... | trusted_official_docs | CPython Docs | specify the subtype of the message. A :mailheader:`Content-Type` header of :mimetype:`multipart/_subtype` will be added to the message object. A :mailheader:`MIME-Version` header will also be added.
Optional *boundary* is the multipart boundary string. When ``None`` (the
default), the boundary is calculated when neede... | specify the subtype of the message. A :mailheader:`Content-Type` header of :mimetype:`multipart/_subtype` will be added to the message object. A :mailheader:`MIME-Version` header will also be added.
Optional *boundary* is the multipart boundary string. When ``None`` (the
default), the boundary is calculated when neede... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f819e9bf-c3bf-4784-a670-d980b244e2fc | CPython Docs | file://datasets/cpython/Doc/library/email.mime.rst | unknown | 7f625516-aaaf-44c2-a359-84db86b0cb0b | 21,713 | supabase-export-v2 | 349c80c8bcf9abf1 | can also take an existing structure and add new :class:`~email.message.Message` objects, move them around, etc. This makes a very convenient interface for slicing-and-dicing MIME messages.
You can create a new object structure by creating :class:`~email.message.Message`
instances, adding attachments and all the appropr... | trusted_official_docs | CPython Docs | can also take an existing structure and add new :class:`~email.message.Message` objects, move them around, etc. This makes a very convenient interface for slicing-and-dicing MIME messages.
You can create a new object structure by creating :class:`~email.message.Message`
instances, adding attachments and all the appropr... | can also take an existing structure and add new :class:`~email.message.Message` objects, move them around, etc. This makes a very convenient interface for slicing-and-dicing MIME messages.
You can create a new object structure by creating :class:`~email.message.Message`
instances, adding attachments and all the appropr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
032d174c-de52-475e-8af5-1cb07fbbb791 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,119 | supabase-export-v2 | e26710e00157ec05 | If the wrapped coroutine raised an exception that exception is returned. If the wrapped coroutine returned normally this method returns ``None``.
If the Task has been *cancelled*, this method raises a
:exc:`CancelledError` exception. | trusted_official_docs | CPython Docs | If the wrapped coroutine raised an exception that exception is returned. If the wrapped coroutine returned normally this method returns ``None``.
If the Task has been *cancelled*, this method raises a
:exc:`CancelledError` exception. | If the wrapped coroutine raised an exception that exception is returned. If the wrapped coroutine returned normally this method returns ``None``.
If the Task has been *cancelled*, this method raises a
:exc:`CancelledError` exception. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05f9f1ff-a5e8-4695-b1df-375d1735ed97 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,132 | supabase-export-v2 | ca3a9f8a1f041691 | completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames.
The frames are always ordered from oldest to newest. | trusted_official_docs | CPython Docs | completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames.
The frames are always ordered from oldest to newest. | completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames.
The frames are always ordered from oldest to newest. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07f10afc-e0a9-4ab8-b56e-e2a73f2eaaba | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,102 | supabase-export-v2 | b54732e47a96245c | the *coro* to run in. If no *context* is provided, the Task copies the current context and later runs its coroutine in the copied context.
An optional keyword-only *eager_start* argument allows eagerly starting
the execution of the :class:`asyncio.Task` at task creation time. If set to ``True`` and the event loop is r... | trusted_official_docs | CPython Docs | the *coro* to run in. If no *context* is provided, the Task copies the current context and later runs its coroutine in the copied context.
An optional keyword-only *eager_start* argument allows eagerly starting
the execution of the :class:`asyncio.Task` at task creation time. If set to ``True`` and the event loop is r... | the *coro* to run in. If no *context* is provided, the Task copies the current context and later runs its coroutine in the copied context.
An optional keyword-only *eager_start* argument allows eagerly starting
the execution of the :class:`asyncio.Task` at task creation time. If set to ``True`` and the event loop is r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0913dcfd-fdee-44ad-8517-6bde451670b0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,881 | supabase-export-v2 | 7715150b6eaae820 | where one piece of code passes an unused :class:`asyncio.TaskGroup` instance to another in order to have the ability to cancel anything run within the group.
:meth:`cancel` is idempotent and may be called after the task group has
already exited. | trusted_official_docs | CPython Docs | where one piece of code passes an unused :class:`asyncio.TaskGroup` instance to another in order to have the ability to cancel anything run within the group.
:meth:`cancel` is idempotent and may be called after the task group has
already exited. | where one piece of code passes an unused :class:`asyncio.TaskGroup` instance to another in order to have the ability to cancel anything run within the group.
:meth:`cancel` is idempotent and may be called after the task group has
already exited. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ab034d7-a00d-4a71-85ca-fda8c4beac89 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,007 | supabase-export-v2 | 9999e2dd3e78566e | .. versionchanged:: 3.7 When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be cancelled. Previously, it raised :exc:`TimeoutError` immediately.
.. versionchanged:: 3.10
Removed the *loop* parameter. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7 When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be cancelled. Previously, it raised :exc:`TimeoutError` immediately.
.. versionchanged:: 3.10
Removed the *loop* parameter. | .. versionchanged:: 3.7 When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be cancelled. Previously, it raised :exc:`TimeoutError` immediately.
.. versionchanged:: 3.10
Removed the *loop* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bf3769a-e1cd-480a-a307-33abd243e01b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,891 | supabase-export-v2 | eea4c5fbdb6d1157 | it is :exc:`asyncio.CancelledError`, is also included in the exception group. The same special case is made for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph.
Task groups are careful not to mix up the internal cancellation used to
"wake up" their :meth:`~object.__aexit__` with cancellation... | trusted_official_docs | CPython Docs | it is :exc:`asyncio.CancelledError`, is also included in the exception group. The same special case is made for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph.
Task groups are careful not to mix up the internal cancellation used to
"wake up" their :meth:`~object.__aexit__` with cancellation... | it is :exc:`asyncio.CancelledError`, is also included in the exception group. The same special case is made for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph.
Task groups are careful not to mix up the internal cancellation used to
"wake up" their :meth:`~object.__aexit__` with cancellation... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d195602-60b3-4523-bd98-909b7c6dcae5 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,950 | supabase-export-v2 | 0124a67c0b80fcb5 | the point of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the "await" expression still raises a :exc:`CancelledError`.
If ``something()`` is cancelled by other means (i.e. from within
itself) that would also cancel ``shield()``. | trusted_official_docs | CPython Docs | the point of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the "await" expression still raises a :exc:`CancelledError`.
If ``something()`` is cancelled by other means (i.e. from within
itself) that would also cancel ``shield()``. | the point of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the "await" expression still raises a :exc:`CancelledError`.
If ``something()`` is cancelled by other means (i.e. from within
itself) that would also cancel ``shield()``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1151383b-1adc-402c-b1b6-cf0e9155ebaa | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,857 | supabase-export-v2 | 19e2a1edc6dac2fd | # Add task to the set. This creates a strong reference. background_tasks.add(task)
# To prevent keeping references to finished tasks forever,
# make each task remove its own reference from the set after
# completion:
task.add_done_callback(background_tasks.discard) | trusted_official_docs | CPython Docs | # Add task to the set. This creates a strong reference. background_tasks.add(task)
# To prevent keeping references to finished tasks forever,
# make each task remove its own reference from the set after
# completion:
task.add_done_callback(background_tasks.discard) | # Add task to the set. This creates a strong reference. background_tasks.add(task)
# To prevent keeping references to finished tasks forever,
# make each task remove its own reference from the set after
# completion:
task.add_done_callback(background_tasks.discard) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1411ee16-b8a6-4121-b66e-0e0519a7c35f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,162 | supabase-export-v2 | f246e23c1e74adf3 | cancelled is currently awaiting on a future-like object, that awaited object will also be cancelled. This cancellation propagates down the entire chain of awaited objects.
.. versionchanged:: 3.9
Added the *msg* parameter. | trusted_official_docs | CPython Docs | cancelled is currently awaiting on a future-like object, that awaited object will also be cancelled. This cancellation propagates down the entire chain of awaited objects.
.. versionchanged:: 3.9
Added the *msg* parameter. | cancelled is currently awaiting on a future-like object, that awaited object will also be cancelled. This cancellation propagates down the entire chain of awaited objects.
.. versionchanged:: 3.9
Added the *msg* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15bdaffb-0017-480f-897e-07bbb585e4c6 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,159 | supabase-export-v2 | 13cb5bbe690e069f | If the Task is already *done* or *cancelled*, return ``False``, otherwise, return ``True``.
The method arranges for a :exc:`CancelledError` exception to be thrown
into the wrapped coroutine on the next cycle of the event loop. | trusted_official_docs | CPython Docs | If the Task is already *done* or *cancelled*, return ``False``, otherwise, return ``True``.
The method arranges for a :exc:`CancelledError` exception to be thrown
into the wrapped coroutine on the next cycle of the event loop. | If the Task is already *done* or *cancelled*, return ``False``, otherwise, return ``True``.
The method arranges for a :exc:`CancelledError` exception to be thrown
into the wrapped coroutine on the next cycle of the event loop. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16ef8970-af89-427b-876b-bdeaf3c53b79 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,963 | supabase-export-v2 | 3fac27d33632f6b8 | async def main(): async with asyncio.timeout(10): await long_running_task()
If ``long_running_task`` takes more than 10 seconds to complete,
the context manager will cancel the current task and handle
the resulting :exc:`asyncio.CancelledError` internally, transforming it
into a :exc:`TimeoutError` which can be caug... | trusted_official_docs | CPython Docs | async def main(): async with asyncio.timeout(10): await long_running_task()
If ``long_running_task`` takes more than 10 seconds to complete,
the context manager will cancel the current task and handle
the resulting :exc:`asyncio.CancelledError` internally, transforming it
into a :exc:`TimeoutError` which can be caug... | async def main(): async with asyncio.timeout(10): await long_running_task()
If ``long_running_task`` takes more than 10 seconds to complete,
the context manager will cancel the current task and handle
the resulting :exc:`asyncio.CancelledError` internally, transforming it
into a :exc:`TimeoutError` which can be caug... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18ca0452-6c47-4088-bdaa-9356bf0be9bf | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,973 | supabase-export-v2 | 1a09039b1b786583 | Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at` rather than instantiating :class:`!Timeout` directly.
``when`` should be an absolute time at which the context should time out,
as measured by the event loop's clock: | trusted_official_docs | CPython Docs | Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at` rather than instantiating :class:`!Timeout` directly.
``when`` should be an absolute time at which the context should time out,
as measured by the event loop's clock: | Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at` rather than instantiating :class:`!Timeout` directly.
``when`` should be an absolute time at which the context should time out,
as measured by the event loop's clock: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18ca82fd-0cb9-417a-b3a6-165942dbc65e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,889 | supabase-export-v2 | a91c454a48109029 | failed with an exception other than :exc:`asyncio.CancelledError`, those exceptions are combined in an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see their documentation) which is then raised.
Two base exceptions are treated specially:
If any task fails with :exc:`KeyboardInterrupt` or :exc:`Sy... | trusted_official_docs | CPython Docs | failed with an exception other than :exc:`asyncio.CancelledError`, those exceptions are combined in an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see their documentation) which is then raised.
Two base exceptions are treated specially:
If any task fails with :exc:`KeyboardInterrupt` or :exc:`Sy... | failed with an exception other than :exc:`asyncio.CancelledError`, those exceptions are combined in an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see their documentation) which is then raised.
Two base exceptions are treated specially:
If any task fails with :exc:`KeyboardInterrupt` or :exc:`Sy... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b4f2525-c69d-4a7a-ae2a-e00cf8543c6b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,054 | supabase-export-v2 | 7f85ae5d8ad2748d | # Expected output: # # started main at 19:50:53 # start blocking_io at 19:50:53 # blocking_io complete at 19:50:54 # finished main at 19:50:54
Directly calling ``blocking_io()`` in any coroutine would block the event loop
for its duration, resulting in an additional 1 second of run time. Instead,
by using ``asyncio.t... | trusted_official_docs | CPython Docs | # Expected output: # # started main at 19:50:53 # start blocking_io at 19:50:53 # blocking_io complete at 19:50:54 # finished main at 19:50:54
Directly calling ``blocking_io()`` in any coroutine would block the event loop
for its duration, resulting in an additional 1 second of run time. Instead,
by using ``asyncio.t... | # Expected output: # # started main at 19:50:53 # start blocking_io at 19:50:53 # blocking_io complete at 19:50:54 # finished main at 19:50:54
Directly calling ``blocking_io()`` in any coroutine would block the event loop
for its duration, resulting in an additional 1 second of run time. Instead,
by using ``asyncio.t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1c17b4b1-e969-4455-9f75-eeeacf45dba1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,041 | supabase-export-v2 | 897bc30d2908df99 | .. versionchanged:: 3.12 Added support for generators yielding tasks.
.. versionchanged:: 3.13
The result can now be used as either an :term:`asynchronous iterator`
or as a plain :term:`iterator` (previously it was only a plain iterator). | trusted_official_docs | CPython Docs | .. versionchanged:: 3.12 Added support for generators yielding tasks.
.. versionchanged:: 3.13
The result can now be used as either an :term:`asynchronous iterator`
or as a plain :term:`iterator` (previously it was only a plain iterator). | .. versionchanged:: 3.12 Added support for generators yielding tasks.
.. versionchanged:: 3.13
The result can now be used as either an :term:`asynchronous iterator`
or as a plain :term:`iterator` (previously it was only a plain iterator). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d35e85c-b8d6-4c9f-bae0-e24fbd5a763b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,074 | supabase-export-v2 | cb40363ac91ac2f0 | # Create a loop in another thread with loop_in_thread() as loop: # Create a coroutine coro = asyncio.sleep(1, result=3)
# Submit the coroutine to a given loop
future = asyncio.run_coroutine_threadsafe(coro, loop) | trusted_official_docs | CPython Docs | # Create a loop in another thread with loop_in_thread() as loop: # Create a coroutine coro = asyncio.sleep(1, result=3)
# Submit the coroutine to a given loop
future = asyncio.run_coroutine_threadsafe(coro, loop) | # Create a loop in another thread with loop_in_thread() as loop: # Create a coroutine coro = asyncio.sleep(1, result=3)
# Submit the coroutine to a given loop
future = asyncio.run_coroutine_threadsafe(coro, loop) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22b51bca-da5e-4a2c-8a76-2d55b112c00d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,835 | supabase-export-v2 | 704da38e75844c3c | When a Future object is *awaited* it means that the coroutine will wait until the Future is resolved in some other place.
Future objects in asyncio are needed to allow callback-based code
to be used with async/await. | trusted_official_docs | CPython Docs | When a Future object is *awaited* it means that the coroutine will wait until the Future is resolved in some other place.
Future objects in asyncio are needed to allow callback-based code
to be used with async/await. | When a Future object is *awaited* it means that the coroutine will wait until the Future is resolved in some other place.
Future objects in asyncio are needed to allow callback-based code
to be used with async/await. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
23e9e711-9b6f-441b-aa18-0a447d39bf3e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,887 | supabase-export-v2 | c41856c765bc1fc9 | on some condition. Once the last task has finished and the ``async with`` block is exited, no new tasks may be added to the group.
The first time any of the tasks belonging to the group fails
with an exception other than :exc:`asyncio.CancelledError`,
the remaining tasks in the group are cancelled. No further tasks can... | trusted_official_docs | CPython Docs | on some condition. Once the last task has finished and the ``async with`` block is exited, no new tasks may be added to the group.
The first time any of the tasks belonging to the group fails
with an exception other than :exc:`asyncio.CancelledError`,
the remaining tasks in the group are cancelled. No further tasks can... | on some condition. Once the last task has finished and the ``async with`` block is exited, no new tasks may be added to the group.
The first time any of the tasks belonging to the group fails
with an exception other than :exc:`asyncio.CancelledError`,
the remaining tasks in the group are cancelled. No further tasks can... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
261fc21b-1bb0-4889-8644-ed05ae7103a7 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,039 | supabase-export-v2 | 32989142e1890fee | .. versionchanged:: 3.10 Removed the *loop* parameter.
.. deprecated:: 3.10
Deprecation warning is emitted if not all awaitable objects in the *aws*
iterable are Future-like objects and there is no running event loop. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.10 Removed the *loop* parameter.
.. deprecated:: 3.10
Deprecation warning is emitted if not all awaitable objects in the *aws*
iterable are Future-like objects and there is no running event loop. | .. versionchanged:: 3.10 Removed the *loop* parameter.
.. deprecated:: 3.10
Deprecation warning is emitted if not all awaitable objects in the *aws*
iterable are Future-like objects and there is no running event loop. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
267961cf-b563-447f-b0fc-1d3870844d0c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,849 | supabase-export-v2 | 86324a1e56c6ed7d | should execute eagerly during the call to create_task, or be scheduled later. If *eager_start* is not passed the mode set by :meth:`loop.set_task_factory` will be used.
The task is executed in the loop returned by :func:`get_running_loop`,
:exc:`RuntimeError` is raised if there is no running loop in
current thread. | trusted_official_docs | CPython Docs | should execute eagerly during the call to create_task, or be scheduled later. If *eager_start* is not passed the mode set by :meth:`loop.set_task_factory` will be used.
The task is executed in the loop returned by :func:`get_running_loop`,
:exc:`RuntimeError` is raised if there is no running loop in
current thread. | should execute eagerly during the call to create_task, or be scheduled later. If *eager_start* is not passed the mode set by :meth:`loop.set_task_factory` will be used.
The task is executed in the loop returned by :func:`get_running_loop`,
:exc:`RuntimeError` is raised if there is no running loop in
current thread. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2bf246f8-a00b-4721-be23-b03a8ce82bd1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,974 | supabase-export-v2 | b5f58fe894cdaef7 | ``when`` should be an absolute time at which the context should time out, as measured by the event loop's clock:
- If ``when`` is ``None``, the timeout will never trigger. - If ``when < loop.time()``, the timeout will trigger on the next
iteration of the event loop. | trusted_official_docs | CPython Docs | ``when`` should be an absolute time at which the context should time out, as measured by the event loop's clock:
- If ``when`` is ``None``, the timeout will never trigger. - If ``when < loop.time()``, the timeout will trigger on the next
iteration of the event loop. | ``when`` should be an absolute time at which the context should time out, as measured by the event loop's clock:
- If ``when`` is ``None``, the timeout will never trigger. - If ``when < loop.time()``, the timeout will trigger on the next
iteration of the event loop. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d4c3ad0-c55f-4b8f-a89b-72c3e235ee21 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,975 | supabase-export-v2 | e98375973b89070d | ``when`` is ``None``, the timeout will never trigger. - If ``when < loop.time()``, the timeout will trigger on the next iteration of the event loop.
.. method:: when() -> float | None | trusted_official_docs | CPython Docs | ``when`` is ``None``, the timeout will never trigger. - If ``when < loop.time()``, the timeout will trigger on the next iteration of the event loop.
.. method:: when() -> float | None | ``when`` is ``None``, the timeout will never trigger. - If ``when < loop.time()``, the timeout will trigger on the next iteration of the event loop.
.. method:: when() -> float | None | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d514f09-cd9b-402e-b946-787e81da4994 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,831 | supabase-export-v2 | 4f2db1aba43e56f9 | async def main(): # Schedule nested() to run soon concurrently # with "main()". task = asyncio.create_task(nested())
# "task" can now be used to cancel "nested()", or
# can simply be awaited to wait until it is complete:
await task | trusted_official_docs | CPython Docs | async def main(): # Schedule nested() to run soon concurrently # with "main()". task = asyncio.create_task(nested())
# "task" can now be used to cancel "nested()", or
# can simply be awaited to wait until it is complete:
await task | async def main(): # Schedule nested() to run soon concurrently # with "main()". task = asyncio.create_task(nested())
# "task" can now be used to cancel "nested()", or
# can simply be awaited to wait until it is complete:
await task | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2dea592f-c79c-4336-9b48-d6cdc7d19cfd | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,049 | supabase-export-v2 | 3d862a101e14b448 | blocking_io at {time.strftime('%X')}") # Note that time.sleep() can be replaced with any blocking # IO-bound operation, such as file operations. time.sleep(1) print(f"blocking_io complete at {time.strftime('%X')}")
async def main():
print(f"started main at {time.strftime('%X')}") | trusted_official_docs | CPython Docs | blocking_io at {time.strftime('%X')}") # Note that time.sleep() can be replaced with any blocking # IO-bound operation, such as file operations. time.sleep(1) print(f"blocking_io complete at {time.strftime('%X')}")
async def main():
print(f"started main at {time.strftime('%X')}") | blocking_io at {time.strftime('%X')}") # Note that time.sleep() can be replaced with any blocking # IO-bound operation, such as file operations. time.sleep(1) print(f"blocking_io complete at {time.strftime('%X')}")
async def main():
print(f"started main at {time.strftime('%X')}") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
30d6f572-73d5-49e8-b5ef-957af82a7917 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,927 | supabase-export-v2 | 69371bcc277b3800 | .. versionchanged:: 3.10 Removed the *loop* parameter.
.. deprecated:: 3.10
Deprecation warning is emitted if no positional arguments are provided
or not all positional arguments are Future-like objects
and there is no running event loop. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.10 Removed the *loop* parameter.
.. deprecated:: 3.10
Deprecation warning is emitted if no positional arguments are provided
or not all positional arguments are Future-like objects
and there is no running event loop. | .. versionchanged:: 3.10 Removed the *loop* parameter.
.. deprecated:: 3.10
Deprecation warning is emitted if no positional arguments are provided
or not all positional arguments are Future-like objects
and there is no running event loop. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34055a38-752c-4aa0-866d-3e9ba7b8c80f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,189 | supabase-export-v2 | 1c8fa0d670363f8f | Return the number of pending cancellation requests to this Task, i.e., the number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls.
Note that if this number is greater than zero but the Task is
still executing, :meth:`cancelled` will still return ``False``. This is because this number can be lowere... | trusted_official_docs | CPython Docs | Return the number of pending cancellation requests to this Task, i.e., the number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls.
Note that if this number is greater than zero but the Task is
still executing, :meth:`cancelled` will still return ``False``. This is because this number can be lowere... | Return the number of pending cancellation requests to this Task, i.e., the number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls.
Note that if this number is greater than zero but the Task is
still executing, :meth:`cancelled` will still return ``False``. This is because this number can be lowere... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35294f1f-10e8-4df0-9b29-8d927fd96178 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,923 | supabase-export-v2 | 9bbc1378de6bbe16 | asyncio.run(main())
# Expected output:
#
# Task A: Compute factorial(2), currently i=2... # Task B: Compute factorial(3), currently i=2... # Task C: Compute factorial(4), currently i=2... # Task A: factorial(2) = 2
# Task B: Compute factorial(3), currently i=3... # Task C: Compute factorial(4), currently i=3... # Ta... | trusted_official_docs | CPython Docs | asyncio.run(main())
# Expected output:
#
# Task A: Compute factorial(2), currently i=2... # Task B: Compute factorial(3), currently i=2... # Task C: Compute factorial(4), currently i=2... # Task A: factorial(2) = 2
# Task B: Compute factorial(3), currently i=3... # Task C: Compute factorial(4), currently i=3... # Ta... | asyncio.run(main())
# Expected output:
#
# Task A: Compute factorial(2), currently i=2... # Task B: Compute factorial(3), currently i=2... # Task C: Compute factorial(4), currently i=2... # Task A: factorial(2) = 2
# Task B: Compute factorial(3), currently i=3... # Task C: Compute factorial(4), currently i=3... # Ta... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
36513b86-de8c-4956-b2b6-2dd3299cb1ac | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,047 | supabase-export-v2 | beeefdb633aa7d0c | Return a coroutine that can be awaited to get the eventual result of *func*.
This coroutine function is primarily intended to be used for executing
IO-bound functions/methods that would otherwise block the event loop if
they were run in the main thread. For example:: | trusted_official_docs | CPython Docs | Return a coroutine that can be awaited to get the eventual result of *func*.
This coroutine function is primarily intended to be used for executing
IO-bound functions/methods that would otherwise block the event loop if
they were run in the main thread. For example:: | Return a coroutine that can be awaited to get the eventual result of *func*.
This coroutine function is primarily intended to be used for executing
IO-bound functions/methods that would otherwise block the event loop if
they were run in the main thread. For example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3865873e-849d-42f1-8237-984d30938071 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,032 | supabase-export-v2 | d62aabfa182b55da | for earliest_connect in as_completed(tasks): # earliest_connect is done. The result can be obtained by # awaiting it or calling earliest_connect.result() reader, writer = await earliest_connect
if earliest_connect is ipv6_connect:
print("IPv6 connection established.")
else:
print("IPv4 connection established.") | trusted_official_docs | CPython Docs | for earliest_connect in as_completed(tasks): # earliest_connect is done. The result can be obtained by # awaiting it or calling earliest_connect.result() reader, writer = await earliest_connect
if earliest_connect is ipv6_connect:
print("IPv6 connection established.")
else:
print("IPv4 connection established.") | for earliest_connect in as_completed(tasks): # earliest_connect is done. The result can be obtained by # awaiting it or calling earliest_connect.result() reader, writer = await earliest_connect
if earliest_connect is ipv6_connect:
print("IPv6 connection established.")
else:
print("IPv4 connection established.") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a634af7-d677-4c48-b7d4-548a4b8d2f20 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,046 | supabase-export-v2 | 1e0633a898cd3aa5 | directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the event loop thread to be accessed in the separate thread.
Return a coroutine that can be awaited to get the eventual result of *func*. | trusted_official_docs | CPython Docs | directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the event loop thread to be accessed in the separate thread.
Return a coroutine that can be awaited to get the eventual result of *func*. | directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the event loop thread to be accessed in the separate thread.
Return a coroutine that can be awaited to get the eventual result of *func*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c5dab75-0878-45e0-98c5-3a61020ad18f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,913 | supabase-export-v2 | 040449e5c7e3ee84 | If any awaitable in *aws* is a coroutine, it is automatically scheduled as a Task.
If all awaitables are completed successfully, the result is an
aggregate list of returned values. The order of result values
corresponds to the order of awaitables in *aws*. | trusted_official_docs | CPython Docs | If any awaitable in *aws* is a coroutine, it is automatically scheduled as a Task.
If all awaitables are completed successfully, the result is an
aggregate list of returned values. The order of result values
corresponds to the order of awaitables in *aws*. | If any awaitable in *aws* is a coroutine, it is automatically scheduled as a Task.
If all awaitables are completed successfully, the result is an
aggregate list of returned values. The order of result values
corresponds to the order of awaitables in *aws*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3dc357a9-b8b3-4585-9258-026c9deb7ba1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,955 | supabase-export-v2 | e9a2476b9d0e61bc | event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done.
.. versionchanged:: 3.10
Removed the *loop* parameter. | trusted_official_docs | CPython Docs | event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done.
.. versionchanged:: 3.10
Removed the *loop* parameter. | event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done.
.. versionchanged:: 3.10
Removed the *loop* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
41f537ee-a09c-40ee-b2d1-c1e5c6d78a67 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,892 | supabase-export-v2 | 47536f32711b2233 | tasks simultaneously, the inner task group will process its exceptions, and then the outer task group will receive another cancellation and process its own exceptions.
In the case where a task group is cancelled externally and also must
raise an :exc:`ExceptionGroup`, it will call the parent task's
:meth:`~asyncio.Task... | trusted_official_docs | CPython Docs | tasks simultaneously, the inner task group will process its exceptions, and then the outer task group will receive another cancellation and process its own exceptions.
In the case where a task group is cancelled externally and also must
raise an :exc:`ExceptionGroup`, it will call the parent task's
:meth:`~asyncio.Task... | tasks simultaneously, the inner task group will process its exceptions, and then the outer task group will receive another cancellation and process its own exceptions.
In the case where a task group is cancelled externally and also must
raise an :exc:`ExceptionGroup`, it will call the parent task's
:meth:`~asyncio.Task... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4456eac1-99d0-48a2-b75c-6d31d36e0de0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,820 | supabase-export-v2 | a3d014ccba0d2246 | just call "nested()". # A coroutine object is created but not awaited, # so it *won't run at all*. nested() # will raise a "RuntimeWarning".
# Let's do it differently now and await it:
print(await nested()) # will print "42". | trusted_official_docs | CPython Docs | just call "nested()". # A coroutine object is created but not awaited, # so it *won't run at all*. nested() # will raise a "RuntimeWarning".
# Let's do it differently now and await it:
print(await nested()) # will print "42". | just call "nested()". # A coroutine object is created but not awaited, # so it *won't run at all*. nested() # will raise a "RuntimeWarning".
# Let's do it differently now and await it:
print(await nested()) # will print "42". | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
45ffb22f-dba7-4a75-9469-66b9f136fa6d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,040 | supabase-export-v2 | 32a90ff3d8aad1fc | deprecated:: 3.10 Deprecation warning is emitted if not all awaitable objects in the *aws* iterable are Future-like objects and there is no running event loop.
.. versionchanged:: 3.12
Added support for generators yielding tasks. | trusted_official_docs | CPython Docs | deprecated:: 3.10 Deprecation warning is emitted if not all awaitable objects in the *aws* iterable are Future-like objects and there is no running event loop.
.. versionchanged:: 3.12
Added support for generators yielding tasks. | deprecated:: 3.10 Deprecation warning is emitted if not all awaitable objects in the *aws* iterable are Future-like objects and there is no running event loop.
.. versionchanged:: 3.12
Added support for generators yielding tasks. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
499c417b-2028-42b5-88a8-744c4a3057b9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,805 | supabase-export-v2 | ed41c3fecba24d1d | * The :class:`asyncio.TaskGroup` class provides a more modern alternative to :func:`create_task`. Using this API, the last example becomes::
async def main():
async with asyncio.TaskGroup() as tg:
task1 = tg.create_task(
say_after(1, 'hello')) | trusted_official_docs | CPython Docs | * The :class:`asyncio.TaskGroup` class provides a more modern alternative to :func:`create_task`. Using this API, the last example becomes::
async def main():
async with asyncio.TaskGroup() as tg:
task1 = tg.create_task(
say_after(1, 'hello')) | * The :class:`asyncio.TaskGroup` class provides a more modern alternative to :func:`create_task`. Using this API, the last example becomes::
async def main():
async with asyncio.TaskGroup() as tg:
task1 = tg.create_task(
say_after(1, 'hello')) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4ae22fe4-250c-48b5-8c8e-d5d7e6384439 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,924 | supabase-export-v2 | 6cfbe07ae03a667b | currently i=3... # Task B: factorial(3) = 6 # Task C: Compute factorial(4), currently i=4... # Task C: factorial(4) = 24 # [2, 6, 24]
.. note::
If *return_exceptions* is false, cancelling gather() after it
has been marked done won't cancel any submitted awaitables. For instance, gather can be marked done after propag... | trusted_official_docs | CPython Docs | currently i=3... # Task B: factorial(3) = 6 # Task C: Compute factorial(4), currently i=4... # Task C: factorial(4) = 24 # [2, 6, 24]
.. note::
If *return_exceptions* is false, cancelling gather() after it
has been marked done won't cancel any submitted awaitables. For instance, gather can be marked done after propag... | currently i=3... # Task B: factorial(3) = 6 # Task C: Compute factorial(4), currently i=4... # Task C: factorial(4) = 24 # [2, 6, 24]
.. note::
If *return_exceptions* is false, cancelling gather() after it
has been marked done won't cancel any submitted awaitables. For instance, gather can be marked done after propag... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c8e9962-d220-4978-942a-2d5060b1d239 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,185 | supabase-export-v2 | c94da0c9b9accb79 | If end-user code is, for some reason, suppressing cancellation by catching :exc:`CancelledError`, it needs to call this method to remove the cancellation state.
When this method decrements the cancellation count to zero,
the method checks if a previous :meth:`cancel` call had arranged
for :exc:`CancelledError` to be ... | trusted_official_docs | CPython Docs | If end-user code is, for some reason, suppressing cancellation by catching :exc:`CancelledError`, it needs to call this method to remove the cancellation state.
When this method decrements the cancellation count to zero,
the method checks if a previous :meth:`cancel` call had arranged
for :exc:`CancelledError` to be ... | If end-user code is, for some reason, suppressing cancellation by catching :exc:`CancelledError`, it needs to call this method to remove the cancellation state.
When this method decrements the cancellation count to zero,
the method checks if a previous :meth:`cancel` call had arranged
for :exc:`CancelledError` to be ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4d436277-1efc-47fb-b482-12b83489e081 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,063 | supabase-export-v2 | d06c1beeb30c213f | This function is meant to be called from a different OS thread than the one where the event loop is running. Example::
def in_thread(loop: asyncio.AbstractEventLoop) -> None:
# Run some blocking IO
pathlib.Path("example.txt").write_text("hello world", encoding="utf8") | trusted_official_docs | CPython Docs | This function is meant to be called from a different OS thread than the one where the event loop is running. Example::
def in_thread(loop: asyncio.AbstractEventLoop) -> None:
# Run some blocking IO
pathlib.Path("example.txt").write_text("hello world", encoding="utf8") | This function is meant to be called from a different OS thread than the one where the event loop is running. Example::
def in_thread(loop: asyncio.AbstractEventLoop) -> None:
# Run some blocking IO
pathlib.Path("example.txt").write_text("hello world", encoding="utf8") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fc6322d-b685-4423-b0d2-b1c8ce8cae16 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,915 | supabase-export-v2 | 310b052e1a429996 | exception is immediately propagated to the task that awaits on ``gather()``. Other awaitables in the *aws* sequence **won't be cancelled** and will continue to run.
If *return_exceptions* is ``True``, exceptions are treated the
same as successful results, and aggregated in the result list. | trusted_official_docs | CPython Docs | exception is immediately propagated to the task that awaits on ``gather()``. Other awaitables in the *aws* sequence **won't be cancelled** and will continue to run.
If *return_exceptions* is ``True``, exceptions are treated the
same as successful results, and aggregated in the result list. | exception is immediately propagated to the task that awaits on ``gather()``. Other awaitables in the *aws* sequence **won't be cancelled** and will continue to run.
If *return_exceptions* is ``True``, exceptions are treated the
same as successful results, and aggregated in the result list. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50678b57-4110-42c0-a23e-9b8708f1ea85 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,062 | supabase-export-v2 | 008de47242f370f3 | Return a :class:`concurrent.futures.Future` to wait for the result from another OS thread.
This function is meant to be called from a different OS thread
than the one where the event loop is running. Example:: | trusted_official_docs | CPython Docs | Return a :class:`concurrent.futures.Future` to wait for the result from another OS thread.
This function is meant to be called from a different OS thread
than the one where the event loop is running. Example:: | Return a :class:`concurrent.futures.Future` to wait for the result from another OS thread.
This function is meant to be called from a different OS thread
than the one where the event loop is running. Example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
51eff5cb-4c5b-4f43-a7bf-7cec81c1ab68 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,038 | supabase-export-v2 | 12452f1701b1d339 | occurs before all awaitables are done. This is raised by the ``async for`` loop during asynchronous iteration or by the coroutines yielded during plain iteration.
.. versionchanged:: 3.10
Removed the *loop* parameter. | trusted_official_docs | CPython Docs | occurs before all awaitables are done. This is raised by the ``async for`` loop during asynchronous iteration or by the coroutines yielded during plain iteration.
.. versionchanged:: 3.10
Removed the *loop* parameter. | occurs before all awaitables are done. This is raised by the ``async for`` loop during asynchronous iteration or by the coroutines yielded during plain iteration.
.. versionchanged:: 3.10
Removed the *loop* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5212627d-86d1-40bf-bd7c-a3f4b71aaf3c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,901 | supabase-export-v2 | bb429034b96edf21 | ``sleep()`` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other
tasks to run. This can be used by long-running functions to avoid
blocking the event loop for the full duration of the function call. | trusted_official_docs | CPython Docs | ``sleep()`` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other
tasks to run. This can be used by long-running functions to avoid
blocking the event loop for the full duration of the function call. | ``sleep()`` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other
tasks to run. This can be used by long-running functions to avoid
blocking the event loop for the full duration of the function call. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
57214c06-bce9-43af-9b80-3193b361e8fe | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,114 | supabase-export-v2 | 1410db051eb161aa | If the Task is *done*, the result of the wrapped coroutine is returned (or if the coroutine raised an exception, that exception is re-raised.)
If the Task has been *cancelled*, this method raises
a :exc:`CancelledError` exception. | trusted_official_docs | CPython Docs | If the Task is *done*, the result of the wrapped coroutine is returned (or if the coroutine raised an exception, that exception is re-raised.)
If the Task has been *cancelled*, this method raises
a :exc:`CancelledError` exception. | If the Task is *done*, the result of the wrapped coroutine is returned (or if the coroutine raised an exception, that exception is re-raised.)
If the Task has been *cancelled*, this method raises
a :exc:`CancelledError` exception. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
591e5601-306d-417b-ab24-d0b6b28bd155 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,095 | supabase-export-v2 | 0f491042753ba7bb | A :class:`Future-like <Future>` object that runs a Python :ref:`coroutine <coroutine>`. Not thread-safe.
Tasks are used to run coroutines in event loops. If a coroutine awaits on a Future, the Task suspends
the execution of the coroutine and waits for the completion
of the Future. When the Future is *done*, the execu... | trusted_official_docs | CPython Docs | A :class:`Future-like <Future>` object that runs a Python :ref:`coroutine <coroutine>`. Not thread-safe.
Tasks are used to run coroutines in event loops. If a coroutine awaits on a Future, the Task suspends
the execution of the coroutine and waits for the completion
of the Future. When the Future is *done*, the execu... | A :class:`Future-like <Future>` object that runs a Python :ref:`coroutine <coroutine>`. Not thread-safe.
Tasks are used to run coroutines in event loops. If a coroutine awaits on a Future, the Task suspends
the execution of the coroutine and waits for the completion
of the Future. When the Future is *done*, the execu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d3e98de-8a9d-4380-bf3a-b39562c112b9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,076 | supabase-export-v2 | d535a91c52604ee2 | # Wait for the result with an optional timeout argument assert future.result(timeout=2) == 3
If an exception is raised in the coroutine, the returned Future
will be notified. It can also be used to cancel the task in
the event loop:: | trusted_official_docs | CPython Docs | # Wait for the result with an optional timeout argument assert future.result(timeout=2) == 3
If an exception is raised in the coroutine, the returned Future
will be notified. It can also be used to cancel the task in
the event loop:: | # Wait for the result with an optional timeout argument assert future.result(timeout=2) == 3
If an exception is raised in the coroutine, the returned Future
will be notified. It can also be used to cancel the task in
the event loop:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d45274d-dda2-4e94-b50a-3139cda6a15c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,099 | supabase-export-v2 | 8e71db639b36827f | throw a :exc:`CancelledError` exception into the wrapped coroutine. If a coroutine is awaiting on a future-like object during cancellation, the awaited object will be cancelled.
:meth:`cancelled` can be used to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not
suppress the :... | trusted_official_docs | CPython Docs | throw a :exc:`CancelledError` exception into the wrapped coroutine. If a coroutine is awaiting on a future-like object during cancellation, the awaited object will be cancelled.
:meth:`cancelled` can be used to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not
suppress the :... | throw a :exc:`CancelledError` exception into the wrapped coroutine. If a coroutine is awaiting on a future-like object during cancellation, the awaited object will be cancelled.
:meth:`cancelled` can be used to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not
suppress the :... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d6b8c0d-373d-48fc-bd0c-4aa0b07df419 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,918 | supabase-export-v2 | 9270ae70330d67b9 | ``gather()`` call is **not** cancelled in this case. This is to prevent the cancellation of one submitted Task/Future to cause other Tasks/Futures to be cancelled.
.. note::
A new alternative to create and run tasks concurrently and
wait for their completion is :class:`asyncio.TaskGroup`. *TaskGroup*
provides strong... | trusted_official_docs | CPython Docs | ``gather()`` call is **not** cancelled in this case. This is to prevent the cancellation of one submitted Task/Future to cause other Tasks/Futures to be cancelled.
.. note::
A new alternative to create and run tasks concurrently and
wait for their completion is :class:`asyncio.TaskGroup`. *TaskGroup*
provides strong... | ``gather()`` call is **not** cancelled in this case. This is to prevent the cancellation of one submitted Task/Future to cause other Tasks/Futures to be cancelled.
.. note::
A new alternative to create and run tasks concurrently and
wait for their completion is :class:`asyncio.TaskGroup`. *TaskGroup*
provides strong... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e2feeae-6936-4978-81ee-ae920058d859 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,880 | supabase-export-v2 | 71c52565b00afb1a | group that aren't yet done, as well as the parent (body) of the group. The task group context manager will exit *without* :exc:`asyncio.CancelledError` being raised.
If :meth:`cancel` is called before entering the task group, the group will be
cancelled upon entry. This is useful for patterns where one piece of
code ... | trusted_official_docs | CPython Docs | group that aren't yet done, as well as the parent (body) of the group. The task group context manager will exit *without* :exc:`asyncio.CancelledError` being raised.
If :meth:`cancel` is called before entering the task group, the group will be
cancelled upon entry. This is useful for patterns where one piece of
code ... | group that aren't yet done, as well as the parent (body) of the group. The task group context manager will exit *without* :exc:`asyncio.CancelledError` being raised.
If :meth:`cancel` is called before entering the task group, the group will be
cancelled upon entry. This is useful for patterns where one piece of
code ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
651287ba-db7c-4ebf-9764-ec103eb80f0e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,035 | supabase-export-v2 | 9e3b42bdbe746ec6 | new coroutine that returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python versions older than 3.13::
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
ipv6_connect = create_task(open_connection("::1", 80))
tasks = [ipv4_connect, ipv6_connect] | trusted_official_docs | CPython Docs | new coroutine that returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python versions older than 3.13::
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
ipv6_connect = create_task(open_connection("::1", 80))
tasks = [ipv4_connect, ipv6_connect] | new coroutine that returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python versions older than 3.13::
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
ipv6_connect = create_task(open_connection("::1", 80))
tasks = [ipv4_connect, ipv6_connect] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6605e4b9-7bfe-4926-a405-5d910424fd44 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,814 | supabase-export-v2 | 2d7cd622f336721e | say that an object is an **awaitable** object if it can be used in an :keyword:`await` expression. Many asyncio APIs are designed to accept awaitables.
There are three main types of *awaitable* objects:
**coroutines**, **Tasks**, and **Futures**. | trusted_official_docs | CPython Docs | say that an object is an **awaitable** object if it can be used in an :keyword:`await` expression. Many asyncio APIs are designed to accept awaitables.
There are three main types of *awaitable* objects:
**coroutines**, **Tasks**, and **Futures**. | say that an object is an **awaitable** object if it can be used in an :keyword:`await` expression. Many asyncio APIs are designed to accept awaitables.
There are three main types of *awaitable* objects:
**coroutines**, **Tasks**, and **Futures**. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a41170c-6490-4de2-bff2-a1023127ea97 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,960 | supabase-export-v2 | 0cd3876fbb3acb22 | If *delay* is ``None``, no time limit will be applied; this can be useful if the delay is unknown when the context manager is created.
In either case, the context manager can be rescheduled after
creation using :meth:`Timeout.reschedule`. | trusted_official_docs | CPython Docs | If *delay* is ``None``, no time limit will be applied; this can be useful if the delay is unknown when the context manager is created.
In either case, the context manager can be rescheduled after
creation using :meth:`Timeout.reschedule`. | If *delay* is ``None``, no time limit will be applied; this can be useful if the delay is unknown when the context manager is created.
In either case, the context manager can be rescheduled after
creation using :meth:`Timeout.reschedule`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a4dea73-f63d-43e1-83f7-99e8e50bc408 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,186 | supabase-export-v2 | 35966d8a00f2665f | for :exc:`CancelledError` to be thrown into the task. If it hasn't been thrown yet, that arrangement will be rescinded (by resetting the internal ``_must_cancel`` flag).
.. versionchanged:: 3.13
Changed to rescind pending cancellation requests upon reaching zero. | trusted_official_docs | CPython Docs | for :exc:`CancelledError` to be thrown into the task. If it hasn't been thrown yet, that arrangement will be rescinded (by resetting the internal ``_must_cancel`` flag).
.. versionchanged:: 3.13
Changed to rescind pending cancellation requests upon reaching zero. | for :exc:`CancelledError` to be thrown into the task. If it hasn't been thrown yet, that arrangement will be rescinded (by resetting the internal ``_must_cancel`` flag).
.. versionchanged:: 3.13
Changed to rescind pending cancellation requests upon reaching zero. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c801306-6d90-41ce-bea7-a7f695c74959 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,864 | supabase-export-v2 | 231bb2e2cb3175fb | Tasks can easily and safely be cancelled. When a task is cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the next opportunity.
It is recommended that coroutines use ``try/finally`` blocks to robustly
perform clean-up logic. In case :exc:`asyncio.CancelledError`
is explicitly caught, it should gen... | trusted_official_docs | CPython Docs | Tasks can easily and safely be cancelled. When a task is cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the next opportunity.
It is recommended that coroutines use ``try/finally`` blocks to robustly
perform clean-up logic. In case :exc:`asyncio.CancelledError`
is explicitly caught, it should gen... | Tasks can easily and safely be cancelled. When a task is cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the next opportunity.
It is recommended that coroutines use ``try/finally`` blocks to robustly
perform clean-up logic. In case :exc:`asyncio.CancelledError`
is explicitly caught, it should gen... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6cfc2202-4062-4abb-9951-a1820ef04f7e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,819 | supabase-export-v2 | bfccccb89d0392fb | async def nested(): return 42
async def main():
# Nothing happens if we just call "nested()". # A coroutine object is created but not awaited,
# so it *won't run at all*. nested() # will raise a "RuntimeWarning". | trusted_official_docs | CPython Docs | async def nested(): return 42
async def main():
# Nothing happens if we just call "nested()". # A coroutine object is created but not awaited,
# so it *won't run at all*. nested() # will raise a "RuntimeWarning". | async def nested(): return 42
async def main():
# Nothing happens if we just call "nested()". # A coroutine object is created but not awaited,
# so it *won't run at all*. nested() # will raise a "RuntimeWarning". | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7236102a-fd5c-405c-b797-83c6ebd75303 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,916 | supabase-export-v2 | 48626b637b886286 | If *return_exceptions* is ``True``, exceptions are treated the same as successful results, and aggregated in the result list.
If ``gather()`` is *cancelled*, all submitted awaitables
(that have not completed yet) are also *cancelled*. | trusted_official_docs | CPython Docs | If *return_exceptions* is ``True``, exceptions are treated the same as successful results, and aggregated in the result list.
If ``gather()`` is *cancelled*, all submitted awaitables
(that have not completed yet) are also *cancelled*. | If *return_exceptions* is ``True``, exceptions are treated the same as successful results, and aggregated in the result list.
If ``gather()`` is *cancelled*, all submitted awaitables
(that have not completed yet) are also *cancelled*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
72ec0362-ffca-406a-a198-e752d8eedafd | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,034 | supabase-export-v2 | 853087a728006f69 | During asynchronous iteration, implicitly-created tasks will be yielded for supplied awaitables that aren't tasks or futures.
When used as a plain iterator, each iteration yields a new coroutine that
returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python vers... | trusted_official_docs | CPython Docs | During asynchronous iteration, implicitly-created tasks will be yielded for supplied awaitables that aren't tasks or futures.
When used as a plain iterator, each iteration yields a new coroutine that
returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python vers... | During asynchronous iteration, implicitly-created tasks will be yielded for supplied awaitables that aren't tasks or futures.
When used as a plain iterator, each iteration yields a new coroutine that
returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python vers... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
76099884-050f-497a-a5d1-c8e176017301 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,982 | supabase-export-v2 | 841892c0ffd4e759 | Example::
async def main():
try:
# We do not know the timeout when starting, so we pass ``None``. async with asyncio.timeout(None) as cm:
# We know the timeout now, so we reschedule it. new_deadline = get_running_loop().time() + 10
cm.reschedule(new_deadline) | trusted_official_docs | CPython Docs | Example::
async def main():
try:
# We do not know the timeout when starting, so we pass ``None``. async with asyncio.timeout(None) as cm:
# We know the timeout now, so we reschedule it. new_deadline = get_running_loop().time() + 10
cm.reschedule(new_deadline) | Example::
async def main():
try:
# We do not know the timeout when starting, so we pass ``None``. async with asyncio.timeout(None) as cm:
# We know the timeout now, so we reschedule it. new_deadline = get_running_loop().time() + 10
cm.reschedule(new_deadline) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
76ea6d8e-a9cd-4b82-94c0-754fd0f04ec2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,183 | supabase-export-v2 | 8c026030d46c5f6c | block affected by the timeout: await make_request() await make_another_request() except TimeoutError: log("There was a timeout") # Outer code not affected by the timeout: await unrelated_code()
While the block with ``make_request()`` and ``make_another_request()``
might get cancelled due to the timeout, ``unrelated_co... | trusted_official_docs | CPython Docs | block affected by the timeout: await make_request() await make_another_request() except TimeoutError: log("There was a timeout") # Outer code not affected by the timeout: await unrelated_code()
While the block with ``make_request()`` and ``make_another_request()``
might get cancelled due to the timeout, ``unrelated_co... | block affected by the timeout: await make_request() await make_another_request() except TimeoutError: log("There was a timeout") # Outer code not affected by the timeout: await unrelated_code()
While the block with ``make_request()`` and ``make_another_request()``
might get cancelled due to the timeout, ``unrelated_co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7771f1d9-5378-405c-a4ea-21d6690b0487 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,000 | supabase-export-v2 | 44088620216543b1 | wait until the future is actually cancelled, so the total wait time may exceed the *timeout*. If an exception happens during cancellation, it is propagated.
If the wait is cancelled, the future *aw* is also cancelled. | trusted_official_docs | CPython Docs | wait until the future is actually cancelled, so the total wait time may exceed the *timeout*. If an exception happens during cancellation, it is propagated.
If the wait is cancelled, the future *aw* is also cancelled. | wait until the future is actually cancelled, so the total wait time may exceed the *timeout*. If an exception happens during cancellation, it is propagated.
If the wait is cancelled, the future *aw* is also cancelled. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
79b0238a-d280-44f6-ba45-d6a630d9ada0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,100 | supabase-export-v2 | 5b8cd710d5405b4c | to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not suppress the :exc:`CancelledError` exception and was actually cancelled.
:class:`asyncio.Task` inherits from :class:`Future` all of its
APIs except :meth:`Future.set_result` and
:meth:`Future.set_exception`. | trusted_official_docs | CPython Docs | to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not suppress the :exc:`CancelledError` exception and was actually cancelled.
:class:`asyncio.Task` inherits from :class:`Future` all of its
APIs except :meth:`Future.set_result` and
:meth:`Future.set_exception`. | to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not suppress the :exc:`CancelledError` exception and was actually cancelled.
:class:`asyncio.Task` inherits from :class:`Future` all of its
APIs except :meth:`Future.set_result` and
:meth:`Future.set_exception`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a210c46-ecd4-4e4c-81ce-6a3aba6ac9ce | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,935 | supabase-export-v2 | 75a551e23e2d682a | .. note::
Immediate execution of the coroutine is a semantic change. If the coroutine returns or raises, the task is never scheduled
to the event loop. If the coroutine execution blocks, the task is
scheduled to the event loop. This change may introduce behavior
changes to existing applications. For example,
the ap... | trusted_official_docs | CPython Docs | .. note::
Immediate execution of the coroutine is a semantic change. If the coroutine returns or raises, the task is never scheduled
to the event loop. If the coroutine execution blocks, the task is
scheduled to the event loop. This change may introduce behavior
changes to existing applications. For example,
the ap... | .. note::
Immediate execution of the coroutine is a semantic change. If the coroutine returns or raises, the task is never scheduled
to the event loop. If the coroutine execution blocks, the task is
scheduled to the event loop. This change may introduce behavior
changes to existing applications. For example,
the ap... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83358701-e724-4e09-8867-d50f76a4e251 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,190 | supabase-export-v2 | 64eef057d444b289 | can be lowered by calling :meth:`uncancel`, which can lead to the task not being cancelled after all if the cancellation requests go down to zero.
This method is used by asyncio's internals and isn't expected to be
used by end-user code. See :meth:`uncancel` for more details. | trusted_official_docs | CPython Docs | can be lowered by calling :meth:`uncancel`, which can lead to the task not being cancelled after all if the cancellation requests go down to zero.
This method is used by asyncio's internals and isn't expected to be
used by end-user code. See :meth:`uncancel` for more details. | can be lowered by calling :meth:`uncancel`, which can lead to the task not being cancelled after all if the cancellation requests go down to zero.
This method is used by asyncio's internals and isn't expected to be
used by end-user code. See :meth:`uncancel` for more details. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
841f02e0-df18-4630-bda8-973c56b30be6 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,954 | supabase-export-v2 | db760ec189b00fee | .. important::
Save a reference to tasks passed to this function, to avoid
a task disappearing mid-execution. The event loop only keeps
weak references to tasks. A task that isn't referenced elsewhere
may get garbage collected at any time, even before it's done. | trusted_official_docs | CPython Docs | .. important::
Save a reference to tasks passed to this function, to avoid
a task disappearing mid-execution. The event loop only keeps
weak references to tasks. A task that isn't referenced elsewhere
may get garbage collected at any time, even before it's done. | .. important::
Save a reference to tasks passed to this function, to avoid
a task disappearing mid-execution. The event loop only keeps
weak references to tasks. A task that isn't referenced elsewhere
may get garbage collected at any time, even before it's done. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
841fb62f-fe32-4e3d-a415-e69eb3afd397 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,101 | supabase-export-v2 | eba7bc824f508523 | :class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :meth:`Future.set_result` and :meth:`Future.set_exception`.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the *coro* to run in. If no *context* is provided, the Task copies the current c... | trusted_official_docs | CPython Docs | :class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :meth:`Future.set_result` and :meth:`Future.set_exception`.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the *coro* to run in. If no *context* is provided, the Task copies the current c... | :class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :meth:`Future.set_result` and :meth:`Future.set_exception`.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the *coro* to run in. If no *context* is provided, the Task copies the current c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84c64bdd-e4d7-42a4-b195-cc198cfc5247 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,184 | supabase-export-v2 | 0a2686a1dce5dc25 | timeout, ``unrelated_code()`` should continue running even in case of the timeout. This is implemented with :meth:`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a similar fashion.
If end-user code is, for some reason, suppressing cancellation by
catching :exc:`CancelledError`, it needs to call... | trusted_official_docs | CPython Docs | timeout, ``unrelated_code()`` should continue running even in case of the timeout. This is implemented with :meth:`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a similar fashion.
If end-user code is, for some reason, suppressing cancellation by
catching :exc:`CancelledError`, it needs to call... | timeout, ``unrelated_code()`` should continue running even in case of the timeout. This is implemented with :meth:`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a similar fashion.
If end-user code is, for some reason, suppressing cancellation by
catching :exc:`CancelledError`, it needs to call... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84f93769-8d51-4147-8236-a17af0e0c8d0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,072 | supabase-export-v2 | ff00135bf6910432 | async def main() -> None: loop_fut.set_result(asyncio.get_running_loop()) await stop_event.wait()
with concurrent.futures.ThreadPoolExecutor(1) as tpe:
complete_fut = tpe.submit(asyncio.run, main())
for fut in concurrent.futures.as_completed((loop_fut, complete_fut)):
if fut is loop_fut:
loop = loop_fut.result()
t... | trusted_official_docs | CPython Docs | async def main() -> None: loop_fut.set_result(asyncio.get_running_loop()) await stop_event.wait()
with concurrent.futures.ThreadPoolExecutor(1) as tpe:
complete_fut = tpe.submit(asyncio.run, main())
for fut in concurrent.futures.as_completed((loop_fut, complete_fut)):
if fut is loop_fut:
loop = loop_fut.result()
t... | async def main() -> None: loop_fut.set_result(asyncio.get_running_loop()) await stop_event.wait()
with concurrent.futures.ThreadPoolExecutor(1) as tpe:
complete_fut = tpe.submit(asyncio.run, main())
for fut in concurrent.futures.as_completed((loop_fut, complete_fut)):
if fut is loop_fut:
loop = loop_fut.result()
t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
895bb6b7-30fa-480a-b3c7-e61e937a4e89 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,135 | supabase-export-v2 | 1fb46d1ad720dabf | the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.)
.. method:: print_stack(*, limit=None, file=None) | trusted_official_docs | CPython Docs | the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.)
.. method:: print_stack(*, limit=None, file=None) | the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.)
.. method:: print_stack(*, limit=None, file=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a6c7f09-0c52-4bdc-8a43-72792390c052 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,991 | supabase-export-v2 | 48724535d927f1a5 | loop = get_running_loop() deadline = loop.time() + 20 try: async with asyncio.timeout_at(deadline): await long_running_task() except TimeoutError: print("The long operation timed out, but we've handled it.")
print("This statement will run regardless.") | trusted_official_docs | CPython Docs | loop = get_running_loop() deadline = loop.time() + 20 try: async with asyncio.timeout_at(deadline): await long_running_task() except TimeoutError: print("The long operation timed out, but we've handled it.")
print("This statement will run regardless.") | loop = get_running_loop() deadline = loop.time() + 20 try: async with asyncio.timeout_at(deadline): await long_running_task() except TimeoutError: print("The long operation timed out, but we've handled it.")
print("This statement will run regardless.") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a7108f5-1064-41b5-a4a6-dd132e83d795 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,952 | supabase-export-v2 | 355faabe91660bba | If it is desired to completely ignore cancellation (not recommended) the ``shield()`` function should be combined with a try/except clause, as follows::
task = asyncio.create_task(something())
try:
res = await shield(task)
except CancelledError:
res = None | trusted_official_docs | CPython Docs | If it is desired to completely ignore cancellation (not recommended) the ``shield()`` function should be combined with a try/except clause, as follows::
task = asyncio.create_task(something())
try:
res = await shield(task)
except CancelledError:
res = None | If it is desired to completely ignore cancellation (not recommended) the ``shield()`` function should be combined with a try/except clause, as follows::
task = asyncio.create_task(something())
try:
res = await shield(task)
except CancelledError:
res = None | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c8ca193-f8c4-484b-a018-857d3d524fc4 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,847 | supabase-export-v2 | 65a65f0bf9edbda9 | the same as that of the :class:`Task` constructor (or factory) - all of the keyword arguments to this function are passed through to that interface.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the *coro* to run in. The current context copy is created when no ... | trusted_official_docs | CPython Docs | the same as that of the :class:`Task` constructor (or factory) - all of the keyword arguments to this function are passed through to that interface.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the *coro* to run in. The current context copy is created when no ... | the same as that of the :class:`Task` constructor (or factory) - all of the keyword arguments to this function are passed through to that interface.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the *coro* to run in. The current context copy is created when no ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8da12dba-1235-4c09-8855-68502f888d44 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,949 | supabase-export-v2 | 5710ad164c7809af | res = await something()
*except* that if the coroutine containing it is cancelled, the
Task running in ``something()`` is not cancelled. From the point
of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the "await" expression
still raises a :exc:`CancelledError`. | trusted_official_docs | CPython Docs | res = await something()
*except* that if the coroutine containing it is cancelled, the
Task running in ``something()`` is not cancelled. From the point
of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the "await" expression
still raises a :exc:`CancelledError`. | res = await something()
*except* that if the coroutine containing it is cancelled, the
Task running in ``something()`` is not cancelled. From the point
of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the "await" expression
still raises a :exc:`CancelledError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f0b7df4-b13c-41a5-8bc3-1579d927ccc0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,016 | supabase-export-v2 | 59505bb06b889537 | *timeout* (a float or int), if specified, can be used to control the maximum number of seconds to wait before returning.
Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks that aren't done when the timeout occurs are simply
returned in the second set. | trusted_official_docs | CPython Docs | *timeout* (a float or int), if specified, can be used to control the maximum number of seconds to wait before returning.
Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks that aren't done when the timeout occurs are simply
returned in the second set. | *timeout* (a float or int), if specified, can be used to control the maximum number of seconds to wait before returning.
Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks that aren't done when the timeout occurs are simply
returned in the second set. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
92b66b4c-9f69-4073-8da0-21a9b0d13fe2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,865 | supabase-export-v2 | 244b0fa6e71c6cfb | caught, it should generally be propagated when clean-up is complete. :exc:`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most code will not need to be aware of it.
The asyncio components that enable structured concurrency, like
:class:`asyncio.TaskGroup` and :func:`asyncio.timeout`,
are implemente... | trusted_official_docs | CPython Docs | caught, it should generally be propagated when clean-up is complete. :exc:`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most code will not need to be aware of it.
The asyncio components that enable structured concurrency, like
:class:`asyncio.TaskGroup` and :func:`asyncio.timeout`,
are implemente... | caught, it should generally be propagated when clean-up is complete. :exc:`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most code will not need to be aware of it.
The asyncio components that enable structured concurrency, like
:class:`asyncio.TaskGroup` and :func:`asyncio.timeout`,
are implemente... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
960744ec-7287-4673-8aab-2828ef8f1eae | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,037 | supabase-export-v2 | 92a868a2657fe78b | must be # awaited to obtain the result value or raise the exception of the # awaitable that finishes next. reader, writer = await next_connect
A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables
are done. This is raised by the ``async for`` loop during asynchronous
iteration or by the coroutin... | trusted_official_docs | CPython Docs | must be # awaited to obtain the result value or raise the exception of the # awaitable that finishes next. reader, writer = await next_connect
A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables
are done. This is raised by the ``async for`` loop during asynchronous
iteration or by the coroutin... | must be # awaited to obtain the result value or raise the exception of the # awaitable that finishes next. reader, writer = await next_connect
A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables
are done. This is raised by the ``async for`` loop during asynchronous
iteration or by the coroutin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
99109959-5b0e-4329-a045-e41262df30fb | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,932 | supabase-export-v2 | 5c7a93967411ddb9 | A task factory for eager task execution.
When using this factory (via :meth:`loop.set_task_factory(asyncio.eager_task_factory) <loop.set_task_factory>`),
coroutines begin execution synchronously during :class:`Task` construction. Tasks are only scheduled on the event loop if they block. This can be a performance impro... | trusted_official_docs | CPython Docs | A task factory for eager task execution.
When using this factory (via :meth:`loop.set_task_factory(asyncio.eager_task_factory) <loop.set_task_factory>`),
coroutines begin execution synchronously during :class:`Task` construction. Tasks are only scheduled on the event loop if they block. This can be a performance impro... | A task factory for eager task execution.
When using this factory (via :meth:`loop.set_task_factory(asyncio.eager_task_factory) <loop.set_task_factory>`),
coroutines begin execution synchronously during :class:`Task` construction. Tasks are only scheduled on the event loop if they block. This can be a performance impro... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a93eb96-d4e8-4e66-84d3-39978f938415 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,878 | supabase-export-v2 | 46fe82ceb99a0dae | .. method:: cancel()
Cancel the task group. This is a non-exceptional, early exit of the
task group's lifetime -- useful once the group's goal has been met or
its services no longer needed. | trusted_official_docs | CPython Docs | .. method:: cancel()
Cancel the task group. This is a non-exceptional, early exit of the
task group's lifetime -- useful once the group's goal has been met or
its services no longer needed. | .. method:: cancel()
Cancel the task group. This is a non-exceptional, early exit of the
task group's lifetime -- useful once the group's goal has been met or
its services no longer needed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ad16ef3-84cb-4e52-88fd-c73fb3b5acb1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,160 | supabase-export-v2 | 22bdbdca2fde316e | The method arranges for a :exc:`CancelledError` exception to be thrown into the wrapped coroutine on the next cycle of the event loop.
The coroutine then has a chance to clean up or even deny the
request by suppressing the exception with a :keyword:`try` ... ... ``except CancelledError`` ... :keyword:`finally` block. ... | trusted_official_docs | CPython Docs | The method arranges for a :exc:`CancelledError` exception to be thrown into the wrapped coroutine on the next cycle of the event loop.
The coroutine then has a chance to clean up or even deny the
request by suppressing the exception with a :keyword:`try` ... ... ``except CancelledError`` ... :keyword:`finally` block. ... | The method arranges for a :exc:`CancelledError` exception to be thrown into the wrapped coroutine on the next cycle of the event loop.
The coroutine then has a chance to clean up or even deny the
request by suppressing the exception with a :keyword:`try` ... ... ``except CancelledError`` ... :keyword:`finally` block. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a044e8f2-2518-4e69-b99a-63071ecb0c7b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,914 | supabase-export-v2 | f8aa8210c912a096 | are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in *aws*.
If *return_exceptions* is ``False`` (default), the first
raised exception is immediately propagated to the task that
awaits on ``gather()``. Other awaitables in t... | trusted_official_docs | CPython Docs | are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in *aws*.
If *return_exceptions* is ``False`` (default), the first
raised exception is immediately propagated to the task that
awaits on ``gather()``. Other awaitables in t... | are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in *aws*.
If *return_exceptions* is ``False`` (default), the first
raised exception is immediately propagated to the task that
awaits on ``gather()``. Other awaitables in t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6a46e63-9d71-440c-8dd8-bf2bab2eb4a9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,134 | supabase-export-v2 | 5766f9da7e15436b | Only one stack frame is returned for a suspended coroutine.
The optional *limit* argument sets the maximum number of frames
to return; by default all available frames are returned. The ordering of the returned list differs depending on whether
a stack or a traceback is returned: the newest frames of a
stack are retu... | trusted_official_docs | CPython Docs | Only one stack frame is returned for a suspended coroutine.
The optional *limit* argument sets the maximum number of frames
to return; by default all available frames are returned. The ordering of the returned list differs depending on whether
a stack or a traceback is returned: the newest frames of a
stack are retu... | Only one stack frame is returned for a suspended coroutine.
The optional *limit* argument sets the maximum number of frames
to return; by default all available frames are returned. The ordering of the returned list differs depending on whether
a stack or a traceback is returned: the newest frames of a
stack are retu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6d38b03-87c3-41e7-bf23-612b39f30cc9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,779 | supabase-export-v2 | 30c20938be4cd06c | ----------------------------------------------------
:term:`Coroutines <coroutine>` declared with the async/await syntax is the
preferred way of writing asyncio applications. For example, the following
snippet of code prints "hello", waits 1 second,
and then prints "world":: | trusted_official_docs | CPython Docs | ----------------------------------------------------
:term:`Coroutines <coroutine>` declared with the async/await syntax is the
preferred way of writing asyncio applications. For example, the following
snippet of code prints "hello", waits 1 second,
and then prints "world":: | ----------------------------------------------------
:term:`Coroutines <coroutine>` declared with the async/await syntax is the
preferred way of writing asyncio applications. For example, the following
snippet of code prints "hello", waits 1 second,
and then prints "world":: | 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.