mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-05 14:10:49 +03:00
Add long description to the doc block
This commit is contained in:
parent
c379f23e80
commit
883e785ea3
File diff suppressed because it is too large
Load Diff
|
@ -2452,7 +2452,31 @@ cdef class List(Provider):
|
||||||
cdef class Dict(Provider):
|
cdef class Dict(Provider):
|
||||||
"""Dict provider provides a dictionary of values.
|
"""Dict provider provides a dictionary of values.
|
||||||
|
|
||||||
TBD.
|
:py:class:`Dict` provider is needed for injecting a dictionary of dependencies. It handles
|
||||||
|
keyword argument injections the same way as :py:class:`Factory` provider.
|
||||||
|
|
||||||
|
Positional argument injections are not supported.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
dispatcher_factory = Factory(
|
||||||
|
Dispatcher,
|
||||||
|
modules=Dict(
|
||||||
|
module1=Factory(ModuleA, dependency_a),
|
||||||
|
module2=Factory(ModuleB, dependency_b),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
dispatcher = dispatcher_factory()
|
||||||
|
|
||||||
|
# is equivalent to:
|
||||||
|
|
||||||
|
dispatcher = Dispatcher(
|
||||||
|
modules={
|
||||||
|
'module1': ModuleA(dependency_a),
|
||||||
|
'module2': ModuleB(dependency_b),
|
||||||
|
},
|
||||||
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user