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: metric.c
+01: from math import log, ceil
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_log); __Pyx_GIVEREF(__pyx_n_s_log); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_log); __Pyx_INCREF(__pyx_n_s_ceil); __Pyx_GIVEREF(__pyx_n_s_ceil); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ceil); __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, __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_log); 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_log, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ceil); 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_ceil, __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:
03: from cpython.genobject cimport PyGen_Check
04: from cpython.object cimport PyObject_HasAttr
05:
+06: cdef class CallMetric:
struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_CallMetric { Py_ssize_t (*value)(struct __pyx_obj_6py_pal_15data_collection_6metric_CallMetric *); }; static struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_CallMetric *__pyx_vtabptr_6py_pal_15data_collection_6metric_CallMetric;
07: """Average case complexities.
08:
09: Generally, 'n' is the number of elements currently in the container.
10: 'k' is either the value of a parameter or the number of elements in the parameter.
11:
12: As in: https://wiki.python.org/moin/TimeComplexity
13: """
14:
+15: def __init__(self, args, kwargs):
/* Python wrapper */ static int __pyx_pw_6py_pal_15data_collection_6metric_10CallMetric_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6py_pal_15data_collection_6metric_10CallMetric_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; PyObject* values[2] = {0,0}; 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 (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 15, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 15, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_args = values[0]; __pyx_v_kwargs = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 15, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("py_pal.data_collection.metric.CallMetric.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6py_pal_15data_collection_6metric_10CallMetric___init__(((struct __pyx_obj_6py_pal_15data_collection_6metric_CallMetric *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6py_pal_15data_collection_6metric_10CallMetric___init__(struct __pyx_obj_6py_pal_15data_collection_6metric_CallMetric *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+16: self.args = args
__Pyx_INCREF(__pyx_v_args); __Pyx_GIVEREF(__pyx_v_args); __Pyx_GOTREF(__pyx_v_self->args); __Pyx_DECREF(__pyx_v_self->args); __pyx_v_self->args = __pyx_v_args;
+17: self.kwargs = kwargs
__Pyx_INCREF(__pyx_v_kwargs); __Pyx_GIVEREF(__pyx_v_kwargs); __Pyx_GOTREF(__pyx_v_self->kwargs); __Pyx_DECREF(__pyx_v_self->kwargs); __pyx_v_self->kwargs = __pyx_v_kwargs;
18:
+19: cdef Py_ssize_t value(self) except -1:
static Py_ssize_t __pyx_f_6py_pal_15data_collection_6metric_10CallMetric_value(CYTHON_UNUSED struct __pyx_obj_6py_pal_15data_collection_6metric_CallMetric *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("value", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("py_pal.data_collection.metric.CallMetric.value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1L; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+20: raise NotImplementedError("Must be implemented by subclass.")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 20, __pyx_L1_error) /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Must_be_implemented_by_subclass); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
21:
+22: cdef class ArgsLengthLinear(CallMetric):
struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_ArgsLengthLinear { struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_CallMetric __pyx_base; }; static struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_ArgsLengthLinear *__pyx_vtabptr_6py_pal_15data_collection_6metric_ArgsLengthLinear;
+23: cdef Py_ssize_t value(self) except -1:
static Py_ssize_t __pyx_f_6py_pal_15data_collection_6metric_16ArgsLengthLinear_value(struct __pyx_obj_6py_pal_15data_collection_6metric_ArgsLengthLinear *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("value", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("py_pal.data_collection.metric.ArgsLengthLinear.value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1L; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+24: if all(map(lambda x: PyObject_HasAttr(x, '__iter__'), self.args)):
/* Python wrapper */ static PyObject *__pyx_pw_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ static PyMethodDef __pyx_mdef_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_lambda = {"lambda", (PyCFunction)__pyx_pw_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_lambda, METH_O, 0}; static PyObject *__pyx_pw_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_x)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(PyObject_HasAttr(__pyx_v_x, __pyx_n_s_iter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("py_pal.data_collection.metric.ArgsLengthLinear.value.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_lambda, 0, __pyx_n_s_ArgsLengthLinear_value_locals_la, NULL, __pyx_n_s_py_pal_data_collection_metric, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_INCREF(__pyx_v_self->__pyx_base.args); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.args); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->__pyx_base.args); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { /* … */ }
+25: return sum(map(lambda x: len([x]) if PyGen_Check(x) else len(x), self.args))
/* Python wrapper */ static PyObject *__pyx_pw_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_1lambda1(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ static PyMethodDef __pyx_mdef_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_1lambda1 = {"lambda1", (PyCFunction)__pyx_pw_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_1lambda1, METH_O, 0}; static PyObject *__pyx_pw_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_1lambda1(PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_x)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda1", 0); __Pyx_XDECREF(__pyx_r); if ((PyGen_Check(__pyx_v_x) != 0)) { __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_x); __pyx_t_3 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; } else { __pyx_t_3 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 25, __pyx_L1_error) __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("py_pal.data_collection.metric.ArgsLengthLinear.value.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6py_pal_15data_collection_6metric_16ArgsLengthLinear_5value_1lambda1, 0, __pyx_n_s_ArgsLengthLinear_value_locals_la, NULL, __pyx_n_s_py_pal_data_collection_metric, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self->__pyx_base.args); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.args); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->__pyx_base.args); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
+26: return len(self.args)
__pyx_t_1 = __pyx_v_self->__pyx_base.args; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
27:
+28: cdef class FirstArgLengthLogarithmic(CallMetric):
struct __pyx_obj_6py_pal_15data_collection_6metric_FirstArgLengthLogarithmic { struct __pyx_obj_6py_pal_15data_collection_6metric_CallMetric __pyx_base; }; /* … */ struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_FirstArgLengthLogarithmic { struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_CallMetric __pyx_base; }; static struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_FirstArgLengthLogarithmic *__pyx_vtabptr_6py_pal_15data_collection_6metric_FirstArgLengthLogarithmic;
29: """Expects a collection as first argument."""
+30: cdef Py_ssize_t value(self) except -1:
static Py_ssize_t __pyx_f_6py_pal_15data_collection_6metric_25FirstArgLengthLogarithmic_value(struct __pyx_obj_6py_pal_15data_collection_6metric_FirstArgLengthLogarithmic *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("value", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("py_pal.data_collection.metric.FirstArgLengthLogarithmic.value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1L; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+31: return ceil(log(len(self.args[0]), 2))
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ceil); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_int_2}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_int_2}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_int_2); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_6; goto __pyx_L0;
32:
+33: cdef class ArgsLinear(CallMetric):
struct __pyx_obj_6py_pal_15data_collection_6metric_ArgsLinear { struct __pyx_obj_6py_pal_15data_collection_6metric_CallMetric __pyx_base; }; /* … */ struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_ArgsLinear { struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_CallMetric __pyx_base; }; static struct __pyx_vtabstruct_6py_pal_15data_collection_6metric_ArgsLinear *__pyx_vtabptr_6py_pal_15data_collection_6metric_ArgsLinear;
+34: cdef Py_ssize_t value(self) except -1:
static Py_ssize_t __pyx_f_6py_pal_15data_collection_6metric_10ArgsLinear_value(struct __pyx_obj_6py_pal_15data_collection_6metric_ArgsLinear *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("value", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("py_pal.data_collection.metric.ArgsLinear.value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1L; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+35: return self.args[0]
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
36:
37:
+38: class AvgBuiltinFuncComplexity:
__pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_AvgBuiltinFuncComplexity, __pyx_n_s_AvgBuiltinFuncComplexity, (PyObject *) NULL, __pyx_n_s_py_pal_data_collection_metric, __pyx_kp_s_Map_of_Python_builtin_functions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* … */ __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_AvgBuiltinFuncComplexity, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_AvgBuiltinFuncComplexity, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
39: """Map of Python builtin functions to average case time-complexity. All complexity classes are based on the CPython
40: implementation. Unlisted functions are implicitly defined as constant."""
41:
42: mapping = {
+43: max.__qualname__: ArgsLengthLinear,
__pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_max, __pyx_n_s_qualname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_ptype_6py_pal_15data_collection_6metric_ArgsLengthLinear)) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+44: min.__qualname__: ArgsLengthLinear,
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_min, __pyx_n_s_qualname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_ptype_6py_pal_15data_collection_6metric_ArgsLengthLinear)) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+45: sorted.__qualname__: FirstArgLengthLogarithmic,
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_sorted, __pyx_n_s_qualname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_ptype_6py_pal_15data_collection_6metric_FirstArgLengthLogarithmic)) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_mapping, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
46: #Random.getrandbits.__qualname__: ArgsLinear,
47: #abs.__qualname__: Constant,
48: #all.__qualname__: Constant,
49: #any.__qualname__: Constant,
50: #ascii.__qualname__: Constant,
51: #bin.__qualname__: Constant,
52: #chr.__qualname__: Constant,
53: #delattr.__qualname__: Constant,
54: #divmod.__qualname__: Constant,
55: #format.__qualname__: Constant,
56: #getattr.__qualname__: Constant,
57: #hasattr.__qualname__: Constant,
58: #hash.__qualname__: Constant,
59: #hex.__qualname__: Constant,
60: #id.__qualname__: Constant,
61: #iter.__qualname__: Constant,
62: #len.__qualname__: Constant,
63: #oct.__qualname__: Constant,
64: #ord.__qualname__: Constant,
65: #pow.__qualname__: Constant,
66: #print.__qualname__: Constant,
67: #repr.__qualname__: Constant,
68: #round.__qualname__: Constant,
69: #setattr.__qualname__: Constant,
70: #sum.__qualname__: Constant,
71: #range.__qualname__: Range,
72: #reversed.__qualname__: FirstArgLengthLinear,
73: }