Refactor string imports

This commit is contained in:
Roman Mogylatov 2022-01-30 23:19:09 -05:00
parent 86df7f91f6
commit 0235d68265
2 changed files with 66 additions and 66 deletions

View File

@ -4045,7 +4045,6 @@ static const char __pyx_k_Providers_module[] = "Providers module.";
static const char __pyx_k_clear_attributes[] = "clear_attributes";
static const char __pyx_k_copy_overridings[] = "_copy_overridings";
static const char __pyx_k_has_no_attribute[] = "\" has no attribute \"";
static const char __pyx_k_resolve_provides[] = "_resolve_provides";
static const char __pyx_k_AbstractCoroutine[] = "AbstractCoroutine";
static const char __pyx_k_AbstractSingleton[] = "AbstractSingleton";
static const char __pyx_k_CoroutineDelegate[] = "CoroutineDelegate";
@ -4109,6 +4108,7 @@ static const char __pyx_k_pyx_unpickle_Selector[] = "__pyx_unpickle_Selector";
static const char __pyx_k_raise_undefined_error[] = "_raise_undefined_error";
static const char __pyx_k_reset_last_overriding[] = "reset_last_overriding";
static const char __pyx_k_resolve_provider_name[] = "resolve_provider_name";
static const char __pyx_k_resolve_string_import[] = "_resolve_string_import";
static const char __pyx_k_set_pydantic_settings[] = "set_pydantic_settings";
static const char __pyx_k_ProvidedInstance___get[] = "ProvidedInstance.__get__";
static const char __pyx_k_create_shutdown_future[] = "_create_shutdown_future";
@ -4724,7 +4724,7 @@ static PyObject *__pyx_n_s_resolve_calling_module;
static PyObject *__pyx_n_s_resolve_calling_package_name;
static PyObject *__pyx_n_s_resolve_config_env_markers;
static PyObject *__pyx_n_s_resolve_provider_name;
static PyObject *__pyx_n_s_resolve_provides;
static PyObject *__pyx_n_s_resolve_string_import;
static PyObject *__pyx_n_s_resources;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_reversed;
@ -5316,7 +5316,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_28traverse(CYTHON_UNU
static PyObject *__pyx_pf_19dependency_injector_9providers_31isawaitable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_33iscoroutinefunction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_35isasyncgenfunction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provides); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_string_import(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provides); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_39_resolve_calling_module(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_41_resolve_calling_package_name(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_43_copy_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_from_, PyObject *__pyx_v_to, PyObject *__pyx_v_memo); /* proto */
@ -25915,7 +25915,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_8provides__
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* Python wrapper */
@ -25955,11 +25955,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6set_provid
/* "dependency_injector/providers.pyx":1230
* def set_provides(self, provides):
* """Set provider provides."""
* provides = _resolve_provides(provides) # <<<<<<<<<<<<<<
* provides = _resolve_string_import(provides) # <<<<<<<<<<<<<<
* if provides and not callable(provides):
* raise Error(
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_provides); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1230, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_string_import); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1230, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
@ -25981,7 +25981,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6set_provid
/* "dependency_injector/providers.pyx":1231
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not callable(provides): # <<<<<<<<<<<<<<
* raise Error(
* "Provider {0} expected to get callable, got {1} instead".format(
@ -25999,7 +25999,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6set_provid
if (unlikely(__pyx_t_4)) {
/* "dependency_injector/providers.pyx":1232
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not callable(provides):
* raise Error( # <<<<<<<<<<<<<<
* "Provider {0} expected to get callable, got {1} instead".format(
@ -26104,7 +26104,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6set_provid
/* "dependency_injector/providers.pyx":1231
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not callable(provides): # <<<<<<<<<<<<<<
* raise Error(
* "Provider {0} expected to get callable, got {1} instead".format(
@ -26141,7 +26141,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6set_provid
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* function exit code */
@ -29878,7 +29878,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
* """Set provider provides."""
* if not asyncio: # <<<<<<<<<<<<<<
* raise Error("Package asyncio is not available")
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1437, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
@ -29891,7 +29891,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
* """Set provider provides."""
* if not asyncio:
* raise Error("Package asyncio is not available") # <<<<<<<<<<<<<<
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not asyncio.iscoroutinefunction(provides):
*/
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1438, __pyx_L1_error)
@ -29920,18 +29920,18 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
* """Set provider provides."""
* if not asyncio: # <<<<<<<<<<<<<<
* raise Error("Package asyncio is not available")
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
}
/* "dependency_injector/providers.pyx":1439
* if not asyncio:
* raise Error("Package asyncio is not available")
* provides = _resolve_provides(provides) # <<<<<<<<<<<<<<
* provides = _resolve_string_import(provides) # <<<<<<<<<<<<<<
* if provides and not asyncio.iscoroutinefunction(provides):
* raise Error(f"Provider {_class_qualname(self)} expected to get coroutine function, "
*/
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_resolve_provides); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1439, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_resolve_string_import); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1439, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@ -29953,7 +29953,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
/* "dependency_injector/providers.pyx":1440
* raise Error("Package asyncio is not available")
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not asyncio.iscoroutinefunction(provides): # <<<<<<<<<<<<<<
* raise Error(f"Provider {_class_qualname(self)} expected to get coroutine function, "
* f"got {provides} instead")
@ -29992,7 +29992,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
if (unlikely(__pyx_t_3)) {
/* "dependency_injector/providers.pyx":1441
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not asyncio.iscoroutinefunction(provides):
* raise Error(f"Provider {_class_qualname(self)} expected to get coroutine function, " # <<<<<<<<<<<<<<
* f"got {provides} instead")
@ -30043,7 +30043,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u_instead);
/* "dependency_injector/providers.pyx":1441
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not asyncio.iscoroutinefunction(provides):
* raise Error(f"Provider {_class_qualname(self)} expected to get coroutine function, " # <<<<<<<<<<<<<<
* f"got {provides} instead")
@ -30074,7 +30074,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Coroutine_set_provid
/* "dependency_injector/providers.pyx":1440
* raise Error("Package asyncio is not available")
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if provides and not asyncio.iscoroutinefunction(provides): # <<<<<<<<<<<<<<
* raise Error(f"Provider {_class_qualname(self)} expected to get coroutine function, "
* f"got {provides} instead")
@ -48515,7 +48515,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_8provides___
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* Python wrapper */
@ -48556,11 +48556,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6set_provide
/* "dependency_injector/providers.pyx":2463
* def set_provides(self, provides):
* """Set provider provides."""
* provides = _resolve_provides(provides) # <<<<<<<<<<<<<<
* provides = _resolve_string_import(provides) # <<<<<<<<<<<<<<
* if (provides
* and self.__class__.provided_type and
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_provides); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2463, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_string_import); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2463, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
@ -48582,7 +48582,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6set_provide
/* "dependency_injector/providers.pyx":2464
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides # <<<<<<<<<<<<<<
* and self.__class__.provided_type and
* not issubclass(provides, self.__class__.provided_type)):
@ -48595,7 +48595,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6set_provide
}
/* "dependency_injector/providers.pyx":2465
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides
* and self.__class__.provided_type and # <<<<<<<<<<<<<<
* not issubclass(provides, self.__class__.provided_type)):
@ -48634,7 +48634,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6set_provide
/* "dependency_injector/providers.pyx":2464
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides # <<<<<<<<<<<<<<
* and self.__class__.provided_type and
* not issubclass(provides, self.__class__.provided_type)):
@ -48754,7 +48754,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6set_provide
/* "dependency_injector/providers.pyx":2464
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides # <<<<<<<<<<<<<<
* and self.__class__.provided_type and
* not issubclass(provides, self.__class__.provided_type)):
@ -48804,7 +48804,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6set_provide
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* function exit code */
@ -54005,7 +54005,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_8prov
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* Python wrapper */
@ -54046,11 +54046,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6set_
/* "dependency_injector/providers.pyx":2754
* def set_provides(self, provides):
* """Set provider provides."""
* provides = _resolve_provides(provides) # <<<<<<<<<<<<<<
* provides = _resolve_string_import(provides) # <<<<<<<<<<<<<<
* if (provides
* and self.__class__.provided_type and
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_provides); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2754, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_string_import); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2754, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
@ -54072,7 +54072,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6set_
/* "dependency_injector/providers.pyx":2755
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides # <<<<<<<<<<<<<<
* and self.__class__.provided_type and
* not issubclass(provides, self.__class__.provided_type)):
@ -54085,7 +54085,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6set_
}
/* "dependency_injector/providers.pyx":2756
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides
* and self.__class__.provided_type and # <<<<<<<<<<<<<<
* not issubclass(provides, self.__class__.provided_type)):
@ -54124,7 +54124,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6set_
/* "dependency_injector/providers.pyx":2755
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides # <<<<<<<<<<<<<<
* and self.__class__.provided_type and
* not issubclass(provides, self.__class__.provided_type)):
@ -54244,7 +54244,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6set_
/* "dependency_injector/providers.pyx":2755
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* if (provides # <<<<<<<<<<<<<<
* and self.__class__.provided_type and
* not issubclass(provides, self.__class__.provided_type)):
@ -54294,7 +54294,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6set_
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* function exit code */
@ -69591,7 +69591,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Resource_8provides__
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* Python wrapper */
@ -69623,11 +69623,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Resource_6set_provid
/* "dependency_injector/providers.pyx":3593
* def set_provides(self, provides):
* """Set provider provides."""
* provides = _resolve_provides(provides) # <<<<<<<<<<<<<<
* provides = _resolve_string_import(provides) # <<<<<<<<<<<<<<
* self.__provides = provides
* return self
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_provides); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3593, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_resolve_string_import); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
@ -69649,7 +69649,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Resource_6set_provid
/* "dependency_injector/providers.pyx":3594
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* self.__provides = provides # <<<<<<<<<<<<<<
* return self
*
@ -69661,7 +69661,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Resource_6set_provid
__pyx_v_self->__pyx___provides = __pyx_v_provides;
/* "dependency_injector/providers.pyx":3595
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
* self.__provides = provides
* return self # <<<<<<<<<<<<<<
*
@ -69677,7 +69677,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_8Resource_6set_provid
*
* def set_provides(self, provides): # <<<<<<<<<<<<<<
* """Set provider provides."""
* provides = _resolve_provides(provides)
* provides = _resolve_string_import(provides)
*/
/* function exit code */
@ -97295,26 +97295,26 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_35isasyncgenfunction(
/* "dependency_injector/providers.pyx":4896
*
*
* def _resolve_provides(provides): # <<<<<<<<<<<<<<
* def _resolve_string_import(provides): # <<<<<<<<<<<<<<
* if provides is None:
* return provides
*/
/* Python wrapper */
static PyObject *__pyx_pw_19dependency_injector_9providers_38_resolve_provides(PyObject *__pyx_self, PyObject *__pyx_v_provides); /*proto*/
static PyMethodDef __pyx_mdef_19dependency_injector_9providers_38_resolve_provides = {"_resolve_provides", (PyCFunction)__pyx_pw_19dependency_injector_9providers_38_resolve_provides, METH_O, 0};
static PyObject *__pyx_pw_19dependency_injector_9providers_38_resolve_provides(PyObject *__pyx_self, PyObject *__pyx_v_provides) {
static PyObject *__pyx_pw_19dependency_injector_9providers_38_resolve_string_import(PyObject *__pyx_self, PyObject *__pyx_v_provides); /*proto*/
static PyMethodDef __pyx_mdef_19dependency_injector_9providers_38_resolve_string_import = {"_resolve_string_import", (PyCFunction)__pyx_pw_19dependency_injector_9providers_38_resolve_string_import, METH_O, 0};
static PyObject *__pyx_pw_19dependency_injector_9providers_38_resolve_string_import(PyObject *__pyx_self, PyObject *__pyx_v_provides) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_resolve_provides (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_37_resolve_provides(__pyx_self, ((PyObject *)__pyx_v_provides));
__Pyx_RefNannySetupContext("_resolve_string_import (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_37_resolve_string_import(__pyx_self, ((PyObject *)__pyx_v_provides));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provides) {
static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_string_import(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provides) {
PyObject *__pyx_v_segments = NULL;
PyObject *__pyx_v_member_name = NULL;
PyObject *__pyx_v_module = NULL;
@ -97333,11 +97333,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(C
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_resolve_provides", 0);
__Pyx_RefNannySetupContext("_resolve_string_import", 0);
/* "dependency_injector/providers.pyx":4897
*
* def _resolve_provides(provides):
* def _resolve_string_import(provides):
* if provides is None: # <<<<<<<<<<<<<<
* return provides
*
@ -97347,7 +97347,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(C
if (__pyx_t_2) {
/* "dependency_injector/providers.pyx":4898
* def _resolve_provides(provides):
* def _resolve_string_import(provides):
* if provides is None:
* return provides # <<<<<<<<<<<<<<
*
@ -97360,7 +97360,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(C
/* "dependency_injector/providers.pyx":4897
*
* def _resolve_provides(provides):
* def _resolve_string_import(provides):
* if provides is None: # <<<<<<<<<<<<<<
* return provides
*
@ -97687,7 +97687,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(C
/* "dependency_injector/providers.pyx":4896
*
*
* def _resolve_provides(provides): # <<<<<<<<<<<<<<
* def _resolve_string_import(provides): # <<<<<<<<<<<<<<
* if provides is None:
* return provides
*/
@ -97698,7 +97698,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_37_resolve_provides(C
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("dependency_injector.providers._resolve_provides", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_AddTraceback("dependency_injector.providers._resolve_string_import", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_segments);
@ -137502,7 +137502,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_resolve_calling_package_name, __pyx_k_resolve_calling_package_name, sizeof(__pyx_k_resolve_calling_package_name), 0, 0, 1, 1},
{&__pyx_n_s_resolve_config_env_markers, __pyx_k_resolve_config_env_markers, sizeof(__pyx_k_resolve_config_env_markers), 0, 0, 1, 1},
{&__pyx_n_s_resolve_provider_name, __pyx_k_resolve_provider_name, sizeof(__pyx_k_resolve_provider_name), 0, 0, 1, 1},
{&__pyx_n_s_resolve_provides, __pyx_k_resolve_provides, sizeof(__pyx_k_resolve_provides), 0, 0, 1, 1},
{&__pyx_n_s_resolve_string_import, __pyx_k_resolve_string_import, sizeof(__pyx_k_resolve_string_import), 0, 0, 1, 1},
{&__pyx_n_s_resources, __pyx_k_resources, sizeof(__pyx_k_resources), 0, 0, 1, 1},
{&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
{&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
@ -137923,14 +137923,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
/* "dependency_injector/providers.pyx":4896
*
*
* def _resolve_provides(provides): # <<<<<<<<<<<<<<
* def _resolve_string_import(provides): # <<<<<<<<<<<<<<
* if provides is None:
* return provides
*/
__pyx_tuple__78 = PyTuple_Pack(6, __pyx_n_s_provides, __pyx_n_s_segments, __pyx_n_s_member_name, __pyx_n_s_module_2, __pyx_n_s_module_name, __pyx_n_s_package_name); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(1, 4896, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__78);
__Pyx_GIVEREF(__pyx_tuple__78);
__pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_dependency_injector_provider, __pyx_n_s_resolve_provides, 4896, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(1, 4896, __pyx_L1_error)
__pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_dependency_injector_provider, __pyx_n_s_resolve_string_import, 4896, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(1, 4896, __pyx_L1_error)
/* "dependency_injector/providers.pyx":4923
*
@ -141735,13 +141735,13 @@ if (!__Pyx_RefNanny) {
/* "dependency_injector/providers.pyx":4896
*
*
* def _resolve_provides(provides): # <<<<<<<<<<<<<<
* def _resolve_string_import(provides): # <<<<<<<<<<<<<<
* if provides is None:
* return provides
*/
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_19dependency_injector_9providers_38_resolve_provides, NULL, __pyx_n_s_dependency_injector_providers); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4896, __pyx_L1_error)
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_19dependency_injector_9providers_38_resolve_string_import, NULL, __pyx_n_s_dependency_injector_providers); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4896, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_resolve_provides, __pyx_t_1) < 0) __PYX_ERR(1, 4896, __pyx_L1_error)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_resolve_string_import, __pyx_t_1) < 0) __PYX_ERR(1, 4896, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "dependency_injector/providers.pyx":4923

View File

@ -1227,7 +1227,7 @@ cdef class Callable(Provider):
def set_provides(self, provides):
"""Set provider provides."""
provides = _resolve_provides(provides)
provides = _resolve_string_import(provides)
if provides and not callable(provides):
raise Error(
"Provider {0} expected to get callable, got {1} instead".format(
@ -1436,7 +1436,7 @@ cdef class Coroutine(Callable):
"""Set provider provides."""
if not asyncio:
raise Error("Package asyncio is not available")
provides = _resolve_provides(provides)
provides = _resolve_string_import(provides)
if provides and not asyncio.iscoroutinefunction(provides):
raise Error(f"Provider {_class_qualname(self)} expected to get coroutine function, "
f"got {provides} instead")
@ -2460,7 +2460,7 @@ cdef class Factory(Provider):
def set_provides(self, provides):
"""Set provider provides."""
provides = _resolve_provides(provides)
provides = _resolve_string_import(provides)
if (provides
and self.__class__.provided_type and
not issubclass(provides, self.__class__.provided_type)):
@ -2751,7 +2751,7 @@ cdef class BaseSingleton(Provider):
def set_provides(self, provides):
"""Set provider provides."""
provides = _resolve_provides(provides)
provides = _resolve_string_import(provides)
if (provides
and self.__class__.provided_type and
not issubclass(provides, self.__class__.provided_type)):
@ -3590,7 +3590,7 @@ cdef class Resource(Provider):
def set_provides(self, provides):
"""Set provider provides."""
provides = _resolve_provides(provides)
provides = _resolve_string_import(provides)
self.__provides = provides
return self
@ -4893,7 +4893,7 @@ def isasyncgenfunction(obj):
return False
def _resolve_provides(provides):
def _resolve_string_import(provides):
if provides is None:
return provides