mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-25 11:04:01 +03:00
Add early implementation of FactoryAggregate provider
This commit is contained in:
parent
eb52ccb3c0
commit
c1053cbd73
|
@ -2,18 +2,18 @@
|
|||
|
||||
import sys
|
||||
|
||||
from dependency_injector.providers import Factory
|
||||
import dependency_injector.providers as providers
|
||||
|
||||
from prototype import FactoryAggregate
|
||||
from games import Chess, Checkers, Ludo
|
||||
|
||||
|
||||
game_factory = FactoryAggregate(chess=Factory(Chess),
|
||||
checkers=Factory(Checkers),
|
||||
ludo=Factory(Ludo))
|
||||
game_factory = providers.FactoryAggregate(chess=providers.Factory(Chess),
|
||||
checkers=providers.Factory(Checkers),
|
||||
ludo=providers.Factory(Ludo))
|
||||
|
||||
if __name__ == '__main__':
|
||||
game_type = sys.argv[1].lower()
|
||||
|
||||
selected_game = game_factory.create(game_type)
|
||||
selected_game.play()
|
||||
|
||||
|
|
|
@ -734,6 +734,7 @@ struct __pyx_obj_19dependency_injector_9providers_Factory;
|
|||
struct __pyx_obj_19dependency_injector_9providers_DelegatedFactory;
|
||||
struct __pyx_obj_19dependency_injector_9providers_AbstractFactory;
|
||||
struct __pyx_obj_19dependency_injector_9providers_FactoryDelegate;
|
||||
struct __pyx_obj_19dependency_injector_9providers_FactoryAggregate;
|
||||
struct __pyx_obj_19dependency_injector_9providers_BaseSingleton;
|
||||
struct __pyx_obj_19dependency_injector_9providers_Singleton;
|
||||
struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton;
|
||||
|
@ -753,7 +754,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":178
|
||||
/* "providers.pxd":184
|
||||
*
|
||||
*
|
||||
* cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<<
|
||||
|
@ -952,7 +953,20 @@ struct __pyx_obj_19dependency_injector_9providers_FactoryDelegate {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":97
|
||||
/* "providers.pxd":96
|
||||
*
|
||||
*
|
||||
* cdef class FactoryAggregate(Provider): # <<<<<<<<<<<<<<
|
||||
* cdef dict __factories
|
||||
*
|
||||
*/
|
||||
struct __pyx_obj_19dependency_injector_9providers_FactoryAggregate {
|
||||
struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base;
|
||||
PyObject *__pyx___factories;
|
||||
};
|
||||
|
||||
|
||||
/* "providers.pxd":103
|
||||
*
|
||||
* # Singleton providers
|
||||
* cdef class BaseSingleton(Provider): # <<<<<<<<<<<<<<
|
||||
|
@ -965,7 +979,7 @@ struct __pyx_obj_19dependency_injector_9providers_BaseSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":101
|
||||
/* "providers.pxd":107
|
||||
*
|
||||
*
|
||||
* cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -978,7 +992,7 @@ struct __pyx_obj_19dependency_injector_9providers_Singleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":107
|
||||
/* "providers.pxd":113
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<<
|
||||
|
@ -990,7 +1004,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":111
|
||||
/* "providers.pxd":117
|
||||
*
|
||||
*
|
||||
* cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1004,7 +1018,7 @@ struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":118
|
||||
/* "providers.pxd":124
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1016,7 +1030,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":122
|
||||
/* "providers.pxd":128
|
||||
*
|
||||
*
|
||||
* cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1029,7 +1043,7 @@ struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":128
|
||||
/* "providers.pxd":134
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1041,7 +1055,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":132
|
||||
/* "providers.pxd":138
|
||||
*
|
||||
*
|
||||
* cdef class AbstractSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1053,7 +1067,7 @@ struct __pyx_obj_19dependency_injector_9providers_AbstractSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":136
|
||||
/* "providers.pxd":142
|
||||
*
|
||||
*
|
||||
* cdef class SingletonDelegate(Delegate): # <<<<<<<<<<<<<<
|
||||
|
@ -1065,7 +1079,7 @@ struct __pyx_obj_19dependency_injector_9providers_SingletonDelegate {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":141
|
||||
/* "providers.pxd":147
|
||||
*
|
||||
* # Injections
|
||||
* cdef class Injection(object): # <<<<<<<<<<<<<<
|
||||
|
@ -1081,7 +1095,7 @@ struct __pyx_obj_19dependency_injector_9providers_Injection {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":148
|
||||
/* "providers.pxd":154
|
||||
*
|
||||
*
|
||||
* cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<<
|
||||
|
@ -1093,7 +1107,7 @@ struct __pyx_obj_19dependency_injector_9providers_PositionalInjection {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":152
|
||||
/* "providers.pxd":158
|
||||
*
|
||||
*
|
||||
* cdef class NamedInjection(Injection): # <<<<<<<<<<<<<<
|
||||
|
@ -1371,7 +1385,22 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_FactoryDelegate {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_FactoryDelegate *__pyx_vtabptr_19dependency_injector_9providers_FactoryDelegate;
|
||||
|
||||
|
||||
/* "providers.pxd":97
|
||||
/* "providers.pxd":96
|
||||
*
|
||||
*
|
||||
* cdef class FactoryAggregate(Provider): # <<<<<<<<<<<<<<
|
||||
* cdef dict __factories
|
||||
*
|
||||
*/
|
||||
|
||||
struct __pyx_vtabstruct_19dependency_injector_9providers_FactoryAggregate {
|
||||
struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base;
|
||||
PyObject *(*__pyx___get_factory)(struct __pyx_obj_19dependency_injector_9providers_FactoryAggregate *, PyObject *);
|
||||
};
|
||||
static struct __pyx_vtabstruct_19dependency_injector_9providers_FactoryAggregate *__pyx_vtabptr_19dependency_injector_9providers_FactoryAggregate;
|
||||
|
||||
|
||||
/* "providers.pxd":103
|
||||
*
|
||||
* # Singleton providers
|
||||
* cdef class BaseSingleton(Provider): # <<<<<<<<<<<<<<
|
||||
|
@ -1385,7 +1414,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton *__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":101
|
||||
/* "providers.pxd":107
|
||||
*
|
||||
*
|
||||
* cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1399,7 +1428,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton *__pyx_vtabptr_19dependency_injector_9providers_Singleton;
|
||||
|
||||
|
||||
/* "providers.pxd":107
|
||||
/* "providers.pxd":113
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1413,7 +1442,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton *__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":111
|
||||
/* "providers.pxd":117
|
||||
*
|
||||
*
|
||||
* cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1427,7 +1456,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":118
|
||||
/* "providers.pxd":124
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1441,7 +1470,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSing
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSingleton *__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":122
|
||||
/* "providers.pxd":128
|
||||
*
|
||||
*
|
||||
* cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1455,7 +1484,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":128
|
||||
/* "providers.pxd":134
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1469,7 +1498,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadLocalSin
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadLocalSingleton *__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":132
|
||||
/* "providers.pxd":138
|
||||
*
|
||||
*
|
||||
* cdef class AbstractSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1483,7 +1512,7 @@ struct __pyx_vtabstruct_19dependency_injector_9providers_AbstractSingleton {
|
|||
static struct __pyx_vtabstruct_19dependency_injector_9providers_AbstractSingleton *__pyx_vtabptr_19dependency_injector_9providers_AbstractSingleton;
|
||||
|
||||
|
||||
/* "providers.pxd":136
|
||||
/* "providers.pxd":142
|
||||
*
|
||||
*
|
||||
* cdef class SingletonDelegate(Delegate): # <<<<<<<<<<<<<<
|
||||
|
@ -2045,6 +2074,7 @@ static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Factory = 0;
|
|||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedFactory = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_AbstractFactory = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_FactoryDelegate = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_FactoryAggregate = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_BaseSingleton = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Singleton = 0;
|
||||
static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton = 0;
|
||||
|
@ -8408,7 +8438,7 @@ static PyObject *__pyx_pf_19dependency_injector_10containers_6_check_provider_ty
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":182
|
||||
/* "providers.pxd":188
|
||||
*
|
||||
* # Inline helper functions
|
||||
* cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8421,7 +8451,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_na
|
|||
__Pyx_RefNannyDeclarations
|
||||
__Pyx_RefNannySetupContext("__get_name", 0);
|
||||
|
||||
/* "providers.pxd":183
|
||||
/* "providers.pxd":189
|
||||
* # Inline helper functions
|
||||
* cdef inline object __get_name(NamedInjection self):
|
||||
* return self.__name # <<<<<<<<<<<<<<
|
||||
|
@ -8433,7 +8463,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_na
|
|||
__pyx_r = __pyx_v_self->__pyx___name;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":182
|
||||
/* "providers.pxd":188
|
||||
*
|
||||
* # Inline helper functions
|
||||
* cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8448,7 +8478,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_na
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":186
|
||||
/* "providers.pxd":192
|
||||
*
|
||||
*
|
||||
* cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8465,7 +8495,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
PyObject *__pyx_t_4 = NULL;
|
||||
__Pyx_RefNannySetupContext("__get_value", 0);
|
||||
|
||||
/* "providers.pxd":187
|
||||
/* "providers.pxd":193
|
||||
*
|
||||
* cdef inline object __get_value(Injection self):
|
||||
* if self.__call == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8475,7 +8505,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":188
|
||||
/* "providers.pxd":194
|
||||
* cdef inline object __get_value(Injection self):
|
||||
* if self.__call == 0:
|
||||
* return self.__value # <<<<<<<<<<<<<<
|
||||
|
@ -8487,7 +8517,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
__pyx_r = __pyx_v_self->__pyx___value;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":187
|
||||
/* "providers.pxd":193
|
||||
*
|
||||
* cdef inline object __get_value(Injection self):
|
||||
* if self.__call == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8496,7 +8526,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":189
|
||||
/* "providers.pxd":195
|
||||
* if self.__call == 0:
|
||||
* return self.__value
|
||||
* return self.__value() # <<<<<<<<<<<<<<
|
||||
|
@ -8516,10 +8546,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, 189, __pyx_L1_error)
|
||||
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 195, __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, 189, __pyx_L1_error)
|
||||
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 195, __pyx_L1_error)
|
||||
}
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||
|
@ -8527,7 +8557,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
__pyx_t_2 = 0;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":186
|
||||
/* "providers.pxd":192
|
||||
*
|
||||
*
|
||||
* cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<<
|
||||
|
@ -8548,7 +8578,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_va
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":194
|
||||
/* "providers.pxd":200
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<<
|
||||
|
@ -8569,7 +8599,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
int __pyx_t_5;
|
||||
__Pyx_RefNannySetupContext("__provide_positional_args", 0);
|
||||
|
||||
/* "providers.pxd":201
|
||||
/* "providers.pxd":207
|
||||
* cdef PositionalInjection injection
|
||||
*
|
||||
* if inj_args_len == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8579,7 +8609,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":202
|
||||
/* "providers.pxd":208
|
||||
*
|
||||
* if inj_args_len == 0:
|
||||
* return args # <<<<<<<<<<<<<<
|
||||
|
@ -8591,7 +8621,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
__pyx_r = __pyx_v_args;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":201
|
||||
/* "providers.pxd":207
|
||||
* cdef PositionalInjection injection
|
||||
*
|
||||
* if inj_args_len == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8600,19 +8630,19 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":204
|
||||
/* "providers.pxd":210
|
||||
* 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, 204, __pyx_L1_error)
|
||||
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 210, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_v_positional_args = ((PyObject*)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
|
||||
/* "providers.pxd":205
|
||||
/* "providers.pxd":211
|
||||
*
|
||||
* positional_args = list()
|
||||
* for index in range(inj_args_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8623,7 +8653,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":206
|
||||
/* "providers.pxd":212
|
||||
* positional_args = list()
|
||||
* for index in range(inj_args_len):
|
||||
* injection = <PositionalInjection>inj_args[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8632,36 +8662,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, 206, __pyx_L1_error)
|
||||
__PYX_ERR(1, 212, __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":207
|
||||
/* "providers.pxd":213
|
||||
* 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, 207, __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, 213, __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, 207, __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, 213, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
}
|
||||
|
||||
/* "providers.pxd":208
|
||||
/* "providers.pxd":214
|
||||
* 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, 208, __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, 214, __pyx_L1_error)
|
||||
|
||||
/* "providers.pxd":210
|
||||
/* "providers.pxd":216
|
||||
* positional_args.extend(args)
|
||||
*
|
||||
* return tuple(positional_args) # <<<<<<<<<<<<<<
|
||||
|
@ -8669,13 +8699,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, 210, __pyx_L1_error)
|
||||
__pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 216, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_r = ((PyObject*)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":194
|
||||
/* "providers.pxd":200
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<<
|
||||
|
@ -8696,7 +8726,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":215
|
||||
/* "providers.pxd":221
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<<
|
||||
|
@ -8718,7 +8748,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
int __pyx_t_6;
|
||||
__Pyx_RefNannySetupContext("__provide_keyword_args", 0);
|
||||
|
||||
/* "providers.pxd":222
|
||||
/* "providers.pxd":228
|
||||
* cdef NamedInjection kw_injection
|
||||
*
|
||||
* if len(kwargs) == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8727,13 +8757,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, 222, __pyx_L1_error)
|
||||
__PYX_ERR(1, 228, __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_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 228, __pyx_L1_error)
|
||||
__pyx_t_2 = ((__pyx_t_1 == 0) != 0);
|
||||
if (__pyx_t_2) {
|
||||
|
||||
/* "providers.pxd":223
|
||||
/* "providers.pxd":229
|
||||
*
|
||||
* if len(kwargs) == 0:
|
||||
* for index in range(inj_kwargs_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8744,7 +8774,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":224
|
||||
/* "providers.pxd":230
|
||||
* if len(kwargs) == 0:
|
||||
* for index in range(inj_kwargs_len):
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8753,43 +8783,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, 224, __pyx_L1_error)
|
||||
__PYX_ERR(1, 230, __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":225
|
||||
/* "providers.pxd":231
|
||||
* 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, 225, __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, 231, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
__Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
|
||||
__pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":226
|
||||
/* "providers.pxd":232
|
||||
* 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, 226, __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, 226, __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, 226, __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":222
|
||||
/* "providers.pxd":228
|
||||
* cdef NamedInjection kw_injection
|
||||
*
|
||||
* if len(kwargs) == 0: # <<<<<<<<<<<<<<
|
||||
|
@ -8799,7 +8829,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
goto __pyx_L3;
|
||||
}
|
||||
|
||||
/* "providers.pxd":228
|
||||
/* "providers.pxd":234
|
||||
* kwargs[name] = __get_value(kw_injection)
|
||||
* else:
|
||||
* for index in range(inj_kwargs_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8811,7 +8841,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":229
|
||||
/* "providers.pxd":235
|
||||
* else:
|
||||
* for index in range(inj_kwargs_len):
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8820,26 +8850,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, 229, __pyx_L1_error)
|
||||
__PYX_ERR(1, 235, __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":230
|
||||
/* "providers.pxd":236
|
||||
* 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, 230, __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, 236, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
__Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
|
||||
__pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":231
|
||||
/* "providers.pxd":237
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection)
|
||||
* if name not in kwargs: # <<<<<<<<<<<<<<
|
||||
|
@ -8848,29 +8878,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, 231, __pyx_L1_error)
|
||||
__PYX_ERR(1, 237, __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_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 237, __pyx_L1_error)
|
||||
__pyx_t_6 = (__pyx_t_2 != 0);
|
||||
if (__pyx_t_6) {
|
||||
|
||||
/* "providers.pxd":232
|
||||
/* "providers.pxd":238
|
||||
* 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, 232, __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, 238, __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, 232, __pyx_L1_error)
|
||||
__PYX_ERR(1, 238, __pyx_L1_error)
|
||||
}
|
||||
if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 232, __pyx_L1_error)
|
||||
if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 238, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||
|
||||
/* "providers.pxd":231
|
||||
/* "providers.pxd":237
|
||||
* kw_injection = <NamedInjection>inj_kwargs[index]
|
||||
* name = __get_name(kw_injection)
|
||||
* if name not in kwargs: # <<<<<<<<<<<<<<
|
||||
|
@ -8882,7 +8912,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
}
|
||||
__pyx_L3:;
|
||||
|
||||
/* "providers.pxd":234
|
||||
/* "providers.pxd":240
|
||||
* kwargs[name] = __get_value(kw_injection)
|
||||
*
|
||||
* return kwargs # <<<<<<<<<<<<<<
|
||||
|
@ -8894,7 +8924,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
__pyx_r = __pyx_v_kwargs;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":215
|
||||
/* "providers.pxd":221
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<<
|
||||
|
@ -8915,7 +8945,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provid
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":239
|
||||
/* "providers.pxd":245
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<<
|
||||
|
@ -8935,7 +8965,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject
|
|||
int __pyx_t_5;
|
||||
__Pyx_RefNannySetupContext("__inject_attributes", 0);
|
||||
|
||||
/* "providers.pxd":243
|
||||
/* "providers.pxd":249
|
||||
* int attributes_len):
|
||||
* cdef NamedInjection attr_injection
|
||||
* for index in range(attributes_len): # <<<<<<<<<<<<<<
|
||||
|
@ -8946,7 +8976,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":244
|
||||
/* "providers.pxd":250
|
||||
* cdef NamedInjection attr_injection
|
||||
* for index in range(attributes_len):
|
||||
* attr_injection = <NamedInjection>attributes[index] # <<<<<<<<<<<<<<
|
||||
|
@ -8955,46 +8985,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, 244, __pyx_L1_error)
|
||||
__PYX_ERR(1, 250, __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":246
|
||||
/* "providers.pxd":252
|
||||
* 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, 246, __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, 252, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_3);
|
||||
|
||||
/* "providers.pxd":247
|
||||
/* "providers.pxd":253
|
||||
* 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, 247, __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, 253, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_4);
|
||||
|
||||
/* "providers.pxd":245
|
||||
/* "providers.pxd":251
|
||||
* 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, 245, __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, 251, __pyx_L1_error)
|
||||
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
}
|
||||
|
||||
/* "providers.pxd":239
|
||||
/* "providers.pxd":245
|
||||
* @cython.boundscheck(False)
|
||||
* @cython.wraparound(False)
|
||||
* cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<<
|
||||
|
@ -9017,7 +9047,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":250
|
||||
/* "providers.pxd":256
|
||||
*
|
||||
*
|
||||
* cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -9034,7 +9064,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
PyObject *__pyx_t_2 = NULL;
|
||||
__Pyx_RefNannySetupContext("__callable_call", 0);
|
||||
|
||||
/* "providers.pxd":255
|
||||
/* "providers.pxd":261
|
||||
*
|
||||
* positional_args = __provide_positional_args(args,
|
||||
* self.__args, # <<<<<<<<<<<<<<
|
||||
|
@ -9044,20 +9074,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":254
|
||||
/* "providers.pxd":260
|
||||
* 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, 254, __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, 260, __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":258
|
||||
/* "providers.pxd":264
|
||||
* self.__args_len)
|
||||
* keyword_args = __provide_keyword_args(kwargs,
|
||||
* self.__kwargs, # <<<<<<<<<<<<<<
|
||||
|
@ -9067,20 +9097,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":257
|
||||
/* "providers.pxd":263
|
||||
* 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, 257, __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, 263, __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":261
|
||||
/* "providers.pxd":267
|
||||
* self.__kwargs_len)
|
||||
*
|
||||
* return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<<
|
||||
|
@ -9090,19 +9120,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, 261, __pyx_L1_error)
|
||||
__PYX_ERR(1, 267, __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, 261, __pyx_L1_error)
|
||||
__PYX_ERR(1, 267, __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_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, 267, __pyx_L1_error)
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
__pyx_r = __pyx_t_1;
|
||||
__pyx_t_1 = 0;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":250
|
||||
/* "providers.pxd":256
|
||||
*
|
||||
*
|
||||
* cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -9124,7 +9154,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "providers.pxd":264
|
||||
/* "providers.pxd":270
|
||||
*
|
||||
*
|
||||
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -9141,7 +9171,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
int __pyx_t_3;
|
||||
__Pyx_RefNannySetupContext("__factory_call", 0);
|
||||
|
||||
/* "providers.pxd":267
|
||||
/* "providers.pxd":273
|
||||
* cdef object instance
|
||||
*
|
||||
* instance = __callable_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<<
|
||||
|
@ -9150,13 +9180,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, 267, __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, 273, __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":269
|
||||
/* "providers.pxd":275
|
||||
* instance = __callable_call(self.__instantiator, args, kwargs)
|
||||
*
|
||||
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
||||
|
@ -9166,7 +9196,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":271
|
||||
/* "providers.pxd":277
|
||||
* if self.__attributes_len > 0:
|
||||
* __inject_attributes(instance,
|
||||
* self.__attributes, # <<<<<<<<<<<<<<
|
||||
|
@ -9176,19 +9206,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":270
|
||||
/* "providers.pxd":276
|
||||
*
|
||||
* 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, 270, __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, 276, __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":269
|
||||
/* "providers.pxd":275
|
||||
* instance = __callable_call(self.__instantiator, args, kwargs)
|
||||
*
|
||||
* if self.__attributes_len > 0: # <<<<<<<<<<<<<<
|
||||
|
@ -9197,7 +9227,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":274
|
||||
/* "providers.pxd":280
|
||||
* self.__attributes_len)
|
||||
*
|
||||
* return instance # <<<<<<<<<<<<<<
|
||||
|
@ -9207,7 +9237,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
__pyx_r = __pyx_v_instance;
|
||||
goto __pyx_L0;
|
||||
|
||||
/* "providers.pxd":264
|
||||
/* "providers.pxd":270
|
||||
*
|
||||
*
|
||||
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
@ -9903,7 +9933,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, 205, __pyx_L1_error)
|
||||
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 211, __pyx_L1_error)
|
||||
return 0;
|
||||
__pyx_L1_error:;
|
||||
return -1;
|
||||
|
@ -10361,27 +10391,29 @@ static int __pyx_pymod_exec_containers(PyObject *__pyx_pyinit_module)
|
|||
__pyx_vtabptr_19dependency_injector_9providers_AbstractFactory = (struct __pyx_vtabstruct_19dependency_injector_9providers_AbstractFactory*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_AbstractFactory->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_AbstractFactory)) __PYX_ERR(1, 88, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_FactoryDelegate = __Pyx_ImportType("dependency_injector.providers", "FactoryDelegate", sizeof(struct __pyx_obj_19dependency_injector_9providers_FactoryDelegate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_FactoryDelegate)) __PYX_ERR(1, 92, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_FactoryDelegate = (struct __pyx_vtabstruct_19dependency_injector_9providers_FactoryDelegate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_FactoryDelegate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_FactoryDelegate)) __PYX_ERR(1, 92, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_BaseSingleton = __Pyx_ImportType("dependency_injector.providers", "BaseSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_BaseSingleton)) __PYX_ERR(1, 97, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_BaseSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton)) __PYX_ERR(1, 97, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_Singleton = __Pyx_ImportType("dependency_injector.providers", "Singleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_Singleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_Singleton)) __PYX_ERR(1, 101, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_Singleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_Singleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_Singleton)) __PYX_ERR(1, 101, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton = __Pyx_ImportType("dependency_injector.providers", "DelegatedSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton)) __PYX_ERR(1, 107, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton)) __PYX_ERR(1, 107, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton = __Pyx_ImportType("dependency_injector.providers", "ThreadSafeSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton)) __PYX_ERR(1, 111, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton)) __PYX_ERR(1, 111, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton = __Pyx_ImportType("dependency_injector.providers", "DelegatedThreadSafeSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton)) __PYX_ERR(1, 118, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton)) __PYX_ERR(1, 118, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton = __Pyx_ImportType("dependency_injector.providers", "ThreadLocalSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton)) __PYX_ERR(1, 122, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton)) __PYX_ERR(1, 122, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton = __Pyx_ImportType("dependency_injector.providers", "DelegatedThreadLocalSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton)) __PYX_ERR(1, 128, __pyx_L1_error)
|
||||
__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_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)
|
||||
__pyx_ptype_19dependency_injector_9providers_FactoryAggregate = __Pyx_ImportType("dependency_injector.providers", "FactoryAggregate", sizeof(struct __pyx_obj_19dependency_injector_9providers_FactoryAggregate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_FactoryAggregate)) __PYX_ERR(1, 96, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_FactoryAggregate = (struct __pyx_vtabstruct_19dependency_injector_9providers_FactoryAggregate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_FactoryAggregate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_FactoryAggregate)) __PYX_ERR(1, 96, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_BaseSingleton = __Pyx_ImportType("dependency_injector.providers", "BaseSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_BaseSingleton)) __PYX_ERR(1, 103, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_BaseSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton)) __PYX_ERR(1, 103, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_Singleton = __Pyx_ImportType("dependency_injector.providers", "Singleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_Singleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_Singleton)) __PYX_ERR(1, 107, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_Singleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_Singleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_Singleton)) __PYX_ERR(1, 107, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton = __Pyx_ImportType("dependency_injector.providers", "DelegatedSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton)) __PYX_ERR(1, 113, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton)) __PYX_ERR(1, 113, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton = __Pyx_ImportType("dependency_injector.providers", "ThreadSafeSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton)) __PYX_ERR(1, 117, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton)) __PYX_ERR(1, 117, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton = __Pyx_ImportType("dependency_injector.providers", "DelegatedThreadSafeSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton)) __PYX_ERR(1, 124, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton)) __PYX_ERR(1, 124, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton = __Pyx_ImportType("dependency_injector.providers", "ThreadLocalSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton)) __PYX_ERR(1, 128, __pyx_L1_error)
|
||||
__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton = (struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton)) __PYX_ERR(1, 128, __pyx_L1_error)
|
||||
__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton = __Pyx_ImportType("dependency_injector.providers", "DelegatedThreadLocalSingleton", sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton)) __PYX_ERR(1, 134, __pyx_L1_error)
|
||||
__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, 134, __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, 138, __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, 138, __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, 142, __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, 142, __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, 147, __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, 154, __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, 158, __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)
|
||||
|
@ -10929,7 +10961,7 @@ static int __pyx_pymod_exec_containers(PyObject *__pyx_pyinit_module)
|
|||
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":264
|
||||
/* "providers.pxd":270
|
||||
*
|
||||
*
|
||||
* cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
|
||||
|
|
|
@ -6,3 +6,7 @@ class Error(Exception):
|
|||
|
||||
All dependency injector errors extend this error class.
|
||||
"""
|
||||
|
||||
|
||||
class NoSuchProviderError(Error, AttributeError):
|
||||
"""Error that is raised when provider lookup is failed."""
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -93,6 +93,12 @@ cdef class FactoryDelegate(Delegate):
|
|||
pass
|
||||
|
||||
|
||||
cdef class FactoryAggregate(Provider):
|
||||
cdef dict __factories
|
||||
|
||||
cdef object __get_factory(self, str factory_name)
|
||||
|
||||
|
||||
# Singleton providers
|
||||
cdef class BaseSingleton(Provider):
|
||||
cdef Factory __instantiator
|
||||
|
|
|
@ -9,7 +9,10 @@ import sys
|
|||
import types
|
||||
import threading
|
||||
|
||||
from .errors import Error
|
||||
from .errors import (
|
||||
Error,
|
||||
NoSuchProviderError,
|
||||
)
|
||||
|
||||
cimport cython
|
||||
|
||||
|
@ -1111,6 +1114,89 @@ cdef class FactoryDelegate(Delegate):
|
|||
super(Delegate, self).__init__(factory)
|
||||
|
||||
|
||||
cdef class FactoryAggregate(Provider):
|
||||
"""Aggregate of factory providers.
|
||||
|
||||
:py:class:`FactoryAggregate` is an aggregate of :py:class:`Factory`
|
||||
providers.
|
||||
|
||||
:py:class:`FactoryAggregate` is a delegated provider, meaning that it is
|
||||
injected "as is".
|
||||
|
||||
Also, while :py:class:`FactoryAggregate` is a sort of container for other
|
||||
factories, it is not callable and it does not support overriding.
|
||||
|
||||
However, all aggregated factories could be retrieved as an attributes and
|
||||
could be used without any limitations.
|
||||
"""
|
||||
|
||||
__IS_DELEGATED__ = True
|
||||
|
||||
def __init__(self, **factories):
|
||||
"""Initializer.
|
||||
|
||||
:param factories: Dictionary of aggregate factories.
|
||||
:type factories: dict[str, :py:class:`Factory`]
|
||||
"""
|
||||
for factory in factories.values():
|
||||
if isinstance(factory, Factory) is False:
|
||||
raise Error(
|
||||
'{0} can aggregate only instances of {1}, given - {2}'
|
||||
.format(self.__class__, Factory, factory))
|
||||
self.__factories = factories
|
||||
super(FactoryAggregate, self).__init__()
|
||||
|
||||
def __call__(self):
|
||||
"""Return provided object.
|
||||
|
||||
Callable interface implementation.
|
||||
"""
|
||||
raise Error('{0} is not callable'.format(self.__class__))
|
||||
|
||||
def __getattr__(self, factory_name):
|
||||
"""Return factory by factory name."""
|
||||
return self.__get_factory(factory_name)
|
||||
|
||||
@property
|
||||
def factories(self):
|
||||
"""Return dictionary of factories, read-only."""
|
||||
return self.__factories
|
||||
|
||||
def create(self, factory_name, *args, **kwargs):
|
||||
"""Create object using factory that is associated with provided name.
|
||||
|
||||
:param factory_name: Name of factory.
|
||||
:type factory_name: str
|
||||
|
||||
:param args: Tuple of positional argument injections.
|
||||
:type args: tuple[object]
|
||||
|
||||
:param kwargs: Dictionary of context keyword argument injections.
|
||||
:type kwargs: dict[str, object]
|
||||
"""
|
||||
return self.__get_factory(factory_name)(*args, **kwargs)
|
||||
|
||||
def override(self, _):
|
||||
"""Override provider with another provider.
|
||||
|
||||
:param provider: Overriding provider.
|
||||
:type provider: :py:class:`Provider`
|
||||
|
||||
:raise: :py:exc:`dependency_injector.errors.Error`
|
||||
|
||||
:return: Overriding context.
|
||||
:rtype: :py:class:`OverridingContext`
|
||||
"""
|
||||
raise Error('{0} can not be overridden'.format(self.__class__))
|
||||
|
||||
cdef object __get_factory(self, str factory_name):
|
||||
if factory_name not in self.__factories:
|
||||
raise NoSuchProviderError(
|
||||
'{0} does not contain factory with name {1}'.format(
|
||||
self, factory_name))
|
||||
return self.__factories[factory_name]
|
||||
|
||||
|
||||
cdef class BaseSingleton(Provider):
|
||||
"""Base class of singleton providers."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user