From 5740dd6df5a9ff7c33511a0600aa88c6cf8bc088 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 9 Sep 2020 21:34:30 -0400 Subject: [PATCH] Remove not relevant "speech" example --- docs/main/changelog.rst | 4 ++++ examples/speech/container.py | 26 -------------------------- examples/speech/factory.py | 14 -------------- examples/speech/factory_injections.py | 20 -------------------- examples/speech/factory_override.py | 24 ------------------------ examples/speech/inject.py | 21 --------------------- 6 files changed, 4 insertions(+), 105 deletions(-) delete mode 100644 examples/speech/container.py delete mode 100644 examples/speech/factory.py delete mode 100644 examples/speech/factory_injections.py delete mode 100644 examples/speech/factory_override.py delete mode 100644 examples/speech/inject.py diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index f88e33ff..c15bec07 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -7,6 +7,10 @@ that were made in every particular version. From version 0.7.6 *Dependency Injector* framework strictly follows `Semantic versioning`_ +Develop +------- +- Remove not relevant "speech" example. + 3.42.0 ------ - Update "DI in Python" documentation page. diff --git a/examples/speech/container.py b/examples/speech/container.py deleted file mode 100644 index e1edbccb..00000000 --- a/examples/speech/container.py +++ /dev/null @@ -1,26 +0,0 @@ -"""IoC container example.""" - -import collections - -import dependency_injector.containers as containers -import dependency_injector.providers as providers - - -Engine = collections.namedtuple('Engine', []) -Car = collections.namedtuple('Car', ['serial_number', 'engine']) - - -class Container(containers.DeclarativeContainer): - """IoC container.""" - - engine_factory = providers.Factory(Engine) - - car_factory = providers.Factory(Car, engine=engine_factory) - - -if __name__ == '__main__': - car1 = Container.car_factory(serial_number=1) - car2 = Container.car_factory(serial_number=2) - - assert car1.serial_number == 1 and car2.serial_number == 2 - assert car1.engine is not car2.engine diff --git a/examples/speech/factory.py b/examples/speech/factory.py deleted file mode 100644 index d8470898..00000000 --- a/examples/speech/factory.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Factory provider example.""" - -from dependency_injector import providers - - -object_factory = providers.Factory(object) - - -if __name__ == '__main__': - object1 = object_factory() - object2 = object_factory() - - assert object1 is not object2 - assert isinstance(object1, object) and isinstance(object2, object) diff --git a/examples/speech/factory_injections.py b/examples/speech/factory_injections.py deleted file mode 100644 index e378b85c..00000000 --- a/examples/speech/factory_injections.py +++ /dev/null @@ -1,20 +0,0 @@ -"""Factory provider keyword argument injections example.""" - -import collections - -import dependency_injector.providers as providers - - -Engine = collections.namedtuple('Engine', []) -Car = collections.namedtuple('Car', ['serial_number', 'engine']) - -engine_factory = providers.Factory(Engine) -car_factory = providers.Factory(Car, engine=engine_factory) - - -if __name__ == '__main__': - car1 = car_factory(serial_number=1) - car2 = car_factory(serial_number=2) - - assert car1.serial_number == 1 and car2.serial_number == 2 - assert car1.engine is not car2.engine diff --git a/examples/speech/factory_override.py b/examples/speech/factory_override.py deleted file mode 100644 index d598979a..00000000 --- a/examples/speech/factory_override.py +++ /dev/null @@ -1,24 +0,0 @@ -"""Overriding of factory provider example.""" - -import collections - -import dependency_injector.providers as providers - - -Engine = collections.namedtuple('Engine', []) -Car = collections.namedtuple('Car', ['serial_number', 'engine']) - -engine_factory = providers.Factory(Engine) -car_factory = providers.Factory(Car, engine=engine_factory) - -EngineX = collections.namedtuple('EngineX', []) -engine_factory.override(providers.Factory(EngineX)) - - -if __name__ == '__main__': - car1 = car_factory(serial_number=1) - car2 = car_factory(serial_number=2, engine=Engine()) - - assert car1.serial_number == 1 and car2.serial_number == 2 - assert car1.engine.__class__ is EngineX - assert car2.engine.__class__ is Engine diff --git a/examples/speech/inject.py b/examples/speech/inject.py deleted file mode 100644 index bd118925..00000000 --- a/examples/speech/inject.py +++ /dev/null @@ -1,21 +0,0 @@ -"""@inject decorator example.""" - -from container import Container - -from dependency_injector.injections import inject - - -@inject(car_factory=Container.car_factory.delegate()) -@inject(extra_engine=Container.engine_factory) -def main(car_factory, extra_engine): - """Run application.""" - car1 = car_factory(serial_number=1) - car2 = car_factory(serial_number=2, engine=extra_engine) - - assert car1.serial_number == 1 and car2.serial_number == 2 - assert car1.engine is not car2.engine - assert car2.engine is extra_engine - - -if __name__ == '__main__': - main()