Add line numbers for all code samples in the documentation

This commit is contained in:
Roman Mogilatov 2016-04-11 10:43:02 +03:00
parent c23803dedb
commit 9fc1502ae6
16 changed files with 47 additions and 0 deletions

View File

@ -42,11 +42,13 @@ Example:
.. literalinclude:: ../../examples/advanced_usage/inject_simple.py
:language: python
:linenos:
Example of usage :py:func:`inject` decorator with Flask:
.. literalinclude:: ../../examples/advanced_usage/inject_flask.py
:language: python
:linenos:
@inject decorator with classes
@ -61,3 +63,4 @@ Example of usage :py:func:`inject` with Flask class-based view:
.. literalinclude:: ../../examples/advanced_usage/inject_flask_class_based.py
:language: python
:linenos:

View File

@ -48,13 +48,16 @@ Listing of `services.py`:
.. literalinclude:: ../../examples/catalogs/bundles/services.py
:language: python
:linenos:
Listing of `views.py`:
.. literalinclude:: ../../examples/catalogs/bundles/views.py
:language: python
:linenos:
Listing of `catalogs.py`:
.. literalinclude:: ../../examples/catalogs/bundles/catalogs.py
:language: python
:linenos:

View File

@ -41,6 +41,7 @@ factories:
.. literalinclude:: ../../examples/catalogs/declarative.py
:language: python
:linenos:
Example of declarative catalogs inheritance:
@ -50,6 +51,7 @@ Example of declarative catalogs inheritance:
.. literalinclude:: ../../examples/catalogs/declarative_inheritance.py
:language: python
:linenos:
Example of declarative catalog's provider injections:
@ -59,3 +61,4 @@ Example of declarative catalog's provider injections:
.. literalinclude:: ../../examples/catalogs/declarative_injections.py
:language: python
:linenos:

View File

@ -22,8 +22,10 @@ Here is an simple example of defining dynamic catalog with several factories:
.. literalinclude:: ../../examples/catalogs/dynamic.py
:language: python
:linenos:
Next one example demonstrates creation and runtime filling of dynamic catalog:
.. literalinclude:: ../../examples/catalogs/dynamic_runtime_creation.py
:language: python
:linenos:

View File

@ -18,11 +18,13 @@ method:
.. literalinclude:: ../../examples/catalogs/override_declarative.py
:language: python
:linenos:
Example of overriding catalog using :py:func:`override` decorator:
.. literalinclude:: ../../examples/catalogs/override_declarative_decorator.py
:language: python
:linenos:
Also there are several useful :py:class:`DeclarativeCatalog` methods and
properties that help to work with catalog overridings:
@ -47,3 +49,4 @@ Example of overriding :py:class:`DeclarativeCatalog` by
.. literalinclude:: ../../examples/catalogs/override_declarative_by_dynamic.py
:language: python
:linenos:

View File

@ -18,11 +18,13 @@ Listing of `services.py`:
.. literalinclude:: ../../examples/catalogs/declarative_provider_type/services.py
:language: python
:linenos:
Listing of `catalog.py`:
.. literalinclude:: ../../examples/catalogs/declarative_provider_type/catalog.py
:language: python
:linenos:
Limitation to provider type could be used with :py:class:`DynamicCatalog`
as well.
@ -34,8 +36,10 @@ Listing of `services.py`:
.. literalinclude:: ../../examples/catalogs/dynamic_provider_type/services.py
:language: python
:linenos:
Listing of `catalog.py`:
.. literalinclude:: ../../examples/catalogs/dynamic_provider_type/catalog.py
:language: python
:linenos:

View File

@ -88,6 +88,7 @@ Let's go through next example:
.. literalinclude:: ../../examples/ioc_di_demos/car_engine_1.py
:language: python
:linenos:
``Car`` **creates** an ``Engine`` during its creation. Really? Does it make
more sense then creating an ``Engine`` separatelly and then
@ -95,3 +96,4 @@ more sense then creating an ``Engine`` separatelly and then
.. literalinclude:: ../../examples/ioc_di_demos/car_engine_2.py
:language: python
:linenos:

View File

@ -76,18 +76,21 @@ Let's go through the code of ``example.py``:
.. literalinclude:: ../../examples/ioc_di_demos/example.py
:language: python
:linenos:
At some point, things defined above mean, that the code from ``example.py``,
could look different, like in ``ioc_example.py``:
.. literalinclude:: ../../examples/ioc_di_demos/ioc_example.py
:language: python
:linenos:
Also the code from ``ioc_example.py`` could be upgraded with inversion of
control container, like in ``ioc_container_example.py``:
.. literalinclude:: ../../examples/ioc_di_demos/ioc_container_example.py
:language: python
:linenos:
.. note::

