mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-25 19:14:00 +03:00
Merge branch 'feature/singleton-delegate' into develop
This commit is contained in:
commit
1adba8f4ce
|
@ -11,6 +11,7 @@ Development
|
|||
-----------
|
||||
- Add ``CallableDelegate`` provider.
|
||||
- Add ``FactoryDelegate`` provider.
|
||||
- Add ``SingletonDelegate`` provider.
|
||||
|
||||
3.5.0
|
||||
-----
|
||||
|
|
|
@ -651,6 +651,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton;
|
|||
struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton;
|
||||
struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton;
|
||||
struct __pyx_obj_19dependency_injector_9providers_AbstractSingleton;
|
||||
struct __pyx_obj_19dependency_injector_9providers_SingletonDelegate;
|
||||
struct __pyx_obj_19dependency_injector_9providers_Injection;
|
||||
struct __pyx_obj_19dependency_injector_9providers_PositionalInjection;
|
||||
struct __pyx_obj_19dependency_injector_9providers_NamedInjection;
|
||||
|
@ -661,7 +662,7 @@ struct __pyx_obj_19dependency_injector_10containers___pyx_scope_struct_3_overrid
|
|||
struct __pyx_obj_19dependency_injector_10containers___pyx_scope_struct_4_copy;
|
||||
struct __pyx_opt_args_19dependency_injector_9providers_deepcopy;
|
||||
|
||||
/* "providers.pxd":174
|
||||
/* "providers.pxd":178
|
||||
*
|
||||
*
|
||||
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
||||
|
@ -961,7 +962,19 @@ struct __pyx_obj_19dependency_injector_9providers_AbstractSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":137
|
||||
/* "providers.pxd":136
|
||||
*
|
||||
*
|
||||
* cdef class SingletonDelegate(Delegate): # <<<<<<<<<<<<<<
|
||||
* pass
|
||||
*
|
||||
*/
|
||||
struct __pyx_obj_19dependency_injector_9providers_SingletonDelegate {
|
||||
struct __pyx_obj_19dependency_injector_9providers_Delegate __pyx_base;
|
||||
};
|
||||
|
||||
|
||||
/* "providers.pxd":141
|
||||
*
|
||||
* # Injections
|
||||
* cdef class Injection(object): # <<<<<<<<<<<<<<
|
||||
|
@ -977,7 +990,7 @@ struct __pyx_obj_19dependency_injector_9providers_Injection {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":144
|
||||
/* "providers.pxd":148
|
||||
*
|
||||
*
|
||||
* cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<<
|
||||
|
@ -989,7 +1002,7 @@ struct __pyx_obj_19dependency_injector_9providers_PositionalInjection {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":148
|
||||
/* "providers.pxd":152
|
||||
*
|
||||
*
|
||||
* cdef class NamedInjection(Injection): # <<<<<<<<<<<<<<
|
||||
|
@ -1378,6 +1391,20 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_AbstractSingleton {
|
|||
};
|
||||
static struct __pyx_vtabstruct_19dependency_injector_9providers_AbstractSingleton *__pyx_vtabptr_19dependency_injector_9providers_AbstractSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":136
|
||||
*
|
||||
*
|
||||
* cdef class SingletonDelegate(Delegate): # <<<<<<<<<<<<<<
|
||||
* pass
|
||||
*
|
||||
*/
|
||||
|
||||
struct __pyx_vtabstruct_19dependency_injector_9providers_SingletonDelegate {
|
||||
struct __pyx_vtabstruct_19dependency_injector_9providers_Delegate __pyx_base;
|
||||
};
|
||||
static struct __pyx_vtabstruct_19dependency_injector_9providers_SingletonDelegate *__pyx_vtabptr_19dependency_injector_9providers_SingletonDelegate;
|
||||
|
||||
/* --- Runtime support code (head) --- */
|
||||
/* Refnanny.proto */
|
||||
#ifndef CYTHON_REFNANNY
|
||||
|
@ -1881,6 +1908,7 @@ static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedThrea
|
|||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_AbstractSingleton = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_SingletonDelegate = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Injection = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_PositionalInjection = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_NamedInjection = 0;
|
||||
|
@ -8219,7 +8247,7 @@ static PyObject *__pyx_pf_19dependency_injector_10containers_6_check_provider_ty
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":178
|
||||
/* "providers.pxd":182
|
||||
*
|
||||
* # Inline helper functions
|
||||
* cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8232,7 +8260,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_na
|
|||
__Pyx_RefNannyDeclarations
|
||||
__Pyx_RefNannySetupContext("__get_name", 0);
|
||||
|
||||
/* "providers.pxd":179
|
||||
/* "providers.pxd":183
|
||||
* # Inline helper functions
|
||||
* cdef inline object __get_name(NamedInjection self):
|
||||
* return self.__name # <<<<<<<<<<<<<<
|
||||
|
@ -8244,7 +8272,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_na
|
|||
__pyx_r = __pyx_v_self->__pyx___name;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":178
|
||||
/* "providers.pxd":182
|
||||
*
|
||||
* # Inline helper functions
|
||||
* cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8259,7 +8287,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_na
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":182
|
||||
/* "providers.pxd":186
|
||||
*
|
||||
*
|
||||
* cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8276,7 +8304,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
PyObject *__pyx_t_4 = NULL;
|
||||
__Pyx_RefNannySetupContext("__get_value", 0);
|
||||
|
||||
/* "providers.pxd":183
|
||||
/* "providers.pxd":187
|
||||
*
|
||||
* cdef inline object __get_value(Injection self):
|
||||
* if self.__call == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8286,7 +8314,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
__pyx_t_1 = ((__pyx_v_self->__pyx___call == 0) != 0);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "providers.pxd":184
|
||||
/* "providers.pxd":188
|
||||
* cdef inline object __get_value(Injection self):
|
||||
* if self.__call == 0:
|
||||
* return self.__value # <<<<<<<<<<<<<<
|
||||
|
@ -8298,7 +8326,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
__pyx_r = __pyx_v_self->__pyx___value;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":183
|
||||
/* "providers.pxd":187
|
||||
*
|
||||
* cdef inline object __get_value(Injection self):
|
||||
* if self.__call == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8307,7 +8335,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":185
|
||||
/* "providers.pxd":189
|
||||
* if self.__call == 0:
|
||||
* return self.__value
|
||||
* return self.__value() # <<<<<<<<<<<<<<
|
||||
|
@ -8327,10 +8355,10 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
}
|
||||
}
|
||||
if (__pyx_t_4) {
|
||||
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 185, __pyx_L1_error)
|
||||
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 189, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
} else {
|
||||
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 185, __pyx_L1_error)
|
||||
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 189, __pyx_L1_error)
|
||||
}
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||
|
@ -8338,7 +8366,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
__pyx_t_2 = 0;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":182
|
||||
/* "providers.pxd":186
|
||||
*
|
||||
*
|
||||
* cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8359,7 +8387,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":190
|
||||
/* "providers.pxd":194
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<<
|
||||
|
@ -8380,7 +8408,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
int __pyx_t_5;
|
||||
__Pyx_RefNannySetupContext("__provide_positional_args", 0);
|
||||
|
||||
/* "providers.pxd":197
|
||||
/* "providers.pxd":201
|
||||
* cdef PositionalInjection injection
|
||||
*
|
||||
* if inj_args_len == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8390,7 +8418,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
__pyx_t_1 = ((__pyx_v_inj_args_len == 0) != 0);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "providers.pxd":198
|
||||
/* "providers.pxd":202
|
||||
*
|
||||
* if inj_args_len == 0:
|
||||
* return args # <<<<<<<<<<<<<<
|
||||
|
@ -8402,7 +8430,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
__pyx_r = __pyx_v_args;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":197
|
||||
/* "providers.pxd":201
|
||||
* cdef PositionalInjection injection
|
||||
*
|
||||
* if inj_args_len == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8411,19 +8439,19 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":200
|
||||
/* "providers.pxd":204
|
||||
* return args
|
||||
*
|
||||
* positional_args = list() # <<<<<<<<<<<<<<
|
||||
* for index in range(inj_args_len):
|
||||
* injection = <PositionalInjection>inj_args[index]
|
||||
*/
|
||||
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 200, __pyx_L1_error)
|
||||
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 204, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_v_positional_args = ((PyObject*)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
|
||||
/* "providers.pxd":201
|
||||
/* "providers.pxd":205
|
||||
*
|
||||
* positional_args = list()
|
||||
* for index in range(inj_args_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8434,7 +8462,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
||||
__pyx_v_index = __pyx_t_4;
|
||||
|
||||
/* "providers.pxd":202
|
||||
/* "providers.pxd":206
|
||||
* positional_args = list()
|
||||
* for index in range(inj_args_len):
|
||||
* injection = <PositionalInjection>inj_args[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8443,36 +8471,36 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
if (unlikely(__pyx_v_inj_args == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
|
||||
__PYX_ERR(1, 202, __pyx_L1_error)
|
||||
__PYX_ERR(1, 206, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_inj_args, __pyx_v_index);
|
||||
__Pyx_INCREF(__pyx_t_2);
|
||||
__Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_t_2));
|
||||
__pyx_t_2 = 0;
|
||||
|
||||
/* "providers.pxd":203
|
||||
/* "providers.pxd":207
|
||||
* for index in range(inj_args_len):
|
||||
* injection = <PositionalInjection>inj_args[index]
|
||||
* positional_args.append(__get_value(injection)) # <<<<<<<<<<<<<<
|
||||
* positional_args.extend(args)
|
||||
*
|
||||
*/
|
||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 203, __pyx_L1_error)
|
||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 207, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 203, __pyx_L1_error)
|
||||
__pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 207, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
}
|
||||
|
||||
/* "providers.pxd":204
|
||||
/* "providers.pxd":208
|
||||
* injection = <PositionalInjection>inj_args[index]
|
||||
* positional_args.append(__get_value(injection))
|
||||
* positional_args.extend(args) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* return tuple(positional_args)
|
||||
*/
|
||||
__pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 204, __pyx_L1_error)
|
||||
__pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 208, __pyx_L1_error)
|
||||
|
||||
/* "providers.pxd":206
|
||||
/* "providers.pxd":210
|
||||
* positional_args.extend(args)
|
||||
*
|
||||
* return tuple(positional_args) # <<<<<<<<<<<<<<
|
||||
|
@ -8480,13 +8508,13 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*
|
||||
*/
|
||||
__Pyx_XDECREF(__pyx_r);
|
||||
__pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 206, __pyx_L1_error)
|
||||
__pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 210, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_r = ((PyObject*)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":190
|
||||
/* "providers.pxd":194
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<<
|
||||
|
@ -8507,7 +8535,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":211
|
||||
/* "providers.pxd":215
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<<
|
||||
|
@ -8529,7 +8557,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
int __pyx_t_6;
|
||||
__Pyx_RefNannySetupContext("__provide_keyword_args", 0);
|
||||
|
||||
/* "providers.pxd":218
|
||||
/* "providers.pxd":222
|
||||
* cdef NamedInjection kw_injection
|
||||
*
|
||||
* if len(kwargs) == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8538,13 +8566,13 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
if (unlikely(__pyx_v_kwargs == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
|
||||
__PYX_ERR(1, 218, __pyx_L1_error)
|
||||
__PYX_ERR(1, 222, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 218, __pyx_L1_error)
|
||||
__pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 222, __pyx_L1_error)
|
||||
__pyx_t_2 = ((__pyx_t_1 == 0) != 0);
|
||||
if (__pyx_t_2) {
|
||||
|
||||
/* "providers.pxd":219
|
||||
/* "providers.pxd":223
|
||||
*
|
||||
* if len(kwargs) == 0:
|
||||
* for index in range(inj_kwargs_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8555,7 +8583,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
||||
__pyx_v_index = __pyx_t_4;
|
||||
|
||||
/* "providers.pxd":220
|
||||
/* "providers.pxd":224
|
||||
* if len(kwargs) == 0:
|
||||
* for index in range(inj_kwargs_len):
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8564,43 +8592,43 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
if (unlikely(__pyx_v_inj_kwargs == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
|
||||
__PYX_ERR(1, 220, __pyx_L1_error)
|
||||
__PYX_ERR(1, 224, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index);
|
||||
__Pyx_INCREF(__pyx_t_5);
|
||||
__Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_5));
|
||||
__pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":221
|
||||
/* "providers.pxd":225
|
||||
* for index in range(inj_kwargs_len):
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection) # <<<<<<<<<<<<<<
|
||||
* kwargs[name] = __get_value(kw_injection)
|
||||
* else:
|
||||
*/
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 221, __pyx_L1_error)
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 225, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
__Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
|
||||
__pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":222
|
||||
/* "providers.pxd":226
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection)
|
||||
* kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<<
|
||||
* else:
|
||||
* for index in range(inj_kwargs_len):
|
||||
*/
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 222, __pyx_L1_error)
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 226, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
if (unlikely(__pyx_v_kwargs == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
|
||||
__PYX_ERR(1, 222, __pyx_L1_error)
|
||||
__PYX_ERR(1, 226, __pyx_L1_error)
|
||||
}
|
||||
if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 222, __pyx_L1_error)
|
||||
if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 226, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||
}
|
||||
|
||||
/* "providers.pxd":218
|
||||
/* "providers.pxd":222
|
||||
* cdef NamedInjection kw_injection
|
||||
*
|
||||
* if len(kwargs) == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8610,7 +8638,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
goto __pyx_L3;
|
||||
}
|
||||
|
||||
/* "providers.pxd":224
|
||||
/* "providers.pxd":228
|
||||
* kwargs[name] = __get_value(kw_injection)
|
||||
* else:
|
||||
* for index in range(inj_kwargs_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8622,7 +8650,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
||||
__pyx_v_index = __pyx_t_4;
|
||||
|
||||
/* "providers.pxd":225
|
||||
/* "providers.pxd":229
|
||||
* else:
|
||||
* for index in range(inj_kwargs_len):
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8631,26 +8659,26 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
if (unlikely(__pyx_v_inj_kwargs == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
|
||||
__PYX_ERR(1, 225, __pyx_L1_error)
|
||||
__PYX_ERR(1, 229, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index);
|
||||
__Pyx_INCREF(__pyx_t_5);
|
||||
__Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_5));
|
||||
__pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":226
|
||||
/* "providers.pxd":230
|
||||
* for index in range(inj_kwargs_len):
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection) # <<<<<<<<<<<<<<
|
||||
* if name not in kwargs:
|
||||
* kwargs[name] = __get_value(kw_injection)
|
||||
*/
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 226, __pyx_L1_error)
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 230, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
__Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
|
||||
__pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":227
|
||||
/* "providers.pxd":231
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection)
|
||||
* if name not in kwargs: # <<<<<<<<<<<<<<
|
||||
|
@ -8659,29 +8687,29 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
if (unlikely(__pyx_v_kwargs == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
|
||||
__PYX_ERR(1, 227, __pyx_L1_error)
|
||||
__PYX_ERR(1, 231, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 227, __pyx_L1_error)
|
||||
__pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 231, __pyx_L1_error)
|
||||
__pyx_t_6 = (__pyx_t_2 != 0);
|
||||
if (__pyx_t_6) {
|
||||
|
||||
/* "providers.pxd":228
|
||||
/* "providers.pxd":232
|
||||
* name = __get_name(kw_injection)
|
||||
* if name not in kwargs:
|
||||
* kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* return kwargs
|
||||
*/
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 228, __pyx_L1_error)
|
||||
__pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 232, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
if (unlikely(__pyx_v_kwargs == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
|
||||
__PYX_ERR(1, 228, __pyx_L1_error)
|
||||
__PYX_ERR(1, 232, __pyx_L1_error)
|
||||
}
|
||||
if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 228, __pyx_L1_error)
|
||||
if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 232, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":227
|
||||
/* "providers.pxd":231
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection)
|
||||
* if name not in kwargs: # <<<<<<<<<<<<<<
|
||||
|
@ -8693,7 +8721,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
}
|
||||
__pyx_L3:;
|
||||
|
||||
/* "providers.pxd":230
|
||||
/* "providers.pxd":234
|
||||
* kwargs[name] = __get_value(kw_injection)
|
||||
*
|
||||
* return kwargs # <<<<<<<<<<<<<<
|
||||
|
@ -8705,7 +8733,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
__pyx_r = __pyx_v_kwargs;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":211
|
||||
/* "providers.pxd":215
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<<
|
||||
|
@ -8726,7 +8754,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":235
|
||||
/* "providers.pxd":239
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<<
|
||||
|
@ -8746,7 +8774,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject
|
|||
int __pyx_t_5;
|
||||
__Pyx_RefNannySetupContext("__inject_attributes", 0);
|
||||
|
||||
/* "providers.pxd":239
|
||||
/* "providers.pxd":243
|
||||
* int attributes_len):
|
||||
* cdef NamedInjection attr_injection
|
||||
* for index in range(attributes_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8757,7 +8785,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject
|
|||
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
|
||||
__pyx_v_index = __pyx_t_2;
|
||||
|
||||
/* "providers.pxd":240
|
||||
/* "providers.pxd":244
|
||||
* cdef NamedInjection attr_injection
|
||||
* for index in range(attributes_len):
|
||||
* attr_injection = <NamedInjection>attributes[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8766,46 +8794,46 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject
|
|||
*/
|
||||
if (unlikely(__pyx_v_attributes == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
|
||||
__PYX_ERR(1, 240, __pyx_L1_error)
|
||||
__PYX_ERR(1, 244, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_attributes, __pyx_v_index);
|
||||
__Pyx_INCREF(__pyx_t_3);
|
||||
__Pyx_XDECREF_SET(__pyx_v_attr_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_3));
|
||||
__pyx_t_3 = 0;
|
||||
|
||||
/* "providers.pxd":242
|
||||
/* "providers.pxd":246
|
||||
* attr_injection = <NamedInjection>attributes[index]
|
||||
* setattr(instance,
|
||||
* __get_name(attr_injection), # <<<<<<<<<<<<<<
|
||||
* __get_value(attr_injection))
|
||||
*
|
||||
*/
|
||||
__pyx_t_3 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 242, __pyx_L1_error)
|
||||
__pyx_t_3 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 246, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_3);
|
||||
|
||||
/* "providers.pxd":243
|
||||
/* "providers.pxd":247
|
||||
* setattr(instance,
|
||||
* __get_name(attr_injection),
|
||||
* __get_value(attr_injection)) # <<<<<<<<<<<<<<
|
||||
*
|
||||
*
|
||||
*/
|
||||
__pyx_t_4 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 243, __pyx_L1_error)
|
||||
__pyx_t_4 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 247, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_4);
|
||||
|
||||
/* "providers.pxd":241
|
||||
/* "providers.pxd":245
|
||||
* for index in range(attributes_len):
|
||||
* attr_injection = <NamedInjection>attributes[index]
|
||||
* setattr(instance, # <<<<<<<<<<<<<<
|
||||
* __get_name(attr_injection),
|
||||
* __get_value(attr_injection))
|
||||
*/
|
||||
__pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 241, __pyx_L1_error)
|
||||
__pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 245, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
}
|
||||
|
||||
/* "providers.pxd":235
|
||||
/* "providers.pxd":239
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<<
|
||||
|
@ -8828,7 +8856,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":246
|
||||
/* "providers.pxd":250
|
||||
*
|
||||
*
|
||||
* cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -8845,7 +8873,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
PyObject *__pyx_t_2 = NULL;
|
||||
__Pyx_RefNannySetupContext("__callable_call", 0);
|
||||
|
||||
/* "providers.pxd":251
|
||||
/* "providers.pxd":255
|
||||
*
|
||||
* positional_args = __provide_positional_args(args,
|
||||
* self.__args, # <<<<<<<<<<<<<<
|
||||
|
@ -8855,20 +8883,20 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
__pyx_t_1 = __pyx_v_self->__pyx___args;
|
||||
__Pyx_INCREF(__pyx_t_1);
|
||||
|
||||
/* "providers.pxd":250
|
||||
/* "providers.pxd":254
|
||||
* cdef dict keyword_args
|
||||
*
|
||||
* positional_args = __provide_positional_args(args, # <<<<<<<<<<<<<<
|
||||
* self.__args,
|
||||
* self.__args_len)
|
||||
*/
|
||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 250, __pyx_L1_error)
|
||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 254, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
__pyx_v_positional_args = ((PyObject*)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
|
||||
/* "providers.pxd":254
|
||||
/* "providers.pxd":258
|
||||
* self.__args_len)
|
||||
* keyword_args = __provide_keyword_args(kwargs,
|
||||
* self.__kwargs, # <<<<<<<<<<<<<<
|
||||
|
@ -8878,20 +8906,20 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
__pyx_t_2 = __pyx_v_self->__pyx___kwargs;
|
||||
__Pyx_INCREF(__pyx_t_2);
|
||||
|
||||
/* "providers.pxd":253
|
||||
/* "providers.pxd":257
|
||||
* self.__args,
|
||||
* self.__args_len)
|
||||
* keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<<
|
||||
* self.__kwargs,
|
||||
* self.__kwargs_len)
|
||||
*/
|
||||
__pyx_t_1 = __pyx_f_19dependency_injector_9providers___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 253, __pyx_L1_error)
|
||||
__pyx_t_1 = __pyx_f_19dependency_injector_9providers___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 257, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
__pyx_v_keyword_args = ((PyObject*)__pyx_t_1);
|
||||
__pyx_t_1 = 0;
|
||||
|
||||
/* "providers.pxd":257
|
||||
/* "providers.pxd":261
|
||||
* self.__kwargs_len)
|
||||
*
|
||||
* return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<<
|
||||
|
@ -8901,19 +8929,19 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
__Pyx_XDECREF(__pyx_r);
|
||||
if (unlikely(__pyx_v_positional_args == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
|
||||
__PYX_ERR(1, 257, __pyx_L1_error)
|
||||
__PYX_ERR(1, 261, __pyx_L1_error)
|
||||
}
|
||||
if (unlikely(__pyx_v_keyword_args == Py_None)) {
|
||||
PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
|
||||
__PYX_ERR(1, 257, __pyx_L1_error)
|
||||
__PYX_ERR(1, 261, __pyx_L1_error)
|
||||
}
|
||||
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->__pyx___provides, __pyx_v_positional_args, __pyx_v_keyword_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 257, __pyx_L1_error)
|
||||
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->__pyx___provides, __pyx_v_positional_args, __pyx_v_keyword_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 261, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
__pyx_r = __pyx_t_1;
|
||||
__pyx_t_1 = 0;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":246
|
||||
/* "providers.pxd":250
|
||||
*
|
||||
*
|
||||
* cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -8935,7 +8963,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":260
|
||||
/* "providers.pxd":264
|
||||
*
|
||||
*
|
||||
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -8952,7 +8980,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
int __pyx_t_3;
|
||||
__Pyx_RefNannySetupContext("__factory_call", 0);
|
||||
|
||||
/* "providers.pxd":263
|
||||
/* "providers.pxd":267
|
||||
* cdef object instance
|
||||
*
|
||||
* instance = __callable_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<<
|
||||
|
@ -8961,13 +8989,13 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
*/
|
||||
__pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instantiator);
|
||||
__Pyx_INCREF(__pyx_t_1);
|
||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___callable_call(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 263, __pyx_L1_error)
|
||||
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___callable_call(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 267, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
__pyx_v_instance = __pyx_t_2;
|
||||
__pyx_t_2 = 0;
|
||||
|
||||
/* "providers.pxd":265
|
||||
/* "providers.pxd":269
|
||||
* instance = __callable_call(self.__instantiator, args, kwargs)
|
||||
*
|
||||
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8977,7 +9005,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
__pyx_t_3 = ((__pyx_v_self->__pyx___attributes_len > 0) != 0);
|
||||
if (__pyx_t_3) {
|
||||
|
||||
/* "providers.pxd":267
|
||||
/* "providers.pxd":271
|
||||
* if self.__attributes_len > 0:
|
||||
* __inject_attributes(instance,
|
||||
* self.__attributes, # <<<<<<<<<<<<<<
|
||||
|
@ -8987,19 +9015,19 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
__pyx_t_2 = __pyx_v_self->__pyx___attributes;
|
||||
__Pyx_INCREF(__pyx_t_2);
|
||||
|
||||
/* "providers.pxd":266
|
||||
/* "providers.pxd":270
|
||||
*
|
||||
* if self.__attributes_len > 0:
|
||||
* __inject_attributes(instance, # <<<<<<<<<<<<<<
|
||||
* self.__attributes,
|
||||
* self.__attributes_len)
|
||||
*/
|
||||
__pyx_t_1 = __pyx_f_19dependency_injector_9providers___inject_attributes(__pyx_v_instance, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___attributes_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 266, __pyx_L1_error)
|
||||
__pyx_t_1 = __pyx_f_19dependency_injector_9providers___inject_attributes(__pyx_v_instance, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___attributes_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 270, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
|
||||
/* "providers.pxd":265
|
||||
/* "providers.pxd":269
|
||||
* instance = __callable_call(self.__instantiator, args, kwargs)
|
||||
*
|
||||
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
||||
|
@ -9008,7 +9036,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":270
|
||||
/* "providers.pxd":274
|
||||
* self.__attributes_len)
|
||||
*
|
||||
* return instance # <<<<<<<<<<<<<<
|
||||
|
@ -9018,7 +9046,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
__pyx_r = __pyx_v_instance;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":260
|
||||
/* "providers.pxd":264
|
||||
*
|
||||
*
|
||||
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -9741,7 +9769,7 @@ static int __Pyx_InitCachedBuiltins(void) {
|
|||
__pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 55, __pyx_L1_error)
|
||||
__pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 111, __pyx_L1_error)
|
||||
__pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 358, __pyx_L1_error)
|
||||
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 201, __pyx_L1_error)
|
||||
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 205, __pyx_L1_error)
|
||||
return 0;
|
||||
__pyx_L1_error:;
|
||||
return -1;
|
||||
|
@ -10146,9 +10174,11 @@ PyMODINIT_FUNC PyInit_containers(void)
|
|||
__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadLocalSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton)) __PYX_ERR(1, 128, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_AbstractSingleton = __Pyx_ImportType("dependency_injector.providers", "AbstractSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_AbstractSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_AbstractSingleton)) __PYX_ERR(1, 132, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_AbstractSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_AbstractSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_AbstractSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_AbstractSingleton)) __PYX_ERR(1, 132, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_Injection = __Pyx_ImportType("dependency_injector.providers", "Injection", sizeof(struct __pyx_obj_19dependency_injector_9providers_Injection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_Injection)) __PYX_ERR(1, 137, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_PositionalInjection = __Pyx_ImportType("dependency_injector.providers", "PositionalInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_PositionalInjection)) __PYX_ERR(1, 144, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_NamedInjection = __Pyx_ImportType("dependency_injector.providers", "NamedInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_NamedInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_NamedInjection)) __PYX_ERR(1, 148, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_SingletonDelegate = __Pyx_ImportType("dependency_injector.providers", "SingletonDelegate", sizeof(struct __pyx_obj_19dependency_injector_9providers_SingletonDelegate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_SingletonDelegate)) __PYX_ERR(1, 136, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_SingletonDelegate = (struct __pyx_vtabstruct_19dependency_injector_9providers_SingletonDelegate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_SingletonDelegate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_SingletonDelegate)) __PYX_ERR(1, 136, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_Injection = __Pyx_ImportType("dependency_injector.providers", "Injection", sizeof(struct __pyx_obj_19dependency_injector_9providers_Injection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_Injection)) __PYX_ERR(1, 141, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_PositionalInjection = __Pyx_ImportType("dependency_injector.providers", "PositionalInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_PositionalInjection)) __PYX_ERR(1, 148, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_NamedInjection = __Pyx_ImportType("dependency_injector.providers", "NamedInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_NamedInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_NamedInjection)) __PYX_ERR(1, 152, __pyx_L1_error)
|
||||
/*--- Variable import code ---*/
|
||||
__pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
|
||||
if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
||||
|
@ -10708,7 +10738,7 @@ PyMODINIT_FUNC PyInit_containers(void)
|
|||
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
|
||||
/* "providers.pxd":260
|
||||
/* "providers.pxd":264
|
||||
*
|
||||
*
|
||||
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -133,6 +133,10 @@ cdef class AbstractSingleton(BaseSingleton):
|
|||
pass
|
||||
|
||||
|
||||
cdef class SingletonDelegate(Delegate):
|
||||
pass
|
||||
|
||||
|
||||
# Injections
|
||||
cdef class Injection(object):
|
||||
cdef object __value
|
||||
|
|
|
@ -660,8 +660,8 @@ cdef class CallableDelegate(Delegate):
|
|||
def __init__(self, callable):
|
||||
"""Initializer.
|
||||
|
||||
:param provides: Value that have to be provided.
|
||||
:type provides: object
|
||||
:param callable: Value that have to be provided.
|
||||
:type callable: object
|
||||
"""
|
||||
if isinstance(callable, Callable) is False:
|
||||
raise Error('{0} can wrap only {1} providers'.format(
|
||||
|
@ -1102,8 +1102,8 @@ cdef class FactoryDelegate(Delegate):
|
|||
def __init__(self, factory):
|
||||
"""Initializer.
|
||||
|
||||
:param provides: Value that have to be provided.
|
||||
:type provides: object
|
||||
:param factory: Value that have to be provided.
|
||||
:type factory: object
|
||||
"""
|
||||
if isinstance(factory, Factory) is False:
|
||||
raise Error('{0} can wrap only {1} providers'.format(
|
||||
|
@ -1548,6 +1548,28 @@ cdef class AbstractSingleton(BaseSingleton):
|
|||
return self.__last_overriding.reset()
|
||||
|
||||
|
||||
cdef class SingletonDelegate(Delegate):
|
||||
"""Singleton delegate injects delegating singleton "as is".
|
||||
|
||||
.. py:attribute:: provides
|
||||
|
||||
Value that have to be provided.
|
||||
|
||||
:type: object
|
||||
"""
|
||||
|
||||
def __init__(self, singleton):
|
||||
"""Initializer.
|
||||
|
||||
:param singleton: Value that have to be provided.
|
||||
:type singleton: py:class:`BaseSingleton`
|
||||
"""
|
||||
if isinstance(singleton, BaseSingleton) is False:
|
||||
raise Error('{0} can wrap only {1} providers'.format(
|
||||
self.__class__, BaseSingleton))
|
||||
super(Delegate, self).__init__(singleton)
|
||||
|
||||
|
||||
cdef class Injection(object):
|
||||
"""Abstract injection class."""
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ class CallableDelegateTests(unittest.TestCase):
|
|||
def test_is_delegate(self):
|
||||
self.assertIsInstance(self.delegate, providers.Delegate)
|
||||
|
||||
def test_init_with_not_factory(self):
|
||||
def test_init_with_not_callable(self):
|
||||
self.assertRaises(errors.Error,
|
||||
providers.CallableDelegate,
|
||||
providers.Object(object()))
|
||||
|
|
|
@ -492,3 +492,18 @@ class AbstractSingletonTests(unittest.TestCase):
|
|||
'AbstractSingleton({0}) at {1}>'.format(
|
||||
repr(Example),
|
||||
hex(id(provider))))
|
||||
|
||||
|
||||
class SingletonDelegateTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.delegated = providers.Singleton(Example)
|
||||
self.delegate = providers.SingletonDelegate(self.delegated)
|
||||
|
||||
def test_is_delegate(self):
|
||||
self.assertIsInstance(self.delegate, providers.Delegate)
|
||||
|
||||
def test_init_with_not_singleton(self):
|
||||
self.assertRaises(errors.Error,
|
||||
providers.SingletonDelegate,
|
||||
providers.Object(object()))
|
||||
|
|
Loading…
Reference in New Issue
Block a user