From a9eedc6760768689d5e87482b92f1b3a25e98c64 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Wed, 2 Sep 2015 18:16:25 +0300 Subject: [PATCH] Update static providers docs --- docs/providers/static.rst | 8 ++++---- examples/providers/static.py | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/providers/static.rst b/docs/providers/static.rst index c7dedd3a..f4c3394e 100644 --- a/docs/providers/static.rst +++ b/docs/providers/static.rst @@ -4,10 +4,10 @@ Static providers Static providers are family of providers that return their values "as is". There are four types of static providers: - - ``Class`` - - ``Object`` - - ``Function`` - - ``Value`` + - ``di.Class`` + - ``di.Object`` + - ``di.Function`` + - ``di.Value`` All of them have the same behaviour, but usage of anyone is predicted by readability and providing object's type. diff --git a/examples/providers/static.py b/examples/providers/static.py index 69bff4b8..86b7587a 100644 --- a/examples/providers/static.py +++ b/examples/providers/static.py @@ -1,23 +1,20 @@ """`Static` providers example.""" -from dependency_injector.providers import Class -from dependency_injector.providers import Object -from dependency_injector.providers import Function -from dependency_injector.providers import Value +import dependency_injector as di # Provides class - `object`: -cls_provider = Class(object) +cls_provider = di.Class(object) assert cls_provider() is object # Provides object - `object()`: -object_provider = Object(object()) +object_provider = di.Object(object()) assert isinstance(object_provider(), object) # Provides function - `len`: -function_provider = Function(len) +function_provider = di.Function(len) assert function_provider() is len # Provides value - `123`: -value_provider = Value(123) +value_provider = di.Value(123) assert value_provider() == 123