mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-23 18:13:56 +03:00
23 lines
677 B
ReStructuredText
23 lines
677 B
ReStructuredText
|
Chained Factories pattern
|
||
|
=========================
|
||
|
|
||
|
This example demonstrate implementation of "Chained Factories" pattern.
|
||
|
Main idea of this pattern is about wrapping `Factory` into other `Factory`
|
||
|
that mix additional arguments or keyword arguments to a wrapped one.
|
||
|
|
||
|
Listing of ``data.py``, demonstrates sample classes structure:
|
||
|
|
||
|
.. literalinclude:: ../../examples/miniapps/factory_patterns/data.py
|
||
|
:language: python
|
||
|
:linenos:
|
||
|
|
||
|
Listing of ``chained_factories.py``, demonstrates "Chained Factories"
|
||
|
pattern and provide some explanation:
|
||
|
|
||
|
.. literalinclude:: ../../examples/miniapps/factory_patterns/chained_factories.py
|
||
|
:language: python
|
||
|
:linenos:
|
||
|
|
||
|
|
||
|
.. disqus::
|