Refactor abstract* providers __call__()

This commit is contained in:
Roman Mogylatov 2020-12-26 23:51:36 -05:00
parent a89602e690
commit fb296788e3
2 changed files with 100 additions and 40 deletions

View File

@ -18682,7 +18682,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_16AbstractCallable___
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
__pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx___last_overriding) == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
@ -18692,7 +18692,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_16AbstractCallable___
* """
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self)) # <<<<<<<<<<<<<<
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 953, __pyx_L1_error)
@ -18739,22 +18739,37 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_16AbstractCallable___
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
}
/* "dependency_injector/providers.pyx":954
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs) # <<<<<<<<<<<<<<
* return super().__call__(*args, **kwargs) # <<<<<<<<<<<<<<
*
* def override(self, provider):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx___last_overriding), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 954, __pyx_L1_error)
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 954, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractCallable));
__Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractCallable));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractCallable));
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 954, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_call); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 954, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 954, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "dependency_injector/providers.pyx":947
@ -18781,7 +18796,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_16AbstractCallable___
}
/* "dependency_injector/providers.pyx":956
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -18965,7 +18980,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_16AbstractCallable_2o
goto __pyx_L0;
/* "dependency_injector/providers.pyx":956
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -21304,7 +21319,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractCoroutine__
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
__pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx___last_overriding) == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
@ -21314,7 +21329,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractCoroutine__
* """
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self)) # <<<<<<<<<<<<<<
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1069, __pyx_L1_error)
@ -21361,22 +21376,37 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractCoroutine__
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
}
/* "dependency_injector/providers.pyx":1070
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs) # <<<<<<<<<<<<<<
* return super().__call__(*args, **kwargs) # <<<<<<<<<<<<<<
*
* def override(self, provider):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx___last_overriding), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1070, __pyx_L1_error)
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1070, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractCoroutine));
__Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractCoroutine));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractCoroutine));
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1070, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_call); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1070, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1070, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "dependency_injector/providers.pyx":1063
@ -21403,7 +21433,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractCoroutine__
}
/* "dependency_injector/providers.pyx":1072
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -21587,7 +21617,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractCoroutine_2
goto __pyx_L0;
/* "dependency_injector/providers.pyx":1072
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -34545,7 +34575,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_15AbstractFactory___c
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
__pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx___last_overriding) == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
@ -34555,7 +34585,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_15AbstractFactory___c
* """
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self)) # <<<<<<<<<<<<<<
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1839, __pyx_L1_error)
@ -34602,22 +34632,37 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_15AbstractFactory___c
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
}
/* "dependency_injector/providers.pyx":1840
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs) # <<<<<<<<<<<<<<
* return super().__call__(*args, **kwargs) # <<<<<<<<<<<<<<
*
* def override(self, provider):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx___last_overriding), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1840, __pyx_L1_error)
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractFactory));
__Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractFactory));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractFactory));
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_call); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "dependency_injector/providers.pyx":1833
@ -34644,7 +34689,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_15AbstractFactory___c
}
/* "dependency_injector/providers.pyx":1842
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -34828,7 +34873,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_15AbstractFactory_2ov
goto __pyx_L0;
/* "dependency_injector/providers.pyx":1842
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -45415,7 +45460,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractSingleton__
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
__pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx___last_overriding) == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
@ -45425,7 +45470,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractSingleton__
* """
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self)) # <<<<<<<<<<<<<<
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2411, __pyx_L1_error)
@ -45472,22 +45517,37 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractSingleton__
* """
* if self.__last_overriding is None: # <<<<<<<<<<<<<<
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*/
}
/* "dependency_injector/providers.pyx":2412
* if self.__last_overriding is None:
* raise Error('{0} must be overridden before calling'.format(self))
* return self.__last_overriding(*args, **kwargs) # <<<<<<<<<<<<<<
* return super().__call__(*args, **kwargs) # <<<<<<<<<<<<<<
*
* def override(self, provider):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx___last_overriding), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2412, __pyx_L1_error)
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractSingleton));
__Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractSingleton));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_AbstractSingleton));
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_call); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "dependency_injector/providers.pyx":2405
@ -45514,7 +45574,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractSingleton__
}
/* "dependency_injector/providers.pyx":2414
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.
@ -45698,7 +45758,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_17AbstractSingleton_2
goto __pyx_L0;
/* "dependency_injector/providers.pyx":2414
* return self.__last_overriding(*args, **kwargs)
* return super().__call__(*args, **kwargs)
*
* def override(self, provider): # <<<<<<<<<<<<<<
* """Override provider with another provider.

View File

@ -951,7 +951,7 @@ cdef class AbstractCallable(Callable):
"""
if self.__last_overriding is None:
raise Error('{0} must be overridden before calling'.format(self))
return self.__last_overriding(*args, **kwargs)
return super().__call__(*args, **kwargs)
def override(self, provider):
"""Override provider with another provider.
@ -1067,7 +1067,7 @@ cdef class AbstractCoroutine(Coroutine):
"""
if self.__last_overriding is None:
raise Error('{0} must be overridden before calling'.format(self))
return self.__last_overriding(*args, **kwargs)
return super().__call__(*args, **kwargs)
def override(self, provider):
"""Override provider with another provider.
@ -1837,7 +1837,7 @@ cdef class AbstractFactory(Factory):
"""
if self.__last_overriding is None:
raise Error('{0} must be overridden before calling'.format(self))
return self.__last_overriding(*args, **kwargs)
return super().__call__(*args, **kwargs)
def override(self, provider):
"""Override provider with another provider.
@ -2409,7 +2409,7 @@ cdef class AbstractSingleton(BaseSingleton):
"""
if self.__last_overriding is None:
raise Error('{0} must be overridden before calling'.format(self))
return self.__last_overriding(*args, **kwargs)
return super().__call__(*args, **kwargs)
def override(self, provider):
"""Override provider with another provider.