python-dependency-injector/docs/providers/dependency.rst

22 lines
757 B
ReStructuredText
Raw Normal View History

Dependency provider
2020-09-03 00:33:02 +03:00
===================
2015-11-30 00:30:48 +03:00
.. currentmodule:: dependency_injector.providers
:py:class:`Dependency` provider is a placeholder for the dependency of the specified type.
The first argument of the ``Dependency`` provider specifies a type of the dependency. It is
called ``instance_of``. ``Dependency`` provider controls the type of the returned object to be an
instance of the ``instance_of`` type.
The ``Dependency`` provider must be overridden before usage. It can be overridden by any type of
the provider. The only rule is that overriding provider must return an instance of ``instance_of``
dependency type.
2017-12-21 23:54:44 +03:00
.. literalinclude:: ../../examples/providers/dependency.py
:language: python
:lines: 3-
:emphasize-lines: 26
.. disqus::