python-dependency-injector/docs/examples/chained_factories.rst

22 lines
673 B
ReStructuredText
Raw Normal View History

2018-08-16 20:52:56 +00:00
Chained Factories pattern
=========================
This example demonstrate implementation of "Chained Factories" pattern.
2018-08-16 21:27:49 +00:00
Main idea of this pattern is about wrapping :py:class:`Factory` into
another :py:class:`Factory` that mix additional arguments or keyword
arguments to a wrapped one.
2018-08-16 20:52:56 +00:00
Listing of ``data.py``, demonstrates sample classes structure:
.. literalinclude:: ../../examples/miniapps/factory_patterns/data.py
:language: python
Listing of ``chained_factories.py``, demonstrates "Chained Factories"
pattern and provide some explanation:
.. literalinclude:: ../../examples/miniapps/factory_patterns/chained_factories.py
:language: python
.. disqus::