mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-10-31 07:57:43 +03:00 
			
		
		
		
	Fix singleton children to have optional provides
This commit is contained in:
		
							parent
							
								
									ce36033faa
								
							
						
					
					
						commit
						bcc0b2ad54
					
				|  | @ -51651,7 +51651,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_34__s | |||
| /* "dependency_injector/providers.pyx":2676
 | ||||
|  *     """ | ||||
|  *  | ||||
|  *     def __init__(self, provides, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *     def __init__(self, provides=None, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *         """Initializer. | ||||
|  *  | ||||
|  */ | ||||
|  | @ -51688,6 +51688,7 @@ static int __pyx_pw_19dependency_injector_9providers_9Singleton_1__init__(PyObje | |||
|   { | ||||
|     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; | ||||
|     PyObject* values[1] = {0}; | ||||
|     values[0] = ((PyObject *)Py_None); | ||||
|     if (unlikely(__pyx_kwds)) { | ||||
|       Py_ssize_t kw_args; | ||||
|       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | ||||
|  | @ -51700,23 +51701,26 @@ static int __pyx_pw_19dependency_injector_9providers_9Singleton_1__init__(PyObje | |||
|       kw_args = PyDict_Size(__pyx_kwds); | ||||
|       switch (pos_args) { | ||||
|         case  0: | ||||
|         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; | ||||
|         else goto __pyx_L5_argtuple_error; | ||||
|         if (kw_args > 0) { | ||||
|           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_provides); | ||||
|           if (value) { values[0] = value; kw_args--; } | ||||
|         } | ||||
|       } | ||||
|       if (unlikely(kw_args > 0)) { | ||||
|         const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; | ||||
|         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 2676, __pyx_L3_error) | ||||
|       } | ||||
|     } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { | ||||
|       goto __pyx_L5_argtuple_error; | ||||
|     } else { | ||||
|       values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | ||||
|       switch (PyTuple_GET_SIZE(__pyx_args)) { | ||||
|         default: | ||||
|         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | ||||
|         CYTHON_FALLTHROUGH; | ||||
|         case  0: break; | ||||
|       } | ||||
|     } | ||||
|     __pyx_v_provides = values[0]; | ||||
|   } | ||||
|   goto __pyx_L4_argument_unpacking_done; | ||||
|   __pyx_L5_argtuple_error:; | ||||
|   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2676, __pyx_L3_error) | ||||
|   __pyx_L3_error:; | ||||
|   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; | ||||
|   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; | ||||
|  | @ -51795,7 +51799,7 @@ static int __pyx_pf_19dependency_injector_9providers_9Singleton___init__(struct | |||
|   /* "dependency_injector/providers.pyx":2676
 | ||||
|  *     """ | ||||
|  *  | ||||
|  *     def __init__(self, provides, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *     def __init__(self, provides=None, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *         """Initializer. | ||||
|  *  | ||||
|  */ | ||||
|  | @ -53108,7 +53112,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_18DelegatedSingleton_ | |||
| /* "dependency_injector/providers.pyx":2743
 | ||||
|  *     """ | ||||
|  *  | ||||
|  *     def __init__(self, provides, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *     def __init__(self, provides=None, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *         """Initializer. | ||||
|  *  | ||||
|  */ | ||||
|  | @ -53145,6 +53149,7 @@ static int __pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_1__in | |||
|   { | ||||
|     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; | ||||
|     PyObject* values[1] = {0}; | ||||
|     values[0] = ((PyObject *)Py_None); | ||||
|     if (unlikely(__pyx_kwds)) { | ||||
|       Py_ssize_t kw_args; | ||||
|       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | ||||
|  | @ -53157,23 +53162,26 @@ static int __pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_1__in | |||
|       kw_args = PyDict_Size(__pyx_kwds); | ||||
|       switch (pos_args) { | ||||
|         case  0: | ||||
|         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; | ||||
|         else goto __pyx_L5_argtuple_error; | ||||
|         if (kw_args > 0) { | ||||
|           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_provides); | ||||
|           if (value) { values[0] = value; kw_args--; } | ||||
|         } | ||||
|       } | ||||
|       if (unlikely(kw_args > 0)) { | ||||
|         const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; | ||||
|         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 2743, __pyx_L3_error) | ||||
|       } | ||||
|     } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { | ||||
|       goto __pyx_L5_argtuple_error; | ||||
|     } else { | ||||
|       values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | ||||
|       switch (PyTuple_GET_SIZE(__pyx_args)) { | ||||
|         default: | ||||
|         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | ||||
|         CYTHON_FALLTHROUGH; | ||||
|         case  0: break; | ||||
|       } | ||||
|     } | ||||
|     __pyx_v_provides = values[0]; | ||||
|   } | ||||
|   goto __pyx_L4_argument_unpacking_done; | ||||
|   __pyx_L5_argtuple_error:; | ||||
|   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2743, __pyx_L3_error) | ||||
|   __pyx_L3_error:; | ||||
|   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; | ||||
|   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; | ||||
|  | @ -53270,7 +53278,7 @@ static int __pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton___ini | |||
|   /* "dependency_injector/providers.pyx":2743
 | ||||
|  *     """ | ||||
|  *  | ||||
|  *     def __init__(self, provides, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *     def __init__(self, provides=None, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *         """Initializer. | ||||
|  *  | ||||
|  */ | ||||
|  | @ -54907,7 +54915,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_28DelegatedThreadSafe | |||
| /* "dependency_injector/providers.pyx":2826
 | ||||
|  *     """ | ||||
|  *  | ||||
|  *     def __init__(self, provides, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *     def __init__(self, provides=None, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *         """Initializer. | ||||
|  *  | ||||
|  */ | ||||
|  | @ -54944,6 +54952,7 @@ static int __pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_1__i | |||
|   { | ||||
|     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; | ||||
|     PyObject* values[1] = {0}; | ||||
|     values[0] = ((PyObject *)Py_None); | ||||
|     if (unlikely(__pyx_kwds)) { | ||||
|       Py_ssize_t kw_args; | ||||
|       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | ||||
|  | @ -54956,23 +54965,26 @@ static int __pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_1__i | |||
|       kw_args = PyDict_Size(__pyx_kwds); | ||||
|       switch (pos_args) { | ||||
|         case  0: | ||||
|         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; | ||||
|         else goto __pyx_L5_argtuple_error; | ||||
|         if (kw_args > 0) { | ||||
|           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_provides); | ||||
|           if (value) { values[0] = value; kw_args--; } | ||||
|         } | ||||
|       } | ||||
|       if (unlikely(kw_args > 0)) { | ||||
|         const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; | ||||
|         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 2826, __pyx_L3_error) | ||||
|       } | ||||
|     } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { | ||||
|       goto __pyx_L5_argtuple_error; | ||||
|     } else { | ||||
|       values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | ||||
|       switch (PyTuple_GET_SIZE(__pyx_args)) { | ||||
|         default: | ||||
|         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | ||||
|         CYTHON_FALLTHROUGH; | ||||
|         case  0: break; | ||||
|       } | ||||
|     } | ||||
|     __pyx_v_provides = values[0]; | ||||
|   } | ||||
|   goto __pyx_L4_argument_unpacking_done; | ||||
|   __pyx_L5_argtuple_error:; | ||||
|   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2826, __pyx_L3_error) | ||||
|   __pyx_L3_error:; | ||||
|   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; | ||||
|   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; | ||||
|  | @ -55071,7 +55083,7 @@ static int __pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton___in | |||
|   /* "dependency_injector/providers.pyx":2826
 | ||||
|  *     """ | ||||
|  *  | ||||
|  *     def __init__(self, provides, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *     def __init__(self, provides=None, *args, **kwargs):             # <<<<<<<<<<<<<< | ||||
|  *         """Initializer. | ||||
|  *  | ||||
|  */ | ||||
|  |  | |||
|  | @ -2673,7 +2673,7 @@ cdef class Singleton(BaseSingleton): | |||
|         :type: type | ||||
|     """ | ||||
| 
 | ||||
|     def __init__(self, provides, *args, **kwargs): | ||||
|     def __init__(self, provides=None, *args, **kwargs): | ||||
|         """Initializer. | ||||
| 
 | ||||
|         :param provides: Provided type. | ||||
|  | @ -2740,7 +2740,7 @@ cdef class ThreadSafeSingleton(BaseSingleton): | |||
|     :type: :py:class:`threading.RLock` | ||||
|     """ | ||||
| 
 | ||||
|     def __init__(self, provides, *args, **kwargs): | ||||
|     def __init__(self, provides=None, *args, **kwargs): | ||||
|         """Initializer. | ||||
| 
 | ||||
|         :param provides: Provided type. | ||||
|  | @ -2823,7 +2823,7 @@ cdef class ThreadLocalSingleton(BaseSingleton): | |||
|         :type: type | ||||
|     """ | ||||
| 
 | ||||
|     def __init__(self, provides, *args, **kwargs): | ||||
|     def __init__(self, provides=None, *args, **kwargs): | ||||
|         """Initializer. | ||||
| 
 | ||||
|         :param provides: Provided type. | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user