Generated by Cython 3.0.8
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: pattern_stream.cpp
+001: '''
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
002: This file is part of Prolothar-Process-Discovery (More Info: https://github.com/shs-it/prolothar-process-discovery).
003:
004: Prolothar-Process-Discovery is free software: you can redistribute it and/or modify
005: it under the terms of the GNU General Public License as published by
006: the Free Software Foundation, either version 3 of the License, or
007: (at your option) any later version.
008:
009: Prolothar-Process-Discovery is distributed in the hope that it will be useful,
010: but WITHOUT ANY WARRANTY; without even the implied warranty of
011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: GNU General Public License for more details.
013:
014: You should have received a copy of the GNU General Public License
015: along with Prolothar-Process-Discovery. If not, see <https://www.gnu.org/licenses/>.
016: '''
+017: from prolothar_process_discovery.discovery.proseqo.pattern_dfg import Pattern
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_Pattern); __Pyx_GIVEREF(__pyx_n_s_Pattern); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Pattern)) __PYX_ERR(0, 17, __pyx_L1_error); __pyx_t_3 = __Pyx_Import(__pyx_n_s_prolothar_process_discovery_disc, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Pattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Pattern, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+018: from typing import List, Dict, Tuple, FrozenSet
__pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_List); __Pyx_GIVEREF(__pyx_n_s_List); if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_List)) __PYX_ERR(0, 18, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_Dict)) __PYX_ERR(0, 18, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Tuple); __Pyx_GIVEREF(__pyx_n_s_Tuple); if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_Tuple)) __PYX_ERR(0, 18, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_FrozenSet); __Pyx_GIVEREF(__pyx_n_s_FrozenSet); if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_FrozenSet)) __PYX_ERR(0, 18, __pyx_L1_error); __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_FrozenSet); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FrozenSet, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+019: from prolothar_common import mdl_utils
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_mdl_utils); __Pyx_GIVEREF(__pyx_n_s_mdl_utils); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_mdl_utils)) __PYX_ERR(0, 19, __pyx_L1_error); __pyx_t_3 = __Pyx_Import(__pyx_n_s_prolothar_common, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_mdl_utils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_mdl_utils, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
020:
+021: cdef class PatternStream:
struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream { PyObject_HEAD struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_vtab; PyObject *_usage_per_pattern_conditional; int _store_patterns; PyObject *_pattern_sequence; PyObject *_PatternStream__pattern_sequence_cache; PyObject *_PatternStream__current_trace_cache; PyObject *_PatternStream__current_trace; }; struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream { struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *(*copy_counts_only)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_vtabptr_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream;
022: """pattern stream of cover, i.e. a stream of patterns that is used to
023: cover (= encode) a set of sequences"""
024:
025: cdef dict _usage_per_pattern_conditional
026: cdef bint _store_patterns
027: cdef list _pattern_sequence
028: cdef dict __pattern_sequence_cache
029: cdef list __current_trace_cache
030: cdef tuple __current_trace
031:
+032: def __init__(self, store_patterns=False):
/* Python wrapper */ static int __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream___init__, "creates a new pattern stream.\n\n Args:\n possible_patterns:\n A list of patterns that can be present in the pattern stream.\n this is needed to initialize the prequential codes to uniform\n probability.\n store_patterns:\n default is False. If true, the patterns in the\n stream are explicitly stored in memory when \"add\" is called.\n This is useful, if one really needs to know the sequence of the\n added patterns\n "); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream___init__; #endif static int __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_store_patterns = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_store_patterns,0}; PyObject* values[1] = {0}; values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_False)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_store_patterns); if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 32, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_store_patterns = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 32, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream___init__(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_store_patterns); /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream___init__(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_store_patterns) { int __pyx_r; /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
033: """creates a new pattern stream.
034:
035: Args:
036: possible_patterns:
037: A list of patterns that can be present in the pattern stream.
038: this is needed to initialize the prequential codes to uniform
039: probability.
040: store_patterns:
041: default is False. If true, the patterns in the
042: stream are explicitly stored in memory when "add" is called.
043: This is useful, if one really needs to know the sequence of the
044: added patterns
045: """
+046: self._usage_per_pattern_conditional = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_usage_per_pattern_conditional); __Pyx_DECREF(__pyx_v_self->_usage_per_pattern_conditional); __pyx_v_self->_usage_per_pattern_conditional = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+047: self._store_patterns = store_patterns
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_store_patterns); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) __pyx_v_self->_store_patterns = __pyx_t_2;
+048: self._pattern_sequence = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_pattern_sequence); __Pyx_DECREF(__pyx_v_self->_pattern_sequence); __pyx_v_self->_pattern_sequence = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+049: self.__pattern_sequence_cache = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_PatternStream__pattern_sequence_cache); __Pyx_DECREF(__pyx_v_self->_PatternStream__pattern_sequence_cache); __pyx_v_self->_PatternStream__pattern_sequence_cache = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
050:
+051: cpdef PatternStream copy_counts_only(self):
static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_copy_counts_only(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, int __pyx_skip_dispatch) { struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_copy = 0; PyObject *__pyx_v_copy_of_pattern_usage_dict = 0; PyObject *__pyx_v_context = NULL; PyObject *__pyx_v_pattern_usage_dict = NULL; PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_usage = NULL; struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_r = NULL; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_counts_only); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only)) { __Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream))))) __PYX_ERR(0, 51, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* 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_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.copy_counts_only", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_copy); __Pyx_XDECREF(__pyx_v_copy_of_pattern_usage_dict); __Pyx_XDECREF(__pyx_v_context); __Pyx_XDECREF(__pyx_v_pattern_usage_dict); __Pyx_XDECREF(__pyx_v_pattern); __Pyx_XDECREF(__pyx_v_usage); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_2copy_counts_only, "returns a copy of this stream. Only the counts are copied.\n All caches and any other information is not copied\n "); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only = {"copy_counts_only", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_2copy_counts_only}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy_counts_only (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy_counts_only", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_counts_only", 0))) return NULL; __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_2copy_counts_only(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_2copy_counts_only(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_copy_counts_only(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __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("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.copy_counts_only", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_copy_counts_only, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_copy_counts_only, __pyx_t_3) < 0) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_copy_counts_only, 51, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 51, __pyx_L1_error)
052: """returns a copy of this stream. Only the counts are copied.
053: All caches and any other information is not copied
054: """
+055: cdef PatternStream copy = PatternStream()
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_copy = ((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_t_1); __pyx_t_1 = 0;
056: cdef dict copy_of_pattern_usage_dict
+057: copy._usage_per_pattern_conditional = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_copy->_usage_per_pattern_conditional); __Pyx_DECREF(__pyx_v_copy->_usage_per_pattern_conditional); __pyx_v_copy->_usage_per_pattern_conditional = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+058: for context, pattern_usage_dict in self._usage_per_pattern_conditional.items():
__pyx_t_6 = 0; if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 58, __pyx_L1_error) } __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_self->_usage_per_pattern_conditional, 1, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_7, &__pyx_t_6, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_5); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_context, __pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_pattern_usage_dict, __pyx_t_3); __pyx_t_3 = 0;
+059: copy_of_pattern_usage_dict = {}
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_copy_of_pattern_usage_dict, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0;
+060: copy._usage_per_pattern_conditional[context] = copy_of_pattern_usage_dict
if (unlikely(__pyx_v_copy->_usage_per_pattern_conditional == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_copy->_usage_per_pattern_conditional, __pyx_v_context, __pyx_v_copy_of_pattern_usage_dict) < 0))) __PYX_ERR(0, 60, __pyx_L1_error)
+061: for pattern, usage in pattern_usage_dict.items():
__pyx_t_9 = 0; if (unlikely(__pyx_v_pattern_usage_dict == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 61, __pyx_L1_error) } __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_pattern_usage_dict, 0, __pyx_n_s_items, (&__pyx_t_10), (&__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_2; __pyx_t_2 = 0; while (1) { __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_10, &__pyx_t_9, &__pyx_t_2, &__pyx_t_4, NULL, __pyx_t_8); if (unlikely(__pyx_t_11 == 0)) break; if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_usage, __pyx_t_4); __pyx_t_4 = 0;
+062: copy_of_pattern_usage_dict[pattern] = usage
if (unlikely((PyDict_SetItem(__pyx_v_copy_of_pattern_usage_dict, __pyx_v_pattern, __pyx_v_usage) < 0))) __PYX_ERR(0, 62, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+063: return copy
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_copy); __pyx_r = __pyx_v_copy; goto __pyx_L0;
064:
+065: def add(self, pattern: Pattern, frozenset usable_pattern_activities,
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_4add, "adds a pattern code to this stream\n Args:\n pattern:\n the pattern that is used for encoding the data and is added\n to this stream. must be in the list of possible patterns that\n has been given to the constructor. otherwise the computed\n code length will be wrong.\n usable_pattern_activities:\n gives the activity names of all patterns that could have been\n used at this stage - inclusive the pattern that has been used\n add_to_cache:\n has only internal usage and should not be used by other classes\n "); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add = {"add", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_4add}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_pattern = 0; PyObject *__pyx_v_usable_pattern_activities = 0; PyObject *__pyx_v_add_to_cache = 0; PyObject *__pyx_v_count = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_usable_pattern_activities,&__pyx_n_s_add_to_cache,&__pyx_n_s_count,0}; PyObject* values[4] = {0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_4add(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_usable_pattern_activities, PyObject *__pyx_v_add_to_cache, PyObject *__pyx_v_count) { PyObject *__pyx_v_usage_per_pattern = 0; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_usage_per_pattern); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__8 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_pattern, __pyx_n_s_usable_pattern_activities, __pyx_n_s_add_to_cache, __pyx_n_s_count, __pyx_n_s_conditional, __pyx_n_s_usage_per_pattern); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_True); __Pyx_GIVEREF(Py_True); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_True)) __PYX_ERR(0, 65, __pyx_L1_error); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1)) __PYX_ERR(0, 65, __pyx_L1_error); __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pattern, __pyx_n_s_Pattern) < 0) __PYX_ERR(0, 65, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_add_to_cache, __pyx_n_s_bool) < 0) __PYX_ERR(0, 65, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_count, __pyx_n_s_int) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_add, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_add, __pyx_t_4) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_add, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 65, __pyx_L1_error)
+066: add_to_cache: bool = True, count: int = 1):
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_True)); values[3] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k_); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pattern)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usable_pattern_activities)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("add", 0, 2, 4, 1); __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_add_to_cache); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_count); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add") < 0)) __PYX_ERR(0, 65, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pattern = values[0]; __pyx_v_usable_pattern_activities = ((PyObject*)values[1]); __pyx_v_add_to_cache = values[2]; __pyx_v_count = ((PyObject*)values[3]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("add", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 65, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.add", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usable_pattern_activities), (&PyFrozenSet_Type), 1, "usable_pattern_activities", 1))) __PYX_ERR(0, 65, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_count), (&PyInt_Type), 0, "count", 1))) __PYX_ERR(0, 66, __pyx_L1_error) __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_4add(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_pattern, __pyx_v_usable_pattern_activities, __pyx_v_add_to_cache, __pyx_v_count); /* … */ if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_INCREF(__pyx_int_1); __pyx_k_ = ((PyObject*)__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); /* … */ if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 66, __pyx_L1_error)
067: """adds a pattern code to this stream
068: Args:
069: pattern:
070: the pattern that is used for encoding the data and is added
071: to this stream. must be in the list of possible patterns that
072: has been given to the constructor. otherwise the computed
073: code length will be wrong.
074: usable_pattern_activities:
075: gives the activity names of all patterns that could have been
076: used at this stage - inclusive the pattern that has been used
077: add_to_cache:
078: has only internal usage and should not be used by other classes
079: """
+080: if not usable_pattern_activities:
__pyx_t_1 = (__pyx_v_usable_pattern_activities != Py_None)&&(PySet_GET_SIZE(__pyx_v_usable_pattern_activities) != 0);
__pyx_t_2 = (!__pyx_t_1);
if (unlikely(__pyx_t_2)) {
/* … */
}
+081: raise ValueError('usable_pattern_activities must not be empty')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 81, __pyx_L1_error) /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_usable_pattern_activities_must_n); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2);
+082: if add_to_cache:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_add_to_cache); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 82, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+083: self.__current_trace_cache.append(
if (unlikely(__pyx_v_self->_PatternStream__current_trace_cache == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); __PYX_ERR(0, 83, __pyx_L1_error) } /* … */ __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_PatternStream__current_trace_cache, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+084: (pattern, usable_pattern_activities))
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pattern); __Pyx_GIVEREF(__pyx_v_pattern); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pattern)) __PYX_ERR(0, 84, __pyx_L1_error); __Pyx_INCREF(__pyx_v_usable_pattern_activities); __Pyx_GIVEREF(__pyx_v_usable_pattern_activities); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_usable_pattern_activities)) __PYX_ERR(0, 84, __pyx_L1_error);
+085: if self._store_patterns:
if (__pyx_v_self->_store_patterns) { /* … */ }
+086: self._pattern_sequence.append(pattern)
if (unlikely(__pyx_v_self->_pattern_sequence == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); __PYX_ERR(0, 86, __pyx_L1_error) } __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_pattern_sequence, __pyx_v_pattern); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error)
087: cdef frozenset conditional
+088: cdef dict usage_per_pattern = <dict>self._usage_per_pattern_conditional.get(usable_pattern_activities, None)
if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); __PYX_ERR(0, 88, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->_usage_per_pattern_conditional, __pyx_v_usable_pattern_activities, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_usage_per_pattern = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0;
+089: if usage_per_pattern is None:
__pyx_t_2 = (__pyx_v_usage_per_pattern == ((PyObject*)Py_None)); if (__pyx_t_2) { /* … */ }
+090: usage_per_pattern = dict.fromkeys(usable_pattern_activities, 0)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyDict_Type)), __pyx_n_s_fromkeys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_usable_pattern_activities, __pyx_int_0}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } if (!(likely(PyDict_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_5))) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_usage_per_pattern, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0;
+091: self._usage_per_pattern_conditional[usable_pattern_activities] = usage_per_pattern
if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 91, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_self->_usage_per_pattern_conditional, __pyx_v_usable_pattern_activities, __pyx_v_usage_per_pattern) < 0))) __PYX_ERR(0, 91, __pyx_L1_error)
+092: usage_per_pattern[pattern.get_activity_name()] += count
if (unlikely(__pyx_v_usage_per_pattern == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 92, __pyx_L1_error) } __Pyx_INCREF(__pyx_v_usage_per_pattern); __pyx_t_8 = __pyx_v_usage_per_pattern; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_get_activity_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } if (unlikely(__pyx_t_8 == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 92, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_v_count); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_8 == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 92, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_t_8, __pyx_t_5, __pyx_t_6) < 0))) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
093:
+094: def remove(self, pattern: Pattern, frozenset usable_pattern_activities,
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_6remove, "removes counts from this pattern stream"); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove = {"remove", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_6remove}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_pattern = 0; PyObject *__pyx_v_usable_pattern_activities = 0; PyObject *__pyx_v_count = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("remove (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_usable_pattern_activities,&__pyx_n_s_count,0}; PyObject* values[3] = {0,0,0}; values[2] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__3); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pattern)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usable_pattern_activities)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("remove", 0, 2, 3, 1); __PYX_ERR(0, 94, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_count); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "remove") < 0)) __PYX_ERR(0, 94, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pattern = values[0]; __pyx_v_usable_pattern_activities = ((PyObject*)values[1]); __pyx_v_count = ((PyObject*)values[2]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("remove", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 94, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.remove", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usable_pattern_activities), (&PyFrozenSet_Type), 1, "usable_pattern_activities", 1))) __PYX_ERR(0, 94, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_count), (&PyInt_Type), 0, "count", 1))) __PYX_ERR(0, 95, __pyx_L1_error) __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_6remove(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_pattern, __pyx_v_usable_pattern_activities, __pyx_v_count); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_6remove(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_usable_pattern_activities, PyObject *__pyx_v_count) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.remove", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__10 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_pattern, __pyx_n_s_usable_pattern_activities, __pyx_n_s_count); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1)) __PYX_ERR(0, 94, __pyx_L1_error); __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pattern, __pyx_n_s_Pattern) < 0) __PYX_ERR(0, 94, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_count, __pyx_n_s_int) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_remove, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_4); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_remove, __pyx_t_3) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_remove, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 94, __pyx_L1_error)
+095: count: int = 1):
if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_INCREF(__pyx_int_1); __pyx_k__3 = ((PyObject*)__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); /* … */ if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 95, __pyx_L1_error)
096: """removes counts from this pattern stream"""
+097: self._usage_per_pattern_conditional[
if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 97, __pyx_L1_error) } /* … */ __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_usage_per_pattern_conditional, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+098: frozenset(usable_pattern_activities)][
__pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_v_usable_pattern_activities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_4) < 0))) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+099: pattern.get_activity_name()] -= count
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_get_activity_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; }
100:
+101: def remove_pattern_from_context(
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context = {"remove_pattern_from_context", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_context = 0; PyObject *__pyx_v_pattern = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("remove_pattern_from_context (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_pattern,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_context)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pattern)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("remove_pattern_from_context", 1, 2, 2, 1); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "remove_pattern_from_context") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_context = ((PyObject*)values[0]); __pyx_v_pattern = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("remove_pattern_from_context", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.remove_pattern_from_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), (&PyFrozenSet_Type), 1, "context", 1))) __PYX_ERR(0, 102, __pyx_L1_error) __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_8remove_pattern_from_context(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_context, __pyx_v_pattern); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_8remove_pattern_from_context(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_context, PyObject *__pyx_v_pattern) { PyObject *__pyx_v_pattern_count_dict = NULL; PyObject *__pyx_v_new_context = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.remove_pattern_from_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pattern_count_dict); __Pyx_XDECREF(__pyx_v_new_context); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__12 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_context, __pyx_n_s_pattern, __pyx_n_s_pattern_count_dict, __pyx_n_s_new_context); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pattern, __pyx_n_s_Pattern) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_remove_pattern_fro, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_remove_pattern_from_context, __pyx_t_2) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_remove_pattern_from_context, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 101, __pyx_L1_error)
102: self, frozenset context, pattern: Pattern):
+103: pattern_count_dict = self._usage_per_pattern_conditional.pop(context)
if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop"); __PYX_ERR(0, 103, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_self->_usage_per_pattern_conditional, __pyx_v_context, ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_pattern_count_dict = __pyx_t_1; __pyx_t_1 = 0;
+104: pattern_count_dict.pop(pattern.get_activity_name())
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern_count_dict, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_get_activity_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(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_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __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, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+105: new_context = context.difference([pattern.get_activity_name()])
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_get_activity_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyFrozenSet_Type_difference, __pyx_v_context, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_new_context = __pyx_t_1; __pyx_t_1 = 0;
+106: self._usage_per_pattern_conditional[new_context] = pattern_count_dict
if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 106, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_self->_usage_per_pattern_conditional, __pyx_v_new_context, __pyx_v_pattern_count_dict) < 0))) __PYX_ERR(0, 106, __pyx_L1_error)
107:
+108: def get_code_length(self, verbose=False) -> float:
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_11get_code_length(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_10get_code_length, "\n Returns:\n the encoded length of this pattern stream\n "); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_11get_code_length = {"get_code_length", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_11get_code_length, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_10get_code_length}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_11get_code_length(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_verbose = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_code_length (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_verbose,0}; PyObject* values[1] = {0}; values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_verbose); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_code_length") < 0)) __PYX_ERR(0, 108, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_verbose = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_code_length", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.get_code_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_10get_code_length(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_verbose); /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_10get_code_length(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_verbose) { PyObject *__pyx_v_code_length = NULL; PyObject *__pyx_v_pattern_counter = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.get_code_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_code_length); __Pyx_XDECREF(__pyx_v_pattern_counter); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__14 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_verbose, __pyx_n_s_code_length, __pyx_n_s_pattern_counter); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_get_code_length, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 108, __pyx_L1_error) /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_float) < 0) __PYX_ERR(0, 108, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_11get_code_length, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_get_code_length, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__16); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_get_code_length, __pyx_t_3) < 0) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_tuple__16 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16);
109: """
110: Returns:
111: the encoded length of this pattern stream
112: """
+113: code_length = 0.0
__Pyx_INCREF(__pyx_float_0_0);
__pyx_v_code_length = __pyx_float_0_0;
114:
+115: for pattern_counter in self._usage_per_pattern_conditional.values():
__pyx_t_2 = 0; if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values"); __PYX_ERR(0, 115, __pyx_L1_error) } __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_usage_per_pattern_conditional, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; while (1) { __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4); if (unlikely(__pyx_t_6 == 0)) break; if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_pattern_counter, __pyx_t_5); __pyx_t_5 = 0;
+116: code_length += mdl_utils.prequential_coding_length(pattern_counter)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_mdl_utils); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_prequential_coding_length); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_pattern_counter}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_code_length, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_code_length, __pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
117:
+118: if verbose:
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_verbose); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 118, __pyx_L1_error) if (__pyx_t_9) { /* … */ }
+119: print('encoded length of pattern stream: %.2f' % code_length)
__pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_encoded_length_of_pattern_stream, __pyx_v_code_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
120:
+121: return code_length
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_code_length); __pyx_r = __pyx_v_code_length; goto __pyx_L0;
122:
+123: def get_sequence_of_added_patterns(self) -> List[Pattern]:
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_13get_sequence_of_added_patterns(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_12get_sequence_of_added_patterns, "returns a list with all patterns added to the stream. the order\n is the same as they have been added to stream. if a patterns has been\n added multiple times to the stream it will occur multiple times in this\n list.\n\n Raises:\n ValueError:\n if the pattern stream was not iniatialized with\n \"store_patterns=True\"\n "); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_13get_sequence_of_added_patterns = {"get_sequence_of_added_patterns", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_13get_sequence_of_added_patterns, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_12get_sequence_of_added_patterns}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_13get_sequence_of_added_patterns(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_sequence_of_added_patterns (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_sequence_of_added_patterns", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "get_sequence_of_added_patterns", 0))) return NULL; __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_12get_sequence_of_added_patterns(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_12get_sequence_of_added_patterns(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.get_sequence_of_added_patterns", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_List_Pattern) < 0) __PYX_ERR(0, 123, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_13get_sequence_of_added_patterns, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_get_sequence_of_ad, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_get_sequence_of_added_patterns, __pyx_t_2) < 0) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); /* … */ __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_get_sequence_of_added_patterns, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 123, __pyx_L1_error)
124: """returns a list with all patterns added to the stream. the order
125: is the same as they have been added to stream. if a patterns has been
126: added multiple times to the stream it will occur multiple times in this
127: list.
128:
129: Raises:
130: ValueError:
131: if the pattern stream was not iniatialized with
132: "store_patterns=True"
133: """
+134: if not self._store_patterns:
__pyx_t_1 = (!__pyx_v_self->_store_patterns); if (unlikely(__pyx_t_1)) { /* … */ }
+135: raise ValueError()
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_ValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 135, __pyx_L1_error)
+136: return self._pattern_sequence
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_pattern_sequence); __pyx_r = __pyx_v_self->_pattern_sequence; goto __pyx_L0;
137:
+138: def get_usage_per_pattern(self) -> Dict[str, int]:
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_15get_usage_per_pattern(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_14get_usage_per_pattern, "returns a dict with activity name => total usage"); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_15get_usage_per_pattern = {"get_usage_per_pattern", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_15get_usage_per_pattern, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_14get_usage_per_pattern}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_15get_usage_per_pattern(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_usage_per_pattern (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_usage_per_pattern", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "get_usage_per_pattern", 0))) return NULL; __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_14get_usage_per_pattern(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_14get_usage_per_pattern(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self) { PyObject *__pyx_v_usage_per_pattern = 0; PyObject *__pyx_v_pattern_usage_dict = NULL; PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_usage = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.get_usage_per_pattern", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_usage_per_pattern); __Pyx_XDECREF(__pyx_v_pattern_usage_dict); __Pyx_XDECREF(__pyx_v_pattern); __Pyx_XDECREF(__pyx_v_usage); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__18 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_usage_per_pattern, __pyx_n_s_pattern_usage_dict, __pyx_n_s_pattern, __pyx_n_s_usage); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Dict_str_int) < 0) __PYX_ERR(0, 138, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_15get_usage_per_pattern, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_get_usage_per_patt, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_get_usage_per_pattern, __pyx_t_3) < 0) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_get_usage_per_pattern, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 138, __pyx_L1_error)
139: """returns a dict with activity name => total usage"""
+140: cdef dict usage_per_pattern = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_usage_per_pattern = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+141: for pattern_usage_dict in self._usage_per_pattern_conditional.values():
__pyx_t_2 = 0; if (unlikely(__pyx_v_self->_usage_per_pattern_conditional == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values"); __PYX_ERR(0, 141, __pyx_L1_error) } __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_usage_per_pattern_conditional, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; while (1) { __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4); if (unlikely(__pyx_t_6 == 0)) break; if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_pattern_usage_dict, __pyx_t_5); __pyx_t_5 = 0;
+142: for pattern, usage in pattern_usage_dict.items():
__pyx_t_7 = 0; if (unlikely(__pyx_v_pattern_usage_dict == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 142, __pyx_L1_error) } __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_pattern_usage_dict, 0, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_6)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_9; __pyx_t_9 = 0; while (1) { __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_8, &__pyx_t_7, &__pyx_t_9, &__pyx_t_10, NULL, __pyx_t_6); if (unlikely(__pyx_t_11 == 0)) break; if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_usage, __pyx_t_10); __pyx_t_10 = 0;
+143: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L14_try_end; __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); goto __pyx_L1_error; __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); __pyx_L14_try_end:; } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+144: usage_per_pattern[pattern] += usage
__Pyx_INCREF(__pyx_v_pattern); __pyx_t_10 = __pyx_v_pattern; __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_usage_per_pattern, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_t_9, __pyx_v_usage); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 144, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely((PyDict_SetItem(__pyx_v_usage_per_pattern, __pyx_t_10, __pyx_t_15) < 0))) __PYX_ERR(0, 144, __pyx_L7_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+145: except KeyError:
__pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_11) { __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.get_usage_per_pattern", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_15, &__pyx_t_9) < 0) __PYX_ERR(0, 145, __pyx_L9_except_error) __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_9);
+146: usage_per_pattern[pattern] = usage
if (unlikely((PyDict_SetItem(__pyx_v_usage_per_pattern, __pyx_v_pattern, __pyx_v_usage) < 0))) __PYX_ERR(0, 146, __pyx_L9_except_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L8_exception_handled; } goto __pyx_L9_except_error;
+147: return usage_per_pattern
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_usage_per_pattern); __pyx_r = __pyx_v_usage_per_pattern; goto __pyx_L0;
148:
+149: def get_conditional_usage_per_pattern(
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_17get_conditional_usage_per_pattern(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_16get_conditional_usage_per_pattern, "returns a nested dictionary (alternative patterns) -> pattern -> count\n "); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_17get_conditional_usage_per_pattern = {"get_conditional_usage_per_pattern", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_17get_conditional_usage_per_pattern, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_16get_conditional_usage_per_pattern}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_17get_conditional_usage_per_pattern(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_conditional_usage_per_pattern (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_conditional_usage_per_pattern", 1, 0, 0, __pyx_nargs); return NULL;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "get_conditional_usage_per_pattern", 0))) return NULL; __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_16get_conditional_usage_per_pattern(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_16get_conditional_usage_per_pattern(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_Dict_FrozenSet_str_Dict_str_int) < 0) __PYX_ERR(0, 149, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_17get_conditional_usage_per_pattern, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_get_conditional_us, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_get_conditional_usage_per_patter, __pyx_t_2) < 0) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); /* … */ __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_get_conditional_usage_per_patter, 149, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 149, __pyx_L1_error)
150: self) -> Dict[FrozenSet[str], Dict[str, int]]:
151: """returns a nested dictionary (alternative patterns) -> pattern -> count
152: """
+153: return self._usage_per_pattern_conditional
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_usage_per_pattern_conditional); __pyx_r = __pyx_v_self->_usage_per_pattern_conditional; goto __pyx_L0;
154:
+155: def start_trace_covering(self, trace: Tuple[str]):
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_18start_trace_covering, "signal that now the given trace starts to get covered"); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering = {"start_trace_covering", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_18start_trace_covering}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_trace = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start_trace_covering (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trace,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_trace)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "start_trace_covering") < 0)) __PYX_ERR(0, 155, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_trace = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("start_trace_covering", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 155, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.start_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trace), (&PyTuple_Type), 0, "trace", 1))) __PYX_ERR(0, 155, __pyx_L1_error) __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_18start_trace_covering(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_trace); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_18start_trace_covering(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_trace) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.start_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_trace); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_trace, __pyx_kp_s_Tuple_str) < 0) __PYX_ERR(0, 155, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_start_trace_coveri, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_start_trace_covering, __pyx_t_3) < 0) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_start_trace_covering, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 155, __pyx_L1_error)
156: """signal that now the given trace starts to get covered"""
+157: self.__current_trace = trace
__Pyx_INCREF(__pyx_v_trace); __Pyx_GIVEREF(__pyx_v_trace); __Pyx_GOTREF(__pyx_v_self->_PatternStream__current_trace); __Pyx_DECREF(__pyx_v_self->_PatternStream__current_trace); __pyx_v_self->_PatternStream__current_trace = __pyx_v_trace;
+158: self.__current_trace_cache = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_PatternStream__current_trace_cache); __Pyx_DECREF(__pyx_v_self->_PatternStream__current_trace_cache); __pyx_v_self->_PatternStream__current_trace_cache = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+159: self.__pattern_sequence_cache[self.__current_trace] = self.__current_trace_cache
__pyx_t_1 = __pyx_v_self->_PatternStream__current_trace_cache; __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_v_self->_PatternStream__pattern_sequence_cache == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 159, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_self->_PatternStream__pattern_sequence_cache, __pyx_v_self->_PatternStream__current_trace, __pyx_t_1) < 0))) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
160:
+161: def end_trace_covering(self, trace: Tuple[str]):
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_20end_trace_covering, "signal that now the given trace is get covered"); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering = {"end_trace_covering", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_20end_trace_covering}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { CYTHON_UNUSED PyObject *__pyx_v_trace = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("end_trace_covering (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trace,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_trace)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "end_trace_covering") < 0)) __PYX_ERR(0, 161, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_trace = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("end_trace_covering", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 161, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.end_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trace), (&PyTuple_Type), 0, "trace", 1))) __PYX_ERR(0, 161, __pyx_L1_error) __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_20end_trace_covering(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_trace); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_20end_trace_covering(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_trace) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_trace, __pyx_kp_s_Tuple_str) < 0) __PYX_ERR(0, 161, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_end_trace_covering, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_end_trace_covering, __pyx_t_2) < 0) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); /* … */ __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_end_trace_covering, 161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 161, __pyx_L1_error)
162: """signal that now the given trace is get covered"""
+163: self.__current_trace = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_PatternStream__current_trace); __Pyx_DECREF(__pyx_v_self->_PatternStream__current_trace); __pyx_v_self->_PatternStream__current_trace = ((PyObject*)Py_None);
+164: self.__current_trace_cache = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_PatternStream__current_trace_cache); __Pyx_DECREF(__pyx_v_self->_PatternStream__current_trace_cache); __pyx_v_self->_PatternStream__current_trace_cache = ((PyObject*)Py_None);
165:
+166: def use_cache_to_cover_trace(self, trace: Tuple[str]):
/* Python wrapper */ static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_22use_cache_to_cover_trace, "repeats the addition of codes as it is stored in a cache for the\n same sequence of activities as the given trace"); static PyMethodDef __pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace = {"use_cache_to_cover_trace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_22use_cache_to_cover_trace}; static PyObject *__pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_trace = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("use_cache_to_cover_trace (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trace,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_trace)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "use_cache_to_cover_trace") < 0)) __PYX_ERR(0, 166, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_trace = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("use_cache_to_cover_trace", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 166, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.use_cache_to_cover_trace", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trace), (&PyTuple_Type), 0, "trace", 1))) __PYX_ERR(0, 166, __pyx_L1_error) __pyx_r = __pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_22use_cache_to_cover_trace(((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self), __pyx_v_trace); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_22use_cache_to_cover_trace(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_trace) { PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_usable_pattern_activities = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.use_cache_to_cover_trace", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pattern); __Pyx_XDECREF(__pyx_v_usable_pattern_activities); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__24 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_trace, __pyx_n_s_pattern, __pyx_n_s_usable_pattern_activities); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_trace, __pyx_kp_s_Tuple_str) < 0) __PYX_ERR(0, 166, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PatternStream_use_cache_to_cover, NULL, __pyx_n_s_prolothar_process_discovery_disc_3, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_n_s_use_cache_to_cover_trace, __pyx_t_3) < 0) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_prolothar_process_discovery_disc_2, __pyx_n_s_use_cache_to_cover_trace, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 166, __pyx_L1_error)
167: """repeats the addition of codes as it is stored in a cache for the
168: same sequence of activities as the given trace"""
+169: for pattern, usable_pattern_activities in self.__pattern_sequence_cache[trace]:
if (unlikely(__pyx_v_self->_PatternStream__pattern_sequence_cache == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 169, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->_PatternStream__pattern_sequence_cache, __pyx_v_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 169, __pyx_L1_error) #endif if (__pyx_t_3 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 169, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 169, __pyx_L1_error) #endif if (__pyx_t_3 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 169, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 169, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 169, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 169, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 169, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF_SET(__pyx_v_usable_pattern_activities, __pyx_t_6); __pyx_t_6 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+170: self.add(pattern, usable_pattern_activities, add_to_cache=False)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_pattern); __Pyx_GIVEREF(__pyx_v_pattern); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_pattern)) __PYX_ERR(0, 170, __pyx_L1_error); __Pyx_INCREF(__pyx_v_usable_pattern_activities); __Pyx_GIVEREF(__pyx_v_usable_pattern_activities); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_usable_pattern_activities)) __PYX_ERR(0, 170, __pyx_L1_error); __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_add_to_cache, Py_False) < 0) __PYX_ERR(0, 170, __pyx_L1_error) __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;