Generated by Cython 0.29.23
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: proxy.c
+01: from copy import deepcopy
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_deepcopy); __Pyx_GIVEREF(__pyx_n_s_deepcopy); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_deepcopy); __pyx_t_2 = __Pyx_Import(__pyx_n_s_copy, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_deepcopy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+02: from math import floor
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_floor); __Pyx_GIVEREF(__pyx_n_s_floor); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_floor); __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_floor, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
03:
04: from cpython.object cimport PyObject_HasAttr
+05: from pympler import asizeof
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_asizeof); __Pyx_GIVEREF(__pyx_n_s_asizeof); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_asizeof); __pyx_t_2 = __Pyx_Import(__pyx_n_s_pympler, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_asizeof); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_asizeof, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
06:
+07: cdef tuple default_filter_types = (set, list, tuple, dict)
__pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)(&PySet_Type))); __Pyx_GIVEREF(((PyObject *)(&PySet_Type))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&PySet_Type))); __Pyx_INCREF(((PyObject *)(&PyList_Type))); __Pyx_GIVEREF(((PyObject *)(&PyList_Type))); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)(&PyList_Type))); __Pyx_INCREF(((PyObject *)(&PyTuple_Type))); __Pyx_GIVEREF(((PyObject *)(&PyTuple_Type))); PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)(&PyTuple_Type))); __Pyx_INCREF(((PyObject *)(&PyDict_Type))); __Pyx_GIVEREF(((PyObject *)(&PyDict_Type))); PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)(&PyDict_Type))); __Pyx_XGOTREF(__pyx_v_6py_pal_15data_collection_5proxy_default_filter_types); __Pyx_DECREF_SET(__pyx_v_6py_pal_15data_collection_5proxy_default_filter_types, ((PyObject*)__pyx_t_2)); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0;
08:
+09: cpdef Py_ssize_t get_input_factor(object args, coll_filter=default_filter_types):
static PyObject *__pyx_pw_6py_pal_15data_collection_5proxy_1get_input_factor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static Py_ssize_t __pyx_f_6py_pal_15data_collection_5proxy_get_input_factor(PyObject *__pyx_v_args, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6py_pal_15data_collection_5proxy_get_input_factor *__pyx_optional_args) { PyObject *__pyx_v_coll_filter = __pyx_k_; PyObject *__pyx_v_iterable = NULL; Py_ssize_t __pyx_v_value; PyObject *__pyx_v_argument = NULL; Py_ssize_t __pyx_v_v; Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_factor", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_coll_filter = __pyx_optional_args->coll_filter; } } __Pyx_INCREF(__pyx_v_args); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_WriteUnraisable("py_pal.data_collection.proxy.get_input_factor", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_iterable); __Pyx_XDECREF(__pyx_v_argument); __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6py_pal_15data_collection_5proxy_1get_input_factor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6py_pal_15data_collection_5proxy_get_input_factor[] = "get_input_factor(args, coll_filter=default_filter_types) -> Py_ssize_t\nProxy for input arguments.\n \n It is used to infer complexity with the least squares algorithm. Therefore all returned values have to be positive\n and greater than zero. \n \n If a collection of non-collection types is encountered, the elements of the collection are assigned the value 1.\n If the collection contains other collections, :meth:`py_pal.data_collection.get_input_factor` is called recursively \n to determine its value. By default this happens for 'set', 'list', 'tuple' and 'dict', with 'coll_filter' you can \n control this behavior.\n \n Keyword Arguments:\n coll_filter (tuple): A tuple of Python types for which the :meth:`py_pal.data_collection.get_input_factor` function descends recursively. Passing an empty tuple might improve profiling results in use cases where non-standard data types (e.g. :class:`numpy.ndarray`) are used as arguments.\n \n Returns:\n int: proxy value\n "; static PyMethodDef __pyx_mdef_6py_pal_15data_collection_5proxy_1get_input_factor = {"get_input_factor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6py_pal_15data_collection_5proxy_1get_input_factor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6py_pal_15data_collection_5proxy_get_input_factor}; static PyObject *__pyx_pw_6py_pal_15data_collection_5proxy_1get_input_factor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_v_coll_filter = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_factor (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_coll_filter,0}; PyObject* values[2] = {0,0}; values[1] = __pyx_k_; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coll_filter); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_input_factor") < 0)) __PYX_ERR(0, 9, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_args = values[0]; __pyx_v_coll_filter = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_input_factor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 9, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("py_pal.data_collection.proxy.get_input_factor", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6py_pal_15data_collection_5proxy_get_input_factor(__pyx_self, __pyx_v_args, __pyx_v_coll_filter); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6py_pal_15data_collection_5proxy_get_input_factor(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args, PyObject *__pyx_v_coll_filter) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_factor", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.coll_filter = __pyx_v_coll_filter; __pyx_t_1 = __pyx_f_6py_pal_15data_collection_5proxy_get_input_factor(__pyx_v_args, 0, &__pyx_t_2); __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("py_pal.data_collection.proxy.get_input_factor", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __Pyx_INCREF(__pyx_v_6py_pal_15data_collection_5proxy_default_filter_types); __pyx_k_ = __pyx_v_6py_pal_15data_collection_5proxy_default_filter_types; __Pyx_GIVEREF(__pyx_v_6py_pal_15data_collection_5proxy_default_filter_types); __Pyx_INCREF(__pyx_v_6py_pal_15data_collection_5proxy_default_filter_types); __pyx_k_ = __pyx_v_6py_pal_15data_collection_5proxy_default_filter_types; __Pyx_GIVEREF(__pyx_v_6py_pal_15data_collection_5proxy_default_filter_types); /* … */ __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_s_args, __pyx_n_s_coll_filter); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6py_pal_15data_collection_5proxy_1get_input_factor, 0, __pyx_n_s_get_input_factor, NULL, __pyx_n_s_py_pal_data_collection_proxy, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_input_factor, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10: """Proxy for input arguments.
11:
12: It is used to infer complexity with the least squares algorithm. Therefore all returned values have to be positive
13: and greater than zero.
14:
15: If a collection of non-collection types is encountered, the elements of the collection are assigned the value 1.
16: If the collection contains other collections, :meth:`py_pal.data_collection.get_input_factor` is called recursively
17: to determine its value. By default this happens for 'set', 'list', 'tuple' and 'dict', with 'coll_filter' you can
18: control this behavior.
19:
20: Keyword Arguments:
21: coll_filter (tuple): A tuple of Python types for which the :meth:`py_pal.data_collection.get_input_factor` \
22: function descends recursively. Passing an empty tuple might improve profiling results in use cases where \
23: non-standard data types (e.g. :class:`numpy.ndarray`) are used as arguments.
24:
25: Returns:
26: int: proxy value
27: """
+28: if args is None or NULL or isinstance(args, type):
__pyx_t_2 = (__pyx_v_args == Py_None);
__pyx_t_3 = (__pyx_t_2 != 0);
if (!__pyx_t_3) {
} else {
__pyx_t_1 = __pyx_t_3;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_3 = PyType_Check(__pyx_v_args);
__pyx_t_2 = (__pyx_t_3 != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+29: return 0
__pyx_r = 0; goto __pyx_L0;
30:
+31: if isinstance(args, (int, float, complex, bool)):
__Pyx_INCREF(((PyObject*)&PyBool_Type)); __pyx_t_4 = ((PyObject*)&PyBool_Type); __pyx_t_2 = PyInt_Check(__pyx_v_args); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L7_bool_binop_done; } __pyx_t_3 = PyFloat_Check(__pyx_v_args); __pyx_t_2 = (__pyx_t_3 != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } __pyx_t_2 = PyComplex_Check(__pyx_v_args); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L7_bool_binop_done; } __pyx_t_3 = PyObject_IsInstance(__pyx_v_args, __pyx_t_4); __pyx_t_2 = (__pyx_t_3 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L7_bool_binop_done:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
32: # Return ``int`` value for numeric types.
+33: if isinstance(args, (int, float)):
__pyx_t_1 = PyInt_Check(__pyx_v_args); __pyx_t_3 = (__pyx_t_1 != 0); if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L12_bool_binop_done; } __pyx_t_3 = PyFloat_Check(__pyx_v_args); __pyx_t_1 = (__pyx_t_3 != 0); __pyx_t_2 = __pyx_t_1; __pyx_L12_bool_binop_done:; __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+34: return floor(abs(args))
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyNumber_Absolute(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_8; goto __pyx_L0;
35:
+36: if isinstance(args, complex):
__pyx_t_1 = PyComplex_Check(__pyx_v_args);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* … */
}
+37: return floor(abs(args.real))
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_args, __pyx_n_s_real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyNumber_Absolute(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_8; goto __pyx_L0;
38:
+39: return 1
__pyx_r = 1; goto __pyx_L0;
40:
+41: if isinstance(args, str):
__pyx_t_2 = PyString_Check(__pyx_v_args);
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* … */
}
+42: return len(args)
__pyx_t_8 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 42, __pyx_L1_error) __pyx_r = __pyx_t_8; goto __pyx_L0;
43:
+44: if PyObject_HasAttr(args, '__iter__'):
__pyx_t_1 = (PyObject_HasAttr(__pyx_v_args, __pyx_n_s_iter) != 0);
if (__pyx_t_1) {
/* … */
}
45: # Collections
+46: if PyObject_HasAttr(args, '__next__'):
__pyx_t_1 = (PyObject_HasAttr(__pyx_v_args, __pyx_n_s_next) != 0);
if (__pyx_t_1) {
/* … */
}
47: # Do not consume the original, try to create a copy.
+48: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L23_try_end; __pyx_L18_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L1_error; __pyx_L21_except_return:; __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L0; __pyx_L23_try_end:; }
+49: args = [deepcopy(args)]
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_v_args) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_args); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_5); __pyx_t_5 = 0;
+50: except (TypeError, RecursionError):
__Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RecursionError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_builtin_TypeError) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_7); __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; if (__pyx_t_12) { __Pyx_AddTraceback("py_pal.data_collection.proxy.get_input_factor", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L20_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5);
+51: return 1
__pyx_r = 1; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L21_except_return; } goto __pyx_L20_except_error; __pyx_L20_except_error:;
52:
+53: iterable = args
__Pyx_INCREF(__pyx_v_args);
__pyx_v_iterable = __pyx_v_args;
+54: if isinstance(args, dict):
__pyx_t_1 = PyDict_Check(__pyx_v_args);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* … */
}
+55: iterable = args.values()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_args, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_iterable, __pyx_t_5); __pyx_t_5 = 0;
56:
+57: value = 0
__pyx_v_value = 0;
+58: for argument in iterable:
if (likely(PyList_CheckExact(__pyx_v_iterable)) || PyTuple_CheckExact(__pyx_v_iterable)) { __pyx_t_5 = __pyx_v_iterable; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0; __pyx_t_13 = NULL; } else { __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_iterable); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_13 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_13)) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 58, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } __Pyx_XDECREF_SET(__pyx_v_argument, __pyx_t_4); __pyx_t_4 = 0; /* … */ __pyx_L27_continue:; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+59: if isinstance(argument, coll_filter) or (not coll_filter and PyObject_HasAttr(argument, '__iter__')):
__pyx_t_1 = PyObject_IsInstance(__pyx_v_argument, __pyx_v_coll_filter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 59, __pyx_L1_error) __pyx_t_3 = (__pyx_t_1 != 0); if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L30_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_coll_filter); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) __pyx_t_1 = ((!__pyx_t_3) != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L30_bool_binop_done; } __pyx_t_1 = (PyObject_HasAttr(__pyx_v_argument, __pyx_n_s_iter) != 0); __pyx_t_2 = __pyx_t_1; __pyx_L30_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+60: v = get_input_factor(argument, coll_filter)
__pyx_t_15.__pyx_n = 1; __pyx_t_15.coll_filter = __pyx_v_coll_filter; __pyx_t_14 = __pyx_f_6py_pal_15data_collection_5proxy_get_input_factor(__pyx_v_argument, 0, &__pyx_t_15); __pyx_v_v = __pyx_t_14;
+61: value += v
__pyx_v_value = (__pyx_v_value + __pyx_v_v);
+62: continue
goto __pyx_L27_continue;
+63: value += 1
__pyx_v_value = (__pyx_v_value + 1);
64:
+65: return value
__pyx_r = __pyx_v_value; goto __pyx_L0;
66:
+67: try:
{ /*try:*/ { /* … */ } __pyx_L33_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); goto __pyx_L1_error; __pyx_L37_try_return:; __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); goto __pyx_L0; __pyx_L36_except_return:; __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); goto __pyx_L0; }
68: # Memory size for complex objects
+69: return asizeof.asizeof(args)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asizeof); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L33_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asizeof); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 69, __pyx_L33_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_args) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_args); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L33_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L33_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_8; goto __pyx_L37_try_return;
+70: except ModuleNotFoundError:
__Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_7, &__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ModuleNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L35_except_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_ErrRestore(__pyx_t_5, __pyx_t_7, __pyx_t_4); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_4 = 0; if (__pyx_t_12) { __Pyx_AddTraceback("py_pal.data_collection.proxy.get_input_factor", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 70, __pyx_L35_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_5);
+71: return 0
__pyx_r = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L36_except_return; } goto __pyx_L35_except_error; __pyx_L35_except_error:;