View File

@ -10,6 +10,7 @@ follows `Semantic versioning`_
Development version
-------------------
- Add ``@copy`` decorator for copying declarative catalog providers.
- Add line numbers for all code samples in documentation.
1.15.2
------

View File

@ -41,6 +41,7 @@ injections:
.. literalinclude:: ../../examples/providers/callable_args.py
:language: python
:linenos:
Next one example shows usage of :py:class:`Callable` with keyword argument
injections:
@ -51,6 +52,7 @@ injections:
.. literalinclude:: ../../examples/providers/callable_kwargs.py
:language: python
:linenos:
.. _callable_delegation:
@ -69,6 +71,7 @@ Example:
.. literalinclude:: ../../examples/providers/callable_delegation.py
:language: python
:linenos:
Alternative way of doing :py:class:`Callable` delegation is an usage of
:py:class:`DelegatedCallable`. :py:class:`DelegatedCallable` is a
@ -78,3 +81,4 @@ Example:
.. literalinclude:: ../../examples/providers/delegated_callable.py
:language: python
:linenos:

View File

@ -32,3 +32,4 @@ Example:
.. literalinclude:: ../../examples/providers/custom_factory.py
:language: python
:linenos:

View File

@ -39,3 +39,4 @@ Example:
.. literalinclude:: ../../examples/providers/external_dependency.py
:language: python
:linenos:

View File

@ -14,6 +14,7 @@ Nothing could be better than brief example:
.. literalinclude:: ../../examples/providers/factory.py
:language: python
:linenos:
Factory providers and __init__ injections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -58,11 +59,13 @@ Example of usage positional argument injections:
.. literalinclude:: ../../examples/providers/factory_init_args.py
:language: python
:linenos:
Example of usage keyword argument injections:
.. literalinclude:: ../../examples/providers/factory_init_kwargs.py
:language: python
:linenos:
Factory providers and __init__ injections priority
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -82,6 +85,7 @@ So, please, follow the example below:
.. literalinclude:: ../../examples/providers/factory_init_injections_and_contexts.py
:language: python
:linenos:
Factory providers and other types of injections
@ -132,6 +136,7 @@ Example:
.. literalinclude:: ../../examples/providers/factory_attribute_injections.py
:language: python
:linenos:
Factory providers and method injections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -151,6 +156,7 @@ Example:
.. literalinclude:: ../../examples/providers/factory_method_injections.py
:language: python
:linenos:
Factory providers delegation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -179,6 +185,7 @@ Example:
.. literalinclude:: ../../examples/providers/factory_delegation.py
:language: python
:linenos:
Alternative way of doing :py:class:`Factory` delegation is an usage of
:py:class:`DelegatedFactory`. :py:class:`DelegatedFactory` is a
@ -188,6 +195,7 @@ Example:
.. literalinclude:: ../../examples/providers/delegated_factory.py
:language: python
:linenos:
Factory providers specialization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -200,3 +208,4 @@ type:
.. literalinclude:: ../../examples/providers/factory_provided_type.py
:language: python
:linenos:

View File

@ -42,6 +42,7 @@ Example:
.. literalinclude:: ../../examples/providers/overriding_simple.py
:language: python
:linenos:
Example:
@ -51,3 +52,4 @@ Example:
.. literalinclude:: ../../examples/providers/overriding_users_model.py
:language: python
:linenos:

View File

@ -14,6 +14,7 @@ Example:
.. literalinclude:: ../../examples/providers/singleton.py
:language: python
:linenos:
Singleton providers and injections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -53,6 +54,7 @@ Example:
.. literalinclude:: ../../examples/providers/singleton_reseting.py
:language: python
:linenos:
Singleton providers delegation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -70,6 +72,7 @@ Example:
.. literalinclude:: ../../examples/providers/singleton_delegation.py
:language: python
:linenos:
Alternative way of doing :py:class:`Singleton` delegation is an usage of
:py:class:`DelegatedSingleton`. :py:class:`DelegatedSingleton` is a
@ -79,6 +82,7 @@ Example:
.. literalinclude:: ../../examples/providers/delegated_singleton.py
:language: python
:linenos:
Singleton providers specialization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -91,3 +95,4 @@ provided type:
.. literalinclude:: ../../examples/providers/singleton_provided_type.py
:language: python
:linenos:

View File

@ -19,3 +19,4 @@ Example:
.. literalinclude:: ../../examples/providers/static.py
:language: python
:linenos: