mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-26 03:23:58 +03:00
Refactor provider internals: C functions naming scheme and code layout
This commit is contained in:
parent
668d503d44
commit
6adf9e4528
|
@ -1,6 +1,6 @@
|
||||||
"""Dependency injector top-level package."""
|
"""Dependency injector top-level package."""
|
||||||
|
|
||||||
VERSION = '3.1.4'
|
VERSION = '3.1.5'
|
||||||
"""Version number that follows semantic versioning.
|
"""Version number that follows semantic versioning.
|
||||||
|
|
||||||
:type: str
|
:type: str
|
||||||
|
|
|
@ -626,9 +626,9 @@ struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency;
|
||||||
struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext;
|
struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext;
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
||||||
|
|
||||||
/* "utils.pxd":13
|
/* "utils.pxd":21
|
||||||
* cpdef bint is_delegated(object instance)
|
*
|
||||||
* cpdef str represent_provider(object provider, object provides)
|
*
|
||||||
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
||||||
*/
|
*/
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,7 +29,7 @@ cdef class DelegatedCallable(Callable):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
cdef inline object __call(Callable self, tuple args, dict kwargs):
|
cdef inline object __callable_call(Callable self, tuple args, dict kwargs):
|
||||||
cdef tuple positional_args
|
cdef tuple positional_args
|
||||||
cdef dict keyword_args
|
cdef dict keyword_args
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ Powered by Cython.
|
||||||
from dependency_injector.errors import Error
|
from dependency_injector.errors import Error
|
||||||
|
|
||||||
from .base cimport Provider
|
from .base cimport Provider
|
||||||
from .callables cimport __call
|
|
||||||
from .injections cimport (
|
from .injections cimport (
|
||||||
PositionalInjection,
|
PositionalInjection,
|
||||||
NamedInjection,
|
NamedInjection,
|
||||||
|
@ -197,7 +196,7 @@ cdef class Callable(Provider):
|
||||||
|
|
||||||
cpdef object _provide(self, tuple args, dict kwargs):
|
cpdef object _provide(self, tuple args, dict kwargs):
|
||||||
"""Return result of provided callable's call."""
|
"""Return result of provided callable's call."""
|
||||||
return __call(self, args, kwargs)
|
return __callable_call(self, args, kwargs)
|
||||||
|
|
||||||
|
|
||||||
cdef class DelegatedCallable(Callable):
|
cdef class DelegatedCallable(Callable):
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@ Powered by Cython.
|
||||||
from .base cimport Provider
|
from .base cimport Provider
|
||||||
from .callables cimport (
|
from .callables cimport (
|
||||||
Callable,
|
Callable,
|
||||||
__call as __call_callable,
|
__callable_call,
|
||||||
)
|
)
|
||||||
from .injections cimport __inject_attributes
|
from .injections cimport __inject_attributes
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ cdef class DelegatedFactory(Factory):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
cdef inline object __call(Factory self, tuple args, dict kwargs):
|
cdef inline object __factory_call(Factory self, tuple args, dict kwargs):
|
||||||
cdef object instance
|
cdef object instance
|
||||||
|
|
||||||
instance = __call_callable(self.__instantiator, args, kwargs)
|
instance = __callable_call(self.__instantiator, args, kwargs)
|
||||||
|
|
||||||
if self.__attributes_len > 0:
|
if self.__attributes_len > 0:
|
||||||
__inject_attributes(instance,
|
__inject_attributes(instance,
|
||||||
|
@ -35,4 +35,3 @@ cdef inline object __call(Factory self, tuple args, dict kwargs):
|
||||||
self.__attributes_len)
|
self.__attributes_len)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ from dependency_injector.errors import Error
|
||||||
|
|
||||||
from .base cimport Provider
|
from .base cimport Provider
|
||||||
from .callables cimport Callable
|
from .callables cimport Callable
|
||||||
from .factories cimport __call
|
|
||||||
from .injections cimport (
|
from .injections cimport (
|
||||||
NamedInjection,
|
NamedInjection,
|
||||||
parse_named_injections,
|
parse_named_injections,
|
||||||
|
@ -248,7 +247,7 @@ cdef class Factory(Provider):
|
||||||
|
|
||||||
cpdef object _provide(self, tuple args, dict kwargs):
|
cpdef object _provide(self, tuple args, dict kwargs):
|
||||||
"""Return new instance."""
|
"""Return new instance."""
|
||||||
return __call(self, args, kwargs)
|
return __factory_call(self, args, kwargs)
|
||||||
|
|
||||||
|
|
||||||
cdef class DelegatedFactory(Factory):
|
cdef class DelegatedFactory(Factory):
|
||||||
|
|
|
@ -625,9 +625,9 @@ struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjecti
|
||||||
struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection;
|
struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection;
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
||||||
|
|
||||||
/* "utils.pxd":13
|
/* "utils.pxd":21
|
||||||
* cpdef bint is_delegated(object instance)
|
*
|
||||||
* cpdef str represent_provider(object provider, object provides)
|
*
|
||||||
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
||||||
*/
|
*/
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
||||||
|
|
|
@ -90,4 +90,6 @@ cdef inline object __inject_attributes(object instance,
|
||||||
|
|
||||||
|
|
||||||
cpdef tuple parse_positional_injections(tuple args)
|
cpdef tuple parse_positional_injections(tuple args)
|
||||||
|
|
||||||
|
|
||||||
cpdef tuple parse_named_injections(dict kwargs)
|
cpdef tuple parse_named_injections(dict kwargs)
|
||||||
|
|
|
@ -644,9 +644,9 @@ struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingle
|
||||||
struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton;
|
struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton;
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
||||||
|
|
||||||
/* "utils.pxd":13
|
/* "utils.pxd":21
|
||||||
* cpdef bint is_delegated(object instance)
|
*
|
||||||
* cpdef str represent_provider(object provider, object provides)
|
*
|
||||||
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
||||||
*/
|
*/
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
||||||
|
@ -1512,12 +1512,12 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10inject
|
||||||
/* Module declarations from 'dependency_injector.providers.callables' */
|
/* Module declarations from 'dependency_injector.providers.callables' */
|
||||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_Callable = 0;
|
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_Callable = 0;
|
||||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = 0;
|
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = 0;
|
||||||
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *, PyObject *, PyObject *); /*proto*/
|
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *, PyObject *, PyObject *); /*proto*/
|
||||||
|
|
||||||
/* Module declarations from 'dependency_injector.providers.factories' */
|
/* Module declarations from 'dependency_injector.providers.factories' */
|
||||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_Factory = 0;
|
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_Factory = 0;
|
||||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory = 0;
|
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory = 0;
|
||||||
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *, PyObject *, PyObject *); /*proto*/
|
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___factory_call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *, PyObject *, PyObject *); /*proto*/
|
||||||
|
|
||||||
/* Module declarations from 'dependency_injector.providers.utils' */
|
/* Module declarations from 'dependency_injector.providers.utils' */
|
||||||
static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0;
|
static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0;
|
||||||
|
@ -3926,7 +3926,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_9Singleto
|
||||||
* cpdef object _provide(self, tuple args, dict kwargs):
|
* cpdef object _provide(self, tuple args, dict kwargs):
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* if self.__storage is None: # <<<<<<<<<<<<<<
|
* if self.__storage is None: # <<<<<<<<<<<<<<
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
*/
|
*/
|
||||||
__pyx_t_7 = (__pyx_v_self->__pyx___storage == Py_None);
|
__pyx_t_7 = (__pyx_v_self->__pyx___storage == Py_None);
|
||||||
|
@ -3936,7 +3936,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_9Singleto
|
||||||
/* "dependency_injector/providers/singletons.pyx":258
|
/* "dependency_injector/providers/singletons.pyx":258
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator, # <<<<<<<<<<<<<<
|
* self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<<
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
* return self.__storage
|
* return self.__storage
|
||||||
*/
|
*/
|
||||||
|
@ -3945,19 +3945,19 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_9Singleto
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":259
|
/* "dependency_injector/providers/singletons.pyx":259
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs) # <<<<<<<<<<<<<<
|
* args, kwargs) # <<<<<<<<<<<<<<
|
||||||
* return self.__storage
|
* return self.__storage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers_9factories___call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
|
__pyx_t_2 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_2);
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":258
|
/* "dependency_injector/providers/singletons.pyx":258
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator, # <<<<<<<<<<<<<<
|
* self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<<
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
* return self.__storage
|
* return self.__storage
|
||||||
*/
|
*/
|
||||||
|
@ -3971,13 +3971,13 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_9Singleto
|
||||||
* cpdef object _provide(self, tuple args, dict kwargs):
|
* cpdef object _provide(self, tuple args, dict kwargs):
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* if self.__storage is None: # <<<<<<<<<<<<<<
|
* if self.__storage is None: # <<<<<<<<<<<<<<
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":260
|
/* "dependency_injector/providers/singletons.pyx":260
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
* return self.__storage # <<<<<<<<<<<<<<
|
* return self.__storage # <<<<<<<<<<<<<<
|
||||||
*
|
*
|
||||||
|
@ -4421,7 +4421,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* with self.__lock: # <<<<<<<<<<<<<<
|
* with self.__lock: # <<<<<<<<<<<<<<
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
*/
|
*/
|
||||||
/*with:*/ {
|
/*with:*/ {
|
||||||
__pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx___lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 312, __pyx_L1_error)
|
__pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx___lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 312, __pyx_L1_error)
|
||||||
|
@ -4461,7 +4461,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* with self.__lock:
|
* with self.__lock:
|
||||||
* if self.__storage is None: # <<<<<<<<<<<<<<
|
* if self.__storage is None: # <<<<<<<<<<<<<<
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
*/
|
*/
|
||||||
__pyx_t_11 = (__pyx_v_self->__pyx___storage == Py_None);
|
__pyx_t_11 = (__pyx_v_self->__pyx___storage == Py_None);
|
||||||
|
@ -4471,7 +4471,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
/* "dependency_injector/providers/singletons.pyx":314
|
/* "dependency_injector/providers/singletons.pyx":314
|
||||||
* with self.__lock:
|
* with self.__lock:
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator, # <<<<<<<<<<<<<<
|
* self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<<
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
* return self.__storage
|
* return self.__storage
|
||||||
*/
|
*/
|
||||||
|
@ -4480,19 +4480,19 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":315
|
/* "dependency_injector/providers/singletons.pyx":315
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs) # <<<<<<<<<<<<<<
|
* args, kwargs) # <<<<<<<<<<<<<<
|
||||||
* return self.__storage
|
* return self.__storage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers_9factories___call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L7_error)
|
__pyx_t_2 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L7_error)
|
||||||
__Pyx_GOTREF(__pyx_t_2);
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":314
|
/* "dependency_injector/providers/singletons.pyx":314
|
||||||
* with self.__lock:
|
* with self.__lock:
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator, # <<<<<<<<<<<<<<
|
* self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<<
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
* return self.__storage
|
* return self.__storage
|
||||||
*/
|
*/
|
||||||
|
@ -4506,7 +4506,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* with self.__lock:
|
* with self.__lock:
|
||||||
* if self.__storage is None: # <<<<<<<<<<<<<<
|
* if self.__storage is None: # <<<<<<<<<<<<<<
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -4516,7 +4516,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* with self.__lock: # <<<<<<<<<<<<<<
|
* with self.__lock: # <<<<<<<<<<<<<<
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
|
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
|
||||||
|
@ -4597,7 +4597,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadS
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":316
|
/* "dependency_injector/providers/singletons.pyx":316
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
* args, kwargs)
|
* args, kwargs)
|
||||||
* return self.__storage # <<<<<<<<<<<<<<
|
* return self.__storage # <<<<<<<<<<<<<<
|
||||||
*
|
*
|
||||||
|
@ -5067,7 +5067,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_20ThreadL
|
||||||
* try:
|
* try:
|
||||||
* instance = self.__storage.instance # <<<<<<<<<<<<<<
|
* instance = self.__storage.instance # <<<<<<<<<<<<<<
|
||||||
* except AttributeError:
|
* except AttributeError:
|
||||||
* instance = __call_factory(self.__instantiator, args, kwargs)
|
* instance = __factory_call(self.__instantiator, args, kwargs)
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L6_error)
|
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L6_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
@ -5098,7 +5098,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_20ThreadL
|
||||||
* try:
|
* try:
|
||||||
* instance = self.__storage.instance
|
* instance = self.__storage.instance
|
||||||
* except AttributeError: # <<<<<<<<<<<<<<
|
* except AttributeError: # <<<<<<<<<<<<<<
|
||||||
* instance = __call_factory(self.__instantiator, args, kwargs)
|
* instance = __factory_call(self.__instantiator, args, kwargs)
|
||||||
* self.__storage.instance = instance
|
* self.__storage.instance = instance
|
||||||
*/
|
*/
|
||||||
__pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
|
__pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
|
||||||
|
@ -5112,13 +5112,13 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_20ThreadL
|
||||||
/* "dependency_injector/providers/singletons.pyx":387
|
/* "dependency_injector/providers/singletons.pyx":387
|
||||||
* instance = self.__storage.instance
|
* instance = self.__storage.instance
|
||||||
* except AttributeError:
|
* except AttributeError:
|
||||||
* instance = __call_factory(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<<
|
* instance = __factory_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<<
|
||||||
* self.__storage.instance = instance
|
* self.__storage.instance = instance
|
||||||
* finally:
|
* finally:
|
||||||
*/
|
*/
|
||||||
__pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator);
|
__pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator);
|
||||||
__Pyx_INCREF(__pyx_t_6);
|
__Pyx_INCREF(__pyx_t_6);
|
||||||
__pyx_t_4 = __pyx_f_19dependency_injector_9providers_9factories___call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_6), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L8_except_error)
|
__pyx_t_4 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_6), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L8_except_error)
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
||||||
__Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_4);
|
__Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_4);
|
||||||
|
@ -5126,7 +5126,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_20ThreadL
|
||||||
|
|
||||||
/* "dependency_injector/providers/singletons.pyx":388
|
/* "dependency_injector/providers/singletons.pyx":388
|
||||||
* except AttributeError:
|
* except AttributeError:
|
||||||
* instance = __call_factory(self.__instantiator, args, kwargs)
|
* instance = __factory_call(self.__instantiator, args, kwargs)
|
||||||
* self.__storage.instance = instance # <<<<<<<<<<<<<<
|
* self.__storage.instance = instance # <<<<<<<<<<<<<<
|
||||||
* finally:
|
* finally:
|
||||||
* return instance
|
* return instance
|
||||||
|
@ -5955,19 +5955,19 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10inject
|
||||||
/* "callables.pxd":32
|
/* "callables.pxd":32
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* cdef inline object __call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
* cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||||
* cdef tuple positional_args
|
* cdef tuple positional_args
|
||||||
* cdef dict keyword_args
|
* cdef dict keyword_args
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
|
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
|
||||||
PyObject *__pyx_v_positional_args = 0;
|
PyObject *__pyx_v_positional_args = 0;
|
||||||
PyObject *__pyx_v_keyword_args = 0;
|
PyObject *__pyx_v_keyword_args = 0;
|
||||||
PyObject *__pyx_r = NULL;
|
PyObject *__pyx_r = NULL;
|
||||||
__Pyx_RefNannyDeclarations
|
__Pyx_RefNannyDeclarations
|
||||||
PyObject *__pyx_t_1 = NULL;
|
PyObject *__pyx_t_1 = NULL;
|
||||||
PyObject *__pyx_t_2 = NULL;
|
PyObject *__pyx_t_2 = NULL;
|
||||||
__Pyx_RefNannySetupContext("__call", 0);
|
__Pyx_RefNannySetupContext("__callable_call", 0);
|
||||||
|
|
||||||
/* "callables.pxd":37
|
/* "callables.pxd":37
|
||||||
*
|
*
|
||||||
|
@ -6038,7 +6038,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callabl
|
||||||
/* "callables.pxd":32
|
/* "callables.pxd":32
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* cdef inline object __call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
* cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||||
* cdef tuple positional_args
|
* cdef tuple positional_args
|
||||||
* cdef dict keyword_args
|
* cdef dict keyword_args
|
||||||
*/
|
*/
|
||||||
|
@ -6047,7 +6047,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callabl
|
||||||
__pyx_L1_error:;
|
__pyx_L1_error:;
|
||||||
__Pyx_XDECREF(__pyx_t_1);
|
__Pyx_XDECREF(__pyx_t_1);
|
||||||
__Pyx_XDECREF(__pyx_t_2);
|
__Pyx_XDECREF(__pyx_t_2);
|
||||||
__Pyx_AddTraceback("dependency_injector.providers.callables.__call", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
__Pyx_AddTraceback("dependency_injector.providers.callables.__callable_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
||||||
__pyx_r = 0;
|
__pyx_r = 0;
|
||||||
__pyx_L0:;
|
__pyx_L0:;
|
||||||
__Pyx_XDECREF(__pyx_v_positional_args);
|
__Pyx_XDECREF(__pyx_v_positional_args);
|
||||||
|
@ -6060,37 +6060,37 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callabl
|
||||||
/* "factories.pxd":27
|
/* "factories.pxd":27
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* cdef inline object __call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||||
* cdef object instance
|
* cdef object instance
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
|
static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___factory_call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
|
||||||
PyObject *__pyx_v_instance = 0;
|
PyObject *__pyx_v_instance = 0;
|
||||||
PyObject *__pyx_r = NULL;
|
PyObject *__pyx_r = NULL;
|
||||||
__Pyx_RefNannyDeclarations
|
__Pyx_RefNannyDeclarations
|
||||||
PyObject *__pyx_t_1 = NULL;
|
PyObject *__pyx_t_1 = NULL;
|
||||||
PyObject *__pyx_t_2 = NULL;
|
PyObject *__pyx_t_2 = NULL;
|
||||||
int __pyx_t_3;
|
int __pyx_t_3;
|
||||||
__Pyx_RefNannySetupContext("__call", 0);
|
__Pyx_RefNannySetupContext("__factory_call", 0);
|
||||||
|
|
||||||
/* "factories.pxd":30
|
/* "factories.pxd":30
|
||||||
* cdef object instance
|
* cdef object instance
|
||||||
*
|
*
|
||||||
* instance = __call_callable(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<<
|
* instance = __callable_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<<
|
||||||
*
|
*
|
||||||
* if self.__attributes_len > 0:
|
* if self.__attributes_len > 0:
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instantiator);
|
__pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instantiator);
|
||||||
__Pyx_INCREF(__pyx_t_1);
|
__Pyx_INCREF(__pyx_t_1);
|
||||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers_9callables___call(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 30, __pyx_L1_error)
|
__pyx_t_2 = __pyx_f_19dependency_injector_9providers_9callables___callable_call(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 30, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_2);
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
__pyx_v_instance = __pyx_t_2;
|
__pyx_v_instance = __pyx_t_2;
|
||||||
__pyx_t_2 = 0;
|
__pyx_t_2 = 0;
|
||||||
|
|
||||||
/* "factories.pxd":32
|
/* "factories.pxd":32
|
||||||
* instance = __call_callable(self.__instantiator, args, kwargs)
|
* instance = __callable_call(self.__instantiator, args, kwargs)
|
||||||
*
|
*
|
||||||
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
||||||
* __inject_attributes(instance,
|
* __inject_attributes(instance,
|
||||||
|
@ -6122,7 +6122,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factori
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "factories.pxd":32
|
/* "factories.pxd":32
|
||||||
* instance = __call_callable(self.__instantiator, args, kwargs)
|
* instance = __callable_call(self.__instantiator, args, kwargs)
|
||||||
*
|
*
|
||||||
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
||||||
* __inject_attributes(instance,
|
* __inject_attributes(instance,
|
||||||
|
@ -6134,7 +6134,6 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factori
|
||||||
* self.__attributes_len)
|
* self.__attributes_len)
|
||||||
*
|
*
|
||||||
* return instance # <<<<<<<<<<<<<<
|
* return instance # <<<<<<<<<<<<<<
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
__Pyx_XDECREF(__pyx_r);
|
__Pyx_XDECREF(__pyx_r);
|
||||||
__Pyx_INCREF(__pyx_v_instance);
|
__Pyx_INCREF(__pyx_v_instance);
|
||||||
|
@ -6144,7 +6143,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factori
|
||||||
/* "factories.pxd":27
|
/* "factories.pxd":27
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* cdef inline object __call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||||
* cdef object instance
|
* cdef object instance
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -6153,7 +6152,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factori
|
||||||
__pyx_L1_error:;
|
__pyx_L1_error:;
|
||||||
__Pyx_XDECREF(__pyx_t_1);
|
__Pyx_XDECREF(__pyx_t_1);
|
||||||
__Pyx_XDECREF(__pyx_t_2);
|
__Pyx_XDECREF(__pyx_t_2);
|
||||||
__Pyx_AddTraceback("dependency_injector.providers.factories.__call", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
__Pyx_AddTraceback("dependency_injector.providers.factories.__factory_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
||||||
__pyx_r = 0;
|
__pyx_r = 0;
|
||||||
__pyx_L0:;
|
__pyx_L0:;
|
||||||
__Pyx_XDECREF(__pyx_v_instance);
|
__Pyx_XDECREF(__pyx_v_instance);
|
||||||
|
@ -6962,7 +6961,7 @@ static int __Pyx_InitCachedConstants(void) {
|
||||||
* """Return single instance."""
|
* """Return single instance."""
|
||||||
* with self.__lock: # <<<<<<<<<<<<<<
|
* with self.__lock: # <<<<<<<<<<<<<<
|
||||||
* if self.__storage is None:
|
* if self.__storage is None:
|
||||||
* self.__storage = __call_factory(self.__instantiator,
|
* self.__storage = __factory_call(self.__instantiator,
|
||||||
*/
|
*/
|
||||||
__pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 312, __pyx_L1_error)
|
__pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 312, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_tuple_);
|
__Pyx_GOTREF(__pyx_tuple_);
|
||||||
|
@ -7330,7 +7329,7 @@ PyMODINIT_FUNC PyInit_singletons(void)
|
||||||
/* "factories.pxd":27
|
/* "factories.pxd":27
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* cdef inline object __call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||||
* cdef object instance
|
* cdef object instance
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,7 +10,7 @@ from dependency_injector.errors import Error
|
||||||
from .base cimport Provider
|
from .base cimport Provider
|
||||||
from .factories cimport (
|
from .factories cimport (
|
||||||
Factory,
|
Factory,
|
||||||
__call as __call_factory,
|
__factory_call,
|
||||||
)
|
)
|
||||||
from .utils cimport (
|
from .utils cimport (
|
||||||
represent_provider,
|
represent_provider,
|
||||||
|
@ -255,7 +255,7 @@ cdef class Singleton(BaseSingleton):
|
||||||
cpdef object _provide(self, tuple args, dict kwargs):
|
cpdef object _provide(self, tuple args, dict kwargs):
|
||||||
"""Return single instance."""
|
"""Return single instance."""
|
||||||
if self.__storage is None:
|
if self.__storage is None:
|
||||||
self.__storage = __call_factory(self.__instantiator,
|
self.__storage = __factory_call(self.__instantiator,
|
||||||
args, kwargs)
|
args, kwargs)
|
||||||
return self.__storage
|
return self.__storage
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ cdef class ThreadSafeSingleton(BaseSingleton):
|
||||||
"""Return single instance."""
|
"""Return single instance."""
|
||||||
with self.__lock:
|
with self.__lock:
|
||||||
if self.__storage is None:
|
if self.__storage is None:
|
||||||
self.__storage = __call_factory(self.__instantiator,
|
self.__storage = __factory_call(self.__instantiator,
|
||||||
args, kwargs)
|
args, kwargs)
|
||||||
return self.__storage
|
return self.__storage
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ cdef class ThreadLocalSingleton(BaseSingleton):
|
||||||
try:
|
try:
|
||||||
instance = self.__storage.instance
|
instance = self.__storage.instance
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
instance = __call_factory(self.__instantiator, args, kwargs)
|
instance = __factory_call(self.__instantiator, args, kwargs)
|
||||||
self.__storage.instance = instance
|
self.__storage.instance = instance
|
||||||
finally:
|
finally:
|
||||||
return instance
|
return instance
|
||||||
|
|
|
@ -621,9 +621,9 @@ static const char *__pyx_f[] = {
|
||||||
/*--- Type declarations ---*/
|
/*--- Type declarations ---*/
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy;
|
||||||
|
|
||||||
/* "dependency_injector/providers/utils.pxd":13
|
/* "dependency_injector/providers/utils.pxd":21
|
||||||
* cpdef bint is_delegated(object instance)
|
*
|
||||||
* cpdef str represent_provider(object provider, object provides)
|
*
|
||||||
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
||||||
*/
|
*/
|
||||||
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy {
|
||||||
|
|
|
@ -7,7 +7,15 @@ cdef object CLASS_TYPES
|
||||||
|
|
||||||
|
|
||||||
cpdef bint is_provider(object instance)
|
cpdef bint is_provider(object instance)
|
||||||
|
|
||||||
|
|
||||||
cpdef object ensure_is_provider(object instance)
|
cpdef object ensure_is_provider(object instance)
|
||||||
|
|
||||||
|
|
||||||
cpdef bint is_delegated(object instance)
|
cpdef bint is_delegated(object instance)
|
||||||
|
|
||||||
|
|
||||||
cpdef str represent_provider(object provider, object provides)
|
cpdef str represent_provider(object provider, object provides)
|
||||||
|
|
||||||
|
|
||||||
cpdef object deepcopy(object instance, dict memo=*)
|
cpdef object deepcopy(object instance, dict memo=*)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user