Generated by Cython 3.1.2

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_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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.pattern cimport Pattern
+018: from typing import List, Dict, FrozenSet
  __pyx_t_2 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_List, __pyx_mstate_global->__pyx_n_u_Dict, __pyx_mstate_global->__pyx_n_u_FrozenSet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __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_mstate_global->__pyx_n_u_List); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_List, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Dict, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_FrozenSet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_FrozenSet, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 019: from prolothar_common cimport mdl_utils
 020: 
+021: cdef class PatternStream:
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);
  PyObject *(*add)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_add *__pyx_optional_args);
  PyObject *(*remove)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_remove *__pyx_optional_args);
  PyObject *(*remove_pattern_from_context)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, PyObject *, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *, int __pyx_skip_dispatch);
  float (*get_code_length)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, int __pyx_skip_dispatch, struct __pyx_opt_args_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_get_code_length *__pyx_optional_args);
  PyObject *(*start_trace_covering)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*end_trace_covering)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*use_cache_to_cover_trace)(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *, PyObject *, 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:     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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_store_patterns,0};
  PyObject* values[1] = {0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 25, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 25, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 25, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 25, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __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, 25, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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 */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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;
}
 026:         """creates a new pattern stream.
 027: 
 028:         Args:
 029:             possible_patterns:
 030:                 A list of patterns that can be present in the pattern stream.
 031:                 this is needed to initialize the prequential codes to uniform
 032:                 probability.
 033:             store_patterns:
 034:                 default is False. If true, the patterns in the
 035:                 stream are explicitly stored in memory when "add" is called.
 036:                 This is useful, if one really needs to know the sequence of the
 037:                 added patterns
 038:         """
+039:         self._usage_per_pattern_conditional = {}
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __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;
+040:         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, 40, __pyx_L1_error)
  __pyx_v_self->_store_patterns = __pyx_t_2;
+041:         self._pattern_sequence = []
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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;
+042:         self.__pattern_sequence_cache = {}
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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;
 043: 
