From 9da9ef71535f667d809699c4e0a87e4b2bb5e5ce Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Sat, 27 Feb 2016 00:07:32 +0200 Subject: [PATCH] 1.14.6 release --- dependency_injector/__init__.py | 2 +- dependency_injector/providers.py | 32 +++++++++++++++++++++++++++++++- docs/main/changelog.rst | 5 +++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/dependency_injector/__init__.py b/dependency_injector/__init__.py index ec4e5c6d..19226b25 100644 --- a/dependency_injector/__init__.py +++ b/dependency_injector/__init__.py @@ -51,7 +51,7 @@ from .errors import UndefinedProviderError from . import catalogs catalog = catalogs -VERSION = '1.14.5' +VERSION = '1.14.6' """Version number that follows semantic versioning. :type: str diff --git a/dependency_injector/providers.py b/dependency_injector/providers.py index ec17195c..a3d6119f 100644 --- a/dependency_injector/providers.py +++ b/dependency_injector/providers.py @@ -401,6 +401,13 @@ class Factory(Callable): :type: type | callable + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attribute:`provides`. + + :type: type + .. py:attribute:: args Tuple of positional argument injections. @@ -428,7 +435,7 @@ class Factory(Callable): provided_type = None - __slots__ = ('attributes', 'methods') + __slots__ = ('cls', 'attributes', 'methods') def __init__(self, provides, *args, **kwargs): """Initializer. @@ -458,6 +465,8 @@ class Factory(Callable): super(Factory, self).__init__(provides, *args, **kwargs) + self.cls = self.provides + @property def injections(self): """Read-only tuple of all injections. @@ -514,6 +523,13 @@ class DelegatedFactory(Factory): :type: type | callable + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attribute:`provides`. + + :type: type + .. py:attribute:: args Tuple of positional argument injections. @@ -582,6 +598,13 @@ class Singleton(Factory): :type: type | callable + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attribute:`provides`. + + :type: type + .. py:attribute:: args Tuple of positional argument injections. @@ -678,6 +701,13 @@ class DelegatedSingleton(Singleton): :type: type | callable + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attribute:`provides`. + + :type: type + .. py:attribute:: args Tuple of positional argument injections. diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 1bad6918..d7bbdf1a 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -11,6 +11,11 @@ Development version ------------------- - No features. +1.14.6 +------ +- Add ``cls`` alias for ``provides`` attributes of ``Factory``, + ``DelegatedFactory``, ``Singleton`` and ``DelegatedSingleton`` providers. + 1.14.5 ------ - Fix typo in provider's error message.