Update injections API docs

This commit is contained in:
Roman Mogilatov 2015-12-14 10:22:15 +02:00
parent 790860f426
commit 1ca17fdeff

View File

@ -25,6 +25,18 @@ class Injection(object):
"""Base injection class.
All injections extend this class.
.. py:attribute:: injectable
Injectable value, could be provider or any other object.
:type: object | :py:class:`dependency_injector.providers.Provider`
.. py:attribute:: injectable_is_provider
Flag that is set to ``True`` if injectable value is provider.
:type: bool
"""
__IS_INJECTION__ = True
@ -39,17 +51,7 @@ class Injection(object):
:py:class:`dependency_injector.providers.Provider`
"""
self.injectable = injectable
"""Injectable value, could be provider or any other object.
:type: object | :py:class:`dependency_injector.providers.Provider`
"""
self.injectable_is_provider = is_provider(injectable)
"""Flag that is set to ``True`` if injectable value is provider.
:type: bool
"""
super(Injection, self).__init__()
@property
@ -88,7 +90,14 @@ class Arg(Injection):
@six.python_2_unicode_compatible
class _NamedInjection(Injection):
"""Base class of named injections."""
"""Base class of named injections.
.. py:attribute:: name
Injection target's name (keyword argument, attribute, method).
:type: str
"""
__slots__ = ('name',)
@ -104,11 +113,6 @@ class _NamedInjection(Injection):
: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):
@ -127,10 +131,11 @@ class _NamedInjection(Injection):
class KwArg(_NamedInjection):
"""Keyword argument injection."""
"""Keyword argument injection.
name = None
"""Keyword argument's name.
.. py:attribute:: name
Keyword argument's name.
:type: str
"""
@ -139,10 +144,11 @@ class KwArg(_NamedInjection):
class Attribute(_NamedInjection):
"""Attribute injection."""
"""Attribute injection.
name = None
"""Attribute's name.
.. py:attribute:: name
Attribute's name.
:type: str
"""
@ -151,10 +157,11 @@ class Attribute(_NamedInjection):
class Method(_NamedInjection):
"""Method injection."""
"""Method injection.
name = None
"""Method's name.
.. py:attribute:: name
Method's name.
:type: str
"""