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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a8519ae0-3a9f-4106-a556-639505a82272 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,028 | supabase-export-v2 | 99adc1a0e3858b27 | .. function:: as_completed(aws, *, timeout=None)
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable
concurrently. The returned object can be iterated to obtain the results
of the awaitables as they finish. | trusted_official_docs | CPython Docs | .. function:: as_completed(aws, *, timeout=None)
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable
concurrently. The returned object can be iterated to obtain the results
of the awaitables as they finish. | .. function:: as_completed(aws, *, timeout=None)
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable
concurrently. The returned object can be iterated to obtain the results
of the awaitables as they finish. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a9ee3f9f-2c57-4c3a-9166-801897707b3a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,787 | supabase-export-v2 | 699785d3dd10ed47 | * The :func:`asyncio.run` function to run the top-level entry point "main()" function (see the above example.)
* Awaiting on a coroutine. The following snippet of code will
print "hello" after waiting for 1 second, and then print "world"
after waiting for *another* 2 seconds:: | trusted_official_docs | CPython Docs | * The :func:`asyncio.run` function to run the top-level entry point "main()" function (see the above example.)
* Awaiting on a coroutine. The following snippet of code will
print "hello" after waiting for 1 second, and then print "world"
after waiting for *another* 2 seconds:: | * The :func:`asyncio.run` function to run the top-level entry point "main()" function (see the above example.)
* Awaiting on a coroutine. The following snippet of code will
print "hello" after waiting for 1 second, and then print "world"
after waiting for *another* 2 seconds:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aded8d04-ae74-48ff-9d18-7933ee171ef5 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,883 | supabase-export-v2 | 207c43d17eb28c64 | Some ways to use :meth:`cancel`:
* call it from the task group body based on some condition or event
* pass the task group instance to child tasks via :meth:`create_task`, allowing a child
task to conditionally cancel the entire entire group
* pass the task group instance or bound :meth:`cancel` method to some other... | trusted_official_docs | CPython Docs | Some ways to use :meth:`cancel`:
* call it from the task group body based on some condition or event
* pass the task group instance to child tasks via :meth:`create_task`, allowing a child
task to conditionally cancel the entire entire group
* pass the task group instance or bound :meth:`cancel` method to some other... | Some ways to use :meth:`cancel`:
* call it from the task group body based on some condition or event
* pass the task group instance to child tasks via :meth:`create_task`, allowing a child
task to conditionally cancel the entire entire group
* pass the task group instance or bound :meth:`cancel` method to some other... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ae37d764-1aff-4a47-b5b0-57fac4a83457 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,030 | supabase-export-v2 | 947feb04e58e5609 | is used, the originally-supplied awaitables are yielded if they are tasks or futures. This makes it easy to correlate previously-scheduled tasks with their results. Example::
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
ipv6_connect = create_task(open_connection("::1", 80))
tasks = [ipv4_connect, ipv6... | trusted_official_docs | CPython Docs | is used, the originally-supplied awaitables are yielded if they are tasks or futures. This makes it easy to correlate previously-scheduled tasks with their results. Example::
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
ipv6_connect = create_task(open_connection("::1", 80))
tasks = [ipv4_connect, ipv6... | is used, the originally-supplied awaitables are yielded if they are tasks or futures. This makes it easy to correlate previously-scheduled tasks with their results. Example::
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
ipv6_connect = create_task(open_connection("::1", 80))
tasks = [ipv4_connect, ipv6... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b01e4e5d-0931-4769-bfd8-81646b9a2298 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,997 | supabase-export-v2 | 2b4f608f8833216f | *timeout* can either be ``None`` or a float or int number of seconds to wait for. If *timeout* is ``None``, block until the future completes.
If a timeout occurs, it cancels the task and raises
:exc:`TimeoutError`. | trusted_official_docs | CPython Docs | *timeout* can either be ``None`` or a float or int number of seconds to wait for. If *timeout* is ``None``, block until the future completes.
If a timeout occurs, it cancels the task and raises
:exc:`TimeoutError`. | *timeout* can either be ``None`` or a float or int number of seconds to wait for. If *timeout* is ``None``, block until the future completes.
If a timeout occurs, it cancels the task and raises
:exc:`TimeoutError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b176987a-eff5-4fa1-a806-95194ddb554f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,888 | supabase-export-v2 | 85e703f3de92577e | ``async with`` statement is also cancelled. The resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not bubble out of the containing ``async with`` statement.
Once all tasks have finished, if any tasks have failed
with an exception other than :exc:`asyncio.CancelledError`,
those exceptions ... | trusted_official_docs | CPython Docs | ``async with`` statement is also cancelled. The resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not bubble out of the containing ``async with`` statement.
Once all tasks have finished, if any tasks have failed
with an exception other than :exc:`asyncio.CancelledError`,
those exceptions ... | ``async with`` statement is also cancelled. The resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not bubble out of the containing ``async with`` statement.
Once all tasks have finished, if any tasks have failed
with an exception other than :exc:`asyncio.CancelledError`,
those exceptions ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b7c849e5-56f3-4282-b2f7-a57fc4d85609 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,113 | supabase-export-v2 | 8eb86d1f79a6e756 | Return the result of the Task.
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.) | trusted_official_docs | CPython Docs | Return the result of the Task.
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.) | Return the result of the Task.
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.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b96c270c-576f-4e85-ac83-2d570c4df4c0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,161 | supabase-export-v2 | 892864bb8ad264fc | common and is actively discouraged. Should the coroutine nevertheless decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` in addition to catching the exception.
If the Task being cancelled is currently awaiting on a future-like
object, that awaited object will also be cancelled. This cancellati... | trusted_official_docs | CPython Docs | common and is actively discouraged. Should the coroutine nevertheless decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` in addition to catching the exception.
If the Task being cancelled is currently awaiting on a future-like
object, that awaited object will also be cancelled. This cancellati... | common and is actively discouraged. Should the coroutine nevertheless decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` in addition to catching the exception.
If the Task being cancelled is currently awaiting on a future-like
object, that awaited object will also be cancelled. This cancellati... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c35a5dee-f60b-463a-b0f4-974fe6112d3e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,056 | supabase-export-v2 | 611c3420854cc112 | .. note::
Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used
to make IO-bound functions non-blocking. However, for extension modules
that release the GIL or alternative Python implementations that don't
have one, ``asyncio.to_thread()`` can also be used for CPU-bound functions. | trusted_official_docs | CPython Docs | .. note::
Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used
to make IO-bound functions non-blocking. However, for extension modules
that release the GIL or alternative Python implementations that don't
have one, ``asyncio.to_thread()`` can also be used for CPU-bound functions. | .. note::
Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used
to make IO-bound functions non-blocking. However, for extension modules
that release the GIL or alternative Python implementations that don't
have one, ``asyncio.to_thread()`` can also be used for CPU-bound functions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c5ba80c6-fe52-4516-bcb3-55e86b6796a6 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,917 | supabase-export-v2 | f015265870a826d1 | If ``gather()`` is *cancelled*, all submitted awaitables (that have not completed yet) are also *cancelled*.
If any Task or Future from the *aws* sequence is *cancelled*, it is
treated as if it raised :exc:`CancelledError` -- the ``gather()``
call is **not** cancelled in this case. This is to prevent the
cancellatio... | trusted_official_docs | CPython Docs | If ``gather()`` is *cancelled*, all submitted awaitables (that have not completed yet) are also *cancelled*.
If any Task or Future from the *aws* sequence is *cancelled*, it is
treated as if it raised :exc:`CancelledError` -- the ``gather()``
call is **not** cancelled in this case. This is to prevent the
cancellatio... | If ``gather()`` is *cancelled*, all submitted awaitables (that have not completed yet) are also *cancelled*.
If any Task or Future from the *aws* sequence is *cancelled*, it is
treated as if it raised :exc:`CancelledError` -- the ``gather()``
call is **not** cancelled in this case. This is to prevent the
cancellatio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c612f3dc-c6cc-49d1-8b50-9ac9ff5065f9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,933 | supabase-export-v2 | 413c4be8155ae515 | the event loop if they block. This can be a performance improvement as the overhead of loop scheduling is avoided for coroutines that complete synchronously.
A common example where this is beneficial is coroutines which employ
caching or memoization to avoid actual I/O when possible. | trusted_official_docs | CPython Docs | the event loop if they block. This can be a performance improvement as the overhead of loop scheduling is avoided for coroutines that complete synchronously.
A common example where this is beneficial is coroutines which employ
caching or memoization to avoid actual I/O when possible. | the event loop if they block. This can be a performance improvement as the overhead of loop scheduling is avoided for coroutines that complete synchronously.
A common example where this is beneficial is coroutines which employ
caching or memoization to avoid actual I/O when possible. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8751c8f-12aa-4058-89b7-20c05ce1d41b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,999 | supabase-export-v2 | c7766eec0aa3bf92 | To avoid the task :meth:`cancellation <Task.cancel>`, wrap it in :func:`shield`.
The function will 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. | trusted_official_docs | CPython Docs | To avoid the task :meth:`cancellation <Task.cancel>`, wrap it in :func:`shield`.
The function will 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. | To avoid the task :meth:`cancellation <Task.cancel>`, wrap it in :func:`shield`.
The function will 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9493054-83bf-4941-a11c-287c4a221a9c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,096 | supabase-export-v2 | 350e444ebaaf9979 | the execution of the coroutine and waits for the completion of the Future. When the Future is *done*, the execution of the wrapped coroutine resumes.
Event loops use cooperative scheduling: an event loop runs
one Task at a time. While a Task awaits for the completion of a
Future, the event loop runs other Tasks, call... | trusted_official_docs | CPython Docs | the execution of the coroutine and waits for the completion of the Future. When the Future is *done*, the execution of the wrapped coroutine resumes.
Event loops use cooperative scheduling: an event loop runs
one Task at a time. While a Task awaits for the completion of a
Future, the event loop runs other Tasks, call... | the execution of the coroutine and waits for the completion of the Future. When the Future is *done*, the execution of the wrapped coroutine resumes.
Event loops use cooperative scheduling: an event loop runs
one Task at a time. While a Task awaits for the completion of a
Future, the event loop runs other Tasks, call... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb66b484-de60-441b-bd1b-ee7322d87f57 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,182 | supabase-export-v2 | 050f4a58cbd2f8a4 | successfully uncancelled, this allows for elements of structured concurrency like :ref:`taskgroups` and :func:`asyncio.timeout` to continue running, isolating cancellation to the respective structured block. For example::
async def make_request_with_timeout():
try:
async with asyncio.timeout(1):
# Structured block a... | trusted_official_docs | CPython Docs | successfully uncancelled, this allows for elements of structured concurrency like :ref:`taskgroups` and :func:`asyncio.timeout` to continue running, isolating cancellation to the respective structured block. For example::
async def make_request_with_timeout():
try:
async with asyncio.timeout(1):
# Structured block a... | successfully uncancelled, this allows for elements of structured concurrency like :ref:`taskgroups` and :func:`asyncio.timeout` to continue running, isolating cancellation to the respective structured block. For example::
async def make_request_with_timeout():
try:
async with asyncio.timeout(1):
# Structured block a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ceaf09a4-3a37-48c5-8a80-c7475d43caa0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,890 | supabase-export-v2 | 0ae05c4ebdec993e | task group still cancels the remaining tasks and waits for them, but then the initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`.
If the body of the ``async with`` statement exits with an exception
(so :meth:`~object.__aexit__` is called with... | trusted_official_docs | CPython Docs | task group still cancels the remaining tasks and waits for them, but then the initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`.
If the body of the ``async with`` statement exits with an exception
(so :meth:`~object.__aexit__` is called with... | task group still cancels the remaining tasks and waits for them, but then the initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`.
If the body of the ``async with`` statement exits with an exception
(so :meth:`~object.__aexit__` is called with... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3b73694-8a70-4528-8b59-803e76658b3c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,925 | supabase-export-v2 | ab95d8709349d4c1 | an exception to the caller, therefore, calling ``gather.cancel()`` after catching an exception (raised by one of the awaitables) from gather won't cancel any other awaitables.
.. versionchanged:: 3.7
If the *gather* itself is cancelled, the cancellation is
propagated regardless of *return_exceptions*. | trusted_official_docs | CPython Docs | an exception to the caller, therefore, calling ``gather.cancel()`` after catching an exception (raised by one of the awaitables) from gather won't cancel any other awaitables.
.. versionchanged:: 3.7
If the *gather* itself is cancelled, the cancellation is
propagated regardless of *return_exceptions*. | an exception to the caller, therefore, calling ``gather.cancel()`` after catching an exception (raised by one of the awaitables) from gather won't cancel any other awaitables.
.. versionchanged:: 3.7
If the *gather* itself is cancelled, the cancellation is
propagated regardless of *return_exceptions*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d4f0dfd4-8966-432c-8e61-f68a17b3d4d6 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,940 | supabase-export-v2 | d6010124fa4ea6d9 | *custom_task_constructor* must be a *callable* with the signature matching the signature of :class:`Task.__init__ <Task>`. The callable must return a :class:`asyncio.Task`-compatible object.
This function returns a *callable* intended to be used as a task factory of an
event loop via :meth:`loop.set_task_factory(facto... | trusted_official_docs | CPython Docs | *custom_task_constructor* must be a *callable* with the signature matching the signature of :class:`Task.__init__ <Task>`. The callable must return a :class:`asyncio.Task`-compatible object.
This function returns a *callable* intended to be used as a task factory of an
event loop via :meth:`loop.set_task_factory(facto... | *custom_task_constructor* must be a *callable* with the signature matching the signature of :class:`Task.__init__ <Task>`. The callable must return a :class:`asyncio.Task`-compatible object.
This function returns a *callable* intended to be used as a task factory of an
event loop via :meth:`loop.set_task_factory(facto... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d5c28ea9-3372-4636-b77b-e374324d6876 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,869 | supabase-export-v2 | 28a0f21b1d75cb1f | .. class:: TaskGroup()
An :ref:`asynchronous context manager <async-context-managers>`
holding a group of tasks. Tasks can be added to the group using :meth:`create_task`. All tasks are awaited when the context manager exits. | trusted_official_docs | CPython Docs | .. class:: TaskGroup()
An :ref:`asynchronous context manager <async-context-managers>`
holding a group of tasks. Tasks can be added to the group using :meth:`create_task`. All tasks are awaited when the context manager exits. | .. class:: TaskGroup()
An :ref:`asynchronous context manager <async-context-managers>`
holding a group of tasks. Tasks can be added to the group using :meth:`create_task`. All tasks are awaited when the context manager exits. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d6fe2bde-ef62-493c-9a20-7d6886c2dabe | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,073 | supabase-export-v2 | 650a2cd96494eee8 | 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() try: yield loop finally: loop.call_soon_threadsafe(stop_event.set) else: fut.result()
# Create a loop in another thread
with loop_in_thread() as loop... | trusted_official_docs | CPython Docs | 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() try: yield loop finally: loop.call_soon_threadsafe(stop_event.set) else: fut.result()
# Create a loop in another thread
with loop_in_thread() as loop... | 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() try: yield loop finally: loop.call_soon_threadsafe(stop_event.set) else: fut.result()
# Create a loop in another thread
with loop_in_thread() as loop... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d7e27401-4a8e-4935-a81f-0f0852d1e956 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,048 | supabase-export-v2 | ff66d8c7a51cbfb2 | 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::
def blocking_io():
print(f"start blocking_io at {time.strftime('%X')}")
# Note that time.sleep() can be replaced with any blocking
# IO-bound operation, such as fi... | trusted_official_docs | CPython Docs | 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::
def blocking_io():
print(f"start blocking_io at {time.strftime('%X')}")
# Note that time.sleep() can be replaced with any blocking
# IO-bound operation, such as fi... | 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::
def blocking_io():
print(f"start blocking_io at {time.strftime('%X')}")
# Note that time.sleep() can be replaced with any blocking
# IO-bound operation, such as fi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d84d6b38-e1ed-4307-a3f6-12c118e10905 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,951 | supabase-export-v2 | 58f53835ac511a0a | If ``something()`` is cancelled by other means (i.e. from within itself) that would also cancel ``shield()``.
If it is desired to completely ignore cancellation (not recommended)
the ``shield()`` function should be combined with a try/except
clause, as follows:: | trusted_official_docs | CPython Docs | If ``something()`` is cancelled by other means (i.e. from within itself) that would also cancel ``shield()``.
If it is desired to completely ignore cancellation (not recommended)
the ``shield()`` function should be combined with a try/except
clause, as follows:: | If ``something()`` is cancelled by other means (i.e. from within itself) that would also cancel ``shield()``.
If it is desired to completely ignore cancellation (not recommended)
the ``shield()`` function should be combined with a try/except
clause, as follows:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d915efc9-a362-4db4-9248-98b538ffa5d6 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,879 | supabase-export-v2 | f05b84c405c31318 | 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.
:meth:`~asyncio.Task.cancel` will be called on any tasks in the group that
aren't yet done, as well as the parent (body) of the group. The task group
context manager will exit *... | trusted_official_docs | CPython Docs | 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.
:meth:`~asyncio.Task.cancel` will be called on any tasks in the group that
aren't yet done, as well as the parent (body) of the group. The task group
context manager will exit *... | 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.
:meth:`~asyncio.Task.cancel` will be called on any tasks in the group that
aren't yet done, as well as the parent (body) of the group. The task group
context manager will exit *... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
daf207ca-24f9-4271-a948-38c86e1afc28 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,154 | supabase-export-v2 | eae96c3339fb3c84 | The *value* argument can be any object, which is then converted to a string.
In the default Task implementation, the name will be visible
in the :func:`repr` output of a task object. | trusted_official_docs | CPython Docs | The *value* argument can be any object, which is then converted to a string.
In the default Task implementation, the name will be visible
in the :func:`repr` output of a task object. | The *value* argument can be any object, which is then converted to a string.
In the default Task implementation, the name will be visible
in the :func:`repr` output of a task object. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
db1d6f40-6865-483f-8c50-0caddbad4737 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,939 | supabase-export-v2 | dba1b2d3643f3271 | Create an eager task factory, similar to :func:`eager_task_factory`, using the provided *custom_task_constructor* when creating a new task instead of the default :class:`Task`.
*custom_task_constructor* must be a *callable* with the signature matching
the signature of :class:`Task.__init__ <Task>`. The callable must r... | trusted_official_docs | CPython Docs | Create an eager task factory, similar to :func:`eager_task_factory`, using the provided *custom_task_constructor* when creating a new task instead of the default :class:`Task`.
*custom_task_constructor* must be a *callable* with the signature matching
the signature of :class:`Task.__init__ <Task>`. The callable must r... | Create an eager task factory, similar to :func:`eager_task_factory`, using the provided *custom_task_constructor* when creating a new task instead of the default :class:`Task`.
*custom_task_constructor* must be a *callable* with the signature matching
the signature of :class:`Task.__init__ <Task>`. The callable must r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd1c6ba5-4ffc-4041-853c-6c0cd8e9bdfe | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,983 | supabase-export-v2 | 758f1d933067cb9a | 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)
await long_running_task()
except TimeoutError:
pass | trusted_official_docs | CPython Docs | 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)
await long_running_task()
except TimeoutError:
pass | 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)
await long_running_task()
except TimeoutError:
pass | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd20af7a-972a-42de-bd1d-e847c8f06e1a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,036 | supabase-export-v2 | 32822f8af90d3943 | ipv4_connect = create_task(open_connection("127.0.0.1", 80)) ipv6_connect = create_task(open_connection("::1", 80)) tasks = [ipv4_connect, ipv6_connect]
for next_connect in as_completed(tasks):
# next_connect is not one of the original task objects. It must be
# awaited to obtain the result value or raise the excepti... | trusted_official_docs | CPython Docs | ipv4_connect = create_task(open_connection("127.0.0.1", 80)) ipv6_connect = create_task(open_connection("::1", 80)) tasks = [ipv4_connect, ipv6_connect]
for next_connect in as_completed(tasks):
# next_connect is not one of the original task objects. It must be
# awaited to obtain the result value or raise the excepti... | ipv4_connect = create_task(open_connection("127.0.0.1", 80)) ipv6_connect = create_task(open_connection("::1", 80)) tasks = [ipv4_connect, ipv6_connect]
for next_connect in as_completed(tasks):
# next_connect is not one of the original task objects. It must be
# awaited to obtain the result value or raise the excepti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd6c0d66-edc8-4a46-b6da-4e8f3757377a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,921 | supabase-export-v2 | ceb804adbfc64ce5 | for i in range(2, number + 1): print(f"Task {name}: Compute factorial({number}), currently i={i}...") await asyncio.sleep(1) f *= i print(f"Task {name}: factorial({number}) = {f}") return f
async def main():
# Schedule three calls *concurrently*:
L = await asyncio.gather(
factorial("A", 2),
factorial("B", 3),
fact... | trusted_official_docs | CPython Docs | for i in range(2, number + 1): print(f"Task {name}: Compute factorial({number}), currently i={i}...") await asyncio.sleep(1) f *= i print(f"Task {name}: factorial({number}) = {f}") return f
async def main():
# Schedule three calls *concurrently*:
L = await asyncio.gather(
factorial("A", 2),
factorial("B", 3),
fact... | for i in range(2, number + 1): print(f"Task {name}: Compute factorial({number}), currently i={i}...") await asyncio.sleep(1) f *= i print(f"Task {name}: factorial({number}) = {f}") return f
async def main():
# Schedule three calls *concurrently*:
L = await asyncio.gather(
factorial("A", 2),
factorial("B", 3),
fact... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dedd25c6-84b2-45fa-b114-501f2df360c1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,886 | supabase-export-v2 | dbdd20dcf22d23c2 | async def main(): async with asyncio.TaskGroup() as tg: task1 = tg.create_task(some_coro(...)) task2 = tg.create_task(another_coro(...)) print(f"Both tasks have completed now: {task1.result()}, {task2.result()}")
The ``async with`` statement will wait for all tasks in the group to finish. While waiting, new tasks may s... | trusted_official_docs | CPython Docs | async def main(): async with asyncio.TaskGroup() as tg: task1 = tg.create_task(some_coro(...)) task2 = tg.create_task(another_coro(...)) print(f"Both tasks have completed now: {task1.result()}, {task2.result()}")
The ``async with`` statement will wait for all tasks in the group to finish. While waiting, new tasks may s... | async def main(): async with asyncio.TaskGroup() as tg: task1 = tg.create_task(some_coro(...)) task2 = tg.create_task(another_coro(...)) print(f"Both tasks have completed now: {task1.result()}, {task2.result()}")
The ``async with`` statement will wait for all tasks in the group to finish. While waiting, new tasks may s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e243cd71-e034-496a-b59c-4778ff5e2ee9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,872 | supabase-export-v2 | c1688ec60a90cb79 | .. method:: create_task(coro, *, name=None, context=None, eager_start=None, **kwargs)
Create a task in this task group. The signature matches that of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet entered,
already finished, or in the process of shutting down),
we will close the given ``coro`... | trusted_official_docs | CPython Docs | .. method:: create_task(coro, *, name=None, context=None, eager_start=None, **kwargs)
Create a task in this task group. The signature matches that of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet entered,
already finished, or in the process of shutting down),
we will close the given ``coro`... | .. method:: create_task(coro, *, name=None, context=None, eager_start=None, **kwargs)
Create a task in this task group. The signature matches that of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet entered,
already finished, or in the process of shutting down),
we will close the given ``coro`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e26de204-9953-433d-89db-4007c992557b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,834 | supabase-export-v2 | ce3904c7f24f312f | A :class:`Future` is a special **low-level** awaitable object that represents an **eventual result** of an asynchronous operation.
When a Future object is *awaited* it means that the coroutine will
wait until the Future is resolved in some other place. | trusted_official_docs | CPython Docs | A :class:`Future` is a special **low-level** awaitable object that represents an **eventual result** of an asynchronous operation.
When a Future object is *awaited* it means that the coroutine will
wait until the Future is resolved in some other place. | A :class:`Future` is a special **low-level** awaitable object that represents an **eventual result** of an asynchronous operation.
When a Future object is *awaited* it means that the coroutine will
wait until the Future is resolved in some other place. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e50784e6-c3b4-4fe8-b34f-5ba22f434f53 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,103 | supabase-export-v2 | 48888f8e418d9959 | the coroutine blocks. If the coroutine returns or raises without blocking, the task will be finished eagerly and will skip scheduling to the event loop.
.. versionchanged:: 3.7
Added support for the :mod:`contextvars` module. | trusted_official_docs | CPython Docs | the coroutine blocks. If the coroutine returns or raises without blocking, the task will be finished eagerly and will skip scheduling to the event loop.
.. versionchanged:: 3.7
Added support for the :mod:`contextvars` module. | the coroutine blocks. If the coroutine returns or raises without blocking, the task will be finished eagerly and will skip scheduling to the event loop.
.. versionchanged:: 3.7
Added support for the :mod:`contextvars` module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e54c29fd-a96e-4922-a1a9-047b02764588 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,959 | supabase-export-v2 | a52495c51e5d4293 | Return an :ref:`asynchronous context manager <async-context-managers>` that can be used to limit the amount of time spent waiting on something.
*delay* can either be ``None``, or a float/int number of
seconds to wait. If *delay* is ``None``, no time limit will
be applied; this can be useful if the delay is unknown wh... | trusted_official_docs | CPython Docs | Return an :ref:`asynchronous context manager <async-context-managers>` that can be used to limit the amount of time spent waiting on something.
*delay* can either be ``None``, or a float/int number of
seconds to wait. If *delay* is ``None``, no time limit will
be applied; this can be useful if the delay is unknown wh... | Return an :ref:`asynchronous context manager <async-context-managers>` that can be used to limit the amount of time spent waiting on something.
*delay* can either be ``None``, or a float/int number of
seconds to wait. If *delay* is ``None``, no time limit will
be applied; this can be useful if the delay is unknown wh... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e6684bcf-cf45-47d8-af84-91ffac1a1304 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,017 | supabase-export-v2 | 3978b7e781bb7089 | 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.
*return_when* indicates when this function should return. It must
be one of the following constants: | trusted_official_docs | CPython Docs | 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.
*return_when* indicates when this function should return. It must
be one of the following constants: | 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.
*return_when* indicates when this function should return. It must
be one of the following constants: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ee332c10-1ce6-4a78-a858-680302dfb07f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,031 | supabase-export-v2 | 6a84531c25601fa1 | ipv4_connect = create_task(open_connection("127.0.0.1", 80)) ipv6_connect = create_task(open_connection("::1", 80)) tasks = [ipv4_connect, ipv6_connect]
async for earliest_connect in as_completed(tasks):
# earliest_connect is done. The result can be obtained by
# awaiting it or calling earliest_connect.result()
read... | trusted_official_docs | CPython Docs | ipv4_connect = create_task(open_connection("127.0.0.1", 80)) ipv6_connect = create_task(open_connection("::1", 80)) tasks = [ipv4_connect, ipv6_connect]
async for earliest_connect in as_completed(tasks):
# earliest_connect is done. The result can be obtained by
# awaiting it or calling earliest_connect.result()
read... | ipv4_connect = create_task(open_connection("127.0.0.1", 80)) ipv6_connect = create_task(open_connection("::1", 80)) tasks = [ipv4_connect, ipv6_connect]
async for earliest_connect in as_completed(tasks):
# earliest_connect is done. The result can be obtained by
# awaiting it or calling earliest_connect.result()
read... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eee672af-2733-4750-b27a-dcaed2a48c0c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,920 | supabase-export-v2 | 35ef98dab4c40612 | import asyncio
async def factorial(name, number):
f = 1
for i in range(2, number + 1):
print(f"Task {name}: Compute factorial({number}), currently i={i}...")
await asyncio.sleep(1)
f *= i
print(f"Task {name}: factorial({number}) = {f}")
return f | trusted_official_docs | CPython Docs | import asyncio
async def factorial(name, number):
f = 1
for i in range(2, number + 1):
print(f"Task {name}: Compute factorial({number}), currently i={i}...")
await asyncio.sleep(1)
f *= i
print(f"Task {name}: factorial({number}) = {f}")
return f | import asyncio
async def factorial(name, number):
f = 1
for i in range(2, number + 1):
print(f"Task {name}: Compute factorial({number}), currently i={i}...")
await asyncio.sleep(1)
f *= i
print(f"Task {name}: factorial({number}) = {f}")
return f | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f15cb71a-c4d5-494c-b870-06d3fe31ec71 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,045 | supabase-export-v2 | 5325a6e4b0cf4a69 | Asynchronously run function *func* in a separate thread.
Any \*args and \*\*kwargs supplied for this function are 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. | trusted_official_docs | CPython Docs | Asynchronously run function *func* in a separate thread.
Any \*args and \*\*kwargs supplied for this function are 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. | Asynchronously run function *func* in a separate thread.
Any \*args and \*\*kwargs supplied for this function are 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f55b33df-0d9c-49f1-b4ce-4065054585d4 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,853 | supabase-export-v2 | baf8a15da578ea64 | .. important::
Save a reference to the result of 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. For reliable "fire-and-forget" background tasks, gather ... | trusted_official_docs | CPython Docs | .. important::
Save a reference to the result of 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. For reliable "fire-and-forget" background tasks, gather ... | .. important::
Save a reference to the result of 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. For reliable "fire-and-forget" background tasks, gather ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f575c256-178c-4a37-a6bb-ce58c21d514d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,077 | supabase-export-v2 | 4198cc9fa23c33f9 | 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::
try:
result = future.result(timeout)
except TimeoutError:
print('The coroutine took too long, cancelling the task...')
future.cancel()
except Exception as exc:
print(f'The corouti... | trusted_official_docs | CPython Docs | 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::
try:
result = future.result(timeout)
except TimeoutError:
print('The coroutine took too long, cancelling the task...')
future.cancel()
except Exception as exc:
print(f'The corouti... | 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::
try:
result = future.result(timeout)
except TimeoutError:
print('The coroutine took too long, cancelling the task...')
future.cancel()
except Exception as exc:
print(f'The corouti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f58980f8-ee47-4d49-8e78-3b105ce8c719 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,893 | supabase-export-v2 | b3b42c2a3b882510 | will call the parent task's :meth:`~asyncio.Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, so the cancellation is not lost.
Task groups preserve the cancellation count
reported by :meth:`asyncio.Task.cancelling`. | trusted_official_docs | CPython Docs | will call the parent task's :meth:`~asyncio.Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, so the cancellation is not lost.
Task groups preserve the cancellation count
reported by :meth:`asyncio.Task.cancelling`. | will call the parent task's :meth:`~asyncio.Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, so the cancellation is not lost.
Task groups preserve the cancellation count
reported by :meth:`asyncio.Task.cancelling`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f64eec76-7d99-462c-b08b-0ccecc4cb6c8 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,131 | supabase-export-v2 | 765af1af264fec43 | Return the list of stack frames for this Task.
If the wrapped coroutine is not done, this returns the stack
where it is suspended. If the coroutine has 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. | trusted_official_docs | CPython Docs | Return the list of stack frames for this Task.
If the wrapped coroutine is not done, this returns the stack
where it is suspended. If the coroutine has 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. | Return the list of stack frames for this Task.
If the wrapped coroutine is not done, this returns the stack
where it is suspended. If the coroutine has 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9c4ef27-1c6a-42b2-9631-acc19c267985 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,846 | supabase-export-v2 | 2520d3d96499e818 | Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task` and schedule its execution. Return the Task object.
The full function signature is largely 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. | trusted_official_docs | CPython Docs | Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task` and schedule its execution. Return the Task object.
The full function signature is largely 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. | Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task` and schedule its execution. Return the Task object.
The full function signature is largely 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc97295e-0919-44d4-884f-b72c2ed91405 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,181 | supabase-export-v2 | 0397c3a5b2950b85 | .. versionadded:: 3.11
This method is used by asyncio's internals and isn't expected to be
used by end-user code. In particular, if a Task gets successfully
uncancelled, this allows for elements of structured concurrency like
:ref:`taskgroups` and :func:`asyncio.timeout` to continue running,
isolating cancellation ... | trusted_official_docs | CPython Docs | .. versionadded:: 3.11
This method is used by asyncio's internals and isn't expected to be
used by end-user code. In particular, if a Task gets successfully
uncancelled, this allows for elements of structured concurrency like
:ref:`taskgroups` and :func:`asyncio.timeout` to continue running,
isolating cancellation ... | .. versionadded:: 3.11
This method is used by asyncio's internals and isn't expected to be
used by end-user code. In particular, if a Task gets successfully
uncancelled, this allows for elements of structured concurrency like
:ref:`taskgroups` and :func:`asyncio.timeout` to continue running,
isolating cancellation ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc9f198e-3424-4123-aa2b-d51e9ec9e43e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,097 | supabase-export-v2 | ab8cdaa8c7ab506d | Task at a time. While a Task awaits for the completion of a Future, the event loop runs other Tasks, callbacks, or performs IO operations.
Use the high-level :func:`asyncio.create_task` function to create
Tasks, or the low-level :meth:`loop.create_task` or
:func:`ensure_future` functions. Manual instantiation of Task... | trusted_official_docs | CPython Docs | Task at a time. While a Task awaits for the completion of a Future, the event loop runs other Tasks, callbacks, or performs IO operations.
Use the high-level :func:`asyncio.create_task` function to create
Tasks, or the low-level :meth:`loop.create_task` or
:func:`ensure_future` functions. Manual instantiation of Task... | Task at a time. While a Task awaits for the completion of a Future, the event loop runs other Tasks, callbacks, or performs IO operations.
Use the high-level :func:`asyncio.create_task` function to create
Tasks, or the low-level :meth:`loop.create_task` or
:func:`ensure_future` functions. Manual instantiation of Task... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fcef188a-4d1e-4b7b-a7e9-7812bbd54e0c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,098 | supabase-export-v2 | bcfee04000b0ae44 | Use the high-level :func:`asyncio.create_task` function to create Tasks, or the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. Manual instantiation of Tasks is discouraged.
To cancel a running Task use the :meth:`cancel` method. Calling it
will cause the Task to throw a :exc:`CancelledError` ex... | trusted_official_docs | CPython Docs | Use the high-level :func:`asyncio.create_task` function to create Tasks, or the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. Manual instantiation of Tasks is discouraged.
To cancel a running Task use the :meth:`cancel` method. Calling it
will cause the Task to throw a :exc:`CancelledError` ex... | Use the high-level :func:`asyncio.create_task` function to create Tasks, or the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. Manual instantiation of Tasks is discouraged.
To cancel a running Task use the :meth:`cancel` method. Calling it
will cause the Task to throw a :exc:`CancelledError` ex... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fdd23bd9-4dcb-4045-9426-c3683a035282 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,078 | supabase-export-v2 | 0da0f284e0fce438 | TimeoutError: print('The coroutine took too long, cancelling the task...') future.cancel() except Exception as exc: print(f'The coroutine raised an exception: {exc!r}') else: print(f'The coroutine returned: {result!r}')
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
section of the documentation... | trusted_official_docs | CPython Docs | TimeoutError: print('The coroutine took too long, cancelling the task...') future.cancel() except Exception as exc: print(f'The coroutine raised an exception: {exc!r}') else: print(f'The coroutine returned: {result!r}')
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
section of the documentation... | TimeoutError: print('The coroutine took too long, cancelling the task...') future.cancel() except Exception as exc: print(f'The coroutine raised an exception: {exc!r}') else: print(f'The coroutine returned: {result!r}')
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
section of the documentation... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff58e454-504b-4df8-ad35-98abd7f49af8 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 22,029 | supabase-export-v2 | ba6f2806d48753b8 | Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable concurrently. The returned object can be iterated to obtain the results of the awaitables as they finish.
The object returned by ``as_completed()`` can be iterated as an
:term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous
... | trusted_official_docs | CPython Docs | Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable concurrently. The returned object can be iterated to obtain the results of the awaitables as they finish.
The object returned by ``as_completed()`` can be iterated as an
:term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous
... | Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable concurrently. The returned object can be iterated to obtain the results of the awaitables as they finish.
The object returned by ``as_completed()`` can be iterated as an
:term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff64924a-2a00-4745-9f7c-b60a6dbb2b67 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-task.rst | unknown | f529df67-182b-426b-aa4a-79251da0bccd | 21,996 | supabase-export-v2 | 3f37ff51ec642387 | If *aw* is a coroutine it is automatically scheduled as a Task.
*timeout* can either be ``None`` or a float or int number of seconds
to wait for. If *timeout* is ``None``, block until the future
completes. | trusted_official_docs | CPython Docs | If *aw* is a coroutine it is automatically scheduled as a Task.
*timeout* can either be ``None`` or a float or int number of seconds
to wait for. If *timeout* is ``None``, block until the future
completes. | If *aw* is a coroutine it is automatically scheduled as a Task.
*timeout* can either be ``None`` or a float or int number of seconds
to wait for. If *timeout* is ``None``, block until the future
completes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0271ba08-d19f-49ed-8032-f5c181df36b2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,195 | supabase-export-v2 | 1d54743ccd672988 | -------------------------------------
asyncio has powerful runtime call graph introspection utilities
to trace the entire call graph of a running *coroutine* or *task*, or
a suspended *future*. These utilities and the underlying machinery
can be used from within a Python program or by external profilers
and debuggers. | trusted_official_docs | CPython Docs | -------------------------------------
asyncio has powerful runtime call graph introspection utilities
to trace the entire call graph of a running *coroutine* or *task*, or
a suspended *future*. These utilities and the underlying machinery
can be used from within a Python program or by external profilers
and debuggers. | -------------------------------------
asyncio has powerful runtime call graph introspection utilities
to trace the entire call graph of a running *coroutine* or *task*, or
a suspended *future*. These utilities and the underlying machinery
can be used from within a Python program or by external profilers
and debuggers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0da77cc3-9eaf-4646-ae1c-9aa2cf4292f3 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,223 | supabase-export-v2 | ad716c3fd42ee508 | Low level utility functions ===========================
To introspect an async call graph asyncio requires cooperation from
control flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an intermediate :class:`Future` object with low-level APIs like
:meth:`Future.add_done_callback() <asyncio.Future.ad... | trusted_official_docs | CPython Docs | Low level utility functions ===========================
To introspect an async call graph asyncio requires cooperation from
control flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an intermediate :class:`Future` object with low-level APIs like
:meth:`Future.add_done_callback() <asyncio.Future.ad... | Low level utility functions ===========================
To introspect an async call graph asyncio requires cooperation from
control flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an intermediate :class:`Future` object with low-level APIs like
:meth:`Future.add_done_callback() <asyncio.Future.ad... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15f1ce1f-3ff1-418f-b3a0-95e3d0cfb295 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,227 | supabase-export-v2 | c59b0811d6e28400 | Both *future* and *waiter* must be instances of :class:`Future` or :class:`Task` or their subclasses, otherwise the call would have no effect.
A call to ``future_add_to_awaited_by()`` must be followed by an
eventual call to the :func:`future_discard_from_awaited_by` function
with the same arguments. | trusted_official_docs | CPython Docs | Both *future* and *waiter* must be instances of :class:`Future` or :class:`Task` or their subclasses, otherwise the call would have no effect.
A call to ``future_add_to_awaited_by()`` must be followed by an
eventual call to the :func:`future_discard_from_awaited_by` function
with the same arguments. | Both *future* and *waiter* must be instances of :class:`Future` or :class:`Task` or their subclasses, otherwise the call would have no effect.
A call to ``future_add_to_awaited_by()`` must be followed by an
eventual call to the :func:`future_discard_from_awaited_by` function
with the same arguments. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17fc333b-496d-4d34-b75f-df57a118b1ea | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,230 | supabase-export-v2 | 8f46e9feff651f19 | Record that *future* is no longer awaited on by *waiter*.
Both *future* and *waiter* must be instances of
:class:`Future` or :class:`Task` or their subclasses, otherwise
the call would have no effect. | trusted_official_docs | CPython Docs | Record that *future* is no longer awaited on by *waiter*.
Both *future* and *waiter* must be instances of
:class:`Future` or :class:`Task` or their subclasses, otherwise
the call would have no effect. | Record that *future* is no longer awaited on by *waiter*.
Both *future* and *waiter* must be instances of
:class:`Future` or :class:`Task` or their subclasses, otherwise
the call would have no effect. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ddc1c10-dc02-43c6-be40-a17e05f35e01 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,201 | supabase-export-v2 | 423dddea90e2c55d | The function receives an optional *future* argument. If not passed, the current running task will be used.
If the function is called on *the current task*, the optional
keyword-only *depth* argument can be used to skip the specified
number of frames from top of the stack. | trusted_official_docs | CPython Docs | The function receives an optional *future* argument. If not passed, the current running task will be used.
If the function is called on *the current task*, the optional
keyword-only *depth* argument can be used to skip the specified
number of frames from top of the stack. | The function receives an optional *future* argument. If not passed, the current running task will be used.
If the function is called on *the current task*, the optional
keyword-only *depth* argument can be used to skip the specified
number of frames from top of the stack. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
500abfac-6971-4191-90d1-0d3d4b440220 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,199 | supabase-export-v2 | 592f6c23d09abdf5 | Print the async call graph for the current task or the provided :class:`Task` or :class:`Future`.
This function prints entries starting from the top frame and going
down towards the invocation point. | trusted_official_docs | CPython Docs | Print the async call graph for the current task or the provided :class:`Task` or :class:`Future`.
This function prints entries starting from the top frame and going
down towards the invocation point. | Print the async call graph for the current task or the provided :class:`Task` or :class:`Future`.
This function prints entries starting from the top frame and going
down towards the invocation point. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6aa20199-1555-4244-8bff-f06f2fcb98d5 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,202 | supabase-export-v2 | 850b52358ae5a877 | called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack.
If the optional keyword-only *limit* argument is provided, each call stack
in the resulting graph is truncated to include at most ``abs(limit)``
entries. If *limit* is pos... | trusted_official_docs | CPython Docs | called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack.
If the optional keyword-only *limit* argument is provided, each call stack
in the resulting graph is truncated to include at most ``abs(limit)``
entries. If *limit* is pos... | called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack.
If the optional keyword-only *limit* argument is provided, each call stack
in the resulting graph is truncated to include at most ``abs(limit)``
entries. If *limit* is pos... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
728a3bf8-d715-45bb-9d5d-92f77fefee02 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,200 | supabase-export-v2 | 199388ad0899959a | This function prints entries starting from the top frame and going down towards the invocation point.
The function receives an optional *future* argument. If not passed, the current running task will be used. | trusted_official_docs | CPython Docs | This function prints entries starting from the top frame and going down towards the invocation point.
The function receives an optional *future* argument. If not passed, the current running task will be used. | This function prints entries starting from the top frame and going down towards the invocation point.
The function receives an optional *future* argument. If not passed, the current running task will be used. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
738d3244-e46f-4221-8d70-34f298936565 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,208 | supabase-export-v2 | f7ce338629551a32 | will print::
* Task(name='test', id=0x1039f0fe0)
+ Call stack:
| File 't2.py', line 4, in async test()
+ Awaited by:
* Task(name='Task-1', id=0x103a5e060)
+ Call stack:
| File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()
| File 't2.py', line 7, in async main() | trusted_official_docs | CPython Docs | will print::
* Task(name='test', id=0x1039f0fe0)
+ Call stack:
| File 't2.py', line 4, in async test()
+ Awaited by:
* Task(name='Task-1', id=0x103a5e060)
+ Call stack:
| File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()
| File 't2.py', line 7, in async main() | will print::
* Task(name='test', id=0x1039f0fe0)
+ Call stack:
| File 't2.py', line 4, in async test()
+ Awaited by:
* Task(name='Task-1', id=0x103a5e060)
+ Call stack:
| File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()
| File 't2.py', line 7, in async main() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
772ce134-0b0f-4c33-bd33-b436d02ec02c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,209 | supabase-export-v2 | fd210b69dc2b5c14 | + Awaited by: * Task(name='Task-1', id=0x103a5e060) + Call stack: | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__() | File 't2.py', line 7, in async main()
.. function:: format_call_graph(future=None, /, *, depth=1, limit=None) | trusted_official_docs | CPython Docs | + Awaited by: * Task(name='Task-1', id=0x103a5e060) + Call stack: | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__() | File 't2.py', line 7, in async main()
.. function:: format_call_graph(future=None, /, *, depth=1, limit=None) | + Awaited by: * Task(name='Task-1', id=0x103a5e060) + Call stack: | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__() | File 't2.py', line 7, in async main()
.. function:: format_call_graph(future=None, /, *, depth=1, limit=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a59f1bc-2113-4af2-a6ac-3ad74bd0bd85 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,224 | supabase-export-v2 | 7c57d1d039f2a2e3 | following two functions should be used to inform asyncio about how exactly such intermediate future objects are connected with the tasks they wrap or control.
.. function:: future_add_to_awaited_by(future, waiter, /) | trusted_official_docs | CPython Docs | following two functions should be used to inform asyncio about how exactly such intermediate future objects are connected with the tasks they wrap or control.
.. function:: future_add_to_awaited_by(future, waiter, /) | following two functions should be used to inform asyncio about how exactly such intermediate future objects are connected with the tasks they wrap or control.
.. function:: future_add_to_awaited_by(future, waiter, /) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ec2e189-67aa-437b-b893-452aec45edb9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,215 | supabase-export-v2 | 89ae76ee337a9c83 | called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack.
Returns a ``FutureCallGraph`` data class object: | trusted_official_docs | CPython Docs | called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack.
Returns a ``FutureCallGraph`` data class object: | called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack.
Returns a ``FutureCallGraph`` data class object: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90304659-26db-4ead-87fd-7e990899fdeb | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,214 | supabase-export-v2 | 93ebea59795cb94d | function receives an optional *future* argument. If not passed, the current running task will be used. If there's no current task, the function returns ``None``.
If the function is called on *the current task*, the optional
keyword-only *depth* argument can be used to skip the specified
number of frames from top of t... | trusted_official_docs | CPython Docs | function receives an optional *future* argument. If not passed, the current running task will be used. If there's no current task, the function returns ``None``.
If the function is called on *the current task*, the optional
keyword-only *depth* argument can be used to skip the specified
number of frames from top of t... | function receives an optional *future* argument. If not passed, the current running task will be used. If there's no current task, the function returns ``None``.
If the function is called on *the current task*, the optional
keyword-only *depth* argument can be used to skip the specified
number of frames from top of t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c64e7266-e76d-4a5a-b5bb-1742e4c9dcae | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,203 | supabase-export-v2 | 00df43f975800b2d | omitted or ``None``, all entries are present. If *limit* is ``0``, the call stack is not printed at all, only "awaited by" information is printed.
If *file* is omitted or ``None``, the function will print
to :data:`sys.stdout`. | trusted_official_docs | CPython Docs | omitted or ``None``, all entries are present. If *limit* is ``0``, the call stack is not printed at all, only "awaited by" information is printed.
If *file* is omitted or ``None``, the function will print
to :data:`sys.stdout`. | omitted or ``None``, all entries are present. If *limit* is ``0``, the call stack is not printed at all, only "awaited by" information is printed.
If *file* is omitted or ``None``, the function will print
to :data:`sys.stdout`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d6fb0e67-c75f-4554-945d-0588a9a41422 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-graph.rst | unknown | 98faf0c4-ad8c-49de-b1c4-95b4d7928a1e | 22,213 | supabase-export-v2 | eeb20b26fed8116e | Capture the async call graph for the current task or the provided :class:`Task` or :class:`Future`.
The function receives an optional *future* argument. If not passed, the current running task will be used. If there's no
current task, the function returns ``None``. | trusted_official_docs | CPython Docs | Capture the async call graph for the current task or the provided :class:`Task` or :class:`Future`.
The function receives an optional *future* argument. If not passed, the current running task will be used. If there's no
current task, the function returns ``None``. | Capture the async call graph for the current task or the provided :class:`Task` or :class:`Future`.
The function receives an optional *future* argument. If not passed, the current running task will be used. If there's no
current task, the function returns ``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
014a3c8d-27e6-4af2-9111-a195bd35e401 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,292 | supabase-export-v2 | d9cc99552753f3f8 | Read and return the contents of the named resource as :class:`str`. By default, the contents are read as strict UTF-8.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`. | trusted_official_docs | CPython Docs | Read and return the contents of the named resource as :class:`str`. By default, the contents are read as strict UTF-8.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`. | Read and return the contents of the named resource as :class:`str`. By default, the contents are read as strict UTF-8.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ecbf3a0-1187-449a-b762-dc9b74090f56 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,279 | supabase-export-v2 | a1e35b8060ebdffe | See :ref:`the introduction <importlib_resources_functional>` for details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`.
For backward compatibility reasons, the *encoding* argument must be given
explicitly if there are multiple *path_names*. This limitation is s... | trusted_official_docs | CPython Docs | See :ref:`the introduction <importlib_resources_functional>` for details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`.
For backward compatibility reasons, the *encoding* argument must be given
explicitly if there are multiple *path_names*. This limitation is s... | See :ref:`the introduction <importlib_resources_functional>` for details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`.
For backward compatibility reasons, the *encoding* argument must be given
explicitly if there are multiple *path_names*. This limitation is s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
10b0e418-1a5f-45f6-8c93-67f539b59176 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,248 | supabase-export-v2 | ff439419ca8b0792 | Returns a :class:`~importlib.resources.abc.Traversable` object representing the resource container (think directory) and its resources (think files). A Traversable may contain other containers (think subdirectories).
*anchor* is an optional :class:`Anchor`. If the anchor is a
package, resources are resolved from that ... | trusted_official_docs | CPython Docs | Returns a :class:`~importlib.resources.abc.Traversable` object representing the resource container (think directory) and its resources (think files). A Traversable may contain other containers (think subdirectories).
*anchor* is an optional :class:`Anchor`. If the anchor is a
package, resources are resolved from that ... | Returns a :class:`~importlib.resources.abc.Traversable` object representing the resource container (think directory) and its resources (think files). A Traversable may contain other containers (think subdirectories).
*anchor* is an optional :class:`Anchor`. If the anchor is a
package, resources are resolved from that ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a8db914-4e08-4960-84ef-fc02b3721840 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,298 | supabase-export-v2 | 2494bd50dc56d3e1 | .. function:: path(anchor, *path_names)
Provides the path to the *resource* as an actual file system path. This
function returns a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object. | trusted_official_docs | CPython Docs | .. function:: path(anchor, *path_names)
Provides the path to the *resource* as an actual file system path. This
function returns a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object. | .. function:: path(anchor, *path_names)
Provides the path to the *resource* as an actual file system path. This
function returns a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
478ef251-10b1-4c2c-8ccf-edd322baa5a6 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,280 | supabase-export-v2 | 611d6c1d25d17106 | backward compatibility reasons, the *encoding* argument must be given explicitly if there are multiple *path_names*. This limitation is scheduled to be removed in Python 3.15.
This function returns a :class:`~typing.TextIO` object,
that is, a text stream open for reading. | trusted_official_docs | CPython Docs | backward compatibility reasons, the *encoding* argument must be given explicitly if there are multiple *path_names*. This limitation is scheduled to be removed in Python 3.15.
This function returns a :class:`~typing.TextIO` object,
that is, a text stream open for reading. | backward compatibility reasons, the *encoding* argument must be given explicitly if there are multiple *path_names*. This limitation is scheduled to be removed in Python 3.15.
This function returns a :class:`~typing.TextIO` object,
that is, a text stream open for reading. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50148c53-e03e-4e77-bda6-4c02bc6ef393 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,251 | supabase-export-v2 | 6c905bcddca5acde | .. versionchanged:: 3.12 *package* parameter was renamed to *anchor*. *package* was still accepted, but deprecated.
.. versionchanged:: 3.15
*package* parameter was fully removed. *anchor* can now be a
non-package module and if omitted will default to the caller's module. *package* is no longer accepted since Python ... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.12 *package* parameter was renamed to *anchor*. *package* was still accepted, but deprecated.
.. versionchanged:: 3.15
*package* parameter was fully removed. *anchor* can now be a
non-package module and if omitted will default to the caller's module. *package* is no longer accepted since Python ... | .. versionchanged:: 3.12 *package* parameter was renamed to *anchor*. *package* was still accepted, but deprecated.
.. versionchanged:: 3.15
*package* parameter was fully removed. *anchor* can now be a
non-package module and if omitted will default to the caller's module. *package* is no longer accepted since Python ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
60861cab-f5b2-4143-9125-9a89862076b1 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,243 | supabase-export-v2 | ca735f4ae79b0d43 | The standalone backport of this module provides more information on `using importlib.resources <https://importlib-resources.readthedocs.io/en/latest/using.html>`_ and `migrating from pkg_resources to importlib.resources <https://importlib-resources.readthedocs.io/en/latest/migration.html>`_.
:class:`Loaders <importlib.... | trusted_official_docs | CPython Docs | The standalone backport of this module provides more information on `using importlib.resources <https://importlib-resources.readthedocs.io/en/latest/using.html>`_ and `migrating from pkg_resources to importlib.resources <https://importlib-resources.readthedocs.io/en/latest/migration.html>`_.
:class:`Loaders <importlib.... | The standalone backport of this module provides more information on `using importlib.resources <https://importlib-resources.readthedocs.io/en/latest/using.html>`_ and `migrating from pkg_resources to importlib.resources <https://importlib-resources.readthedocs.io/en/latest/migration.html>`_.
:class:`Loaders <importlib.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
618baef6-b44a-4238-a58d-ea5c49928739 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,294 | supabase-export-v2 | a79098998ddecd15 | backward compatibility reasons, the *encoding* argument must be given explicitly if there are multiple *path_names*. This limitation is scheduled to be removed in Python 3.15.
This function is roughly equivalent to:: | trusted_official_docs | CPython Docs | backward compatibility reasons, the *encoding* argument must be given explicitly if there are multiple *path_names*. This limitation is scheduled to be removed in Python 3.15.
This function is roughly equivalent to:: | backward compatibility reasons, the *encoding* argument must be given explicitly if there are multiple *path_names*. This limitation is scheduled to be removed in Python 3.15.
This function is roughly equivalent to:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
756da24f-2693-4f6b-9b52-1fc9c35bf0b6 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,254 | supabase-export-v2 | b0dae5424882746e | representing a file or directory, typically from :func:`importlib.resources.files`, return a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object.
Exiting the context manager cleans up any temporary file or directory
created when the resource was extracted... | trusted_official_docs | CPython Docs | representing a file or directory, typically from :func:`importlib.resources.files`, return a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object.
Exiting the context manager cleans up any temporary file or directory
created when the resource was extracted... | representing a file or directory, typically from :func:`importlib.resources.files`, return a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object.
Exiting the context manager cleans up any temporary file or directory
created when the resource was extracted... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9240ce8a-258d-466e-a826-da9e63ab5c96 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,267 | supabase-export-v2 | 579cf961ad196042 | importlib.resources.read_binary(my_module, "pics/painting.png") importlib.resources.read_binary(my_module, "pics", "painting.png")
For backward compatibility reasons, functions that read text require
an explicit *encoding* argument if multiple *path_names* are given. For example, to get the text of ``info/chapter1.txt... | trusted_official_docs | CPython Docs | importlib.resources.read_binary(my_module, "pics/painting.png") importlib.resources.read_binary(my_module, "pics", "painting.png")
For backward compatibility reasons, functions that read text require
an explicit *encoding* argument if multiple *path_names* are given. For example, to get the text of ``info/chapter1.txt... | importlib.resources.read_binary(my_module, "pics/painting.png") importlib.resources.read_binary(my_module, "pics", "painting.png")
For backward compatibility reasons, functions that read text require
an explicit *encoding* argument if multiple *path_names* are given. For example, to get the text of ``info/chapter1.txt... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
928426a9-51e6-433e-a0cf-fa56cd75cd3c | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,255 | supabase-export-v2 | b2a26d56872e257b | Exiting the context manager cleans up any temporary file or directory created when the resource was extracted from e.g. a zip file.
Use ``as_file`` when the Traversable methods
(``read_text``, etc) are insufficient and an actual file or directory on
the file system is required. | trusted_official_docs | CPython Docs | Exiting the context manager cleans up any temporary file or directory created when the resource was extracted from e.g. a zip file.
Use ``as_file`` when the Traversable methods
(``read_text``, etc) are insufficient and an actual file or directory on
the file system is required. | Exiting the context manager cleans up any temporary file or directory created when the resource was extracted from e.g. a zip file.
Use ``as_file`` when the Traversable methods
(``read_text``, etc) are insufficient and an actual file or directory on
the file system is required. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9884d0a1-6b1a-4ab6-8ce6-a192a4fd9490 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,313 | supabase-export-v2 | 9056e9b9040ba491 | .. function:: contents(anchor, *path_names)
Return an iterable over the named items within the package or path. The iterable returns names of resources (e.g. files) and non-resources
(e.g. directories) as :class:`str`. The iterable does not recurse into subdirectories. | trusted_official_docs | CPython Docs | .. function:: contents(anchor, *path_names)
Return an iterable over the named items within the package or path. The iterable returns names of resources (e.g. files) and non-resources
(e.g. directories) as :class:`str`. The iterable does not recurse into subdirectories. | .. function:: contents(anchor, *path_names)
Return an iterable over the named items within the package or path. The iterable returns names of resources (e.g. files) and non-resources
(e.g. directories) as :class:`str`. The iterable does not recurse into subdirectories. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ac4a4fe7-9d1f-4771-b1e6-327d286593b2 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,300 | supabase-export-v2 | 6a27703f85365ea3 | Exiting the context manager cleans up any temporary files created, e.g. when the resource needs to be extracted from a zip file.
For example, the :meth:`~pathlib.Path.stat` method requires
an actual file system path; it can be used like this:: | trusted_official_docs | CPython Docs | Exiting the context manager cleans up any temporary files created, e.g. when the resource needs to be extracted from a zip file.
For example, the :meth:`~pathlib.Path.stat` method requires
an actual file system path; it can be used like this:: | Exiting the context manager cleans up any temporary files created, e.g. when the resource needs to be extracted from a zip file.
For example, the :meth:`~pathlib.Path.stat` method requires
an actual file system path; it can be used like this:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad822c60-5f0d-45b7-900a-68ee0cac0352 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,278 | supabase-export-v2 | 3aa5cb2886db7f79 | Open the named resource for text reading. By default, the contents are read as strict UTF-8.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`. | trusted_official_docs | CPython Docs | Open the named resource for text reading. By default, the contents are read as strict UTF-8.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`. | Open the named resource for text reading. By default, the contents are read as strict UTF-8.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. *encoding* and *errors* have the same meaning as in built-in :func:`open`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af8d4000-7a5c-4293-bce7-2874d2b25866 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,237 | supabase-export-v2 | 0f16e4552226f24f | <os.path.isreserved>` in directories) are technically de-facto resources of that package. In practice, however, resources are primarily those non-Python artifacts exposed specifically by the package author.
Resources can be opened or read in either binary or text mode. | trusted_official_docs | CPython Docs | <os.path.isreserved>` in directories) are technically de-facto resources of that package. In practice, however, resources are primarily those non-Python artifacts exposed specifically by the package author.
Resources can be opened or read in either binary or text mode. | <os.path.isreserved>` in directories) are technically de-facto resources of that package. In practice, however, resources are primarily those non-Python artifacts exposed specifically by the package author.
Resources can be opened or read in either binary or text mode. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bcad4d8f-510f-458b-8a5a-cae6d85975e0 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,263 | supabase-export-v2 | e81a96050dbe89d4 | - *anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib.resources.files`. Unlike in ``files``, it may not be omitted.
- *path_names* are components of a resource's path name, relative to
the anchor. For example, to get the text of resource named ``info.txt``, use:: | trusted_official_docs | CPython Docs | - *anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib.resources.files`. Unlike in ``files``, it may not be omitted.
- *path_names* are components of a resource's path name, relative to
the anchor. For example, to get the text of resource named ``info.txt``, use:: | - *anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib.resources.files`. Unlike in ``files``, it may not be omitted.
- *path_names* are components of a resource's path name, relative to
the anchor. For example, to get the text of resource named ``info.txt``, use:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c20dda1c-8004-4498-8003-a4bf4af49382 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,299 | supabase-export-v2 | c0a920e6118f0b4c | as an actual file system path. This function returns a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object.
Exiting the context manager cleans up any temporary files created, e.g. when the resource needs to be extracted from a zip file. | trusted_official_docs | CPython Docs | as an actual file system path. This function returns a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object.
Exiting the context manager cleans up any temporary files created, e.g. when the resource needs to be extracted from a zip file. | as an actual file system path. This function returns a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object.
Exiting the context manager cleans up any temporary files created, e.g. when the resource needs to be extracted from a zip file. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c5c2cf19-fe99-4303-888e-6f32663a9145 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,238 | supabase-export-v2 | 0a099fe689ebf4cd | Resources can be opened or read in either binary or text mode.
Resources are roughly akin to files inside directories, though it's important
to keep in mind that this is just a metaphor. Resources and packages **do
not** have to exist as physical files and directories on the file system:
for example, a package and its ... | trusted_official_docs | CPython Docs | Resources can be opened or read in either binary or text mode.
Resources are roughly akin to files inside directories, though it's important
to keep in mind that this is just a metaphor. Resources and packages **do
not** have to exist as physical files and directories on the file system:
for example, a package and its ... | Resources can be opened or read in either binary or text mode.
Resources are roughly akin to files inside directories, though it's important
to keep in mind that this is just a metaphor. Resources and packages **do
not** have to exist as physical files and directories on the file system:
for example, a package and its ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
de0de2bb-7773-498d-95b7-4393a5d5742e | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,253 | supabase-export-v2 | a20a94b12cc216c2 | .. function:: as_file(traversable)
Given a :class:`~importlib.resources.abc.Traversable` object representing
a file or directory, typically from :func:`importlib.resources.files`,
return a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object. | trusted_official_docs | CPython Docs | .. function:: as_file(traversable)
Given a :class:`~importlib.resources.abc.Traversable` object representing
a file or directory, typically from :func:`importlib.resources.files`,
return a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object. | .. function:: as_file(traversable)
Given a :class:`~importlib.resources.abc.Traversable` object representing
a file or directory, typically from :func:`importlib.resources.files`,
return a context manager for use in a :keyword:`with` statement. The context manager provides a :class:`pathlib.Path` object. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1279f99-d77c-4c51-8dd0-61c37f73d8d2 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,236 | supabase-export-v2 | 57c6a83b219c8342 | This module leverages Python's import system to provide access to *resources* within *packages*.
"Resources" are file-like resources associated with a module or package in
Python. The resources may be contained directly in a package, within a
subdirectory contained in that package, or adjacent to modules outside a
pack... | trusted_official_docs | CPython Docs | This module leverages Python's import system to provide access to *resources* within *packages*.
"Resources" are file-like resources associated with a module or package in
Python. The resources may be contained directly in a package, within a
subdirectory contained in that package, or adjacent to modules outside a
pack... | This module leverages Python's import system to provide access to *resources* within *packages*.
"Resources" are file-like resources associated with a module or package in
Python. The resources may be contained directly in a package, within a
subdirectory contained in that package, or adjacent to modules outside a
pack... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f16ca958-8e74-474b-9148-3203f88c7d40 | CPython Docs | file://datasets/cpython/Doc/library/importlib.resources.rst | unknown | fa770579-1d4e-4628-90f2-02828961d623 | 22,314 | supabase-export-v2 | e36974a52e38d1cb | the package or path. The iterable returns names of resources (e.g. files) and non-resources (e.g. directories) as :class:`str`. The iterable does not recurse into subdirectories.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. | trusted_official_docs | CPython Docs | the package or path. The iterable returns names of resources (e.g. files) and non-resources (e.g. directories) as :class:`str`. The iterable does not recurse into subdirectories.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. | the package or path. The iterable returns names of resources (e.g. files) and non-resources (e.g. directories) as :class:`str`. The iterable does not recurse into subdirectories.
See :ref:`the introduction <importlib_resources_functional>` for
details on *anchor* and *path_names*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0566192d-e82e-4012-8890-a8d2a3529930 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,385 | supabase-export-v2 | b6b2168b1d2dcd62 | = ['python\n', 'eggy\n', 'hamster\n', 'guido\n'] >>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py')) --- before.py +++ after.py @@ -1,4 +1,4 @@ -bacon -eggs -ham +python +eggy +hamster guido
See :ref:`difflib-interface` for a more detailed example. | trusted_official_docs | CPython Docs | = ['python\n', 'eggy\n', 'hamster\n', 'guido\n'] >>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py')) --- before.py +++ after.py @@ -1,4 +1,4 @@ -bacon -eggs -ham +python +eggy +hamster guido
See :ref:`difflib-interface` for a more detailed example. | = ['python\n', 'eggy\n', 'hamster\n', 'guido\n'] >>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py')) --- before.py +++ after.py @@ -1,4 +1,4 @@ -bacon -eggs -ham +python +eggy +hamster guido
See :ref:`difflib-interface` for a more detailed example. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05ceca9e-825e-4a62-ada3-ccfbc13bd598 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,441 | supabase-export-v2 | ba0d4a8e956db3b3 | Return a :term:`generator` of groups with up to *n* lines of context.
Starting with the groups returned by :meth:`get_opcodes`, this method
splits out smaller change clusters and eliminates intervening ranges which
have no changes. | trusted_official_docs | CPython Docs | Return a :term:`generator` of groups with up to *n* lines of context.
Starting with the groups returned by :meth:`get_opcodes`, this method
splits out smaller change clusters and eliminates intervening ranges which
have no changes. | Return a :term:`generator` of groups with up to *n* lines of context.
Starting with the groups returned by :meth:`get_opcodes`, this method
splits out smaller change clusters and eliminates intervening ranges which
have no changes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07cba50f-2242-499e-a507-f0e28c8be2ad | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,433 | supabase-export-v2 | 0a26276dfbb456a6 | .. method:: get_opcodes()
Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is
of the form ``(tag, i1, i2, j1, j2)``. The first tuple has ``i1 == j1 ==
0``, and remaining tuples have *i1* equal to the *i2* from the preceding
tuple, and, likewise, *j1* equal to the previous *j2*. | trusted_official_docs | CPython Docs | .. method:: get_opcodes()
Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is
of the form ``(tag, i1, i2, j1, j2)``. The first tuple has ``i1 == j1 ==
0``, and remaining tuples have *i1* equal to the *i2* from the preceding
tuple, and, likewise, *j1* equal to the previous *j2*. | .. method:: get_opcodes()
Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is
of the form ``(tag, i1, i2, j1, j2)``. The first tuple has ``i1 == j1 ==
0``, and remaining tuples have *i1* equal to the *i2* from the preceding
tuple, and, likewise, *j1* equal to the previous *j2*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a383f16-68c7-40d0-9a94-850e8c1c6816 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,382 | supabase-export-v2 | 428faed58dcd6e4c | For inputs that do not have trailing newlines, set the *lineterm* argument to ``""`` so that the output will be uniformly newline free.
Set *color* to ``True`` to enable output in color, similar to
:program:`git diff --color`. Even if enabled, it can be
:ref:`controlled using environment variables <using-on-controlli... | trusted_official_docs | CPython Docs | For inputs that do not have trailing newlines, set the *lineterm* argument to ``""`` so that the output will be uniformly newline free.
Set *color* to ``True`` to enable output in color, similar to
:program:`git diff --color`. Even if enabled, it can be
:ref:`controlled using environment variables <using-on-controlli... | For inputs that do not have trailing newlines, set the *lineterm* argument to ``""`` so that the output will be uniformly newline free.
Set *color* to ``True`` to enable output in color, similar to
:program:`git diff --color`. Even if enabled, it can be
:ref:`controlled using environment variables <using-on-controlli... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e9c518f-91a3-4c71-b4b4-0dc7f0794deb | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,379 | supabase-export-v2 | 42c0dc6ce52dfb2e | Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format.
Unified diffs are a compact way of showing just the lines that have changed plus
a few lines of context. The changes are shown in an inline style (instead of
separate before/after blocks). T... | trusted_official_docs | CPython Docs | Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format.
Unified diffs are a compact way of showing just the lines that have changed plus
a few lines of context. The changes are shown in an inline style (instead of
separate before/after blocks). T... | Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format.
Unified diffs are a compact way of showing just the lines that have changed plus
a few lines of context. The changes are shown in an inline style (instead of
separate before/after blocks). T... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16598484-9e9a-4cd1-a54f-5040da7188f9 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,356 | supabase-export-v2 | 3956df7fdb2f9eac | so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines.
For inputs that do not have trailing newlines, set the *lineterm* argument to
``""`` so that the output will be uniformly newline... | trusted_official_docs | CPython Docs | so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines.
For inputs that do not have trailing newlines, set the *lineterm* argument to
``""`` so that the output will be uniformly newline... | so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines.
For inputs that do not have trailing newlines, set the *lineterm* argument to
``""`` so that the output will be uniformly newline... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1c56870b-4948-4f2b-8082-88fcbee77009 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,377 | supabase-export-v2 | acdcd4ffea9d098b | diff = list(diff) # materialize the generated delta into a list >>> print(''.join(restore(diff, 1)), end="") one two three >>> print(''.join(restore(diff, 2)), end="") ore tree emu
.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n', *, color=False) | trusted_official_docs | CPython Docs | diff = list(diff) # materialize the generated delta into a list >>> print(''.join(restore(diff, 1)), end="") one two three >>> print(''.join(restore(diff, 2)), end="") ore tree emu
.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n', *, color=False) | diff = list(diff) # materialize the generated delta into a list >>> print(''.join(restore(diff, 1)), end="") one two three >>> print(''.join(restore(diff, 2)), end="") ore tree emu
.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n', *, color=False) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d46feb2-a3c9-41ea-a510-43da028b59e1 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,445 | supabase-export-v2 | 599cfefde6b6a54b | Return a measure of the sequences' similarity as a float in the range [0, 1].
Where T is the total number of elements in both sequences, and M is the
number of matches, this is 2.0\*M / T. Note that this is ``1.0`` if the
sequences are identical, and ``0.0`` if they have nothing in common. | trusted_official_docs | CPython Docs | Return a measure of the sequences' similarity as a float in the range [0, 1].
Where T is the total number of elements in both sequences, and M is the
number of matches, this is 2.0\*M / T. Note that this is ``1.0`` if the
sequences are identical, and ``0.0`` if they have nothing in common. | Return a measure of the sequences' similarity as a float in the range [0, 1].
Where T is the total number of elements in both sequences, and M is the
number of matches, this is 2.0\*M / T. Note that this is ``1.0`` if the
sequences are identical, and ``0.0`` if they have nothing in common. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d983c3e-5fcf-4690-ae16-bc4511b788c3 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,330 | supabase-export-v2 | 0d579e66582fa2fc | .. class:: Differ
This is a class for comparing sequences of lines of text, and producing
human-readable differences or deltas. Differ uses :class:`SequenceMatcher`
both to compare sequences of lines, and to compare sequences of characters
within similar (near-matching) lines. | trusted_official_docs | CPython Docs | .. class:: Differ
This is a class for comparing sequences of lines of text, and producing
human-readable differences or deltas. Differ uses :class:`SequenceMatcher`
both to compare sequences of lines, and to compare sequences of characters
within similar (near-matching) lines. | .. class:: Differ
This is a class for comparing sequences of lines of text, and producing
human-readable differences or deltas. Differ uses :class:`SequenceMatcher`
both to compare sequences of lines, and to compare sequences of characters
within similar (near-matching) lines. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e5b03cc-527d-471f-abe6-23118bf11d6b | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,396 | supabase-export-v2 | 8e0be48d1ea38ce0 | .. seealso::
`Pattern Matching: The Gestalt Approach <https://jacobfilipp.com/DrDobbs/articles/DDJ/1988/8807/8807c/8807c.htm>`_
Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This
was published in Dr. Dobb's Journal in July, 1988. | trusted_official_docs | CPython Docs | .. seealso::
`Pattern Matching: The Gestalt Approach <https://jacobfilipp.com/DrDobbs/articles/DDJ/1988/8807/8807c/8807c.htm>`_
Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This
was published in Dr. Dobb's Journal in July, 1988. | .. seealso::
`Pattern Matching: The Gestalt Approach <https://jacobfilipp.com/DrDobbs/articles/DDJ/1988/8807/8807c/8807c.htm>`_
Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This
was published in Dr. Dobb's Journal in July, 1988. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
228fd15e-1204-4f75-bd16-8e335de3381d | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,364 | supabase-export-v2 | 2480a7c7a2513b33 | Optional argument *cutoff* (default ``0.6``) is a float in the range [0, 1]. Possibilities that don't score at least that similar to *word* are ignored.
The best (no more than *n*) matches among the possibilities are returned in a
list, sorted by similarity score, most similar first. | trusted_official_docs | CPython Docs | Optional argument *cutoff* (default ``0.6``) is a float in the range [0, 1]. Possibilities that don't score at least that similar to *word* are ignored.
The best (no more than *n*) matches among the possibilities are returned in a
list, sorted by similarity score, most similar first. | Optional argument *cutoff* (default ``0.6``) is a float in the range [0, 1]. Possibilities that don't score at least that similar to *word* are ignored.
The best (no more than *n*) matches among the possibilities are returned in a
list, sorted by similarity score, most similar first. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2705da82-d72b-4e36-a6ef-1ea93d7d5161 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,476 | supabase-export-v2 | 302c392dc6024807 | that accepts a single string argument, and returns true if the string is junk. The default is ``None``, meaning that no line is considered junk.
*charjunk*: A function that accepts a single character argument (a string of
length 1), and returns true if the character is junk. The default is ``None``,
meaning that no c... | trusted_official_docs | CPython Docs | that accepts a single string argument, and returns true if the string is junk. The default is ``None``, meaning that no line is considered junk.
*charjunk*: A function that accepts a single character argument (a string of
length 1), and returns true if the character is junk. The default is ``None``,
meaning that no c... | that accepts a single string argument, and returns true if the string is junk. The default is ``None``, meaning that no line is considered junk.
*charjunk*: A function that accepts a single character argument (a string of
length 1), and returns true if the character is junk. The default is ``None``,
meaning that no c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
279336ef-1417-4d5e-a54f-ab0a367e7584 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,429 | supabase-export-v2 | f3e2b6036a4cd169 | subsequences. Each triple is of the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:j+n]``. The triples are monotonically increasing in *i* and *j*.
The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It
is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')``
are adjacent tri... | trusted_official_docs | CPython Docs | subsequences. Each triple is of the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:j+n]``. The triples are monotonically increasing in *i* and *j*.
The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It
is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')``
are adjacent tri... | subsequences. Each triple is of the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:j+n]``. The triples are monotonically increasing in *i* and *j*.
The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It
is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')``
are adjacent tri... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d053dd7-3e76-4f8a-819d-3c3cb5666436 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,384 | supabase-export-v2 | c54aadfe98f17f02 | for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks.
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
>>> sys.stdout.writelines(unifie... | trusted_official_docs | CPython Docs | for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks.
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
>>> sys.stdout.writelines(unifie... | for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks.
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
>>> sys.stdout.writelines(unifie... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d25407c-9ca8-4f74-8ebb-85a5d3e483c8 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,466 | supabase-export-v2 | 764d8d342f0a444c | If you want to know how to change the first sequence into the second, use :meth:`~SequenceMatcher.get_opcodes`:
>>> for opcode in s.get_opcodes():
... print("%6s a[%d:%d] b[%d:%d]" % opcode)
equal a[0:8] b[0:8]
insert a[8:8] b[8:17]
equal a[8:29] b[17:38] | trusted_official_docs | CPython Docs | If you want to know how to change the first sequence into the second, use :meth:`~SequenceMatcher.get_opcodes`:
>>> for opcode in s.get_opcodes():
... print("%6s a[%d:%d] b[%d:%d]" % opcode)
equal a[0:8] b[0:8]
insert a[8:8] b[8:17]
equal a[8:29] b[17:38] | If you want to know how to change the first sequence into the second, use :meth:`~SequenceMatcher.get_opcodes`:
>>> for opcode in s.get_opcodes():
... print("%6s a[%d:%d] b[%d:%d]" % opcode)
equal a[0:8] b[0:8]
insert a[8:8] b[8:17]
equal a[8:29] b[17:38] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3294bdb4-28b1-4961-b17e-295eaafc5133 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,362 | supabase-export-v2 | b37962d03fffec5d | which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings).
Optional argument *n* (default ``3``) is the maximum number of close matches to
return; *n* must be greater than ``0``. | trusted_official_docs | CPython Docs | which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings).
Optional argument *n* (default ``3``) is the maximum number of close matches to
return; *n* must be greater than ``0``. | which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings).
Optional argument *n* (default ``3``) is the maximum number of close matches to
return; *n* must be greater than ``0``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
339d94da-4202-404d-b515-ae0e3a1be491 | CPython Docs | file://datasets/cpython/Doc/library/difflib.rst | unknown | bd4cae69-8b64-4139-9d02-8d1ee07f35cb | 22,408 | supabase-export-v2 | 1d196e7d4a6df66c | the remaining elements of *b* to a list of positions where they occur. All three are reset whenever *b* is reset with :meth:`set_seqs` or :meth:`set_seq2`.
.. versionadded:: 3.2
The *bjunk* and *bpopular* attributes. | trusted_official_docs | CPython Docs | the remaining elements of *b* to a list of positions where they occur. All three are reset whenever *b* is reset with :meth:`set_seqs` or :meth:`set_seq2`.
.. versionadded:: 3.2
The *bjunk* and *bpopular* attributes. | the remaining elements of *b* to a list of positions where they occur. All three are reset whenever *b* is reset with :meth:`set_seqs` or :meth:`set_seq2`.
.. versionadded:: 3.2
The *bjunk* and *bpopular* attributes. | 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.