From e4ca1261888d678548c9195e02d976a443bab53f Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 2 Sep 2020 17:33:02 -0400 Subject: [PATCH] Update provider doc page headers --- docs/providers/callable.rst | 2 +- docs/providers/configuration.rst | 14 +++++++------- docs/providers/coroutine.rst | 2 +- docs/providers/dependency.rst | 2 +- docs/providers/factory.rst | 10 +++++----- docs/providers/list.rst | 2 +- docs/providers/object.rst | 2 +- docs/providers/provided_instance.rst | 2 +- docs/providers/selector.rst | 2 +- docs/providers/singleton.rst | 8 ++++---- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/providers/callable.rst b/docs/providers/callable.rst index e0cb5089..b9d72b8e 100644 --- a/docs/providers/callable.rst +++ b/docs/providers/callable.rst @@ -1,5 +1,5 @@ Callable provider ------------------ +================= .. meta:: :keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Function,Method,Example diff --git a/docs/providers/configuration.rst b/docs/providers/configuration.rst index 43fd3ee3..9d049e18 100644 --- a/docs/providers/configuration.rst +++ b/docs/providers/configuration.rst @@ -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. diff --git a/docs/providers/coroutine.rst b/docs/providers/coroutine.rst index 3db7846a..6fac6c9e 100644 --- a/docs/providers/coroutine.rst +++ b/docs/providers/coroutine.rst @@ -1,5 +1,5 @@ Coroutine provider ------------------- +================== .. meta:: :keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Coroutine,Asynchronous, diff --git a/docs/providers/dependency.rst b/docs/providers/dependency.rst index 9ce3977b..1246ceae 100644 --- a/docs/providers/dependency.rst +++ b/docs/providers/dependency.rst @@ -1,5 +1,5 @@ Dependency provider -------------------- +=================== .. currentmodule:: dependency_injector.providers diff --git a/docs/providers/factory.rst b/docs/providers/factory.rst index 23045591..626cda8c 100644 --- a/docs/providers/factory.rst +++ b/docs/providers/factory.rst @@ -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 ```` 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. diff --git a/docs/providers/list.rst b/docs/providers/list.rst index 9ad4ece4..afd24a3d 100644 --- a/docs/providers/list.rst +++ b/docs/providers/list.rst @@ -1,5 +1,5 @@ List provider -------------- +============= .. meta:: :keywords: Python,DI,Dependency injection,IoC,Inversion of Control,List,Injection diff --git a/docs/providers/object.rst b/docs/providers/object.rst index 800b8116..61ad6ae1 100644 --- a/docs/providers/object.rst +++ b/docs/providers/object.rst @@ -1,5 +1,5 @@ Object provider ---------------- +=============== .. meta:: :keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Object diff --git a/docs/providers/provided_instance.rst b/docs/providers/provided_instance.rst index 381557fe..f19fdddd 100644 --- a/docs/providers/provided_instance.rst +++ b/docs/providers/provided_instance.rst @@ -1,5 +1,5 @@ Injecting attributes, items, or call methods of the provided instance ---------------------------------------------------------------------- +===================================================================== .. currentmodule:: dependency_injector.providers diff --git a/docs/providers/selector.rst b/docs/providers/selector.rst index b3f372e0..6326e051 100644 --- a/docs/providers/selector.rst +++ b/docs/providers/selector.rst @@ -1,7 +1,7 @@ .. _selector-provider: Selector provider ------------------ +================= .. meta:: :keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Configuration,Injection, diff --git a/docs/providers/singleton.rst b/docs/providers/singleton.rst index 10131e03..a3cc2d4d 100644 --- a/docs/providers/singleton.rst +++ b/docs/providers/singleton.rst @@ -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.