+044:     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 (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_copy_counts_only); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only)) {
        __Pyx_XDECREF((PyObject *)__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream))))) __PYX_ERR(0, 44, __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(*)(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_SIZE
  __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; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy_counts_only", __pyx_kwds); 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, 44, __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_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_3copy_counts_only, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_copy_counts_only, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_copy_counts_only, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 045:         """returns a copy of this stream. Only the counts are copied.
 046:         All caches and any other information is not copied
 047:         """
+048:         cdef PatternStream copy = PatternStream()
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream);
  __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream); 
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__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;
 049:         cdef dict copy_of_pattern_usage_dict
+050:         copy._usage_per_pattern_conditional = {}
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __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;
+051:         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, 51, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_self->_usage_per_pattern_conditional, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_4;
  __pyx_t_4 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_7, &__pyx_t_6, &__pyx_t_4, &__pyx_t_2, NULL, __pyx_t_8);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_context, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_pattern_usage_dict, __pyx_t_2);
    __pyx_t_2 = 0;
+052:             copy_of_pattern_usage_dict = {}
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_copy_of_pattern_usage_dict, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
+053:             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, 53, __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, 53, __pyx_L1_error)
+054:             for pattern, usage in (<dict>pattern_usage_dict).items():
    __pyx_t_10 = 0;
    if (unlikely(__pyx_v_pattern_usage_dict == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 54, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_dict_iterator(((PyObject*)__pyx_v_pattern_usage_dict), 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
    while (1) {
      __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_11, &__pyx_t_10, &__pyx_t_4, &__pyx_t_3, NULL, __pyx_t_9);
      if (unlikely(__pyx_t_12 == 0)) break;
      if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 54, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_usage, __pyx_t_3);
      __pyx_t_3 = 0;
+055:                 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, 55, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+056:         return copy
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_copy);
  __pyx_r = __pyx_v_copy;
  goto __pyx_L0;
 057: 
+058:     cpdef add(self, Pattern pattern, frozenset usable_pattern_activities,
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*/
static PyObject *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_add(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern, PyObject *__pyx_v_usable_pattern_activities, int __pyx_skip_dispatch, struct __pyx_opt_args_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_add *__pyx_optional_args) {
/* … */
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_add_to_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_count); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[5] = {__pyx_t_3, ((PyObject *)__pyx_v_pattern), __pyx_v_usable_pattern_activities, __pyx_t_5, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (5-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __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_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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_usage_per_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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
) {
  struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern = 0;
  PyObject *__pyx_v_usable_pattern_activities = 0;
  int __pyx_v_add_to_cache;
  int __pyx_v_count;
  #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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pattern,&__pyx_mstate_global->__pyx_n_u_usable_pattern_activities,&__pyx_mstate_global->__pyx_n_u_add_to_cache,&__pyx_mstate_global->__pyx_n_u_count,0};
  PyObject* values[4] = {0,0,0,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 58, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 58, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 58, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 58, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 58, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add", 0) < 0) __PYX_ERR(0, 58, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 0, 2, 4, i); __PYX_ERR(0, 58, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 58, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 58, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 58, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 58, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)values[0]);
    __pyx_v_usable_pattern_activities = ((PyObject*)values[1]);
    if (values[2]) {
      __pyx_v_add_to_cache = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_add_to_cache == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
    } else {
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern, PyObject *__pyx_v_usable_pattern_activities, int __pyx_v_add_to_cache, int __pyx_v_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.add_to_cache = __pyx_v_add_to_cache;
  __pyx_t_2.count = __pyx_v_count;
  __pyx_t_1 = __pyx_vtabptr_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream->add(__pyx_v_self, __pyx_v_pattern, __pyx_v_usable_pattern_activities, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __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.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_5add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_add, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[1]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_3) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, Py_True, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
+059:             bint add_to_cache = True, int count = 1):
  int __pyx_v_add_to_cache = ((int)1);
  int __pyx_v_count = ((int)1);
  PyObject *__pyx_v_usage_per_pattern = 0;
  PyObject *__pyx_r = NULL;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_add_to_cache = __pyx_optional_args->add_to_cache;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_count = __pyx_optional_args->count;
      }
    }
  }
/* … */
      __pyx_v_add_to_cache = ((int)1);
    }
    if (values[3]) {
      __pyx_v_count = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
    } else {
      __pyx_v_count = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 58, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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_pattern), __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern, 1, "pattern", 0))) __PYX_ERR(0, 58, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usable_pattern_activities), (&PyFrozenSet_Type), 1, "usable_pattern_activities", 1))) __PYX_ERR(0, 58, __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);
 060:         """adds a pattern code to this stream
 061:         Args:
 062:             pattern:
 063:                 the pattern that is used for encoding the data and is added
 064:                 to this stream. must be in the list of possible patterns that
 065:                 has been given to the constructor. otherwise the computed
 066:                 code length will be wrong.
 067:             usable_pattern_activities:
 068:                 gives the activity names of all patterns that could have been
 069:                 used at this stage - inclusive the pattern that has been used
 070:             add_to_cache:
 071:                 has only internal usage and should not be used by other classes
 072:         """
+073:         if not usable_pattern_activities:
  __pyx_t_8 = (__pyx_v_usable_pattern_activities != Py_None)&&(__Pyx_PySet_GET_SIZE(__pyx_v_usable_pattern_activities) != 0);
  if (unlikely(((!CYTHON_ASSUME_SAFE_MACROS) && __pyx_t_8 < 0))) __PYX_ERR(0, 73, __pyx_L1_error)
  __pyx_t_9 = (!__pyx_t_8);
  if (unlikely(__pyx_t_9)) {
/* … */
  }
+074:             raise ValueError('usable_pattern_activities must not be empty')
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_usable_pattern_activities_must_n};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 74, __pyx_L1_error)
+075:         if add_to_cache:
  if (__pyx_v_add_to_cache) {
/* … */
  }
+076:             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, 76, __pyx_L1_error)
    }
/* … */
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_self->_PatternStream__current_trace_cache, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 76, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+077:                     (pattern, usable_pattern_activities))
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF((PyObject *)__pyx_v_pattern);
    __Pyx_GIVEREF((PyObject *)__pyx_v_pattern);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_pattern)) != (0)) __PYX_ERR(0, 77, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_usable_pattern_activities);
    __Pyx_GIVEREF(__pyx_v_usable_pattern_activities);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_usable_pattern_activities) != (0)) __PYX_ERR(0, 77, __pyx_L1_error);
+078:         if self._store_patterns:
  if (__pyx_v_self->_store_patterns) {
/* … */
  }
+079:             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, 79, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_self->_pattern_sequence, ((PyObject *)__pyx_v_pattern)); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 79, __pyx_L1_error)
 080:         cdef frozenset conditional
+081:         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, 81, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->_usage_per_pattern_conditional, __pyx_v_usable_pattern_activities, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_usage_per_pattern = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
+082:         if usage_per_pattern is None:
  __pyx_t_9 = (__pyx_v_usage_per_pattern == ((PyObject*)Py_None));
  if (__pyx_t_9) {
/* … */
  }
+083:             usage_per_pattern = dict.fromkeys(usable_pattern_activities, 0)
    __pyx_t_1 = ((PyObject *)(&PyDict_Type));
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_usable_pattern_activities, __pyx_mstate_global->__pyx_int_0};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_fromkeys, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_4))) __PYX_ERR(0, 83, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_usage_per_pattern, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
+084:             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, 84, __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, 84, __pyx_L1_error)
+085:         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, 85, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_usage_per_pattern);
  __pyx_t_11 = __pyx_v_usage_per_pattern;
  __pyx_t_4 = ((struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)__pyx_v_pattern->__pyx_vtab)->get_activity_name(__pyx_v_pattern, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (unlikely(__pyx_t_11 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 85, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_11 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 85, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_t_11, __pyx_t_4, __pyx_t_6) < 0))) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
 086: 
+087:     cpdef remove(self, Pattern pattern, frozenset usable_pattern_activities,
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*/
static PyObject *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_remove(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern, PyObject *__pyx_v_usable_pattern_activities, int __pyx_skip_dispatch, struct __pyx_opt_args_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_remove *__pyx_optional_args) {
  int __pyx_v_count = ((int)1);
  PyObject *__pyx_r = NULL;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_count = __pyx_optional_args->count;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_remove); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_3, ((PyObject *)__pyx_v_pattern), __pyx_v_usable_pattern_activities, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __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_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", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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
) {
  struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern = 0;
  PyObject *__pyx_v_usable_pattern_activities = 0;
  int __pyx_v_count;
  #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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pattern,&__pyx_mstate_global->__pyx_n_u_usable_pattern_activities,&__pyx_mstate_global->__pyx_n_u_count,0};
  PyObject* values[3] = {0,0,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 87, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 87, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 87, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 87, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "remove", 0) < 0) __PYX_ERR(0, 87, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove", 0, 2, 3, i); __PYX_ERR(0, 87, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 87, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 87, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 87, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)values[0]);
    __pyx_v_usable_pattern_activities = ((PyObject*)values[1]);
    if (values[2]) {
      __pyx_v_count = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L3_error)
    } else {
      __pyx_v_count = ((int)1);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 87, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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_pattern), __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern, 1, "pattern", 0))) __PYX_ERR(0, 87, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usable_pattern_activities), (&PyFrozenSet_Type), 1, "usable_pattern_activities", 1))) __PYX_ERR(0, 87, __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;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern, PyObject *__pyx_v_usable_pattern_activities, int __pyx_v_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.count = __pyx_v_count;
  __pyx_t_1 = __pyx_vtabptr_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream->remove(__pyx_v_self, __pyx_v_pattern, __pyx_v_usable_pattern_activities, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __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.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_7remove, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_remove, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[2]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_remove, __pyx_t_3) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
 088:                  int count = 1):
 089:         """removes counts from this pattern stream"""
+090:         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, 90, __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, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+091:                 frozenset(usable_pattern_activities)][
  __pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_v_usable_pattern_activities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
/* … */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
/* … */
  __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_3) < 0))) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+092:                         pattern.get_activity_name()] -= count
  __pyx_t_1 = ((struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)__pyx_v_pattern->__pyx_vtab)->get_activity_name(__pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
/* … */
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
 093: 
+094:     cpdef remove_pattern_from_context(
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 PyObject *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_remove_pattern_from_context(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_context, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_pattern_count_dict = 0;
  PyObject *__pyx_v_new_context = NULL;
  PyObject *__pyx_r = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_remove_pattern_from_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_context, ((PyObject *)__pyx_v_pattern)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __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_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_pattern_from_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pattern_count_dict);
  __Pyx_XDECREF(__pyx_v_new_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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;
  struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_context,&__pyx_mstate_global->__pyx_n_u_pattern,0};
  PyObject* values[2] = {0,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 94, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 94, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 94, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "remove_pattern_from_context", 0) < 0) __PYX_ERR(0, 94, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove_pattern_from_context", 1, 2, 2, i); __PYX_ERR(0, 94, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 94, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 94, __pyx_L3_error)
    }
    __pyx_v_context = ((PyObject*)values[0]);
    __pyx_v_pattern = ((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_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, 94, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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, 95, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern, 1, "pattern", 0))) __PYX_ERR(0, 95, __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;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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, struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_remove_pattern_from_context(__pyx_v_self, __pyx_v_context, __pyx_v_pattern, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __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.remove_pattern_from_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_9remove_pattern_from_context, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_remove_pattern_fro, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_remove_pattern_from_context, __pyx_t_3) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 095:             self, frozenset context, Pattern pattern):
+096:         cdef dict 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, 96, __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, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(0, 96, __pyx_L1_error)
  __pyx_v_pattern_count_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+097:         pattern_count_dict.pop(pattern.get_activity_name())
  if (unlikely(__pyx_v_pattern_count_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
    __PYX_ERR(0, 97, __pyx_L1_error)
  }
  __pyx_t_1 = ((struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)__pyx_v_pattern->__pyx_vtab)->get_activity_name(__pyx_v_pattern, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_v_pattern_count_dict, __pyx_t_1, ((PyObject *)NULL)); 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;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+098:         new_context = context.difference([pattern.get_activity_name()])
  __pyx_t_2 = ((struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)__pyx_v_pattern->__pyx_vtab)->get_activity_name(__pyx_v_pattern, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 98, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyFrozenSet_Type__difference, __pyx_v_context, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_new_context = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
+099:         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, 99, __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, 99, __pyx_L1_error)
 100: 
+101:     cpdef float get_code_length(self, bint verbose=False):
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*/
static float __pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_get_code_length(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_get_code_length *__pyx_optional_args) {
  int __pyx_v_verbose = ((int)0);
  float __pyx_v_code_length;
  PyObject *__pyx_v_pattern_counter = NULL;
  float __pyx_r;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_verbose = __pyx_optional_args->verbose;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_get_code_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_11get_code_length)) {
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_verbose); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_t_7 = __Pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_7;
        __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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("prolothar_process_discovery.discovery.proseqo.cover_streams.pattern_stream.PatternStream.get_code_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pattern_counter);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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
) {
  int __pyx_v_verbose;
  #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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_verbose,0};
  PyObject* values[1] = {0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 101, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_code_length", 0) < 0) __PYX_ERR(0, 101, __pyx_L3_error)
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_verbose = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_verbose == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
    } else {
      __pyx_v_verbose = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_code_length", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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 */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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, int __pyx_v_verbose) {
  PyObject *__pyx_r = NULL;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.verbose = __pyx_v_verbose;
  __pyx_t_1 = __pyx_vtabptr_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream->get_code_length(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("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_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __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_mstate_global->__pyx_n_u_PatternStream_get_code_length, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[3]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_get_code_length, __pyx_t_3) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 102:         """
 103:         Returns:
 104:             the encoded length of this pattern stream
 105:         """
+106:         cdef float code_length = 0.0
  __pyx_v_code_length = 0.0;
 107: 
+108:         for pattern_counter in self._usage_per_pattern_conditional.values():
  __pyx_t_8 = 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, 108, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_self->_usage_per_pattern_conditional, 1, __pyx_mstate_global->__pyx_n_u_values, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __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_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_8, NULL, &__pyx_t_2, NULL, __pyx_t_10);
    if (unlikely(__pyx_t_11 == 0)) break;
    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_pattern_counter, __pyx_t_2);
    __pyx_t_2 = 0;
+109:             code_length += mdl_utils.prequential_coding_length(<dict>pattern_counter)
    __pyx_t_12 = __pyx_f_16prolothar_common_9mdl_utils_prequential_coding_length(((PyObject*)__pyx_v_pattern_counter), 0, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error)
    __pyx_v_code_length = (__pyx_v_code_length + __pyx_t_12);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 110: 
+111:         if verbose:
  if (__pyx_v_verbose) {
/* … */
  }
+112:             print('encoded length of pattern stream: %.2f' % code_length)
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_print);
    __pyx_t_4 = __pyx_builtin_print; 
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_code_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_encoded_length_of_pattern_stream, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 113: 
+114:         return code_length
  __pyx_r = __pyx_v_code_length;
  goto __pyx_L0;
 115: 
+116:     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(*)(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_SIZE
  __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; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_sequence_of_added_patterns", __pyx_kwds); 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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_List_Pattern) < 0) __PYX_ERR(0, 116, __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_mstate_global->__pyx_n_u_PatternStream_get_sequence_of_ad, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __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(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_get_sequence_of_added_patterns, __pyx_t_2) < 0) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 117:         """returns a list with all patterns added to the stream. the order
 118:         is the same as they have been added to stream. if a patterns has been
 119:         added multiple times to the stream it will occur multiple times in this
 120:         list.
 121: 
 122:         Raises:
 123:             ValueError:
 124:                 if the pattern stream was not iniatialized with
 125:                 "store_patterns=True"
 126:         """
+127:         if not self._store_patterns:
  __pyx_t_1 = (!__pyx_v_self->_store_patterns);
  if (unlikely(__pyx_t_1)) {
/* … */
  }
+128:             raise ValueError()
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __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, 128, __pyx_L1_error)
+129:         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;
 130: 
+131:     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(*)(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_SIZE
  __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; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_usage_per_pattern", __pyx_kwds); 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_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_str_int) < 0) __PYX_ERR(0, 131, __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_mstate_global->__pyx_n_u_PatternStream_get_usage_per_patt, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __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(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_get_usage_per_pattern, __pyx_t_3) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 132:         """returns a dict with activity name => total usage"""
+133:         cdef dict usage_per_pattern = {}
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_usage_per_pattern = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+134:         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, 134, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_usage_per_pattern_conditional, 1, __pyx_mstate_global->__pyx_n_u_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __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, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_pattern_usage_dict, __pyx_t_5);
    __pyx_t_5 = 0;
+135:             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, 135, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_pattern_usage_dict, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_8), (&__pyx_t_6)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 135, __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, 135, __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;
+136:                 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;
+137:                     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, 137, __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, 137, __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, 137, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+138:                 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, 138, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_9);
+139:                     usage_per_pattern[pattern] = usage
          if (unlikely((PyDict_SetItem(__pyx_v_usage_per_pattern, __pyx_v_pattern, __pyx_v_usage) < 0))) __PYX_ERR(0, 139, __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;
+140:         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;
 141: 
+142:     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(*)(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_SIZE
  __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; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_conditional_usage_per_pattern", __pyx_kwds); 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, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Dict_FrozenSet_str_Dict_str_int) < 0) __PYX_ERR(0, 142, __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_mstate_global->__pyx_n_u_PatternStream_get_conditional_us, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_get_conditional_usage_per_patter, __pyx_t_2) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 143:             self) -> Dict[FrozenSet[str], Dict[str, int]]:
 144:         """returns a nested dictionary (alternative patterns) -> pattern -> count
 145:         """
+146:         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;
 147: 
+148:     cpdef start_trace_covering(self, tuple trace):
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*/
static PyObject *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_start_trace_covering(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_trace, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_start_trace_covering); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_trace};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __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_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.start_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_trace,0};
  PyObject* values[1] = {0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 148, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 148, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "start_trace_covering", 0) < 0) __PYX_ERR(0, 148, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("start_trace_covering", 1, 1, 1, i); __PYX_ERR(0, 148, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 148, __pyx_L3_error)
    }
    __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, 148, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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), 1, "trace", 1))) __PYX_ERR(0, 148, __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;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_start_trace_covering(__pyx_v_self, __pyx_v_trace, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __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.start_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_19start_trace_covering, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_start_trace_coveri, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_start_trace_covering, __pyx_t_2) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 149:         """signal that now the given trace starts to get covered"""
+150:         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;
+151:         self.__current_trace_cache = []
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __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;
+152:         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, 152, __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, 152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 153: 
+154:     cpdef end_trace_covering(self, tuple trace):
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*/
static PyObject *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_end_trace_covering(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_trace, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_end_trace_covering); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_trace};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __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_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.end_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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
) {
  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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_trace,0};
  PyObject* values[1] = {0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 154, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 154, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "end_trace_covering", 0) < 0) __PYX_ERR(0, 154, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("end_trace_covering", 1, 1, 1, i); __PYX_ERR(0, 154, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 154, __pyx_L3_error)
    }
    __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, 154, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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), 1, "trace", 1))) __PYX_ERR(0, 154, __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;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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, PyObject *__pyx_v_trace) {
  PyObject *__pyx_r = NULL;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_end_trace_covering(__pyx_v_self, __pyx_v_trace, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __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.end_trace_covering", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_21end_trace_covering, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_end_trace_covering, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_end_trace_covering, __pyx_t_2) < 0) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 155:         """signal that now the given trace is get covered"""
+156:         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);
+157:         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);
 158: 
+159:     cpdef use_cache_to_cover_trace(self, tuple 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
); /*proto*/
static PyObject *__pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_use_cache_to_cover_trace(struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *__pyx_v_self, PyObject *__pyx_v_trace, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_pattern = NULL;
  PyObject *__pyx_v_usable_pattern_activities = NULL;
  PyObject *__pyx_r = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  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)))
  #endif
  ) {
    #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_mstate_global->__pyx_n_u_use_cache_to_cover_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_trace};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __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_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_8);
  __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 = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pattern);
  __Pyx_XDECREF(__pyx_v_usable_pattern_activities);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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(*)(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_SIZE
  __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 ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_trace,0};
  PyObject* values[1] = {0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 159, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 159, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "use_cache_to_cover_trace", 0) < 0) __PYX_ERR(0, 159, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("use_cache_to_cover_trace", 1, 1, 1, i); __PYX_ERR(0, 159, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 159, __pyx_L3_error)
    }
    __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, 159, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(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), 1, "trace", 1))) __PYX_ERR(0, 159, __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;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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_r = NULL;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_use_cache_to_cover_trace(__pyx_v_self, __pyx_v_trace, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __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.use_cache_to_cover_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_13PatternStream_23use_cache_to_cover_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PatternStream_use_cache_to_cover, NULL, __pyx_mstate_global->__pyx_n_u_prolothar_process_discovery_disc, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream, __pyx_mstate_global->__pyx_n_u_use_cache_to_cover_trace, __pyx_t_2) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 160:         """repeats the addition of codes as it is stored in a cache for the
 161:         same sequence of activities as the given trace"""
+162:         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, 162, __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, 162, __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_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 162, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 162, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_6);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 162, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 162, __pyx_L1_error)
          PyErr_Clear();
        }
        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, 162, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_3);
      } else {
        __pyx_t_4 = __Pyx_PyList_GetItemRef(sequence, 0);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 1);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
      }
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 162, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_usable_pattern_activities, __pyx_t_3);
    __pyx_t_3 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+163:             self.add(<Pattern>pattern, <frozenset>usable_pattern_activities, add_to_cache=False)
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.add_to_cache = 0;
    __pyx_t_1 = ((struct __pyx_vtabstruct_27prolothar_process_discovery_9discovery_7proseqo_13cover_streams_14pattern_stream_PatternStream *)__pyx_v_self->__pyx_vtab)->add(__pyx_v_self, ((struct __pyx_obj_27prolothar_process_discovery_9discovery_7proseqo_7pattern_7pattern_Pattern *)__pyx_v_pattern), ((PyObject*)__pyx_v_usable_pattern_activities), 0, &__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;