mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-07 07:00:49 +03:00
Update provider doc page headers
This commit is contained in:
parent
3eb7b9bc69
commit
e4ca126188
|
@ -1,5 +1,5 @@
|
|||
Callable provider
|
||||
-----------------
|
||||
=================
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Function,Method,Example
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Configuration provider
|
||||
----------------------
|
||||
======================
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Configuration,Injection,
|
||||
|
@ -20,7 +20,7 @@ Configuration provider
|
|||
It implements the principle "use first, define later".
|
||||
|
||||
Loading from an INI file
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
------------------------
|
||||
|
||||
``Configuration`` provider can load configuration from an ``ini`` file using the
|
||||
:py:meth:`Configuration.from_ini` method:
|
||||
|
@ -40,7 +40,7 @@ where ``examples/providers/configuration/config.ini`` is:
|
|||
variable ``ENV_NAME``.
|
||||
|
||||
Loading from a YAML file
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
------------------------
|
||||
|
||||
``Configuration`` provider can load configuration from a ``yaml`` file using the
|
||||
:py:meth:`Configuration.from_yaml` method:
|
||||
|
@ -74,7 +74,7 @@ variable ``ENV_NAME``.
|
|||
*Don't forget to mirror the changes in the requirements file.*
|
||||
|
||||
Loading from a dictionary
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-------------------------
|
||||
|
||||
``Configuration`` provider can load configuration from a Python ``dict`` using the
|
||||
:py:meth:`Configuration.from_dict` method:
|
||||
|
@ -85,7 +85,7 @@ Loading from a dictionary
|
|||
:emphasize-lines: 6-13
|
||||
|
||||
Loading from an environment variable
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
------------------------------------
|
||||
|
||||
``Configuration`` provider can load configuration from an environment variable using the
|
||||
:py:meth:`Configuration.from_env` method:
|
||||
|
@ -96,7 +96,7 @@ Loading from an environment variable
|
|||
:emphasize-lines: 6-8
|
||||
|
||||
Loading from the multiple sources
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
---------------------------------
|
||||
|
||||
``Configuration`` provider can load configuration from the multiple sources. Loaded
|
||||
configuration is merged recursively over the existing configuration.
|
||||
|
@ -112,7 +112,7 @@ where ``examples/providers/configuration/config.local.yml`` is:
|
|||
:language: ini
|
||||
|
||||
Specifying the value type
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-------------------------
|
||||
|
||||
You can specify the type of the injected configuration value explicitly.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Coroutine provider
|
||||
------------------
|
||||
==================
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Coroutine,Asynchronous,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Dependency provider
|
||||
-------------------
|
||||
===================
|
||||
|
||||
.. currentmodule:: dependency_injector.providers
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ injected following these rules:
|
|||
:lines: 3-
|
||||
|
||||
Passing arguments to the underlying providers
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
---------------------------------------------
|
||||
|
||||
``Factory`` provider can pass the arguments to the underlying providers. This helps when you need
|
||||
to assemble a nested objects graph and pass the arguments deep inside.
|
||||
|
@ -88,7 +88,7 @@ If ``<dependency>`` is found the underlying provider will receive the
|
|||
.. _factory_providers_delegation:
|
||||
|
||||
Passing providers to the objects
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
--------------------------------
|
||||
|
||||
When you need to inject the provider itself, but not the result of its call, use the ``.provider``
|
||||
attribute of the provider that you're going to inject.
|
||||
|
@ -105,7 +105,7 @@ attribute of the provider that you're going to inject.
|
|||
.. _factory-specialize-provided-type:
|
||||
|
||||
Specializing the provided type
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
------------------------------
|
||||
|
||||
You can create a specialized ``Factory`` provider that provides only specific type. For doing
|
||||
this you need to create a subclass of the ``Factory`` provider and define the ``provided_type``
|
||||
|
@ -119,7 +119,7 @@ class attribute.
|
|||
.. _abstract-factory:
|
||||
|
||||
Abstract factory
|
||||
~~~~~~~~~~~~~~~~
|
||||
----------------
|
||||
|
||||
:py:class:`AbstractFactory` provider helps when you need to create a provider of some base class
|
||||
and the particular implementation is not yet know. ``AbstractFactory`` provider is a ``Factory``
|
||||
|
@ -138,7 +138,7 @@ provider with two peculiarities:
|
|||
:emphasize-lines: 32
|
||||
|
||||
Factory aggregate
|
||||
~~~~~~~~~~~~~~~~~
|
||||
-----------------
|
||||
|
||||
:py:class:`FactoryAggregate` provider aggregates multiple factories. When you call the
|
||||
``FactoryAggregate`` it delegates the call to one of the factories.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
List provider
|
||||
-------------
|
||||
=============
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,List,Injection
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Object provider
|
||||
---------------
|
||||
===============
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Object
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Injecting attributes, items, or call methods of the provided instance
|
||||
---------------------------------------------------------------------
|
||||
=====================================================================
|
||||
|
||||
.. currentmodule:: dependency_injector.providers
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.. _selector-provider:
|
||||
|
||||
Selector provider
|
||||
-----------------
|
||||
=================
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Configuration,Injection,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Singleton provider
|
||||
------------------
|
||||
==================
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Singleton,Pattern,Example,
|
||||
|
@ -33,7 +33,7 @@ factories:
|
|||
- :ref:`abstract-factory`
|
||||
|
||||
Resetting memorized object
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
--------------------------
|
||||
|
||||
To reset a memorized object you need to call the ``.reset()`` method of the ``Singleton``
|
||||
provider.
|
||||
|
@ -48,7 +48,7 @@ provider.
|
|||
managed by the garbage collector.
|
||||
|
||||
Using singleton with multiple threads
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-------------------------------------
|
||||
|
||||
``Singleton`` provider is NOT thread-safe. You need to explicitly establish a synchronization for
|
||||
using the ``Singleton`` provider in the multi-threading application. Otherwise you could trap
|
||||
|
@ -67,7 +67,7 @@ There are two thread-safe singleton implementations out of the box:
|
|||
:emphasize-lines: 11,12
|
||||
|
||||
Implementing scopes
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
-------------------
|
||||
|
||||
To implement a scoped singleton provider use a ``Singleton`` provider and reset its scope when
|
||||
needed.
|
||||
|
|
Loading…
Reference in New Issue
Block a user