mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-01-31 03:36:41 +03:00
Add public methods for injections
This commit is contained in:
parent
e5498f214b
commit
214a64732b
|
@ -17,7 +17,7 @@ cdef class PositionalInjection(Injection):
|
|||
cdef int __is_delegated
|
||||
cdef int __call
|
||||
|
||||
cdef inline object get_value(self):
|
||||
cdef inline object __get_value(self):
|
||||
if self.__call == 0:
|
||||
return self.__value
|
||||
return self.__value()
|
||||
|
@ -30,10 +30,10 @@ cdef class NamedInjection(Injection):
|
|||
cdef int __is_delegated
|
||||
cdef int __call
|
||||
|
||||
cdef inline object get_name(self):
|
||||
cdef inline object __get_name(self):
|
||||
return self.__name
|
||||
|
||||
cdef inline object get_value(self):
|
||||
cdef inline object __get_value(self):
|
||||
if self.__call == 0:
|
||||
return self.__value
|
||||
return self.__value()
|
||||
|
|
|
@ -21,6 +21,10 @@ cdef class PositionalInjection(Injection):
|
|||
self.__is_delegated = 0
|
||||
self.__call = <int>self.__is_provider == 1 and self.__is_delegated == 0
|
||||
|
||||
def get_value(self):
|
||||
"""Return injection value."""
|
||||
return self.__get_value()
|
||||
|
||||
|
||||
cdef class NamedInjection(Injection):
|
||||
"""Keyword injection class."""
|
||||
|
@ -33,6 +37,14 @@ cdef class NamedInjection(Injection):
|
|||
self.__is_delegated = 0
|
||||
self.__call = <int>self.__is_provider == 1 and self.__is_delegated == 0
|
||||
|
||||
def get_name(self):
|
||||
"""Return injection value."""
|
||||
return self.__get_name()
|
||||
|
||||
def get_value(self):
|
||||
"""Return injection value."""
|
||||
return self.__get_value()
|
||||
|
||||
|
||||
cpdef tuple parse_positional_injections(tuple args):
|
||||
"""Parse positional injections."""
|
||||
|
|
Loading…
Reference in New Issue
Block a user