mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-30 05:23:59 +03:00
6eff213a68
* Add bootstrap and remove created at from ghnav-flask app * Update readme * Add logo to the docs * Update key features description * Update README * Change headers of API docs * Add alabaster theme config * Update docs index * Add tutorials section * Update what is DI page * Update DI in Python page * Update tutorials index page * Update provider docs * Update container docs * Update examples docs
35 lines
1002 B
ReStructuredText
35 lines
1002 B
ReStructuredText
List providers
|
|
--------------
|
|
|
|
.. currentmodule:: dependency_injector.providers
|
|
|
|
:py:class:`List` provider provides a list of values.
|
|
|
|
.. literalinclude:: ../../examples/providers/list.py
|
|
:language: python
|
|
:emphasize-lines: 6-9
|
|
:lines: 6-8, 23-29
|
|
|
|
:py:class:`List` provider is needed for injecting a list of dependencies. It handles
|
|
positional argument injections the same way as :py:class:`Factory` provider:
|
|
|
|
+ All providers (instances of :py:class:`Provider`) are called every time
|
|
when injection needs to be done.
|
|
+ Providers could be injected "as is" (delegated), if it is defined explicitly. Check out
|
|
:ref:`factory_providers_delegation`.
|
|
+ All other values are injected *"as is"*.
|
|
+ Positional context arguments will be appended after :py:class:`List` positional injections.
|
|
|
|
Full example:
|
|
|
|
.. literalinclude:: ../../examples/providers/list.py
|
|
:language: python
|
|
:emphasize-lines: 23-26
|
|
:lines: 3-
|
|
|
|
.. note::
|
|
|
|
Keyword argument injections are not supported.
|
|
|
|
.. disqus::
|