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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c1cd80d3-bf1e-4773-ae0e-1b35ed22db12 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,473 | supabase-export-v2 | 90a45c9253230658 | Close asynchronous generators explicitly ----------------------------------------
It is recommended to manually close the
:term:`asynchronous generator <asynchronous generator iterator>`. If a generator
exits early - for example, due to an exception raised in the body of
an ``async for`` loop - its asynchronous cleanup... | trusted_official_docs | CPython Docs | Close asynchronous generators explicitly ----------------------------------------
It is recommended to manually close the
:term:`asynchronous generator <asynchronous generator iterator>`. If a generator
exits early - for example, due to an exception raised in the body of
an ``async for`` loop - its asynchronous cleanup... | Close asynchronous generators explicitly ----------------------------------------
It is recommended to manually close the
:term:`asynchronous generator <asynchronous generator iterator>`. If a generator
exits early - for example, due to an exception raised in the body of
an ``async for`` loop - its asynchronous cleanup... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c272add2-5ce2-49f9-9ac4-e87f14886349 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,423 | supabase-export-v2 | c76d0d80a0ea7fda | loop.call_soon_threadsafe(callback, *args)
Almost all asyncio objects are not thread safe, which is typically
not a problem unless there is code that works with them from outside
of a Task or a callback. If there's a need for such code to call a
low-level asyncio API, the :meth:`loop.call_soon_threadsafe` method
should... | trusted_official_docs | CPython Docs | loop.call_soon_threadsafe(callback, *args)
Almost all asyncio objects are not thread safe, which is typically
not a problem unless there is code that works with them from outside
of a Task or a callback. If there's a need for such code to call a
low-level asyncio API, the :meth:`loop.call_soon_threadsafe` method
should... | loop.call_soon_threadsafe(callback, *args)
Almost all asyncio objects are not thread safe, which is typically
not a problem unless there is code that works with them from outside
of a Task or a callback. If there's a need for such code to call a
low-level asyncio API, the :meth:`loop.call_soon_threadsafe` method
should... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2a15f8e-5dbe-4af9-8498-a03fc875fa36 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,455 | supabase-export-v2 | 719ab7ee6b2fbf74 | Detect never-retrieved exceptions =================================
If a :meth:`Future.set_exception` is called but the Future object is
never awaited on, the exception would never be propagated to the
user code. In this case, asyncio would emit a log message when the
Future object is garbage collected. | trusted_official_docs | CPython Docs | Detect never-retrieved exceptions =================================
If a :meth:`Future.set_exception` is called but the Future object is
never awaited on, the exception would never be propagated to the
user code. In this case, asyncio would emit a log message when the
Future object is garbage collected. | Detect never-retrieved exceptions =================================
If a :meth:`Future.set_exception` is called but the Future object is
never awaited on, the exception would never be propagated to the
user code. In this case, asyncio would emit a log message when the
Future object is garbage collected. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8b43590-c9b7-4d6e-b419-46d378e1941a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,434 | supabase-export-v2 | 5a15ab307a3aed80 | Running Blocking Code =====================
Blocking (CPU-bound) code should not be called directly. For example,
if a function performs a CPU-intensive calculation for 1 second,
all concurrent asyncio Tasks and IO operations would be delayed
by 1 second. | trusted_official_docs | CPython Docs | Running Blocking Code =====================
Blocking (CPU-bound) code should not be called directly. For example,
if a function performs a CPU-intensive calculation for 1 second,
all concurrent asyncio Tasks and IO operations would be delayed
by 1 second. | Running Blocking Code =====================
Blocking (CPU-bound) code should not be called directly. For example,
if a function performs a CPU-intensive calculation for 1 second,
all concurrent asyncio Tasks and IO operations would be delayed
by 1 second. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9c78be3-6a37-46e8-b72b-4a0e5fa9d3ca | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,497 | supabase-export-v2 | fd53e8420dcc2c41 | system hook during its first iteration. At the same time, the generator records that the hook has been called and does not call it again.
Therefore, if iteration begins before the event loop is created,
the event loop will not be able to add the generator to its list of active
generators because the hooks are set after... | trusted_official_docs | CPython Docs | system hook during its first iteration. At the same time, the generator records that the hook has been called and does not call it again.
Therefore, if iteration begins before the event loop is created,
the event loop will not be able to add the generator to its list of active
generators because the hooks are set after... | system hook during its first iteration. At the same time, the generator records that the hook has been called and does not call it again.
Therefore, if iteration begins before the event loop is created,
the event loop will not be able to add the generator to its list of active
generators because the hooks are set after... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb0fd5d6-e6aa-4534-9f40-fcabd3307a3b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,491 | supabase-export-v2 | f38f689012737c0d | The example can be fixed by explicitly closing the ``cursor`` and ``rows`` async-generators::
async def main():
async with contextlib.aclosing(cursor()) as cursor_gen:
async for c in cursor_gen:
async with contextlib.aclosing(rows()) as rows_gen:
async for r in rows_gen:
break
break | trusted_official_docs | CPython Docs | The example can be fixed by explicitly closing the ``cursor`` and ``rows`` async-generators::
async def main():
async with contextlib.aclosing(cursor()) as cursor_gen:
async for c in cursor_gen:
async with contextlib.aclosing(rows()) as rows_gen:
async for r in rows_gen:
break
break | The example can be fixed by explicitly closing the ``cursor`` and ``rows`` async-generators::
async def main():
async with contextlib.aclosing(cursor()) as cursor_gen:
async for c in cursor_gen:
async with contextlib.aclosing(rows()) as rows_gen:
async for r in rows_gen:
break
break | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d025f28c-aacc-4b5d-bfcc-6172a965c772 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,487 | supabase-export-v2 | a8696143c6e7d695 | during asyncio.run() shutdown task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()> Traceback (most recent call last): File "example.py", line 6, in cursor yield 1 asyncio.exceptions.CancelledError
During handling of the above exception, another exception occu... | trusted_official_docs | CPython Docs | during asyncio.run() shutdown task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()> Traceback (most recent call last): File "example.py", line 6, in cursor yield 1 asyncio.exceptions.CancelledError
During handling of the above exception, another exception occu... | during asyncio.run() shutdown task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()> Traceback (most recent call last): File "example.py", line 6, in cursor yield 1 asyncio.exceptions.CancelledError
During handling of the above exception, another exception occu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc784920-260c-4de9-a7c4-d69bf632dd5d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,456 | supabase-export-v2 | 7457f992750c78fc | exception would never be propagated to the user code. In this case, asyncio would emit a log message when the Future object is garbage collected.
Example of an unhandled exception:: | trusted_official_docs | CPython Docs | exception would never be propagated to the user code. In this case, asyncio would emit a log message when the Future object is garbage collected.
Example of an unhandled exception:: | exception would never be propagated to the user code. In this case, asyncio would emit a log message when the Future object is garbage collected.
Example of an unhandled exception:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dcdb83c5-97ea-4d88-824a-bc153f27d26c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,516 | supabase-export-v2 | f4c0a99eed4ba1b4 | Output::
received A
Traceback (most recent call last):
File "test.py", line 38, in <module>
asyncio.run(amain())
~~~~~~~~~~~^^^^^^^^^
File "Lib/asyncio/runners.py", line 204, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "Lib/asyncio/runners.py", line 127, in run
return self._loop.run_until_complete(tas... | trusted_official_docs | CPython Docs | Output::
received A
Traceback (most recent call last):
File "test.py", line 38, in <module>
asyncio.run(amain())
~~~~~~~~~~~^^^^^^^^^
File "Lib/asyncio/runners.py", line 204, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "Lib/asyncio/runners.py", line 127, in run
return self._loop.run_until_complete(tas... | Output::
received A
Traceback (most recent call last):
File "test.py", line 38, in <module>
asyncio.run(amain())
~~~~~~~~~~~^^^^^^^^^
File "Lib/asyncio/runners.py", line 204, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "Lib/asyncio/runners.py", line 127, in run
return self._loop.run_until_complete(tas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e0aeafb1-9ec9-4135-855c-3b53708b7960 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,479 | supabase-export-v2 | e19cc1a3faca4543 | asyncio.run(func())
As noted above, the cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous
generator can occur in an unexpected order:: | trusted_official_docs | CPython Docs | asyncio.run(func())
As noted above, the cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous
generator can occur in an unexpected order:: | asyncio.run(func())
As noted above, the cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous
generator can occur in an unexpected order:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ecae9c6d-a6f4-46a3-ab0e-835f8aebe481 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,443 | supabase-export-v2 | 02336183a6903f56 | Detect never-awaited coroutines ===============================
When a coroutine function is called, but not awaited
(e.g. ``coro()`` instead of ``await coro()``)
or the coroutine is not scheduled with :meth:`asyncio.create_task`, asyncio
will emit a :exc:`RuntimeWarning`:: | trusted_official_docs | CPython Docs | Detect never-awaited coroutines ===============================
When a coroutine function is called, but not awaited
(e.g. ``coro()`` instead of ``await coro()``)
or the coroutine is not scheduled with :meth:`asyncio.create_task`, asyncio
will emit a :exc:`RuntimeWarning`:: | Detect never-awaited coroutines ===============================
When a coroutine function is called, but not awaited
(e.g. ``coro()`` instead of ``await coro()``)
or the coroutine is not scheduled with :meth:`asyncio.create_task`, asyncio
will emit a :exc:`RuntimeWarning`:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f00d5b03-0825-4de5-b873-70eb7f5bc251 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-dev.rst | unknown | b9f032f7-e45c-46bb-b259-5e648fc1b889 | 17,495 | supabase-export-v2 | 8e80f11d96e5f17d | loop uses the :func:`sys.set_asyncgen_hooks` function to register callback functions. These callbacks update the list of running asynchronous generators to keep it in a consistent state.
When the :meth:`loop.shutdown_asyncgens() <asyncio.loop.shutdown_asyncgens>`
function is called, the running generators are stopped g... | trusted_official_docs | CPython Docs | loop uses the :func:`sys.set_asyncgen_hooks` function to register callback functions. These callbacks update the list of running asynchronous generators to keep it in a consistent state.
When the :meth:`loop.shutdown_asyncgens() <asyncio.loop.shutdown_asyncgens>`
function is called, the running generators are stopped g... | loop uses the :func:`sys.set_asyncgen_hooks` function to register callback functions. These callbacks update the list of running asynchronous generators to keep it in a consistent state.
When the :meth:`loop.shutdown_asyncgens() <asyncio.loop.shutdown_asyncgens>`
function is called, the running generators are stopped g... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bd0a0ce-e918-443a-b531-a488d41948d4 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,643 | supabase-export-v2 | e3b9f2cea111f6e0 | >>> table = symtable.symtable("def some_func(): pass", "string", "exec") >>> table.lookup("some_func").is_namespace() True
Note that a single name can be bound to multiple objects. If the result
is ``True``, the name may also be bound to other objects, like an int or
list, that does not introduce a new namespace. | trusted_official_docs | CPython Docs | >>> table = symtable.symtable("def some_func(): pass", "string", "exec") >>> table.lookup("some_func").is_namespace() True
Note that a single name can be bound to multiple objects. If the result
is ``True``, the name may also be bound to other objects, like an int or
list, that does not introduce a new namespace. | >>> table = symtable.symtable("def some_func(): pass", "string", "exec") >>> table.lookup("some_func").is_namespace() True
Note that a single name can be bound to multiple objects. If the result
is ``True``, the name may also be bound to other objects, like an int or
list, that does not introduce a new namespace. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2697ce92-37cd-4539-b4a7-02fbddd7bb89 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,549 | supabase-export-v2 | 33fa4694e03db201 | Return the type of the symbol table. Possible values are members of the :class:`SymbolTableType` enumeration.
.. versionchanged:: 3.12
Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``,
and ``'type parameter'`` as possible return values. | trusted_official_docs | CPython Docs | Return the type of the symbol table. Possible values are members of the :class:`SymbolTableType` enumeration.
.. versionchanged:: 3.12
Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``,
and ``'type parameter'`` as possible return values. | Return the type of the symbol table. Possible values are members of the :class:`SymbolTableType` enumeration.
.. versionchanged:: 3.12
Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``,
and ``'type parameter'`` as possible return values. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
283f3372-5986-4f3c-9eb2-10032200f077 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,551 | supabase-export-v2 | d661758079f33a83 | .. versionchanged:: 3.13 Return values are members of the :class:`SymbolTableType` enumeration.
The exact values of the returned string may change in the future,
and thus, it is recommended to use :class:`SymbolTableType` members
instead of hard-coded strings. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.13 Return values are members of the :class:`SymbolTableType` enumeration.
The exact values of the returned string may change in the future,
and thus, it is recommended to use :class:`SymbolTableType` members
instead of hard-coded strings. | .. versionchanged:: 3.13 Return values are members of the :class:`SymbolTableType` enumeration.
The exact values of the returned string may change in the future,
and thus, it is recommended to use :class:`SymbolTableType` members
instead of hard-coded strings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2908e0a9-7765-4e75-a878-dfbf55bf7a09 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,590 | supabase-export-v2 | b3f67897dc9efb5e | Return a tuple containing the names of method-like functions declared in the class.
Here, the term 'method' designates *any* function defined in the class
body via :keyword:`def` or :keyword:`async def`. | trusted_official_docs | CPython Docs | Return a tuple containing the names of method-like functions declared in the class.
Here, the term 'method' designates *any* function defined in the class
body via :keyword:`def` or :keyword:`async def`. | Return a tuple containing the names of method-like functions declared in the class.
Here, the term 'method' designates *any* function defined in the class
body via :keyword:`def` or :keyword:`async def`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b75b537-c20e-49b2-bf70-774df2dd4ee8 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,522 | supabase-export-v2 | 8a17e9c459996263 | --------------
Symbol tables are generated by the compiler from AST just before bytecode is
generated. The symbol table is responsible for calculating the scope of every
identifier in the code. :mod:`!symtable` provides an interface to examine these
tables. | trusted_official_docs | CPython Docs | --------------
Symbol tables are generated by the compiler from AST just before bytecode is
generated. The symbol table is responsible for calculating the scope of every
identifier in the code. :mod:`!symtable` provides an interface to examine these
tables. | --------------
Symbol tables are generated by the compiler from AST just before bytecode is
generated. The symbol table is responsible for calculating the scope of every
identifier in the code. :mod:`!symtable` provides an interface to examine these
tables. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4f5438a0-2272-4f53-9266-f8e25a1f3665 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,598 | supabase-export-v2 | 7989cbf1862bd3fa | .. doctest:: symtable.Class.get_methods
>>> import symtable
>>> st = symtable.symtable('''
... def outer(): pass
... ... class A:
... def f():
... def w(): pass
... ... def g(self): pass
... ... @classmethod
... async def h(cls): pass
... ... global outer
... def outer(self): pass
... ''', 'test', 'exec')
>... | trusted_official_docs | CPython Docs | .. doctest:: symtable.Class.get_methods
>>> import symtable
>>> st = symtable.symtable('''
... def outer(): pass
... ... class A:
... def f():
... def w(): pass
... ... def g(self): pass
... ... @classmethod
... async def h(cls): pass
... ... global outer
... def outer(self): pass
... ''', 'test', 'exec')
>... | .. doctest:: symtable.Class.get_methods
>>> import symtable
>>> st = symtable.symtable('''
... def outer(): pass
... ... class A:
... def f():
... def w(): pass
... ... def g(self): pass
... ... @classmethod
... async def h(cls): pass
... ... global outer
... def outer(self): pass
... ''', 'test', 'exec')
>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6cf755b6-3fe2-49f5-9d35-4262f99f37b9 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,653 | supabase-export-v2 | 18cacd7bf9d94378 | python -m symtable [infile...]
Symbol tables are generated for the specified Python source files and
dumped to stdout. If no input file is specified, the content is read from stdin. | trusted_official_docs | CPython Docs | python -m symtable [infile...]
Symbol tables are generated for the specified Python source files and
dumped to stdout. If no input file is specified, the content is read from stdin. | python -m symtable [infile...]
Symbol tables are generated for the specified Python source files and
dumped to stdout. If no input file is specified, the content is read from stdin. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
82564c3c-0213-451a-9595-5654910646d6 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,544 | supabase-export-v2 | 9c8073d33e21ba3b | .. attribute:: TYPE_VARIABLE :value: "type variable"
Used for the symbol table of the bound, the constraint tuple or the
default value of a single type variable in the formal sense, i.e.,
a TypeVar, a TypeVarTuple or a ParamSpec object (the latter two do
not support a bound or a constraint tuple). | trusted_official_docs | CPython Docs | .. attribute:: TYPE_VARIABLE :value: "type variable"
Used for the symbol table of the bound, the constraint tuple or the
default value of a single type variable in the formal sense, i.e.,
a TypeVar, a TypeVarTuple or a ParamSpec object (the latter two do
not support a bound or a constraint tuple). | .. attribute:: TYPE_VARIABLE :value: "type variable"
Used for the symbol table of the bound, the constraint tuple or the
default value of a single type variable in the formal sense, i.e.,
a TypeVar, a TypeVarTuple or a ParamSpec object (the latter two do
not support a bound or a constraint tuple). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0c97b2d-f8ab-4981-847d-b76ba1d01cc1 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,526 | supabase-export-v2 | ba877748dfc23014 | the *mode* argument to :func:`compile`. The optional argument *module* specifies the module name. It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings by module name.
.. versionadded:: 3.15
Added the *module* parameter. | trusted_official_docs | CPython Docs | the *mode* argument to :func:`compile`. The optional argument *module* specifies the module name. It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings by module name.
.. versionadded:: 3.15
Added the *module* parameter. | the *mode* argument to :func:`compile`. The optional argument *module* specifies the module name. It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings by module name.
.. versionadded:: 3.15
Added the *module* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b15a8851-8a24-47f8-aec6-68de7ba77453 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,631 | supabase-export-v2 | 6523f2ff154ba910 | def f(): x = 1 # function-scoped class C: x = 2 # class-scoped def method(self): return x
In this example, the class-scoped symbol ``x`` is considered to
be free from the perspective of ``C.method``, thereby allowing
the latter to return *1* at runtime and not *2*. | trusted_official_docs | CPython Docs | def f(): x = 1 # function-scoped class C: x = 2 # class-scoped def method(self): return x
In this example, the class-scoped symbol ``x`` is considered to
be free from the perspective of ``C.method``, thereby allowing
the latter to return *1* at runtime and not *2*. | def f(): x = 1 # function-scoped class C: x = 2 # class-scoped def method(self): return x
In this example, the class-scoped symbol ``x`` is considered to
be free from the perspective of ``C.method``, thereby allowing
the latter to return *1* at runtime and not *2*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c5b330f4-cddc-4ea6-af50-800f616ab4c6 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,555 | supabase-export-v2 | c5251c26d21c1b69 | .. method:: get_name()
Return the table's name. This is the name of the class if the table is
for a class, the name of the function if the table is for a function, or
``'top'`` if the table is global (:meth:`get_type` returns ``'module'``). For type parameter scopes (which are used for generic classes, functions,
an... | trusted_official_docs | CPython Docs | .. method:: get_name()
Return the table's name. This is the name of the class if the table is
for a class, the name of the function if the table is for a function, or
``'top'`` if the table is global (:meth:`get_type` returns ``'module'``). For type parameter scopes (which are used for generic classes, functions,
an... | .. method:: get_name()
Return the table's name. This is the name of the class if the table is
for a class, the name of the function if the table is for a function, or
``'top'`` if the table is global (:meth:`get_type` returns ``'module'``). For type parameter scopes (which are used for generic classes, functions,
an... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d2309a03-73ad-45f3-967b-b6827daa0c22 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,591 | supabase-export-v2 | 2e6162eab2b1643f | Here, the term 'method' designates *any* function defined in the class body via :keyword:`def` or :keyword:`async def`.
Functions defined in a deeper scope (e.g., in an inner class) are not
picked up by :meth:`get_methods`. | trusted_official_docs | CPython Docs | Here, the term 'method' designates *any* function defined in the class body via :keyword:`def` or :keyword:`async def`.
Functions defined in a deeper scope (e.g., in an inner class) are not
picked up by :meth:`get_methods`. | Here, the term 'method' designates *any* function defined in the class body via :keyword:`def` or :keyword:`async def`.
Functions defined in a deeper scope (e.g., in an inner class) are not
picked up by :meth:`get_methods`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e108ca6f-d2e3-41f1-94b2-3c70763949c9 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,599 | supabase-export-v2 | 1cef1ee741e90430 | async def h(cls): pass ... ... global outer ... def outer(self): pass ... ''', 'test', 'exec') >>> class_A = st.get_children()[2] >>> class_A.get_methods() ('f', 'g', 'h')
Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still
considered as a method-like function. | trusted_official_docs | CPython Docs | async def h(cls): pass ... ... global outer ... def outer(self): pass ... ''', 'test', 'exec') >>> class_A = st.get_children()[2] >>> class_A.get_methods() ('f', 'g', 'h')
Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still
considered as a method-like function. | async def h(cls): pass ... ... global outer ... def outer(self): pass ... ''', 'test', 'exec') >>> class_A = st.get_children()[2] >>> class_A.get_methods() ('f', 'g', 'h')
Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still
considered as a method-like function. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e3363b88-74a9-4511-a61a-f94fdf6dee33 | CPython Docs | file://datasets/cpython/Doc/library/symtable.rst | unknown | 60b96136-5d48-4eba-ae42-63e6d5d1d919 | 17,525 | supabase-export-v2 | 5d97c7954075f2c0 | .. function:: symtable(code, filename, compile_type, *, module=None)
Return the toplevel :class:`SymbolTable` for the Python source *code*. *filename* is the name of the file containing the code. *compile_type* is
like the *mode* argument to :func:`compile`. The optional argument *module* specifies the module name. It... | trusted_official_docs | CPython Docs | .. function:: symtable(code, filename, compile_type, *, module=None)
Return the toplevel :class:`SymbolTable` for the Python source *code*. *filename* is the name of the file containing the code. *compile_type* is
like the *mode* argument to :func:`compile`. The optional argument *module* specifies the module name. It... | .. function:: symtable(code, filename, compile_type, *, module=None)
Return the toplevel :class:`SymbolTable` for the Python source *code*. *filename* is the name of the file containing the code. *compile_type* is
like the *mode* argument to :func:`compile`. The optional argument *module* specifies the module name. It... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
04600ff0-98af-4b4e-9e77-64f6cb95ca08 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,755 | supabase-export-v2 | 51143a264cbd4b44 | def is_prime(n): if n < 2: return False if n == 2: return True if n % 2 == 0: return False
sqrt_n = int(math.floor(math.sqrt(n)))
for i in range(3, sqrt_n + 1, 2):
if n % i == 0:
return False
return True | trusted_official_docs | CPython Docs | def is_prime(n): if n < 2: return False if n == 2: return True if n % 2 == 0: return False
sqrt_n = int(math.floor(math.sqrt(n)))
for i in range(3, sqrt_n + 1, 2):
if n % i == 0:
return False
return True | def is_prime(n): if n < 2: return False if n == 2: return True if n % 2 == 0: return False
sqrt_n = int(math.floor(math.sqrt(n)))
for i in range(3, sqrt_n + 1, 2):
if n % i == 0:
return False
return True | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
080aba39-3f3e-40a0-b5b2-36453c953534 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,737 | supabase-export-v2 | c054d1055f8c35a5 | terminates abruptly, a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. Previously, behaviour was undefined but operations on the executor or its futures would often freeze or deadlock.
.. versionchanged:: 3.7
The *mp_context* argument was added to allow users to control the
start_method for ... | trusted_official_docs | CPython Docs | terminates abruptly, a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. Previously, behaviour was undefined but operations on the executor or its futures would often freeze or deadlock.
.. versionchanged:: 3.7
The *mp_context* argument was added to allow users to control the
start_method for ... | terminates abruptly, a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. Previously, behaviour was undefined but operations on the executor or its futures would often freeze or deadlock.
.. versionchanged:: 3.7
The *mp_context* argument was added to allow users to control the
start_method for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0cc8d15b-6e51-4d4b-a557-ac69f86ba8d4 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,674 | supabase-export-v2 | e95b93ba1066accc | to :meth:`Executor.map`. *timeout* can be an int or a float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
If a *fn* call raises an exception, then that exception will be
raised when its value is retrieved from the iterator. | trusted_official_docs | CPython Docs | to :meth:`Executor.map`. *timeout* can be an int or a float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
If a *fn* call raises an exception, then that exception will be
raised when its value is retrieved from the iterator. | to :meth:`Executor.map`. *timeout* can be an int or a float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
If a *fn* call raises an exception, then that exception will be
raised when its value is retrieved from the iterator. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0df9b31a-8298-4bf6-bcdc-fbc05ad2a389 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,781 | supabase-export-v2 | 4e4b4697bbf80951 | them. If the callable raises an :exc:`Exception` subclass, it will be logged and ignored. If the callable raises a :exc:`BaseException` subclass, the behavior is undefined.
If the future has already completed or been cancelled, *fn* will be
called immediately. | trusted_official_docs | CPython Docs | them. If the callable raises an :exc:`Exception` subclass, it will be logged and ignored. If the callable raises a :exc:`BaseException` subclass, the behavior is undefined.
If the future has already completed or been cancelled, *fn* will be
called immediately. | them. If the callable raises an :exc:`Exception` subclass, it will be logged and ignored. If the callable raises a :exc:`BaseException` subclass, the behavior is undefined.
If the future has already completed or been cancelled, *fn* will be
called immediately. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11ba0e62-a23b-4ded-9b74-8cec3d3fefa3 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,725 | supabase-export-v2 | 9dae86dd5783623a | worker serializes the callable and arguments using :mod:`pickle` when sending them to its interpreter. The worker likewise serializes the return value when sending it back.
When a worker's current task raises an uncaught exception, the worker
always tries to preserve the exception as-is. If that is successful
then it a... | trusted_official_docs | CPython Docs | worker serializes the callable and arguments using :mod:`pickle` when sending them to its interpreter. The worker likewise serializes the return value when sending it back.
When a worker's current task raises an uncaught exception, the worker
always tries to preserve the exception as-is. If that is successful
then it a... | worker serializes the callable and arguments using :mod:`pickle` when sending them to its interpreter. The worker likewise serializes the return value when sending it back.
When a worker's current task raises an uncaught exception, the worker
always tries to preserve the exception as-is. If that is successful
then it a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
157a47a3-17ba-4be7-aa41-abb05511bc9e | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,754 | supabase-export-v2 | 3487fcb1512c01e9 | PRIMES = [ 112272535095293, 112582705942171, 112272535095293, 115280095190773, 115797848077099, 1099726899285419]
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False | trusted_official_docs | CPython Docs | PRIMES = [ 112272535095293, 112582705942171, 112272535095293, 115280095190773, 115797848077099, 1099726899285419]
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False | PRIMES = [ 112272535095293, 112582705942171, 112272535095293, 115280095190773, 115797848077099, 1099726899285419]
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18c50e1e-6a06-48cc-a165-2c2097838926 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,715 | supabase-export-v2 | 65cfb306628459e5 | interpreter lock>`, so code running in one interpreter can run on one CPU core, while code in another interpreter runs unblocked on a different core.
The tradeoff is that writing concurrent code for use with multiple
interpreters can take extra effort. However, this is because it
forces you to be deliberate about how a... | trusted_official_docs | CPython Docs | interpreter lock>`, so code running in one interpreter can run on one CPU core, while code in another interpreter runs unblocked on a different core.
The tradeoff is that writing concurrent code for use with multiple
interpreters can take extra effort. However, this is because it
forces you to be deliberate about how a... | interpreter lock>`, so code running in one interpreter can run on one CPU core, while code in another interpreter runs unblocked on a different core.
The tradeoff is that writing concurrent code for use with multiple
interpreters can take extra effort. However, this is because it
forces you to be deliberate about how a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1952868b-d2fc-49ac-a107-ebcf78118db0 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,787 | supabase-export-v2 | ccef236b94270502 | the method returns ``True`` then the :class:`Future` was not cancelled and has been put in the running state, i.e. calls to :meth:`Future.running` will return ``True``.
This method can only be called once and cannot be called after
:meth:`Future.set_result` or :meth:`Future.set_exception` have been
called. | trusted_official_docs | CPython Docs | the method returns ``True`` then the :class:`Future` was not cancelled and has been put in the running state, i.e. calls to :meth:`Future.running` will return ``True``.
This method can only be called once and cannot be called after
:meth:`Future.set_result` or :meth:`Future.set_exception` have been
called. | the method returns ``True`` then the :class:`Future` was not cancelled and has been put in the running state, i.e. calls to :meth:`Future.running` will return ``True``.
This method can only be called once and cannot be called after
:meth:`Future.set_result` or :meth:`Future.set_exception` have been
called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a8bcd41-b3ce-43d0-bfd7-4e9d7779676a | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,807 | supabase-export-v2 | fd5d11f5b831db93 | .. function:: as_completed(fs, timeout=None)
Returns an iterator over the :class:`Future` instances (possibly created by
different :class:`Executor` instances) given by *fs* that yields futures as
they complete (finished or cancelled futures). Any futures given by *fs* that
are duplicated will be returned once. Any ... | trusted_official_docs | CPython Docs | .. function:: as_completed(fs, timeout=None)
Returns an iterator over the :class:`Future` instances (possibly created by
different :class:`Executor` instances) given by *fs* that yields futures as
they complete (finished or cancelled futures). Any futures given by *fs* that
are duplicated will be returned once. Any ... | .. function:: as_completed(fs, timeout=None)
Returns an iterator over the :class:`Future` instances (possibly created by
different :class:`Executor` instances) given by *fs* that yields futures as
they complete (finished or cancelled futures). Any futures given by *fs* that
are duplicated will be returned once. Any ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e519167-e0bc-461c-9039-078d85f88020 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,798 | supabase-export-v2 | 553e5e35c32b91d9 | .. function:: wait(fs, timeout=None, return_when=ALL_COMPLETED)
Wait for the :class:`Future` instances (possibly created by different
:class:`Executor` instances) given by *fs* to complete. Duplicate futures
given to *fs* are removed and will be returned only once. Returns a named
2-tuple of sets. The first set, nam... | trusted_official_docs | CPython Docs | .. function:: wait(fs, timeout=None, return_when=ALL_COMPLETED)
Wait for the :class:`Future` instances (possibly created by different
:class:`Executor` instances) given by *fs* to complete. Duplicate futures
given to *fs* are removed and will be returned only once. Returns a named
2-tuple of sets. The first set, nam... | .. function:: wait(fs, timeout=None, return_when=ALL_COMPLETED)
Wait for the :class:`Future` instances (possibly created by different
:class:`Executor` instances) given by *fs* to complete. Duplicate futures
given to *fs* are removed and will be returned only once. Returns a named
2-tuple of sets. The first set, nam... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
221447ec-3482-4306-9582-1faee39d339e | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,690 | supabase-export-v2 | bd8dd04521bb6e47 | import time def wait_on_b(): time.sleep(5) print(b.result()) # b will never complete because it is waiting on a. return 5
def wait_on_a():
time.sleep(5)
print(a.result()) # a will never complete because it is waiting on b. return 6 | trusted_official_docs | CPython Docs | import time def wait_on_b(): time.sleep(5) print(b.result()) # b will never complete because it is waiting on a. return 5
def wait_on_a():
time.sleep(5)
print(a.result()) # a will never complete because it is waiting on b. return 6 | import time def wait_on_b(): time.sleep(5) print(b.result()) # b will never complete because it is waiting on a. return 5
def wait_on_a():
time.sleep(5)
print(a.result()) # a will never complete because it is waiting on b. return 6 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2393a6f2-7893-4ac0-879a-bd78ba079260 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,763 | supabase-export-v2 | 1713353b4799078f | .. method:: cancel()
Attempt to cancel the call. If the call is currently being executed or
finished running and cannot be cancelled then the method will return
``False``, otherwise the call will be cancelled and the method will
return ``True``. | trusted_official_docs | CPython Docs | .. method:: cancel()
Attempt to cancel the call. If the call is currently being executed or
finished running and cannot be cancelled then the method will return
``False``, otherwise the call will be cancelled and the method will
return ``True``. | .. method:: cancel()
Attempt to cancel the call. If the call is currently being executed or
finished running and cannot be cancelled then the method will return
``False``, otherwise the call will be cancelled and the method will
return ``True``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
248dd010-0a7c-4a18-9c94-cecbea45169f | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,668 | supabase-export-v2 | 5169b6e38c51328f | Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and returns a :class:`Future` object representing the execution of the callable. ::
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(pow, 323, 1235)
print(future.result()) | trusted_official_docs | CPython Docs | Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and returns a :class:`Future` object representing the execution of the callable. ::
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(pow, 323, 1235)
print(future.result()) | Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and returns a :class:`Future` object representing the execution of the callable. ::
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(pow, 323, 1235)
print(future.result()) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
304ccfc9-55b1-43a3-949e-ee6eeed3c023 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,732 | supabase-export-v2 | 27ea941056e6a3ab | .. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
An :class:`Executor` subclass that executes calls asynchronously using a pool
of at most *max_workers* processes. If *max_workers* is ``None`` or not
given, it will default to :func:`os.process_c... | trusted_official_docs | CPython Docs | .. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
An :class:`Executor` subclass that executes calls asynchronously using a pool
of at most *max_workers* processes. If *max_workers* is ``None`` or not
given, it will default to :func:`os.process_c... | .. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
An :class:`Executor` subclass that executes calls asynchronously using a pool
of at most *max_workers* processes. If *max_workers* is ``None`` or not
given, it will default to :func:`os.process_c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
38f7f0d2-5a7f-46a1-820a-5a3ab8e92a78 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,756 | supabase-export-v2 | 2145314adb55c446 | sqrt_n = int(math.floor(math.sqrt(n))) for i in range(3, sqrt_n + 1, 2): if n % i == 0: return False return True
def main():
with concurrent.futures.ProcessPoolExecutor() as executor:
for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
print('%d is prime: %s' % (number, prime)) | trusted_official_docs | CPython Docs | sqrt_n = int(math.floor(math.sqrt(n))) for i in range(3, sqrt_n + 1, 2): if n % i == 0: return False return True
def main():
with concurrent.futures.ProcessPoolExecutor() as executor:
for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
print('%d is prime: %s' % (number, prime)) | sqrt_n = int(math.floor(math.sqrt(n))) for i in range(3, sqrt_n + 1, 2): if n % i == 0: return False return True
def main():
with concurrent.futures.ProcessPoolExecutor() as executor:
for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
print('%d is prime: %s' % (number, prime)) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3945be8d-f468-4545-be83-dfc1b8a816d4 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,683 | supabase-export-v2 | 104543c2607bed29 | and *wait* are ``True``, all futures that the executor has started running will be completed prior to this method returning. The remaining futures are cancelled.
You can avoid having to call this method explicitly if you use the executor
as a :term:`context manager` via the :keyword:`with` statement, which
will shutd... | trusted_official_docs | CPython Docs | and *wait* are ``True``, all futures that the executor has started running will be completed prior to this method returning. The remaining futures are cancelled.
You can avoid having to call this method explicitly if you use the executor
as a :term:`context manager` via the :keyword:`with` statement, which
will shutd... | and *wait* are ``True``, all futures that the executor has started running will be completed prior to this method returning. The remaining futures are cancelled.
You can avoid having to call this method explicitly if you use the executor
as a :term:`context manager` via the :keyword:`with` statement, which
will shutd... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3ed7f20a-4b3a-4eff-bee5-19d1592fdd82 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,800 | supabase-export-v2 | 55133d3157483291 | wait before returning. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
*return_when* indicates when this function should return. It must be one of
the following constants: | trusted_official_docs | CPython Docs | wait before returning. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
*return_when* indicates when this function should return. It must be one of
the following constants: | wait before returning. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
*return_when* indicates when this function should return. It must be one of
the following constants: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
412f9df2-d83a-40b7-989c-3e9cc8313ea0 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,742 | supabase-export-v2 | d7251210b0155fd1 | .. versionchanged:: 3.13 *max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:`os.cpu_count`.
.. versionchanged:: 3.14
The default process start method (see
:ref:`multiprocessing-start-methods`) changed away from *fork*. If you
require the *fork* start method for :class:`ProcessPoolExecutor` ... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.13 *max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:`os.cpu_count`.
.. versionchanged:: 3.14
The default process start method (see
:ref:`multiprocessing-start-methods`) changed away from *fork*. If you
require the *fork* start method for :class:`ProcessPoolExecutor` ... | .. versionchanged:: 3.13 *max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:`os.cpu_count`.
.. versionchanged:: 3.14
The default process start method (see
:ref:`multiprocessing-start-methods`) changed away from *fork*. If you
require the *fork* start method for :class:`ProcessPoolExecutor` ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c88f428-a5d7-4813-a3cf-5b58c974224a | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,716 | supabase-export-v2 | a059bcf09bd7470b | about concurrency. Another major benefit is that you don't have to deal with several of the big pain points of using threads, like race conditions.
Each worker's interpreter is isolated from all the other interpreters. "Isolated" means each interpreter has its own runtime state and
operates completely independently. Fo... | trusted_official_docs | CPython Docs | about concurrency. Another major benefit is that you don't have to deal with several of the big pain points of using threads, like race conditions.
Each worker's interpreter is isolated from all the other interpreters. "Isolated" means each interpreter has its own runtime state and
operates completely independently. Fo... | about concurrency. Another major benefit is that you don't have to deal with several of the big pain points of using threads, like race conditions.
Each worker's interpreter is isolated from all the other interpreters. "Isolated" means each interpreter has its own runtime state and
operates completely independently. Fo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fd69f33-86f8-4b3c-b000-a46311d6a177 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,717 | supabase-export-v2 | 6ee8acb39c6e5425 | each module imported in an interpreter is a completely separate object from the same module in a different interpreter, including :mod:`sys`, :mod:`builtins`, and even ``__main__``.
Isolation means a mutable object, or other data, cannot be used
by more than one interpreter at the same time. That effectively means
inte... | trusted_official_docs | CPython Docs | each module imported in an interpreter is a completely separate object from the same module in a different interpreter, including :mod:`sys`, :mod:`builtins`, and even ``__main__``.
Isolation means a mutable object, or other data, cannot be used
by more than one interpreter at the same time. That effectively means
inte... | each module imported in an interpreter is a completely separate object from the same module in a different interpreter, including :mod:`sys`, :mod:`builtins`, and even ``__main__``.
Isolation means a mutable object, or other data, cannot be used
by more than one interpreter at the same time. That effectively means
inte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fefe035-6d54-4f3b-9b0a-e90facd9b1b8 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,700 | supabase-export-v2 | 1e4205a4d414cbe1 | is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for :class:`ProcessPoolExecutor`.
.. versionchanged:: 3.6
Added the *thread_name_prefix* parameter to allow users to
control the :class:`threading.Thread` names for worker threads created by
the poo... | trusted_official_docs | CPython Docs | is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for :class:`ProcessPoolExecutor`.
.. versionchanged:: 3.6
Added the *thread_name_prefix* parameter to allow users to
control the :class:`threading.Thread` names for worker threads created by
the poo... | is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for :class:`ProcessPoolExecutor`.
.. versionchanged:: 3.6
Added the *thread_name_prefix* parameter to allow users to
control the :class:`threading.Thread` names for worker threads created by
the poo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5250001a-ed01-4854-a5af-1c78570190d5 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,721 | supabase-export-v2 | e2b5d05738a98819 | or other data. Each interpreter has its own :term:`Global Interpreter Lock <global interpreter lock>`, which means code run with this executor has true multi-core parallelism.
The optional *initializer* and *initargs* arguments have the same
meaning as for :class:`!ThreadPoolExecutor`: the initializer is run
when eac... | trusted_official_docs | CPython Docs | or other data. Each interpreter has its own :term:`Global Interpreter Lock <global interpreter lock>`, which means code run with this executor has true multi-core parallelism.
The optional *initializer* and *initargs* arguments have the same
meaning as for :class:`!ThreadPoolExecutor`: the initializer is run
when eac... | or other data. Each interpreter has its own :term:`Global Interpreter Lock <global interpreter lock>`, which means code run with this executor has true multi-core parallelism.
The optional *initializer* and *initargs* arguments have the same
meaning as for :class:`!ThreadPoolExecutor`: the initializer is run
when eac... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55a4ccaa-d72e-491d-9b83-f7c4eb782af3 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,735 | supabase-export-v2 | 96c7626b2c5b9bba | the "spawn" multiprocessing start method will be used by default in absence of a *mp_context* parameter. This feature is incompatible with the "fork" start method.
.. note::
Bugs have been reported when using the *max_tasks_per_child* feature that
can result in the :class:`ProcessPoolExecutor` hanging in some
circum... | trusted_official_docs | CPython Docs | the "spawn" multiprocessing start method will be used by default in absence of a *mp_context* parameter. This feature is incompatible with the "fork" start method.
.. note::
Bugs have been reported when using the *max_tasks_per_child* feature that
can result in the :class:`ProcessPoolExecutor` hanging in some
circum... | the "spawn" multiprocessing start method will be used by default in absence of a *mp_context* parameter. This feature is incompatible with the "fork" start method.
.. note::
Bugs have been reported when using the *max_tasks_per_child* feature that
can result in the :class:`ProcessPoolExecutor` hanging in some
circum... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59f012b2-d677-42bf-8a03-2513e8ffcf6f | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,679 | supabase-export-v2 | dafe570a6ca6cddd | .. method:: shutdown(wait=True, *, cancel_futures=False)
Signal the executor that it should free any resources that it is using
when the currently pending futures are done executing. Calls to
:meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will
raise :exc:`RuntimeError`. | trusted_official_docs | CPython Docs | .. method:: shutdown(wait=True, *, cancel_futures=False)
Signal the executor that it should free any resources that it is using
when the currently pending futures are done executing. Calls to
:meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will
raise :exc:`RuntimeError`. | .. method:: shutdown(wait=True, *, cancel_futures=False)
Signal the executor that it should free any resources that it is using
when the currently pending futures are done executing. Calls to
:meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will
raise :exc:`RuntimeError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d8456dd-62d0-44c2-bf20-e3b2521dfd55 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,698 | supabase-export-v2 | 51b71ad78f7dd426 | caught and handled in order to signal threads to exit gracefully. For this reason, it is recommended that ``ThreadPoolExecutor`` not be used for long-running tasks.
*initializer* is an optional callable that is called at the start of
each worker thread; *initargs* is a tuple of arguments passed to the
initializer. Sh... | trusted_official_docs | CPython Docs | caught and handled in order to signal threads to exit gracefully. For this reason, it is recommended that ``ThreadPoolExecutor`` not be used for long-running tasks.
*initializer* is an optional callable that is called at the start of
each worker thread; *initargs* is a tuple of arguments passed to the
initializer. Sh... | caught and handled in order to signal threads to exit gracefully. For this reason, it is recommended that ``ThreadPoolExecutor`` not be used for long-running tasks.
*initializer* is an optional callable that is called at the start of
each worker thread; *initargs* is a tuple of arguments passed to the
initializer. Sh... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
65e8ee94-db2e-4c88-9198-25d9e03d00f9 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,661 | supabase-export-v2 | e7e4c8ddd7f5a5bb | performed with threads, using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate processes, using :class:`ProcessPoolExecutor`. Each implements the same interface, which is defined by the abstract :class:`Executor` class.
:class:`concurrent.futures.Future` must not be confused with
:class:`asy... | trusted_official_docs | CPython Docs | performed with threads, using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate processes, using :class:`ProcessPoolExecutor`. Each implements the same interface, which is defined by the abstract :class:`Executor` class.
:class:`concurrent.futures.Future` must not be confused with
:class:`asy... | performed with threads, using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate processes, using :class:`ProcessPoolExecutor`. Each implements the same interface, which is defined by the abstract :class:`Executor` class.
:class:`concurrent.futures.Future` must not be confused with
:class:`asy... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73a445a5-63ec-4886-a1c2-f530d78f34e6 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,785 | supabase-export-v2 | b389c7f9044a5d76 | This method should only be called by :class:`Executor` implementations before executing the work associated with the :class:`Future` and by unit tests.
If the method returns ``False`` then the :class:`Future` was cancelled,
i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads
waiting on the :class... | trusted_official_docs | CPython Docs | This method should only be called by :class:`Executor` implementations before executing the work associated with the :class:`Future` and by unit tests.
If the method returns ``False`` then the :class:`Future` was cancelled,
i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads
waiting on the :class... | This method should only be called by :class:`Executor` implementations before executing the work associated with the :class:`Future` and by unit tests.
If the method returns ``False`` then the :class:`Future` was cancelled,
i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads
waiting on the :class... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
78c7d1ee-aceb-460c-a194-067202d9546e | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,744 | supabase-export-v2 | 8b69754b9649fba4 | .. method:: terminate_workers()
Attempt to terminate all living worker processes immediately by calling
:meth:`Process.terminate <multiprocessing.Process.terminate>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all
other resources associated with the executor are freed. | trusted_official_docs | CPython Docs | .. method:: terminate_workers()
Attempt to terminate all living worker processes immediately by calling
:meth:`Process.terminate <multiprocessing.Process.terminate>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all
other resources associated with the executor are freed. | .. method:: terminate_workers()
Attempt to terminate all living worker processes immediately by calling
:meth:`Process.terminate <multiprocessing.Process.terminate>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all
other resources associated with the executor are freed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
791ff92a-ff9f-4ecb-a91c-bd2368db73b9 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,702 | supabase-export-v2 | d4459c2a1321dd36 | .. versionchanged:: 3.7 Added the *initializer* and *initargs* arguments.
.. versionchanged:: 3.8
Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``. This default value preserves at least 5 workers for I/O bound tasks. It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7 Added the *initializer* and *initargs* arguments.
.. versionchanged:: 3.8
Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``. This default value preserves at least 5 workers for I/O bound tasks. It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL... | .. versionchanged:: 3.7 Added the *initializer* and *initargs* arguments.
.. versionchanged:: 3.8
Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``. This default value preserves at least 5 workers for I/O bound tasks. It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7b0073c0-a281-4c09-b523-0e6d16a87ac3 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,697 | supabase-export-v2 | 3f535ca28112879a | An :class:`Executor` subclass that uses a pool of at most *max_workers* threads to execute calls asynchronously.
All threads enqueued to ``ThreadPoolExecutor`` will be joined before the
interpreter can exit. Note that the exit handler which does this is
executed *before* any exit handlers added using ``atexit``. This... | trusted_official_docs | CPython Docs | An :class:`Executor` subclass that uses a pool of at most *max_workers* threads to execute calls asynchronously.
All threads enqueued to ``ThreadPoolExecutor`` will be joined before the
interpreter can exit. Note that the exit handler which does this is
executed *before* any exit handlers added using ``atexit``. This... | An :class:`Executor` subclass that uses a pool of at most *max_workers* threads to execute calls asynchronously.
All threads enqueued to ``ThreadPoolExecutor`` will be joined before the
interpreter can exit. Note that the exit handler which does this is
executed *before* any exit handlers added using ``atexit``. This... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
81293b3a-ba23-477d-bf55-964bc49b0d58 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,729 | supabase-export-v2 | 9534215e979da921 | The ``__main__`` module must be importable by worker subprocesses. This means that :class:`ProcessPoolExecutor` will not work in the interactive interpreter.
Calling :class:`Executor` or :class:`Future` methods from a callable submitted
to a :class:`ProcessPoolExecutor` will result in deadlock. | trusted_official_docs | CPython Docs | The ``__main__`` module must be importable by worker subprocesses. This means that :class:`ProcessPoolExecutor` will not work in the interactive interpreter.
Calling :class:`Executor` or :class:`Future` methods from a callable submitted
to a :class:`ProcessPoolExecutor` will result in deadlock. | The ``__main__`` module must be importable by worker subprocesses. This means that :class:`ProcessPoolExecutor` will not work in the interactive interpreter.
Calling :class:`Executor` or :class:`Future` methods from a callable submitted
to a :class:`ProcessPoolExecutor` will result in deadlock. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86a3f7b9-b772-4681-a08d-680e96147b96 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,748 | supabase-export-v2 | cb049c597ec523cd | calling :meth:`Process.kill <multiprocessing.Process.kill>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed.
After calling this method the caller should no longer submit tasks to the
executor. | trusted_official_docs | CPython Docs | calling :meth:`Process.kill <multiprocessing.Process.kill>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed.
After calling this method the caller should no longer submit tasks to the
executor. | calling :meth:`Process.kill <multiprocessing.Process.kill>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed.
After calling this method the caller should no longer submit tasks to the
executor. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
88da4331-8c41-4ea0-9585-c48852bdfa2e | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,688 | supabase-export-v2 | 6fd55582cac32800 | :class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a pool of threads to execute calls asynchronously.
Deadlocks can occur when the callable associated with a :class:`Future` waits on
the results of another :class:`Future`. For example:: | trusted_official_docs | CPython Docs | :class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a pool of threads to execute calls asynchronously.
Deadlocks can occur when the callable associated with a :class:`Future` waits on
the results of another :class:`Future`. For example:: | :class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a pool of threads to execute calls asynchronously.
Deadlocks can occur when the callable associated with a :class:`Future` waits on
the results of another :class:`Future`. For example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a0bdae6-a37c-486c-b9cb-7b91594f5da9 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,701 | supabase-export-v2 | 8bb5acb9a9d6230e | .. versionchanged:: 3.6 Added the *thread_name_prefix* parameter to allow users to control the :class:`threading.Thread` names for worker threads created by the pool for easier debugging.
.. versionchanged:: 3.7
Added the *initializer* and *initargs* arguments. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.6 Added the *thread_name_prefix* parameter to allow users to control the :class:`threading.Thread` names for worker threads created by the pool for easier debugging.
.. versionchanged:: 3.7
Added the *initializer* and *initargs* arguments. | .. versionchanged:: 3.6 Added the *thread_name_prefix* parameter to allow users to control the :class:`threading.Thread` names for worker threads created by the pool for easier debugging.
.. versionchanged:: 3.7
Added the *initializer* and *initargs* arguments. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8e7489e9-5df5-4e60-b22f-e1b390eab85f | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,673 | supabase-export-v2 | ee04a212fd8edbe5 | * *fn* is executed asynchronously and several calls to *fn* may be made concurrently.
The returned iterator raises a :exc:`TimeoutError`
if :meth:`~iterator.__next__` is called and the result isn't available
after *timeout* seconds from the original call to :meth:`Executor.map`. *timeout* can be an int or a float. If... | trusted_official_docs | CPython Docs | * *fn* is executed asynchronously and several calls to *fn* may be made concurrently.
The returned iterator raises a :exc:`TimeoutError`
if :meth:`~iterator.__next__` is called and the result isn't available
after *timeout* seconds from the original call to :meth:`Executor.map`. *timeout* can be an int or a float. If... | * *fn* is executed asynchronously and several calls to *fn* may be made concurrently.
The returned iterator raises a :exc:`TimeoutError`
if :meth:`~iterator.__next__` is called and the result isn't available
after *timeout* seconds from the original call to :meth:`Executor.map`. *timeout* can be an int or a float. If... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90cbe5ac-4315-41e6-b09d-368e53d8ec27 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,805 | supabase-export-v2 | 97e97844e1f595ce | - The function will return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to :const:`ALL_COMPLETED`.
* - .. data:: ALL_COMPLETED
- The function will return when all futures finish or are cancelled. | trusted_official_docs | CPython Docs | - The function will return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to :const:`ALL_COMPLETED`.
* - .. data:: ALL_COMPLETED
- The function will return when all futures finish or are cancelled. | - The function will return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to :const:`ALL_COMPLETED`.
* - .. data:: ALL_COMPLETED
- The function will return when all futures finish or are cancelled. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
917c7e26-80c8-4438-8cf9-0333139f4166 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,713 | supabase-export-v2 | d741d8d3d24a0c54 | .. versionadded:: 3.14
The :class:`InterpreterPoolExecutor` class uses a pool of interpreters
to execute calls asynchronously. It is a :class:`ThreadPoolExecutor`
subclass, which means each worker is running in its own thread. The difference here is that each worker has its own interpreter,
and runs each task using tha... | trusted_official_docs | CPython Docs | .. versionadded:: 3.14
The :class:`InterpreterPoolExecutor` class uses a pool of interpreters
to execute calls asynchronously. It is a :class:`ThreadPoolExecutor`
subclass, which means each worker is running in its own thread. The difference here is that each worker has its own interpreter,
and runs each task using tha... | .. versionadded:: 3.14
The :class:`InterpreterPoolExecutor` class uses a pool of interpreters
to execute calls asynchronously. It is a :class:`ThreadPoolExecutor`
subclass, which means each worker is running in its own thread. The difference here is that each worker has its own interpreter,
and runs each task using tha... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
928aedfe-92cc-4fc2-8ac7-1fe98f1806f2 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,675 | supabase-export-v2 | 1c431807c473e02a | If a *fn* call raises an exception, then that exception will be raised when its value is retrieved from the iterator.
When using :class:`ProcessPoolExecutor`, this method chops *iterables*
into a number of chunks which it submits to the pool as separate
tasks. The (approximate) size of these chunks can be specified b... | trusted_official_docs | CPython Docs | If a *fn* call raises an exception, then that exception will be raised when its value is retrieved from the iterator.
When using :class:`ProcessPoolExecutor`, this method chops *iterables*
into a number of chunks which it submits to the pool as separate
tasks. The (approximate) size of these chunks can be specified b... | If a *fn* call raises an exception, then that exception will be raised when its value is retrieved from the iterator.
When using :class:`ProcessPoolExecutor`, this method chops *iterables*
into a number of chunks which it submits to the pool as separate
tasks. The (approximate) size of these chunks can be specified b... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
930cc2ff-32da-4646-be74-6a7128002b52 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,775 | supabase-export-v2 | 1c09864ecd5ea706 | .. method:: exception(timeout=None)
Return the exception raised by the call. If the call hasn't yet
completed then this method will wait up to *timeout* seconds. If the
call hasn't completed in *timeout* seconds, then a
:exc:`TimeoutError` will be raised. *timeout* can be
an int or float. If *timeout* is not specif... | trusted_official_docs | CPython Docs | .. method:: exception(timeout=None)
Return the exception raised by the call. If the call hasn't yet
completed then this method will wait up to *timeout* seconds. If the
call hasn't completed in *timeout* seconds, then a
:exc:`TimeoutError` will be raised. *timeout* can be
an int or float. If *timeout* is not specif... | .. method:: exception(timeout=None)
Return the exception raised by the call. If the call hasn't yet
completed then this method will wait up to *timeout* seconds. If the
call hasn't completed in *timeout* seconds, then a
:exc:`TimeoutError` will be raised. *timeout* can be
an int or float. If *timeout* is not specif... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
94205532-b87d-433f-a12e-131e9fd837ef | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,681 | supabase-export-v2 | bf8d9ba324d01f39 | pending futures are done executing. Regardless of the value of *wait*, the entire Python program will not exit until all pending futures are done executing.
If *cancel_futures* is ``True``, this method will cancel all pending
futures that the executor has not started running. Any futures that
are completed or running... | trusted_official_docs | CPython Docs | pending futures are done executing. Regardless of the value of *wait*, the entire Python program will not exit until all pending futures are done executing.
If *cancel_futures* is ``True``, this method will cancel all pending
futures that the executor has not started running. Any futures that
are completed or running... | pending futures are done executing. Regardless of the value of *wait*, the entire Python program will not exit until all pending futures are done executing.
If *cancel_futures* is ``True``, this method will cancel all pending
futures that the executor has not started running. Any futures that
are completed or running... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
958b39b4-d744-425f-9eee-bb73de44c545 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,722 | supabase-export-v2 | 862b740944605325 | this case it is run in the worker's interpreter. The executor serializes the *initializer* and *initargs* using :mod:`pickle` when sending them to the worker's interpreter.
.. note::
The executor may replace uncaught exceptions from *initializer*
with :class:`~concurrent.interpreters.ExecutionFailed`. | trusted_official_docs | CPython Docs | this case it is run in the worker's interpreter. The executor serializes the *initializer* and *initargs* using :mod:`pickle` when sending them to the worker's interpreter.
.. note::
The executor may replace uncaught exceptions from *initializer*
with :class:`~concurrent.interpreters.ExecutionFailed`. | this case it is run in the worker's interpreter. The executor serializes the *initializer* and *initargs* using :mod:`pickle` when sending them to the worker's interpreter.
.. note::
The executor may replace uncaught exceptions from *initializer*
with :class:`~concurrent.interpreters.ExecutionFailed`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
98d208e6-5664-4329-a359-f5106a6d79f6 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,714 | supabase-export-v2 | 969d0e6fe09713fb | worker is running in its own thread. The difference here is that each worker has its own interpreter, and runs each task using that interpreter.
The biggest benefit to using interpreters instead of only threads
is true multi-core parallelism. Each interpreter has its own
:term:`Global Interpreter Lock <global interpret... | trusted_official_docs | CPython Docs | worker is running in its own thread. The difference here is that each worker has its own interpreter, and runs each task using that interpreter.
The biggest benefit to using interpreters instead of only threads
is true multi-core parallelism. Each interpreter has its own
:term:`Global Interpreter Lock <global interpret... | worker is running in its own thread. The difference here is that each worker has its own interpreter, and runs each task using that interpreter.
The biggest benefit to using interpreters instead of only threads
is true multi-core parallelism. Each interpreter has its own
:term:`Global Interpreter Lock <global interpret... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
990961af-4dd3-417c-87b0-bd168536dcac | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,720 | supabase-export-v2 | f7a232ecdfab4ed2 | .. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
using a pool of at most *max_workers* threads. Each thread runs
tasks in its own interpreter. The worker interpreters are isolated
from ... | trusted_official_docs | CPython Docs | .. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
using a pool of at most *max_workers* threads. Each thread runs
tasks in its own interpreter. The worker interpreters are isolated
from ... | .. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
using a pool of at most *max_workers* threads. Each thread runs
tasks in its own interpreter. The worker interpreters are isolated
from ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f22aaa7-c4f6-40e1-b7fb-f46e769f566d | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,671 | supabase-export-v2 | a98c444136aa2bb8 | Similar to :func:`map(fn, *iterables) <map>` except:
* The *iterables* are collected immediately rather than lazily, unless a
*buffersize* is specified to limit the number of submitted tasks whose
results have not yet been yielded. If the buffer is full, iteration over
the *iterables* pauses until a result is yielde... | trusted_official_docs | CPython Docs | Similar to :func:`map(fn, *iterables) <map>` except:
* The *iterables* are collected immediately rather than lazily, unless a
*buffersize* is specified to limit the number of submitted tasks whose
results have not yet been yielded. If the buffer is full, iteration over
the *iterables* pauses until a result is yielde... | Similar to :func:`map(fn, *iterables) <map>` except:
* The *iterables* are collected immediately rather than lazily, unless a
*buffersize* is specified to limit the number of submitted tasks whose
results have not yet been yielded. If the buffer is full, iteration over
the *iterables* pauses until a result is yielde... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f44e067-52ba-4a37-a0e6-eaf978007906 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,747 | supabase-export-v2 | 941589c4c144e184 | .. method:: kill_workers()
Attempt to kill all living worker processes immediately by calling
:meth:`Process.kill <multiprocessing.Process.kill>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all
other resources associated with the executor are freed. | trusted_official_docs | CPython Docs | .. method:: kill_workers()
Attempt to kill all living worker processes immediately by calling
:meth:`Process.kill <multiprocessing.Process.kill>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all
other resources associated with the executor are freed. | .. method:: kill_workers()
Attempt to kill all living worker processes immediately by calling
:meth:`Process.kill <multiprocessing.Process.kill>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all
other resources associated with the executor are freed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3c3269f-f7e8-4450-81bc-e6942a304d62 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,741 | supabase-export-v2 | a975162cc963ba0e | internally to spawn workers may raise a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a different start method. See the :func:`os.fork` documentation for further explanation.
.. versionchanged:: 3.13
*max_workers* uses :func:`os.process_cpu_count` by default, instead of
:func:`os.cpu_count`. | trusted_official_docs | CPython Docs | internally to spawn workers may raise a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a different start method. See the :func:`os.fork` documentation for further explanation.
.. versionchanged:: 3.13
*max_workers* uses :func:`os.process_cpu_count` by default, instead of
:func:`os.cpu_count`. | internally to spawn workers may raise a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a different start method. See the :func:`os.fork` documentation for further explanation.
.. versionchanged:: 3.13
*max_workers* uses :func:`os.process_cpu_count` by default, instead of
:func:`os.cpu_count`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a9c757eb-c726-4432-b1a4-e3103e605a56 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,730 | supabase-export-v2 | fd4da5009a3f375b | Calling :class:`Executor` or :class:`Future` methods from a callable submitted to a :class:`ProcessPoolExecutor` will result in deadlock.
Note that the restrictions on functions and arguments needing to picklable as
per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
and :meth:`~Executor.map`... | trusted_official_docs | CPython Docs | Calling :class:`Executor` or :class:`Future` methods from a callable submitted to a :class:`ProcessPoolExecutor` will result in deadlock.
Note that the restrictions on functions and arguments needing to picklable as
per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
and :meth:`~Executor.map`... | Calling :class:`Executor` or :class:`Future` methods from a callable submitted to a :class:`ProcessPoolExecutor` will result in deadlock.
Note that the restrictions on functions and arguments needing to picklable as
per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
and :meth:`~Executor.map`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ac9f0507-7145-4fda-b763-c4a362ecc227 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,834 | supabase-export-v2 | ccfc7692100205ca | .. exception:: BrokenProcessPool
Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly
:exc:`RuntimeError`), this exception class is raised when one of the
workers of a :class:`~concurrent.futures.ProcessPoolExecutor`
has terminated in a non-clean
fashion (for example, if it was killed from the outside). | trusted_official_docs | CPython Docs | .. exception:: BrokenProcessPool
Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly
:exc:`RuntimeError`), this exception class is raised when one of the
workers of a :class:`~concurrent.futures.ProcessPoolExecutor`
has terminated in a non-clean
fashion (for example, if it was killed from the outside). | .. exception:: BrokenProcessPool
Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly
:exc:`RuntimeError`), this exception class is raised when one of the
workers of a :class:`~concurrent.futures.ProcessPoolExecutor`
has terminated in a non-clean
fashion (for example, if it was killed from the outside). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aca9b860-ef6a-4516-b131-26242cf41185 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,660 | supabase-export-v2 | eed39200701773df | The :mod:`!concurrent.futures` module provides a high-level interface for asynchronously executing callables.
The asynchronous execution can be performed with threads, using
:class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`,
or separate processes, using :class:`ProcessPoolExecutor`. Each implements the sa... | trusted_official_docs | CPython Docs | The :mod:`!concurrent.futures` module provides a high-level interface for asynchronously executing callables.
The asynchronous execution can be performed with threads, using
:class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`,
or separate processes, using :class:`ProcessPoolExecutor`. Each implements the sa... | The :mod:`!concurrent.futures` module provides a high-level interface for asynchronously executing callables.
The asynchronous execution can be performed with threads, using
:class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`,
or separate processes, using :class:`ProcessPoolExecutor`. Each implements the sa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af0682de-a5f5-41d0-b8e2-93df74851fb4 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,699 | supabase-export-v2 | 5c9599537325eb91 | Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`, as well as any attempt to submit more jobs to the pool.
.. versionchanged:: 3.5
If *max_workers* is ``None`` or
not given, it will default to the number of processors on the machine,
m... | trusted_official_docs | CPython Docs | Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`, as well as any attempt to submit more jobs to the pool.
.. versionchanged:: 3.5
If *max_workers* is ``None`` or
not given, it will default to the number of processors on the machine,
m... | Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`, as well as any attempt to submit more jobs to the pool.
.. versionchanged:: 3.5
If *max_workers* is ``None`` or
not given, it will default to the number of processors on the machine,
m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b058d88e-5cd6-4b38-b085-e31dc2253bc4 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,786 | supabase-export-v2 | 2ff3b12c2d61e981 | was cancelled, i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads waiting on the :class:`Future` completing (i.e. through :func:`as_completed` or :func:`wait`) will be woken up.
If the method returns ``True`` then the :class:`Future` was not cancelled
and has been put in the running state, i.e. c... | trusted_official_docs | CPython Docs | was cancelled, i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads waiting on the :class:`Future` completing (i.e. through :func:`as_completed` or :func:`wait`) will be woken up.
If the method returns ``True`` then the :class:`Future` was not cancelled
and has been put in the running state, i.e. c... | was cancelled, i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads waiting on the :class:`Future` completing (i.e. through :func:`as_completed` or :func:`wait`) will be woken up.
If the method returns ``True`` then the :class:`Future` was not cancelled
and has been put in the running state, i.e. c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b2560d6a-aad3-4f68-8554-22e641801554 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,680 | supabase-export-v2 | dc041382e36522be | any resources that it is using when the currently pending futures are done executing. Calls to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will raise :exc:`RuntimeError`.
If *wait* is ``True`` then this method will not return until all the
pending futures are done executing and the resources a... | trusted_official_docs | CPython Docs | any resources that it is using when the currently pending futures are done executing. Calls to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will raise :exc:`RuntimeError`.
If *wait* is ``True`` then this method will not return until all the
pending futures are done executing and the resources a... | any resources that it is using when the currently pending futures are done executing. Calls to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will raise :exc:`RuntimeError`.
If *wait* is ``True`` then this method will not return until all the
pending futures are done executing and the resources a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b31b0f27-cc25-4635-b1c4-e1ca0c70aaa7 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,703 | supabase-export-v2 | f678ee69c938b829 | utilizes at most 32 CPU cores for CPU bound tasks which release the GIL. And it avoids using very large resources implicitly on many-core machines.
ThreadPoolExecutor now reuses idle worker threads before starting
*max_workers* worker threads too. | trusted_official_docs | CPython Docs | utilizes at most 32 CPU cores for CPU bound tasks which release the GIL. And it avoids using very large resources implicitly on many-core machines.
ThreadPoolExecutor now reuses idle worker threads before starting
*max_workers* worker threads too. | utilizes at most 32 CPU cores for CPU bound tasks which release the GIL. And it avoids using very large resources implicitly on many-core machines.
ThreadPoolExecutor now reuses idle worker threads before starting
*max_workers* worker threads too. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b61223df-6254-4f91-975d-639dfc5204b7 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,718 | supabase-export-v2 | 95e7bf3850a0b3c3 | synchronize any changes between the copies manually. Immutable objects and data, like the builtin singletons, strings, and tuples of immutable objects, don't have these limitations.
Communicating and synchronizing between interpreters is most effectively
done using dedicated tools, like those proposed in :pep:`734`. On... | trusted_official_docs | CPython Docs | synchronize any changes between the copies manually. Immutable objects and data, like the builtin singletons, strings, and tuples of immutable objects, don't have these limitations.
Communicating and synchronizing between interpreters is most effectively
done using dedicated tools, like those proposed in :pep:`734`. On... | synchronize any changes between the copies manually. Immutable objects and data, like the builtin singletons, strings, and tuples of immutable objects, don't have these limitations.
Communicating and synchronizing between interpreters is most effectively
done using dedicated tools, like those proposed in :pep:`734`. On... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b9fdba7a-4e05-4dd6-a199-d2035ea2542d | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,740 | supabase-export-v2 | cc66da5917fd859d | .. versionchanged:: 3.11 The *max_tasks_per_child* argument was added to allow users to control the lifetime of workers in the pool.
.. versionchanged:: 3.12
On POSIX systems, if your application has multiple threads and the
:mod:`multiprocessing` context uses the ``"fork"`` start method:
The :func:`os.fork` functio... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.11 The *max_tasks_per_child* argument was added to allow users to control the lifetime of workers in the pool.
.. versionchanged:: 3.12
On POSIX systems, if your application has multiple threads and the
:mod:`multiprocessing` context uses the ``"fork"`` start method:
The :func:`os.fork` functio... | .. versionchanged:: 3.11 The *max_tasks_per_child* argument was added to allow users to control the lifetime of workers in the pool.
.. versionchanged:: 3.12
On POSIX systems, if your application has multiple threads and the
:mod:`multiprocessing` context uses the ``"fork"`` start method:
The :func:`os.fork` functio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
baf53c8f-4a03-401f-af80-736712177069 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,731 | supabase-export-v2 | f01bf81cad97809f | :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda should not be expected to work.
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_... | trusted_official_docs | CPython Docs | :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda should not be expected to work.
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_... | :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda should not be expected to work.
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2a262b0-727b-4098-be62-760e84cc3f8a | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,719 | supabase-export-v2 | 325b1cbe7d6cb32e | proposed in :pep:`734`. One less efficient alternative is to serialize with :mod:`pickle` and then send the bytes over a shared :mod:`socket <socket>` or :func:`pipe <os.pipe>`.
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) | trusted_official_docs | CPython Docs | proposed in :pep:`734`. One less efficient alternative is to serialize with :mod:`pickle` and then send the bytes over a shared :mod:`socket <socket>` or :func:`pipe <os.pipe>`.
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) | proposed in :pep:`734`. One less efficient alternative is to serialize with :mod:`pickle` and then send the bytes over a shared :mod:`socket <socket>` or :func:`pipe <os.pipe>`.
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c3596e79-56bb-43b2-8f16-4fdfb6a0b487 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,689 | supabase-export-v2 | 26ed424d101b7512 | Deadlocks can occur when the callable associated with a :class:`Future` waits on the results of another :class:`Future`. For example::
import time
def wait_on_b():
time.sleep(5)
print(b.result()) # b will never complete because it is waiting on a. return 5 | trusted_official_docs | CPython Docs | Deadlocks can occur when the callable associated with a :class:`Future` waits on the results of another :class:`Future`. For example::
import time
def wait_on_b():
time.sleep(5)
print(b.result()) # b will never complete because it is waiting on a. return 5 | Deadlocks can occur when the callable associated with a :class:`Future` waits on the results of another :class:`Future`. For example::
import time
def wait_on_b():
time.sleep(5)
print(b.result()) # b will never complete because it is waiting on a. return 5 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c832e5f1-ab40-479c-b1cf-ec4824ff14a9 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,733 | supabase-export-v2 | ce301d116d27c356 | or ``None``. It will be used to launch the workers. If *mp_context* is ``None`` or not given, the default :mod:`multiprocessing` context is used. See :ref:`multiprocessing-start-methods`.
*initializer* is an optional callable that is called at the start of
each worker process; *initargs* is a tuple of arguments passed... | trusted_official_docs | CPython Docs | or ``None``. It will be used to launch the workers. If *mp_context* is ``None`` or not given, the default :mod:`multiprocessing` context is used. See :ref:`multiprocessing-start-methods`.
*initializer* is an optional callable that is called at the start of
each worker process; *initargs* is a tuple of arguments passed... | or ``None``. It will be used to launch the workers. If *mp_context* is ``None`` or not given, the default :mod:`multiprocessing` context is used. See :ref:`multiprocessing-start-methods`.
*initializer* is an optional callable that is called at the start of
each worker process; *initargs* is a tuple of arguments passed... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9d09bc5-4d8d-4326-bfe8-b22080d353a8 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,672 | supabase-export-v2 | 9b7b588b3cbae516 | whose results have not yet been yielded. If the buffer is full, iteration over the *iterables* pauses until a result is yielded from the buffer.
* *fn* is executed asynchronously and several calls to
*fn* may be made concurrently. | trusted_official_docs | CPython Docs | whose results have not yet been yielded. If the buffer is full, iteration over the *iterables* pauses until a result is yielded from the buffer.
* *fn* is executed asynchronously and several calls to
*fn* may be made concurrently. | whose results have not yet been yielded. If the buffer is full, iteration over the *iterables* pauses until a result is yielded from the buffer.
* *fn* is executed asynchronously and several calls to
*fn* may be made concurrently. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cc20132a-1931-436e-a167-80ba73866264 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,772 | supabase-export-v2 | e48e3cf706f61fc6 | will be raised. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
If the future is cancelled before completing then :exc:`.CancelledError`
will be raised. | trusted_official_docs | CPython Docs | will be raised. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
If the future is cancelled before completing then :exc:`.CancelledError`
will be raised. | will be raised. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time.
If the future is cancelled before completing then :exc:`.CancelledError`
will be raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cf4dec1e-326c-4594-814d-36758389e64b | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,727 | supabase-export-v2 | 3ccdac5eb5e010d3 | ProcessPoolExecutor -------------------
The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that
uses a pool of processes to execute calls asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which
allows it to side-step the :term:`Global Interpreter Lock
<global inte... | trusted_official_docs | CPython Docs | ProcessPoolExecutor -------------------
The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that
uses a pool of processes to execute calls asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which
allows it to side-step the :term:`Global Interpreter Lock
<global inte... | ProcessPoolExecutor -------------------
The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that
uses a pool of processes to execute calls asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which
allows it to side-step the :term:`Global Interpreter Lock
<global inte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc308cfd-88b9-4462-ad08-6ed8780c262d | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,799 | supabase-export-v2 | 721d46d820987a67 | completed (finished or cancelled futures) before the wait completed. The second set, named ``not_done``, contains the futures that did not complete (pending or running futures).
*timeout* can be used to control the maximum number of seconds to wait before
returning. *timeout* can be an int or float. If *timeout* is no... | trusted_official_docs | CPython Docs | completed (finished or cancelled futures) before the wait completed. The second set, named ``not_done``, contains the futures that did not complete (pending or running futures).
*timeout* can be used to control the maximum number of seconds to wait before
returning. *timeout* can be an int or float. If *timeout* is no... | completed (finished or cancelled futures) before the wait completed. The second set, named ``not_done``, contains the futures that did not complete (pending or running futures).
*timeout* can be used to control the maximum number of seconds to wait before
returning. *timeout* can be an int or float. If *timeout* is no... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dfcfeeb7-8358-4d40-8a72-b6353b844d43 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,676 | supabase-export-v2 | 3875c81f441bc0b9 | using a large value for *chunksize* can significantly improve performance compared to the default size of 1. With :class:`ThreadPoolExecutor` and :class:`InterpreterPoolExecutor`, *chunksize* has no effect.
.. versionchanged:: 3.5
Added the *chunksize* parameter. | trusted_official_docs | CPython Docs | using a large value for *chunksize* can significantly improve performance compared to the default size of 1. With :class:`ThreadPoolExecutor` and :class:`InterpreterPoolExecutor`, *chunksize* has no effect.
.. versionchanged:: 3.5
Added the *chunksize* parameter. | using a large value for *chunksize* can significantly improve performance compared to the default size of 1. With :class:`ThreadPoolExecutor` and :class:`InterpreterPoolExecutor`, *chunksize* has no effect.
.. versionchanged:: 3.5
Added the *chunksize* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e098ad5a-f2ed-4f2a-a369-eb866ace7008 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,694 | supabase-export-v2 | d1af2afa9597e9ea | f = executor.submit(pow, 5, 2) # This will never complete because there is only one worker thread and # it is executing this function. print(f.result())
executor = ThreadPoolExecutor(max_workers=1)
future = executor.submit(wait_on_future)
# Note: calling future.result() would also cause a deadlock because
# the sing... | trusted_official_docs | CPython Docs | f = executor.submit(pow, 5, 2) # This will never complete because there is only one worker thread and # it is executing this function. print(f.result())
executor = ThreadPoolExecutor(max_workers=1)
future = executor.submit(wait_on_future)
# Note: calling future.result() would also cause a deadlock because
# the sing... | f = executor.submit(pow, 5, 2) # This will never complete because there is only one worker thread and # it is executing this function. print(f.result())
executor = ThreadPoolExecutor(max_workers=1)
future = executor.submit(wait_on_future)
# Note: calling future.result() would also cause a deadlock because
# the sing... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2aa9969-775f-4b62-8a19-6e08cf603881 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,734 | supabase-export-v2 | c419fcd6ba6241cf | Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.process.BrokenProcessPool`, as well as any attempt to submit more jobs to the pool.
*max_tasks_per_child* is an optional argument that specifies the maximum
number of tasks a single process can execute before it ... | trusted_official_docs | CPython Docs | Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.process.BrokenProcessPool`, as well as any attempt to submit more jobs to the pool.
*max_tasks_per_child* is an optional argument that specifies the maximum
number of tasks a single process can execute before it ... | Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.process.BrokenProcessPool`, as well as any attempt to submit more jobs to the pool.
*max_tasks_per_child* is an optional argument that specifies the maximum
number of tasks a single process can execute before it ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e9db6da5-3024-4e29-9f9e-ac7b58879bde | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,745 | supabase-export-v2 | bedacb70684bfb84 | calling :meth:`Process.terminate <multiprocessing.Process.terminate>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed.
After calling this method the caller should no longer submit tasks to the
executor. | trusted_official_docs | CPython Docs | calling :meth:`Process.terminate <multiprocessing.Process.terminate>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed.
After calling this method the caller should no longer submit tasks to the
executor. | calling :meth:`Process.terminate <multiprocessing.Process.terminate>` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed.
After calling this method the caller should no longer submit tasks to the
executor. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb82ae4b-8210-4b03-9de2-963a0de47a03 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,728 | supabase-export-v2 | b8f9a847700765d2 | module, which allows it to side-step the :term:`Global Interpreter Lock <global interpreter lock>` but also means that only picklable objects can be executed and returned.
The ``__main__`` module must be importable by worker subprocesses. This means
that :class:`ProcessPoolExecutor` will not work in the interactive int... | trusted_official_docs | CPython Docs | module, which allows it to side-step the :term:`Global Interpreter Lock <global interpreter lock>` but also means that only picklable objects can be executed and returned.
The ``__main__`` module must be importable by worker subprocesses. This means
that :class:`ProcessPoolExecutor` will not work in the interactive int... | module, which allows it to side-step the :term:`Global Interpreter Lock <global interpreter lock>` but also means that only picklable objects can be executed and returned.
The ``__main__`` module must be importable by worker subprocesses. This means
that :class:`ProcessPoolExecutor` will not work in the interactive int... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ec658ec7-36ed-441d-a4af-32e7913b6f7c | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,804 | supabase-export-v2 | 31c697ecfd109d5b | * - .. data:: FIRST_COMPLETED - The function will return when any future finishes or is cancelled.
* - .. data:: FIRST_EXCEPTION
- The function will return when any future finishes by raising an
exception. If no future raises an exception
then it is equivalent to :const:`ALL_COMPLETED`. | trusted_official_docs | CPython Docs | * - .. data:: FIRST_COMPLETED - The function will return when any future finishes or is cancelled.
* - .. data:: FIRST_EXCEPTION
- The function will return when any future finishes by raising an
exception. If no future raises an exception
then it is equivalent to :const:`ALL_COMPLETED`. | * - .. data:: FIRST_COMPLETED - The function will return when any future finishes or is cancelled.
* - .. data:: FIRST_EXCEPTION
- The function will return when any future finishes by raising an
exception. If no future raises an exception
then it is equivalent to :const:`ALL_COMPLETED`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ee726769-eb53-49f7-bd5f-f5786c6c15be | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,780 | supabase-export-v2 | cd0ea377116d260a | the callable *fn* to the future. *fn* will be called, with the future as its only argument, when the future is cancelled or finishes running.
Added callables are called in the order that they were added and are
always called in a thread belonging to the process that added them. If
the callable raises an :exc:`Excepti... | trusted_official_docs | CPython Docs | the callable *fn* to the future. *fn* will be called, with the future as its only argument, when the future is cancelled or finishes running.
Added callables are called in the order that they were added and are
always called in a thread belonging to the process that added them. If
the callable raises an :exc:`Excepti... | the callable *fn* to the future. *fn* will be called, with the future as its only argument, when the future is cancelled or finishes running.
Added callables are called in the order that they were added and are
always called in a thread belonging to the process that added them. If
the callable raises an :exc:`Excepti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
efd4e58c-a053-49ed-97cc-a86c25687078 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,695 | supabase-export-v2 | a1603a7d9a5e724a | = ThreadPoolExecutor(max_workers=1) future = executor.submit(wait_on_future) # Note: calling future.result() would also cause a deadlock because # the single worker thread is already waiting for wait_on_future().
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) | trusted_official_docs | CPython Docs | = ThreadPoolExecutor(max_workers=1) future = executor.submit(wait_on_future) # Note: calling future.result() would also cause a deadlock because # the single worker thread is already waiting for wait_on_future().
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) | = ThreadPoolExecutor(max_workers=1) future = executor.submit(wait_on_future) # Note: calling future.result() would also cause a deadlock because # the single worker thread is already waiting for wait_on_future().
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f4a51503-2070-4ac3-846f-9aa5eb9dc3cb | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,771 | supabase-export-v2 | 858a95055bfee18e | .. method:: result(timeout=None)
Return the value returned by the call. If the call hasn't yet completed
then this method will wait up to *timeout* seconds. If the call hasn't
completed in *timeout* seconds, then a
:exc:`TimeoutError` will be raised. *timeout* can be
an int or float. If *timeout* is not specified o... | trusted_official_docs | CPython Docs | .. method:: result(timeout=None)
Return the value returned by the call. If the call hasn't yet completed
then this method will wait up to *timeout* seconds. If the call hasn't
completed in *timeout* seconds, then a
:exc:`TimeoutError` will be raised. *timeout* can be
an int or float. If *timeout* is not specified o... | .. method:: result(timeout=None)
Return the value returned by the call. If the call hasn't yet completed
then this method will wait up to *timeout* seconds. If the call hasn't
completed in *timeout* seconds, then a
:exc:`TimeoutError` will be raised. *timeout* can be
an int or float. If *timeout* is not specified o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f58b581b-3270-4641-988a-5b2ed0b0120d | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,736 | supabase-export-v2 | c2f3f80447876ab9 | Bugs have been reported when using the *max_tasks_per_child* feature that can result in the :class:`ProcessPoolExecutor` hanging in some circumstances. Follow its eventual resolution in :gh:`115634`.
.. versionchanged:: 3.3
When one of the worker processes terminates abruptly, a
:exc:`~concurrent.futures.process.Brok... | trusted_official_docs | CPython Docs | Bugs have been reported when using the *max_tasks_per_child* feature that can result in the :class:`ProcessPoolExecutor` hanging in some circumstances. Follow its eventual resolution in :gh:`115634`.
.. versionchanged:: 3.3
When one of the worker processes terminates abruptly, a
:exc:`~concurrent.futures.process.Brok... | Bugs have been reported when using the *max_tasks_per_child* feature that can result in the :class:`ProcessPoolExecutor` hanging in some circumstances. Follow its eventual resolution in :gh:`115634`.
.. versionchanged:: 3.3
When one of the worker processes terminates abruptly, a
:exc:`~concurrent.futures.process.Brok... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8517368-cf8a-4c49-8ff3-8118f397b0a2 | CPython Docs | file://datasets/cpython/Doc/library/concurrent.futures.rst | unknown | 63cd1e54-22a0-432e-b1e0-98f5c05b8259 | 17,682 | supabase-export-v2 | f133f1ac850fcbe3 | pending futures that the executor has not started running. Any futures that are completed or running won't be cancelled, regardless of the value of *cancel_futures*.
If both *cancel_futures* and *wait* are ``True``, all futures that the
executor has started running will be completed prior to this method
returning. Th... | trusted_official_docs | CPython Docs | pending futures that the executor has not started running. Any futures that are completed or running won't be cancelled, regardless of the value of *cancel_futures*.
If both *cancel_futures* and *wait* are ``True``, all futures that the
executor has started running will be completed prior to this method
returning. Th... | pending futures that the executor has not started running. Any futures that are completed or running won't be cancelled, regardless of the value of *cancel_futures*.
If both *cancel_futures* and *wait* are ``True``, all futures that the
executor has started running will be completed prior to this method
returning. Th... | 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.