mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-03-12 15:55:47 +03:00
Make some cosmetic changes to _resolve_config_env_markers()
This commit is contained in:
parent
8ca72b5051
commit
35a46bdb7f
|
@ -3904,7 +3904,6 @@ static const char __pyx_k_MethodCaller[] = "MethodCaller";
|
||||||
static const char __pyx_k_Object___get[] = "Object.__get__";
|
static const char __pyx_k_Object___get[] = "Object.__get__";
|
||||||
static const char __pyx_k_RuntimeError[] = "RuntimeError";
|
static const char __pyx_k_RuntimeError[] = "RuntimeError";
|
||||||
static const char __pyx_k_clear_kwargs[] = "clear_kwargs";
|
static const char __pyx_k_clear_kwargs[] = "clear_kwargs";
|
||||||
static const char __pyx_k_config_value[] = "config_value";
|
|
||||||
static const char __pyx_k_configparser[] = "configparser";
|
static const char __pyx_k_configparser[] = "configparser";
|
||||||
static const char __pyx_k_factory_name[] = "factory_name";
|
static const char __pyx_k_factory_name[] = "factory_name";
|
||||||
static const char __pyx_k_get_children[] = "get_children";
|
static const char __pyx_k_get_children[] = "get_children";
|
||||||
|
@ -3948,6 +3947,7 @@ static const char __pyx_k_Resource___get[] = "Resource.__get__";
|
||||||
static const char __pyx_k_Selector___get[] = "Selector.__get__";
|
static const char __pyx_k_Selector___get[] = "Selector.__get__";
|
||||||
static const char __pyx_k_add_attributes[] = "add_attributes";
|
static const char __pyx_k_add_attributes[] = "add_attributes";
|
||||||
static const char __pyx_k_attribute_name[] = "attribute_name";
|
static const char __pyx_k_attribute_name[] = "attribute_name";
|
||||||
|
static const char __pyx_k_config_content[] = "config_content";
|
||||||
static const char __pyx_k_container_name[] = ", container name: \"";
|
static const char __pyx_k_container_name[] = ", container name: \"";
|
||||||
static const char __pyx_k_is_not_defined[] = "\" is not defined";
|
static const char __pyx_k_is_not_defined[] = "\" is not defined";
|
||||||
static const char __pyx_k_parse_ini_file[] = "_parse_ini_file";
|
static const char __pyx_k_parse_ini_file[] = "_parse_ini_file";
|
||||||
|
@ -4392,10 +4392,10 @@ static PyObject *__pyx_n_s_cls;
|
||||||
static PyObject *__pyx_kp_s_cls_object_has_no_attribute_att;
|
static PyObject *__pyx_kp_s_cls_object_has_no_attribute_att;
|
||||||
static PyObject *__pyx_n_s_compile;
|
static PyObject *__pyx_n_s_compile;
|
||||||
static PyObject *__pyx_n_s_config;
|
static PyObject *__pyx_n_s_config;
|
||||||
|
static PyObject *__pyx_n_s_config_content;
|
||||||
static PyObject *__pyx_n_s_config_env_marker_pattern;
|
static PyObject *__pyx_n_s_config_env_marker_pattern;
|
||||||
static PyObject *__pyx_n_s_config_file;
|
static PyObject *__pyx_n_s_config_file;
|
||||||
static PyObject *__pyx_n_s_config_string;
|
static PyObject *__pyx_n_s_config_string;
|
||||||
static PyObject *__pyx_n_s_config_value;
|
|
||||||
static PyObject *__pyx_n_s_configparser;
|
static PyObject *__pyx_n_s_configparser;
|
||||||
static PyObject *__pyx_n_s_container;
|
static PyObject *__pyx_n_s_container;
|
||||||
static PyObject *__pyx_n_s_container_cls;
|
static PyObject *__pyx_n_s_container_cls;
|
||||||
|
@ -4689,7 +4689,7 @@ static PyObject *__pyx_n_s_wrap;
|
||||||
static PyObject *__pyx_n_s_yaml;
|
static PyObject *__pyx_n_s_yaml;
|
||||||
static PyObject *__pyx_n_s_zip;
|
static PyObject *__pyx_n_s_zip;
|
||||||
static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_memo); /* proto */
|
static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_memo); /* proto */
|
||||||
static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_markers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config_value, PyObject *__pyx_v_envs_required); /* proto */
|
static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_markers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config_content, PyObject *__pyx_v_envs_required); /* proto */
|
||||||
static PyObject *__pyx_pf_19dependency_injector_9providers_2_parse_ini_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filepath); /* proto */
|
static PyObject *__pyx_pf_19dependency_injector_9providers_2_parse_ini_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filepath); /* proto */
|
||||||
static PyObject *__pyx_pf_19dependency_injector_9providers_4_parse_ini_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filepath); /* proto */
|
static PyObject *__pyx_pf_19dependency_injector_9providers_4_parse_ini_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filepath); /* proto */
|
||||||
static int __pyx_pf_19dependency_injector_9providers_8Provider___init__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */
|
static int __pyx_pf_19dependency_injector_9providers_8Provider___init__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */
|
||||||
|
@ -5762,9 +5762,9 @@ static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_lambda(CY
|
||||||
/* "dependency_injector/providers.pyx":71
|
/* "dependency_injector/providers.pyx":71
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* def _resolve_config_env_markers(config_value, envs_required=False): # <<<<<<<<<<<<<<
|
* def _resolve_config_env_markers(config_content, envs_required=False): # <<<<<<<<<<<<<<
|
||||||
* """Replace environment variable markers with their values."""
|
* """Replace environment variable markers with their values."""
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value))
|
* findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Python wrapper */
|
/* Python wrapper */
|
||||||
|
@ -5772,7 +5772,7 @@ static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_
|
||||||
static char __pyx_doc_19dependency_injector_9providers__resolve_config_env_markers[] = "Replace environment variable markers with their values.";
|
static char __pyx_doc_19dependency_injector_9providers__resolve_config_env_markers[] = "Replace environment variable markers with their values.";
|
||||||
static PyMethodDef __pyx_mdef_19dependency_injector_9providers_1_resolve_config_env_markers = {"_resolve_config_env_markers", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_markers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers__resolve_config_env_markers};
|
static PyMethodDef __pyx_mdef_19dependency_injector_9providers_1_resolve_config_env_markers = {"_resolve_config_env_markers", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_markers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers__resolve_config_env_markers};
|
||||||
static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_markers(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_markers(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
||||||
PyObject *__pyx_v_config_value = 0;
|
PyObject *__pyx_v_config_content = 0;
|
||||||
PyObject *__pyx_v_envs_required = 0;
|
PyObject *__pyx_v_envs_required = 0;
|
||||||
int __pyx_lineno = 0;
|
int __pyx_lineno = 0;
|
||||||
const char *__pyx_filename = NULL;
|
const char *__pyx_filename = NULL;
|
||||||
|
@ -5781,7 +5781,7 @@ static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_
|
||||||
__Pyx_RefNannyDeclarations
|
__Pyx_RefNannyDeclarations
|
||||||
__Pyx_RefNannySetupContext("_resolve_config_env_markers (wrapper)", 0);
|
__Pyx_RefNannySetupContext("_resolve_config_env_markers (wrapper)", 0);
|
||||||
{
|
{
|
||||||
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_config_value,&__pyx_n_s_envs_required,0};
|
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_config_content,&__pyx_n_s_envs_required,0};
|
||||||
PyObject* values[2] = {0,0};
|
PyObject* values[2] = {0,0};
|
||||||
values[1] = ((PyObject *)Py_False);
|
values[1] = ((PyObject *)Py_False);
|
||||||
if (unlikely(__pyx_kwds)) {
|
if (unlikely(__pyx_kwds)) {
|
||||||
|
@ -5798,7 +5798,7 @@ static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_
|
||||||
kw_args = PyDict_Size(__pyx_kwds);
|
kw_args = PyDict_Size(__pyx_kwds);
|
||||||
switch (pos_args) {
|
switch (pos_args) {
|
||||||
case 0:
|
case 0:
|
||||||
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_config_value)) != 0)) kw_args--;
|
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_config_content)) != 0)) kw_args--;
|
||||||
else goto __pyx_L5_argtuple_error;
|
else goto __pyx_L5_argtuple_error;
|
||||||
CYTHON_FALLTHROUGH;
|
CYTHON_FALLTHROUGH;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -5819,7 +5819,7 @@ static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_
|
||||||
default: goto __pyx_L5_argtuple_error;
|
default: goto __pyx_L5_argtuple_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__pyx_v_config_value = values[0];
|
__pyx_v_config_content = values[0];
|
||||||
__pyx_v_envs_required = values[1];
|
__pyx_v_envs_required = values[1];
|
||||||
}
|
}
|
||||||
goto __pyx_L4_argument_unpacking_done;
|
goto __pyx_L4_argument_unpacking_done;
|
||||||
|
@ -5830,14 +5830,14 @@ static PyObject *__pyx_pw_19dependency_injector_9providers_1_resolve_config_env_
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return NULL;
|
return NULL;
|
||||||
__pyx_L4_argument_unpacking_done:;
|
__pyx_L4_argument_unpacking_done:;
|
||||||
__pyx_r = __pyx_pf_19dependency_injector_9providers__resolve_config_env_markers(__pyx_self, __pyx_v_config_value, __pyx_v_envs_required);
|
__pyx_r = __pyx_pf_19dependency_injector_9providers__resolve_config_env_markers(__pyx_self, __pyx_v_config_content, __pyx_v_envs_required);
|
||||||
|
|
||||||
/* function exit code */
|
/* function exit code */
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return __pyx_r;
|
return __pyx_r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_markers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config_value, PyObject *__pyx_v_envs_required) {
|
static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_markers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config_content, PyObject *__pyx_v_envs_required) {
|
||||||
PyObject *__pyx_v_findings = NULL;
|
PyObject *__pyx_v_findings = NULL;
|
||||||
PyObject *__pyx_v_match = NULL;
|
PyObject *__pyx_v_match = NULL;
|
||||||
PyObject *__pyx_v_env_name = NULL;
|
PyObject *__pyx_v_env_name = NULL;
|
||||||
|
@ -5863,12 +5863,12 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
const char *__pyx_filename = NULL;
|
const char *__pyx_filename = NULL;
|
||||||
int __pyx_clineno = 0;
|
int __pyx_clineno = 0;
|
||||||
__Pyx_RefNannySetupContext("_resolve_config_env_markers", 0);
|
__Pyx_RefNannySetupContext("_resolve_config_env_markers", 0);
|
||||||
__Pyx_INCREF(__pyx_v_config_value);
|
__Pyx_INCREF(__pyx_v_config_content);
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":73
|
/* "dependency_injector/providers.pyx":73
|
||||||
* def _resolve_config_env_markers(config_value, envs_required=False):
|
* def _resolve_config_env_markers(config_content, envs_required=False):
|
||||||
* """Replace environment variable markers with their values."""
|
* """Replace environment variable markers with their values."""
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value)) # <<<<<<<<<<<<<<
|
* findings = list(config_env_marker_pattern.finditer(config_content)) # <<<<<<<<<<<<<<
|
||||||
*
|
*
|
||||||
* for match in reversed(findings):
|
* for match in reversed(findings):
|
||||||
*/
|
*/
|
||||||
|
@ -5887,7 +5887,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
__Pyx_DECREF_SET(__pyx_t_3, function);
|
__Pyx_DECREF_SET(__pyx_t_3, function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_config_value) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_config_value);
|
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_config_content) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_config_content);
|
||||||
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
|
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||||
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 73, __pyx_L1_error)
|
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 73, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
@ -5899,7 +5899,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
__pyx_t_3 = 0;
|
__pyx_t_3 = 0;
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":75
|
/* "dependency_injector/providers.pyx":75
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value))
|
* findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
*
|
*
|
||||||
* for match in reversed(findings): # <<<<<<<<<<<<<<
|
* for match in reversed(findings): # <<<<<<<<<<<<<<
|
||||||
* env_name = match.group('name')
|
* env_name = match.group('name')
|
||||||
|
@ -6119,8 +6119,8 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
* value = match.group('default')
|
* value = match.group('default')
|
||||||
*
|
*
|
||||||
* span_min, span_max = match.span() # <<<<<<<<<<<<<<
|
* span_min, span_max = match.span() # <<<<<<<<<<<<<<
|
||||||
* config_value = f'{config_value[:span_min]}{value}{config_value[span_max:]}'
|
* config_content = f'{config_content[:span_min]}{value}{config_content[span_max:]}'
|
||||||
* return config_value
|
* return config_content
|
||||||
*/
|
*/
|
||||||
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_span); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 85, __pyx_L1_error)
|
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_span); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 85, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
|
@ -6193,15 +6193,15 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
/* "dependency_injector/providers.pyx":86
|
/* "dependency_injector/providers.pyx":86
|
||||||
*
|
*
|
||||||
* span_min, span_max = match.span()
|
* span_min, span_max = match.span()
|
||||||
* config_value = f'{config_value[:span_min]}{value}{config_value[span_max:]}' # <<<<<<<<<<<<<<
|
* config_content = f'{config_content[:span_min]}{value}{config_content[span_max:]}' # <<<<<<<<<<<<<<
|
||||||
* return config_value
|
* return config_content
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error)
|
__pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_2);
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
__pyx_t_9 = 0;
|
__pyx_t_9 = 0;
|
||||||
__pyx_t_10 = 127;
|
__pyx_t_10 = 127;
|
||||||
__pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_config_value, 0, 0, NULL, &__pyx_v_span_min, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_config_content, 0, 0, NULL, &__pyx_v_span_min, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error)
|
__pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
|
@ -6218,7 +6218,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
__Pyx_GIVEREF(__pyx_t_5);
|
__Pyx_GIVEREF(__pyx_t_5);
|
||||||
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
|
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
|
||||||
__pyx_t_5 = 0;
|
__pyx_t_5 = 0;
|
||||||
__pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_config_value, 0, 0, &__pyx_v_span_max, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error)
|
__pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_config_content, 0, 0, &__pyx_v_span_max, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
__pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
@ -6231,11 +6231,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
__pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||||
__Pyx_DECREF_SET(__pyx_v_config_value, __pyx_t_1);
|
__Pyx_DECREF_SET(__pyx_v_config_content, __pyx_t_1);
|
||||||
__pyx_t_1 = 0;
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":75
|
/* "dependency_injector/providers.pyx":75
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value))
|
* findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
*
|
*
|
||||||
* for match in reversed(findings): # <<<<<<<<<<<<<<
|
* for match in reversed(findings): # <<<<<<<<<<<<<<
|
||||||
* env_name = match.group('name')
|
* env_name = match.group('name')
|
||||||
|
@ -6246,22 +6246,22 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":87
|
/* "dependency_injector/providers.pyx":87
|
||||||
* span_min, span_max = match.span()
|
* span_min, span_max = match.span()
|
||||||
* config_value = f'{config_value[:span_min]}{value}{config_value[span_max:]}'
|
* config_content = f'{config_content[:span_min]}{value}{config_content[span_max:]}'
|
||||||
* return config_value # <<<<<<<<<<<<<<
|
* return config_content # <<<<<<<<<<<<<<
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__Pyx_XDECREF(__pyx_r);
|
__Pyx_XDECREF(__pyx_r);
|
||||||
__Pyx_INCREF(__pyx_v_config_value);
|
__Pyx_INCREF(__pyx_v_config_content);
|
||||||
__pyx_r = __pyx_v_config_value;
|
__pyx_r = __pyx_v_config_content;
|
||||||
goto __pyx_L0;
|
goto __pyx_L0;
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":71
|
/* "dependency_injector/providers.pyx":71
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* def _resolve_config_env_markers(config_value, envs_required=False): # <<<<<<<<<<<<<<
|
* def _resolve_config_env_markers(config_content, envs_required=False): # <<<<<<<<<<<<<<
|
||||||
* """Replace environment variable markers with their values."""
|
* """Replace environment variable markers with their values."""
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value))
|
* findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* function exit code */
|
/* function exit code */
|
||||||
|
@ -6281,7 +6281,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers__resolve_config_env_m
|
||||||
__Pyx_XDECREF(__pyx_v_value);
|
__Pyx_XDECREF(__pyx_v_value);
|
||||||
__Pyx_XDECREF(__pyx_v_span_min);
|
__Pyx_XDECREF(__pyx_v_span_min);
|
||||||
__Pyx_XDECREF(__pyx_v_span_max);
|
__Pyx_XDECREF(__pyx_v_span_max);
|
||||||
__Pyx_XDECREF(__pyx_v_config_value);
|
__Pyx_XDECREF(__pyx_v_config_content);
|
||||||
__Pyx_XGIVEREF(__pyx_r);
|
__Pyx_XGIVEREF(__pyx_r);
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return __pyx_r;
|
return __pyx_r;
|
||||||
|
@ -133242,10 +133242,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
||||||
{&__pyx_kp_s_cls_object_has_no_attribute_att, __pyx_k_cls_object_has_no_attribute_att, sizeof(__pyx_k_cls_object_has_no_attribute_att), 0, 0, 1, 0},
|
{&__pyx_kp_s_cls_object_has_no_attribute_att, __pyx_k_cls_object_has_no_attribute_att, sizeof(__pyx_k_cls_object_has_no_attribute_att), 0, 0, 1, 0},
|
||||||
{&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
|
{&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1},
|
{&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1},
|
||||||
|
{&__pyx_n_s_config_content, __pyx_k_config_content, sizeof(__pyx_k_config_content), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_config_env_marker_pattern, __pyx_k_config_env_marker_pattern, sizeof(__pyx_k_config_env_marker_pattern), 0, 0, 1, 1},
|
{&__pyx_n_s_config_env_marker_pattern, __pyx_k_config_env_marker_pattern, sizeof(__pyx_k_config_env_marker_pattern), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_config_file, __pyx_k_config_file, sizeof(__pyx_k_config_file), 0, 0, 1, 1},
|
{&__pyx_n_s_config_file, __pyx_k_config_file, sizeof(__pyx_k_config_file), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_config_string, __pyx_k_config_string, sizeof(__pyx_k_config_string), 0, 0, 1, 1},
|
{&__pyx_n_s_config_string, __pyx_k_config_string, sizeof(__pyx_k_config_string), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_config_value, __pyx_k_config_value, sizeof(__pyx_k_config_value), 0, 0, 1, 1},
|
|
||||||
{&__pyx_n_s_configparser, __pyx_k_configparser, sizeof(__pyx_k_configparser), 0, 0, 1, 1},
|
{&__pyx_n_s_configparser, __pyx_k_configparser, sizeof(__pyx_k_configparser), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_container, __pyx_k_container, sizeof(__pyx_k_container), 0, 0, 1, 1},
|
{&__pyx_n_s_container, __pyx_k_container, sizeof(__pyx_k_container), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_container_cls, __pyx_k_container_cls, sizeof(__pyx_k_container_cls), 0, 0, 1, 1},
|
{&__pyx_n_s_container_cls, __pyx_k_container_cls, sizeof(__pyx_k_container_cls), 0, 0, 1, 1},
|
||||||
|
@ -133708,11 +133708,11 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
|
||||||
/* "dependency_injector/providers.pyx":71
|
/* "dependency_injector/providers.pyx":71
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* def _resolve_config_env_markers(config_value, envs_required=False): # <<<<<<<<<<<<<<
|
* def _resolve_config_env_markers(config_content, envs_required=False): # <<<<<<<<<<<<<<
|
||||||
* """Replace environment variable markers with their values."""
|
* """Replace environment variable markers with their values."""
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value))
|
* findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
*/
|
*/
|
||||||
__pyx_tuple__45 = PyTuple_Pack(9, __pyx_n_s_config_value, __pyx_n_s_envs_required, __pyx_n_s_findings, __pyx_n_s_match, __pyx_n_s_env_name, __pyx_n_s_has_default, __pyx_n_s_value, __pyx_n_s_span_min, __pyx_n_s_span_max); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 71, __pyx_L1_error)
|
__pyx_tuple__45 = PyTuple_Pack(9, __pyx_n_s_config_content, __pyx_n_s_envs_required, __pyx_n_s_findings, __pyx_n_s_match, __pyx_n_s_env_name, __pyx_n_s_has_default, __pyx_n_s_value, __pyx_n_s_span_min, __pyx_n_s_span_max); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 71, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_tuple__45);
|
__Pyx_GOTREF(__pyx_tuple__45);
|
||||||
__Pyx_GIVEREF(__pyx_tuple__45);
|
__Pyx_GIVEREF(__pyx_tuple__45);
|
||||||
__pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_dependency_injector_provider, __pyx_n_s_resolve_config_env_markers, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(1, 71, __pyx_L1_error)
|
__pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_dependency_injector_provider, __pyx_n_s_resolve_config_env_markers, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(1, 71, __pyx_L1_error)
|
||||||
|
@ -136652,9 +136652,9 @@ if (!__Pyx_RefNanny) {
|
||||||
/* "dependency_injector/providers.pyx":71
|
/* "dependency_injector/providers.pyx":71
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* def _resolve_config_env_markers(config_value, envs_required=False): # <<<<<<<<<<<<<<
|
* def _resolve_config_env_markers(config_content, envs_required=False): # <<<<<<<<<<<<<<
|
||||||
* """Replace environment variable markers with their values."""
|
* """Replace environment variable markers with their values."""
|
||||||
* findings = list(config_env_marker_pattern.finditer(config_value))
|
* findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
*/
|
*/
|
||||||
__pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_19dependency_injector_9providers_1_resolve_config_env_markers, NULL, __pyx_n_s_dependency_injector_providers); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 71, __pyx_L1_error)
|
__pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_19dependency_injector_9providers_1_resolve_config_env_markers, NULL, __pyx_n_s_dependency_injector_providers); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 71, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_7);
|
__Pyx_GOTREF(__pyx_t_7);
|
||||||
|
|
|
@ -68,9 +68,9 @@ config_env_marker_pattern = re.compile(
|
||||||
r'\${(?P<name>[^}^{:]+)(?P<separator>:?)(?P<default>.*?)}',
|
r'\${(?P<name>[^}^{:]+)(?P<separator>:?)(?P<default>.*?)}',
|
||||||
)
|
)
|
||||||
|
|
||||||
def _resolve_config_env_markers(config_value, envs_required=False):
|
def _resolve_config_env_markers(config_content, envs_required=False):
|
||||||
"""Replace environment variable markers with their values."""
|
"""Replace environment variable markers with their values."""
|
||||||
findings = list(config_env_marker_pattern.finditer(config_value))
|
findings = list(config_env_marker_pattern.finditer(config_content))
|
||||||
|
|
||||||
for match in reversed(findings):
|
for match in reversed(findings):
|
||||||
env_name = match.group('name')
|
env_name = match.group('name')
|
||||||
|
@ -83,8 +83,8 @@ def _resolve_config_env_markers(config_value, envs_required=False):
|
||||||
value = match.group('default')
|
value = match.group('default')
|
||||||
|
|
||||||
span_min, span_max = match.span()
|
span_min, span_max = match.span()
|
||||||
config_value = f'{config_value[:span_min]}{value}{config_value[span_max:]}'
|
config_content = f'{config_content[:span_min]}{value}{config_content[span_max:]}'
|
||||||
return config_value
|
return config_content
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[0] == 3:
|
if sys.version_info[0] == 3:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user