diff --git a/dependency_injector/injections.py b/dependency_injector/injections.py index 1b3d2ed6..420dc931 100644 --- a/dependency_injector/injections.py +++ b/dependency_injector/injections.py @@ -93,8 +93,22 @@ class _NamedInjection(Injection): __slots__ = ('name',) def __init__(self, name, injectable): - """Initializer.""" + """Initializer. + + :param name: Injection target's name. + :type name: str + + :param injectable: Injectable value, could be provider or any + other object. + :type injectable: object | + :py:class:`dependency_injector.providers.Provider` + """ self.name = name + """Injection target's name (keyword argument, attribute, method). + + :type: str + """ + super(_NamedInjection, self).__init__(injectable) def __str__(self): @@ -115,18 +129,36 @@ class _NamedInjection(Injection): class KwArg(_NamedInjection): """Keyword argument injection.""" + name = None + """Keyword argument's name. + + :type: str + """ + __IS_KWARG_INJECTION__ = True class Attribute(_NamedInjection): """Attribute injection.""" + name = None + """Attribute's name. + + :type: str + """ + __IS_ATTRIBUTE_INJECTION__ = True class Method(_NamedInjection): """Method injection.""" + name = None + """Method's name. + + :type: str + """ + __IS_METHOD_INJECTION__ = True diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 7465f231..b4228e51 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -9,7 +9,8 @@ follows `Semantic versioning`_ Development version ------------------- -- No features. +- Improve representation of providers and injections. + 1.11.1 ------