2020-09-02 04:39:23 +03:00
|
|
|
Callable provider
|
2020-09-03 00:33:02 +03:00
|
|
|
=================
|
2015-07-16 00:48:30 +03:00
|
|
|
|
2020-09-02 04:39:23 +03:00
|
|
|
.. meta::
|
|
|
|
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Function,Method,Example
|
|
|
|
:description: Callable provider helps to make dependencies injection into functions. This page
|
|
|
|
demonstrates how to use a Callable provider.
|
2015-07-16 00:48:30 +03:00
|
|
|
|
2020-09-02 04:39:23 +03:00
|
|
|
.. currentmodule:: dependency_injector.providers
|
2015-07-16 00:48:30 +03:00
|
|
|
|
2020-09-02 04:39:23 +03:00
|
|
|
:py:class:`Callable` provider calls a function, a method or another callable.
|
2015-07-16 00:48:30 +03:00
|
|
|
|
2020-09-02 04:39:23 +03:00
|
|
|
.. literalinclude:: ../../examples/providers/callable.py
|
2015-08-03 15:49:55 +03:00
|
|
|
:language: python
|
2020-09-02 04:39:23 +03:00
|
|
|
:lines: 3-
|
2015-07-20 19:31:31 +03:00
|
|
|
|
2020-09-02 04:39:23 +03:00
|
|
|
``Callable`` provider handles an injection of the dependencies the same way like a
|
|
|
|
:ref:`factory-provider`.
|
2017-02-28 23:07:12 +03:00
|
|
|
|
|
|
|
.. disqus::
|