python-dependency-injector/docs/providers/coroutine.rst
Roman Mogylatov c4b33749d2
Providers docs update (#289)
* 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
2020-09-01 21:39:23 -04:00

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::