mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
c4b33749d2
* Update callable provider docs * Update coroutine provider docs * Edit object docs * Edit list provider docs * Edit configuration provider docs * Edit selector provider docs * Fix mypy stub of the ``DeclarativeContainer`` to specify the ``__init__`` interface * Edit Dependency provider docs
28 lines
826 B
ReStructuredText
28 lines
826 B
ReStructuredText
Coroutine provider
|
|
------------------
|
|
|
|
.. meta::
|
|
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Coroutine,Asynchronous,
|
|
Asyncio,Example
|
|
:description: Coroutine provider creates a coroutine. This page demonstrates how to use a
|
|
Coroutine provider.
|
|
|
|
.. currentmodule:: dependency_injector.providers
|
|
|
|
:py:class:`Coroutine` provider creates a coroutine.
|
|
|
|
.. literalinclude:: ../../examples/providers/coroutine.py
|
|
:language: python
|
|
:lines: 3-
|
|
|
|
.. note::
|
|
The example works on Python 3.7+. For earlier versions use ``loop.run_until_complete()``.
|
|
|
|
``Coroutine`` provider handles an injection of the dependencies the same way like a
|
|
:ref:`factory-provider`.
|
|
|
|
.. note::
|
|
``Coroutine`` provider returns ``True`` for ``asyncio.iscoroutinefunction()`` check.
|
|
|
|
.. disqus::
|