mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-26 03:23:58 +03:00
Add factory patterns to docs
This commit is contained in:
parent
50af2508e8
commit
2a051ffd70
22
docs/examples/chained_factories.rst
Normal file
22
docs/examples/chained_factories.rst
Normal file
|
@ -0,0 +1,22 @@
|
|||
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::
|
22
docs/examples/factory_of_factories.rst
Normal file
22
docs/examples/factory_of_factories.rst
Normal file
|
@ -0,0 +1,22 @@
|
|||
Factory of Factories pattern
|
||||
============================
|
||||
|
||||
This example demonstrate implementation of "Factory of Factories" pattern.
|
||||
Main idea of this pattern is about creation of a :py:class:`Factory` that
|
||||
creates another :py:class:`Factory` and mix additional arguments to it.
|
||||
|
||||
Listing of ``data.py``, demonstrates sample classes structure:
|
||||
|
||||
.. literalinclude:: ../../examples/miniapps/factory_patterns/data.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
Listing of ``factory_of_factories.py``, demonstrates "Chained Factories"
|
||||
pattern and provide some explanation:
|
||||
|
||||
.. literalinclude:: ../../examples/miniapps/factory_patterns/factory_of_factories.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
|
||||
.. disqus::
|
|
@ -21,3 +21,5 @@ and powered by *Dependency Injector* framework.
|
|||
bundles_miniapp
|
||||
use_cases_miniapp
|
||||
password_hashing_miniapp
|
||||
chained_factories
|
||||
factory_of_factories
|
||||
|
|
Loading…
Reference in New Issue
Block a user