mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-23 18:13:56 +03:00
6eff213a68
* Add bootstrap and remove created at from ghnav-flask app * Update readme * Add logo to the docs * Update key features description * Update README * Change headers of API docs * Add alabaster theme config * Update docs index * Add tutorials section * Update what is DI page * Update DI in Python page * Update tutorials index page * Update provider docs * Update container docs * Update examples docs
26 lines
774 B
ReStructuredText
26 lines
774 B
ReStructuredText
Specialization of containers
|
|
----------------------------
|
|
|
|
.. currentmodule:: dependency_injector.containers
|
|
|
|
:py:class:`DeclarativeContainer` could be specialized for any kind of needs
|
|
via declaring its subclasses.
|
|
|
|
One of such `builtin` features is a limitation for providers type.
|
|
|
|
Next example shows usage of this feature with :py:class:`DeclarativeContainer`
|
|
in couple with feature of :py:class:`dependency_injector.providers.Factory`
|
|
for limitation of its provided type:
|
|
|
|
.. literalinclude:: ../../examples/containers/declarative_provider_type.py
|
|
:language: python
|
|
|
|
Limitation for providers type could be used with :py:class:`DynamicContainer`
|
|
as well:
|
|
|
|
.. literalinclude:: ../../examples/containers/dynamic_provider_type.py
|
|
:language: python
|
|
|
|
|
|
.. disqus::
|