mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-28 12:33:59 +03:00
Add wording improvements to the docs
This commit is contained in:
parent
5b9da9ea5b
commit
417c449092
|
@ -10,7 +10,7 @@ Aggregate provider
|
||||||
This page demonstrates how to implement the polymorphism and increase the
|
This page demonstrates how to implement the polymorphism and increase the
|
||||||
flexibility of your application using the Aggregate provider.
|
flexibility of your application using the Aggregate provider.
|
||||||
|
|
||||||
:py:class:`Aggregate` provider aggregates other providers.
|
:py:class:`Aggregate` provider aggregates a group of other providers.
|
||||||
|
|
||||||
.. currentmodule:: dependency_injector.providers
|
.. currentmodule:: dependency_injector.providers
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Aggregate provider
|
||||||
:emphasize-lines: 24-27
|
:emphasize-lines: 24-27
|
||||||
|
|
||||||
Each provider in the ``Aggregate`` is associated with a key. You can call aggregated providers by providing
|
Each provider in the ``Aggregate`` is associated with a key. You can call aggregated providers by providing
|
||||||
their key as a first argument. All positional and keyword arguments after the key will be forwarded to
|
their key as a first argument. All positional and keyword arguments following the key will be forwarded to
|
||||||
the called provider:
|
the called provider:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -33,7 +33,7 @@ You can also retrieve an aggregated provider by providing its key as an attribut
|
||||||
|
|
||||||
yaml_reader = container.config_readers.yaml("./config.yml", foo=...)
|
yaml_reader = container.config_readers.yaml("./config.yml", foo=...)
|
||||||
|
|
||||||
To retrieve a dictionary of aggregated providers with their associated keys, use ``.providers`` attribute:
|
To retrieve a dictionary of aggregated providers, use ``.providers`` attribute:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ To retrieve a dictionary of aggregated providers with their associated keys, use
|
||||||
You can not override the ``Aggregate`` provider.
|
You can not override the ``Aggregate`` provider.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
When you inject the ``Aggregate`` provider it is passed "as is".
|
When you inject the ``Aggregate`` provider, it is passed "as is".
|
||||||
|
|
||||||
To use non-string keys or string keys with ``.`` and ``-``, provide a dictionary as a positional argument:
|
To use non-string keys or string keys with ``.`` and ``-``, provide a dictionary as a positional argument:
|
||||||
|
|
||||||
|
@ -59,13 +59,14 @@ To use non-string keys or string keys with ``.`` and ``-``, provide a dictionary
|
||||||
})
|
})
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
:ref:`selector-provider` to inject selected provider based on a configuration value or other callable.
|
:ref:`selector-provider` to make injections based on a configuration value, environment variable, or a result of a callable.
|
||||||
|
|
||||||
``Aggregate`` provider is different from the :ref:`selector-provider`. ``Aggregate`` provider doesn't select which provider
|
``Aggregate`` provider is different from the :ref:`selector-provider`. ``Aggregate`` provider doesn't select which provider
|
||||||
to inject and doesn't have a selector. It is always injected "as is". The rest of the interface of both providers is similar.
|
to inject and doesn't have a selector. It is a group of providers and is always injected "as is". The rest of the interface
|
||||||
|
of both providers is similar.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
``Aggregate`` provider is a successor of :ref:`factory-aggregate-provider` provider. ``Aggregate`` provider doesn't have
|
``Aggregate`` provider is a successor of :ref:`factory-aggregate-provider` provider. ``Aggregate`` provider doesn't have
|
||||||
a restriction on the provider type, while ``FactoryAggregate`` can aggregate only ``Factory`` providers.
|
a restriction on the provider type, while ``FactoryAggregate`` aggregates only ``Factory`` providers.
|
||||||
|
|
||||||
.. disqus::
|
.. disqus::
|
||||||
|
|
|
@ -31,6 +31,6 @@ the provider with a matching name. The ``selector`` callable works as a switch:
|
||||||
value is changed the ``Selector`` provider will delegate the work to another provider.
|
value is changed the ``Selector`` provider will delegate the work to another provider.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
:ref:`aggregate-provider` to work with a group of providers.
|
:ref:`aggregate-provider` to inject a group of providers.
|
||||||
|
|
||||||
.. disqus::
|
.. disqus::
|
||||||
|
|
Loading…
Reference in New Issue
Block a user