mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Add early implementation of FactoryAggregate provider
This commit is contained in:
parent
a548924969
commit
b65d3bac98
|
@ -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()
|
||||
|
||||
|
|
|
@ -688,6 +688,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;
|
||||
|
@ -707,7 +708,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=*) # <<<<<<<<<<<<<<
|
||||
|
@ -906,7 +907,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): # <<<<<<<<<<<<<<
|
||||
|
@ -919,7 +933,7 @@ struct __pyx_obj_19dependency_injector_9providers_BaseSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":101
|
||||
/* "providers.pxd":107
|
||||
*
|
||||
*
|
||||
* cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -932,7 +946,7 @@ struct __pyx_obj_19dependency_injector_9providers_Singleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":107
|
||||
/* "providers.pxd":113
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<<
|
||||
|
@ -944,7 +958,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":111
|
||||
/* "providers.pxd":117
|
||||
*
|
||||
*
|
||||
* cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -958,7 +972,7 @@ struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":118
|
||||
/* "providers.pxd":124
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -970,7 +984,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":122
|
||||
/* "providers.pxd":128
|
||||
*
|
||||
*
|
||||
* cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -983,7 +997,7 @@ struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":128
|
||||
/* "providers.pxd":134
|
||||
*
|
||||
*
|
||||
* cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -995,7 +1009,7 @@ struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":132
|
||||
/* "providers.pxd":138
|
||||
*
|
||||
*
|
||||
* cdef class AbstractSingleton(BaseSingleton): # <<<<<<<<<<<<<<
|
||||
|
@ -1007,7 +1021,7 @@ struct __pyx_obj_19dependency_injector_9providers_AbstractSingleton {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":136
|
||||
/* "providers.pxd":142
|
||||
*
|
||||
*
|
||||
* cdef class SingletonDelegate(Delegate): # <<<<<<<<<<<<<<
|
||||
|
@ -1019,7 +1033,7 @@ struct __pyx_obj_19dependency_injector_9providers_SingletonDelegate {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":141
|
||||
/* "providers.pxd":147
|
||||
*
|
||||
* # Injections
|
||||
* cdef class Injection(object): # <<<<<<<<<<<<<<
|
||||
|
@ -1035,7 +1049,7 @@ struct __pyx_obj_19dependency_injector_9providers_Injection {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":148
|
||||
/* "providers.pxd":154
|
||||
*
|
||||
*
|
||||
* cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<<
|
||||
|
@ -1047,7 +1061,7 @@ struct __pyx_obj_19dependency_injector_9providers_PositionalInjection {
|
|||
};
|
||||
|
||||
|
||||
/* "providers.pxd":152
|
||||
/* "providers.pxd":158
|
||||
*
|
||||
*
|
||||
* cdef class NamedInjection(Injection): # <<<<<<<<<<<<<<
|
||||
|
@ -1325,7 +1339,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1339,7 +1368,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1353,7 +1382,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1367,7 +1396,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1381,7 +1410,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1395,7 +1424,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1409,7 +1438,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1423,7 +1452,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1437,7 +1466,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): # <<<<<<<<<<<<<<
|
||||
|
@ -1948,6 +1977,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;
|
||||
|
@ -8330,7 +8360,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8343,7 +8373,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 # <<<<<<<<<<<<<<
|
||||
|
@ -8355,7 +8385,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8370,7 +8400,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8387,7 +8417,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8397,7 +8427,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 # <<<<<<<<<<<<<<
|
||||
|
@ -8409,7 +8439,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8418,7 +8448,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() # <<<<<<<<<<<<<<
|
||||
|
@ -8438,10 +8468,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;
|
||||
|
@ -8449,7 +8479,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8470,7 +8500,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8491,7 +8521,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8501,7 +8531,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 # <<<<<<<<<<<<<<
|
||||
|
@ -8513,7 +8543,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8522,19 +8552,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8545,7 +8575,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] # <<<<<<<<<<<<<<
|
||||
|
@ -8554,36 +8584,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) # <<<<<<<<<<<<<<
|
||||
|
@ -8591,13 +8621,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8618,7 +8648,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8640,7 +8670,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8649,13 +8679,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8666,7 +8696,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] # <<<<<<<<<<<<<<
|
||||
|
@ -8675,43 +8705,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8721,7 +8751,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8733,7 +8763,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] # <<<<<<<<<<<<<<
|
||||
|
@ -8742,26 +8772,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8770,29 +8800,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: # <<<<<<<<<<<<<<
|
||||
|
@ -8804,7 +8834,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 # <<<<<<<<<<<<<<
|
||||
|
@ -8816,7 +8846,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8837,7 +8867,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8857,7 +8887,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8868,7 +8898,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] # <<<<<<<<<<<<<<
|
||||
|
@ -8877,46 +8907,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8939,7 +8969,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): # <<<<<<<<<<<<<<
|
||||
|
@ -8956,7 +8986,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8966,20 +8996,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, # <<<<<<<<<<<<<<
|
||||
|
@ -8989,20 +9019,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) # <<<<<<<<<<<<<<
|
||||
|
@ -9012,19 +9042,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): # <<<<<<<<<<<<<<
|
||||
|
@ -9046,7 +9076,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): # <<<<<<<<<<<<<<
|
||||
|
@ -9063,7 +9093,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) # <<<<<<<<<<<<<<
|
||||
|
@ -9072,13 +9102,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: # <<<<<<<<<<<<<<
|
||||
|
@ -9088,7 +9118,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, # <<<<<<<<<<<<<<
|
||||
|
@ -9098,19 +9128,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: # <<<<<<<<<<<<<<
|
||||
|
@ -9119,7 +9149,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factor
|
|||
*/
|
||||
}
|
||||
|
||||
/* "providers.pxd":274
|
||||
/* "providers.pxd":280
|
||||
* self.__attributes_len)
|
||||
*
|
||||
* return instance # <<<<<<<<<<<<<<
|
||||
|
@ -9129,7 +9159,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): # <<<<<<<<<<<<<<
|
||||
|
@ -9853,7 +9883,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;
|
||||
|
@ -10243,27 +10273,29 @@ PyMODINIT_FUNC PyInit_containers(void)
|
|||
__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)
|
||||
|
@ -10823,7 +10855,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":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