diff --git a/docs/main/introduction/di_in_python.rst b/docs/main/introduction/di_in_python.rst index c0f3f0e9..521de444 100644 --- a/docs/main/introduction/di_in_python.rst +++ b/docs/main/introduction/di_in_python.rst @@ -86,12 +86,12 @@ Example Let's go through next example: -.. literalinclude:: ../../../examples/ioc_demo/car_engine_1.py +.. literalinclude:: ../../../examples/ioc_di_demo/car_engine_1.py :language: python ``Car`` **creates** an ``Engine`` during its creation. Really? Does it make more sense then creating an ``Engine`` separatelly and then **put (inject) it into** ``Car`` when ``Car`` is being created? -.. literalinclude:: ../../../examples/ioc_demo/car_engine_2.py +.. literalinclude:: ../../../examples/ioc_di_demo/car_engine_2.py :language: python diff --git a/examples/ioc_demo/car_engine_1.py b/examples/ioc_demo/car_engine_1.py deleted file mode 100644 index bf6fde9a..00000000 --- a/examples/ioc_demo/car_engine_1.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Car & Engine example 1.""" - - -class Engine(object): - """Example engine.""" - - -class Car(object): - """Example car.""" - - def __init__(self): - """Initializer.""" - self.engine = Engine() - - -if __name__ == '__main__': - car = Car() - assert car.engine is not None diff --git a/examples/ioc_demo/car_engine_2.py b/examples/ioc_demo/car_engine_2.py deleted file mode 100644 index 194506d0..00000000 --- a/examples/ioc_demo/car_engine_2.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Car & Engine example 2.""" - - -class Engine(object): - """Example engine.""" - - -class Car(object): - """Example car.""" - - def __init__(self, engine): - """Initializer.""" - self.engine = engine - - -if __name__ == '__main__': - car = Car(Engine()) - assert car.engine is not None diff --git a/examples/ioc_di_demos/ioc_container_example.py b/examples/ioc_di_demos/ioc_container_example.py index 1321f12c..24fde2ef 100644 --- a/examples/ioc_di_demos/ioc_container_example.py +++ b/examples/ioc_di_demos/ioc_container_example.py @@ -1,10 +1,8 @@ """The Code, that uses IoC container.""" -from dependency_injector import catalogs -from dependency_injector import providers +from dependency_injector import catalogs, providers -from ioc_example import Service -from ioc_example import Client +from ioc_example import Service, Client class Components(catalogs.DeclarativeCatalog):