• Home
  • Raw
  • Download

Lines Matching refs:coroutine

21 :term:`Coroutines <coroutine>` declared with the async/await syntax is the
37 Note that simply calling a coroutine will not schedule it to
41 <coroutine object main at 0x1053bb7c8>
43 To actually run a coroutine, asyncio provides three main mechanisms:
48 * Awaiting on a coroutine. The following snippet of code will
132 # A coroutine object is created but not awaited,
143 In this documentation the term "coroutine" can be used for
146 * a *coroutine function*: an :keyword:`async def` function;
148 * a *coroutine object*: an object returned by calling a
149 *coroutine function*.
159 When a coroutine is wrapped into a *Task* with functions like
160 :func:`asyncio.create_task` the coroutine is automatically
185 When a Future object is *awaited* it means that the coroutine will
215 Execute the :term:`coroutine` *coro* and return the result.
217 This function runs the passed coroutine, taking care of
252 Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task`
296 when the coroutine completes.
313 Example of coroutine displaying the current date every second
347 If any awaitable in *aws* is a coroutine, it is automatically
448 If *aw* is a coroutine it is automatically scheduled as a Task.
458 *except* that if the coroutine containing it is cancelled, the
495 If *aw* is a coroutine it is automatically scheduled as a Task.
603 If any awaitable in *aws* is a coroutine, it is automatically
650 Passing coroutine objects to ``wait()`` directly is
658 Each coroutine returned can be awaited to get the earliest next
699 Return a coroutine that can be awaited to get the eventual result of *func*.
701 This coroutine function is primarily intended to be used for executing
731 Directly calling `blocking_io()` in any coroutine would block the event loop
751 Submit a coroutine to the given event loop. Thread-safe.
759 # Create a coroutine
762 # Submit the coroutine to a given loop
768 If an exception is raised in the coroutine, the returned Future
775 print('The coroutine took too long, cancelling the task...')
778 print(f'The coroutine raised an exception: {exc!r}')
780 print(f'The coroutine returned: {result!r}')
823 :ref:`coroutine <coroutine>`. Not thread-safe.
826 If a coroutine awaits on a Future, the Task suspends
827 the execution of the coroutine and waits for the completion
829 the wrapped coroutine resumes.
843 the wrapped coroutine. If a coroutine is awaiting on a Future
847 The method returns ``True`` if the wrapped coroutine did not
857 coroutine in the copied context.
877 into the wrapped coroutine on the next cycle of the event loop.
879 The coroutine then has a chance to clean up or even deny the
934 :meth:`cancel` and the wrapped coroutine propagated the
941 A Task is *done* when the wrapped coroutine either returned
948 If the Task is *done*, the result of the wrapped coroutine
949 is returned (or if the coroutine raised an exception, that
962 If the wrapped coroutine raised an exception that exception
963 is returned. If the wrapped coroutine returned normally
994 If the wrapped coroutine is not done, this returns the stack
995 where it is suspended. If the coroutine has completed
997 If the coroutine was terminated by an exception, this returns
1002 Only one stack frame is returned for a suspended coroutine.
1025 Return the coroutine object wrapped by the :class:`Task`.
1067 :func:`@asyncio.coroutine <asyncio.coroutine>`, although this is not
1071 .. decorator:: coroutine
1078 @asyncio.coroutine
1094 Return ``True`` if *obj* is a :ref:`coroutine object <coroutine>`.
1101 Return ``True`` if *func* is a :ref:`coroutine function
1102 <coroutine>`.
1105 because it returns ``True`` for generator-based coroutine functions
1106 decorated with :func:`@coroutine <coroutine>`.