2015-06-16 07:37:57 +00:00
|
|
|
Static providers
|
|
|
|
----------------
|
|
|
|
|
2015-11-29 21:30:48 +00:00
|
|
|
.. currentmodule:: dependency_injector.providers
|
2015-11-23 13:03:30 +00:00
|
|
|
|
2015-06-16 07:37:57 +00:00
|
|
|
Static providers are family of providers that return their values "as is".
|
|
|
|
There are four types of static providers:
|
|
|
|
|
2015-11-23 13:03:30 +00:00
|
|
|
- :py:class:`Class`
|
|
|
|
- :py:class:`Object`
|
|
|
|
- :py:class:`Function`
|
|
|
|
- :py:class:`Value`
|
2015-06-16 07:37:57 +00:00
|
|
|
|
2015-11-23 13:03:30 +00:00
|
|
|
All of them have the same behaviour (inherited from
|
|
|
|
:py:class:`StaticProvider`), but usage of any is predicted by readability
|
|
|
|
and providing object's type.
|
2015-06-16 07:37:57 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
2015-08-03 12:57:06 +00:00
|
|
|
.. literalinclude:: ../../examples/providers/static.py
|
|
|
|
:language: python
|