diff --git a/src/dawg.cpp b/src/dawg.cpp index 7e9d536..e5e903a 100644 --- a/src/dawg.cpp +++ b/src/dawg.cpp @@ -1,5 +1,19 @@ /* Generated by Cython 0.29.15 */ +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "language": "c++", + "name": "dawg", + "sources": [ + "src/dawg.pyx" + ] + }, + "module_name": "dawg" +} +END: Cython Metadata */ + #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H @@ -870,7 +884,7 @@ struct __pyx_opt_args_4dawg_7IntDAWG_get; struct __pyx_opt_args_4dawg_17IntCompletionDAWG_get; struct __pyx_opt_args_4dawg_17IntCompletionDAWG_items; -/* "dawg.pyx":307 +/* "dawg.pyx":325 * self.guide.Clear() * * cpdef list keys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -882,7 +896,7 @@ struct __pyx_opt_args_4dawg_14CompletionDAWG_keys { PyObject *prefix; }; -/* "dawg.pyx":526 +/* "dawg.pyx":544 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -894,7 +908,7 @@ struct __pyx_opt_args_4dawg_9BytesDAWG_get { PyObject *__pyx_default; }; -/* "dawg.pyx":582 +/* "dawg.pyx":600 * return self._value_for_index(index) * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -906,7 +920,7 @@ struct __pyx_opt_args_4dawg_9BytesDAWG_items { PyObject *prefix; }; -/* "dawg.pyx":661 +/* "dawg.pyx":679 * yield (u_key, value) * * cpdef list keys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -918,7 +932,7 @@ struct __pyx_opt_args_4dawg_9BytesDAWG_keys { PyObject *prefix; }; -/* "dawg.pyx":846 +/* "dawg.pyx":885 * return [self._struct.unpack(val) for val in value] * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -930,7 +944,7 @@ struct __pyx_opt_args_4dawg_10RecordDAWG_items { PyObject *prefix; }; -/* "dawg.pyx":885 +/* "dawg.pyx":924 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -942,7 +956,7 @@ struct __pyx_opt_args_4dawg_7IntDAWG_get { PyObject *__pyx_default; }; -/* "dawg.pyx":929 +/* "dawg.pyx":988 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -954,7 +968,7 @@ struct __pyx_opt_args_4dawg_17IntCompletionDAWG_get { PyObject *__pyx_default; }; -/* "dawg.pyx":951 +/* "dawg.pyx":1010 * return self.dct.Find(key) * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -981,7 +995,7 @@ struct __pyx_obj_4dawg_DAWG { }; -/* "dawg.pyx":293 +/* "dawg.pyx":311 * * * cdef class CompletionDAWG(DAWG): # <<<<<<<<<<<<<< @@ -994,7 +1008,7 @@ struct __pyx_obj_4dawg_CompletionDAWG { }; -/* "dawg.pyx":460 +/* "dawg.pyx":478 * DEF MAX_VALUE_SIZE = 32768 * * cdef class BytesDAWG(CompletionDAWG): # <<<<<<<<<<<<<< @@ -1009,8 +1023,8 @@ struct __pyx_obj_4dawg_BytesDAWG { }; -/* "dawg.pyx":807 - * +/* "dawg.pyx":846 + * raise KeyError("No prefix found") * * cdef class RecordDAWG(BytesDAWG): # <<<<<<<<<<<<<< * """ @@ -1022,7 +1036,7 @@ struct __pyx_obj_4dawg_RecordDAWG { }; -/* "dawg.pyx":866 +/* "dawg.pyx":905 * DEF LOOKUP_ERROR = -1 * * cdef class IntDAWG(DAWG): # <<<<<<<<<<<<<< @@ -1034,7 +1048,7 @@ struct __pyx_obj_4dawg_IntDAWG { }; -/* "dawg.pyx":909 +/* "dawg.pyx":968 * * # FIXME: code duplication. * cdef class IntCompletionDAWG(CompletionDAWG): # <<<<<<<<<<<<<< @@ -1046,8 +1060,8 @@ struct __pyx_obj_4dawg_IntCompletionDAWG { }; -/* "dawg.pyx":256 - * return res +/* "dawg.pyx":274 + * raise KeyError("No prefix found") * * def iterprefixes(self, unicode key): # <<<<<<<<<<<<<< * ''' @@ -1069,7 +1083,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct__iterprefixes { }; -/* "dawg.pyx":273 +/* "dawg.pyx":291 * * @classmethod * def compile_replaces(cls, replaces): # <<<<<<<<<<<<<< @@ -1082,7 +1096,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_1_compile_replaces { }; -/* "dawg.pyx":281 +/* "dawg.pyx":299 * return dict( * ( * k.encode('utf8'), # <<<<<<<<<<<<<< @@ -1097,7 +1111,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_2_genexpr { }; -/* "dawg.pyx":325 +/* "dawg.pyx":343 * return res * * def iterkeys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -1115,7 +1129,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_3_iterkeys { }; -/* "dawg.pyx":473 +/* "dawg.pyx":491 * cdef Completer* _completer * * def __init__(self, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -1129,7 +1143,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_4___init__ { }; -/* "dawg.pyx":483 +/* "dawg.pyx":501 * self._c_payload_separator = ord(payload_separator) * * keys = (self._raw_key(d[0], d[1]) for d in arg) # <<<<<<<<<<<<<< @@ -1146,7 +1160,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_5_genexpr { }; -/* "dawg.pyx":624 +/* "dawg.pyx":642 * return res * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -1172,7 +1186,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_6_iteritems { }; -/* "dawg.pyx":686 +/* "dawg.pyx":704 * return res * * def iterkeys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -1192,7 +1206,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_7_iterkeys { }; -/* "dawg.pyx":824 +/* "dawg.pyx":863 * cdef _struct * * def __init__(self, fmt, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -1206,7 +1220,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_8___init__ { }; -/* "dawg.pyx":839 +/* "dawg.pyx":878 * arg = [] * * keys = ((d[0], self._struct.pack(*d[1])) for d in arg) # <<<<<<<<<<<<<< @@ -1223,7 +1237,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_9_genexpr { }; -/* "dawg.pyx":850 +/* "dawg.pyx":889 * return [(key, self._struct.unpack(val)) for (key, val) in items] * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -1242,7 +1256,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_10_iteritems { }; -/* "dawg.pyx":855 +/* "dawg.pyx":894 * * * def _iterable_from_argument(arg): # <<<<<<<<<<<<<< @@ -1255,7 +1269,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_11__iterable_from_argument { }; -/* "dawg.pyx":860 +/* "dawg.pyx":899 * * if isinstance(arg, Mapping): * return ((key, arg[key]) for key in arg) # <<<<<<<<<<<<<< @@ -1272,7 +1286,7 @@ struct __pyx_obj_4dawg___pyx_scope_struct_12_genexpr { }; -/* "dawg.pyx":971 +/* "dawg.pyx":1030 * return res * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -1314,7 +1328,7 @@ struct __pyx_vtabstruct_4dawg_DAWG { static struct __pyx_vtabstruct_4dawg_DAWG *__pyx_vtabptr_4dawg_DAWG; -/* "dawg.pyx":293 +/* "dawg.pyx":311 * * * cdef class CompletionDAWG(DAWG): # <<<<<<<<<<<<<< @@ -1329,7 +1343,7 @@ struct __pyx_vtabstruct_4dawg_CompletionDAWG { static struct __pyx_vtabstruct_4dawg_CompletionDAWG *__pyx_vtabptr_4dawg_CompletionDAWG; -/* "dawg.pyx":460 +/* "dawg.pyx":478 * DEF MAX_VALUE_SIZE = 32768 * * cdef class BytesDAWG(CompletionDAWG): # <<<<<<<<<<<<<< @@ -1355,8 +1369,8 @@ struct __pyx_vtabstruct_4dawg_BytesDAWG { static struct __pyx_vtabstruct_4dawg_BytesDAWG *__pyx_vtabptr_4dawg_BytesDAWG; -/* "dawg.pyx":807 - * +/* "dawg.pyx":846 + * raise KeyError("No prefix found") * * cdef class RecordDAWG(BytesDAWG): # <<<<<<<<<<<<<< * """ @@ -1369,7 +1383,7 @@ struct __pyx_vtabstruct_4dawg_RecordDAWG { static struct __pyx_vtabstruct_4dawg_RecordDAWG *__pyx_vtabptr_4dawg_RecordDAWG; -/* "dawg.pyx":866 +/* "dawg.pyx":905 * DEF LOOKUP_ERROR = -1 * * cdef class IntDAWG(DAWG): # <<<<<<<<<<<<<< @@ -1386,7 +1400,7 @@ struct __pyx_vtabstruct_4dawg_IntDAWG { static struct __pyx_vtabstruct_4dawg_IntDAWG *__pyx_vtabptr_4dawg_IntDAWG; -/* "dawg.pyx":909 +/* "dawg.pyx":968 * * # FIXME: code duplication. * cdef class IntCompletionDAWG(CompletionDAWG): # <<<<<<<<<<<<<< @@ -1803,6 +1817,10 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* unicode_iter.proto */ +static CYTHON_INLINE int __Pyx_init_unicode_iteration( + PyObject* ustring, Py_ssize_t *length, void** data, int *kind); + /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; @@ -2046,6 +2064,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char valu /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_dawgdic_3a__3a_ValueType(dawgdic::ValueType value); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -2273,14 +2294,14 @@ static PyObject *__pyx_builtin_ImportError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_IOError; static PyObject *__pyx_builtin_open; +static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_super; static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_KeyError; static const char __pyx_k__2[] = ")"; static const char __pyx_k__6[] = ""; static const char __pyx_k_wb[] = "wb"; -static const char __pyx_k__11[] = "')"; -static const char __pyx_k__13[] = "\001"; +static const char __pyx_k__12[] = "')"; +static const char __pyx_k__14[] = "\001"; static const char __pyx_k_arg[] = "arg"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_fmt[] = "fmt"; @@ -2357,6 +2378,7 @@ static const char __pyx_k_similar_keys[] = "similar_keys"; static const char __pyx_k_src_dawg_pyx[] = "src/dawg.pyx"; static const char __pyx_k_similar_items[] = "similar_items"; static const char __pyx_k_CompletionDAWG[] = "CompletionDAWG"; +static const char __pyx_k_No_prefix_found[] = "No prefix found"; static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_input_is_sorted[] = "input_is_sorted"; static const char __pyx_k_Can_t_insert_key[] = "Can't insert key "; @@ -2412,14 +2434,15 @@ static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_kp_u_Keys_and_values_must_be_single_c; static PyObject *__pyx_n_s_Mapping; static PyObject *__pyx_kp_u_Negative_values_are_not_supporte; +static PyObject *__pyx_kp_u_No_prefix_found; static PyObject *__pyx_kp_u_None; static PyObject *__pyx_kp_u_Payload_separator; static PyObject *__pyx_n_s_RecordDAWG; static PyObject *__pyx_n_s_RecordDAWG_iteritems; static PyObject *__pyx_n_s_Struct; static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_kp_u__11; -static PyObject *__pyx_kp_b__13; +static PyObject *__pyx_kp_u__12; +static PyObject *__pyx_kp_b__14; static PyObject *__pyx_kp_u__2; static PyObject *__pyx_kp_u__6; static PyObject *__pyx_n_s_arg; @@ -2520,9 +2543,10 @@ static PyObject *__pyx_pf_4dawg_4DAWG_32_file_size(struct __pyx_obj_4dawg_DAWG * static PyObject *__pyx_pf_4dawg_4DAWG_34similar_keys(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_replaces); /* proto */ static PyObject *__pyx_pf_4dawg_4DAWG_36prefixes(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static PyObject *__pyx_pf_4dawg_4DAWG_38b_prefixes(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_b_key); /* proto */ -static PyObject *__pyx_pf_4dawg_4DAWG_40iterprefixes(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_4dawg_4DAWG_40longest_prefix(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_4dawg_4DAWG_42iterprefixes(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static PyObject *__pyx_pf_4dawg_4DAWG_16compile_replaces_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_replaces); /* proto */ +static PyObject *__pyx_pf_4dawg_4DAWG_45compile_replaces(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_replaces); /* proto */ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_CompletionDAWG *__pyx_v_self, PyObject *__pyx_v_arg, PyObject *__pyx_v_input_is_sorted); /* proto */ static void __pyx_pf_4dawg_14CompletionDAWG_2__dealloc__(struct __pyx_obj_4dawg_CompletionDAWG *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_4keys(struct __pyx_obj_4dawg_CompletionDAWG *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */ @@ -2549,6 +2573,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_25keys(struct __pyx_obj_4dawg_BytesDA static PyObject *__pyx_pf_4dawg_9BytesDAWG_27iterkeys(struct __pyx_obj_4dawg_BytesDAWG *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */ static PyObject *__pyx_pf_4dawg_9BytesDAWG_30similar_items(struct __pyx_obj_4dawg_BytesDAWG *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_replaces); /* proto */ static PyObject *__pyx_pf_4dawg_9BytesDAWG_32similar_item_values(struct __pyx_obj_4dawg_BytesDAWG *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_replaces); /* proto */ +static PyObject *__pyx_pf_4dawg_9BytesDAWG_34longest_prefix(struct __pyx_obj_4dawg_BytesDAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static PyObject *__pyx_pf_4dawg_10RecordDAWG_8__init___genexpr(PyObject *__pyx_self); /* proto */ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAWG *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_arg, PyObject *__pyx_v_input_is_sorted, PyObject *__pyx_v_payload_separator); /* proto */ static PyObject *__pyx_pf_4dawg_10RecordDAWG_2items(struct __pyx_obj_4dawg_RecordDAWG *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */ @@ -2560,6 +2585,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int static PyObject *__pyx_pf_4dawg_7IntDAWG_4get(struct __pyx_obj_4dawg_IntDAWG *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */ static PyObject *__pyx_pf_4dawg_7IntDAWG_6get_value(struct __pyx_obj_4dawg_IntDAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static PyObject *__pyx_pf_4dawg_7IntDAWG_8b_get_value(struct __pyx_obj_4dawg_IntDAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_4dawg_7IntDAWG_10longest_prefix(struct __pyx_obj_4dawg_IntDAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_IntCompletionDAWG *__pyx_v_self, PyObject *__pyx_v_arg, PyObject *__pyx_v_input_is_sorted); /* proto */ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_obj_4dawg_IntCompletionDAWG *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_4get(struct __pyx_obj_4dawg_IntCompletionDAWG *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */ @@ -2588,8 +2614,8 @@ static PyObject *__pyx_tp_new_4dawg___pyx_scope_struct_11__iterable_from_argumen static PyObject *__pyx_tp_new_4dawg___pyx_scope_struct_12_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_4dawg___pyx_scope_struct_13_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_k__10; -static PyObject *__pyx_k__12; +static PyObject *__pyx_k__11; +static PyObject *__pyx_k__13; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; @@ -2597,8 +2623,9 @@ static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_codeobj__15; +static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_codeobj__16; /* Late includes */ /* "dawg.pyx":40 @@ -6381,7 +6408,7 @@ static PyObject *__pyx_f_4dawg_4DAWG_b_prefixes(struct __pyx_obj_4dawg_DAWG *__p * * return res # <<<<<<<<<<<<<< * - * def iterprefixes(self, unicode key): + * def longest_prefix(self, unicode key): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_res); @@ -6453,25 +6480,255 @@ static PyObject *__pyx_pf_4dawg_4DAWG_38b_prefixes(struct __pyx_obj_4dawg_DAWG * __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ /* "dawg.pyx":256 * return res * + * def longest_prefix(self, unicode key): # <<<<<<<<<<<<<< + * cdef BaseType index = self.dct.root() + * cdef int pos = 1 + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4dawg_4DAWG_41longest_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_4dawg_4DAWG_40longest_prefix[] = "DAWG.longest_prefix(self, unicode key)"; +static PyObject *__pyx_pw_4dawg_4DAWG_41longest_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("longest_prefix (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_r = __pyx_pf_4dawg_4DAWG_40longest_prefix(((struct __pyx_obj_4dawg_DAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4dawg_4DAWG_40longest_prefix(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key) { + dawgdic::BaseType __pyx_v_index; + int __pyx_v_pos; + int __pyx_v_lastpos; + dawgdic::CharType __pyx_v_ch; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("longest_prefix", 0); + + /* "dawg.pyx":257 + * + * def longest_prefix(self, unicode key): + * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< + * cdef int pos = 1 + * cdef int lastpos = 0 + */ + __pyx_v_index = __pyx_v_self->dct.root(); + + /* "dawg.pyx":258 + * def longest_prefix(self, unicode key): + * cdef BaseType index = self.dct.root() + * cdef int pos = 1 # <<<<<<<<<<<<<< + * cdef int lastpos = 0 + * cdef CharType ch + */ + __pyx_v_pos = 1; + + /* "dawg.pyx":259 + * cdef BaseType index = self.dct.root() + * cdef int pos = 1 + * cdef int lastpos = 0 # <<<<<<<<<<<<<< + * cdef CharType ch + * + */ + __pyx_v_lastpos = 0; + + /* "dawg.pyx":262 + * cdef CharType ch + * + * for ch in key: # <<<<<<<<<<<<<< + * if not self.dct.Follow(ch, &index): + * break + */ + if (unlikely(__pyx_v_key == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(0, 262, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_key); + __pyx_t_1 = __pyx_v_key; + __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 262, __pyx_L1_error) + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) { + __pyx_t_2 = __pyx_t_7; + __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2); + + /* "dawg.pyx":263 + * + * for ch in key: + * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< + * break + * if self.dct.has_value(index): + */ + __pyx_t_8 = ((!(__pyx_v_self->dct.Follow(__pyx_v_ch, (&__pyx_v_index)) != 0)) != 0); + if (__pyx_t_8) { + + /* "dawg.pyx":264 + * for ch in key: + * if not self.dct.Follow(ch, &index): + * break # <<<<<<<<<<<<<< + * if self.dct.has_value(index): + * lastpos = pos + */ + goto __pyx_L4_break; + + /* "dawg.pyx":263 + * + * for ch in key: + * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< + * break + * if self.dct.has_value(index): + */ + } + + /* "dawg.pyx":265 + * if not self.dct.Follow(ch, &index): + * break + * if self.dct.has_value(index): # <<<<<<<<<<<<<< + * lastpos = pos + * pos += 1 + */ + __pyx_t_8 = (__pyx_v_self->dct.has_value(__pyx_v_index) != 0); + if (__pyx_t_8) { + + /* "dawg.pyx":266 + * break + * if self.dct.has_value(index): + * lastpos = pos # <<<<<<<<<<<<<< + * pos += 1 + * + */ + __pyx_v_lastpos = __pyx_v_pos; + + /* "dawg.pyx":265 + * if not self.dct.Follow(ch, &index): + * break + * if self.dct.has_value(index): # <<<<<<<<<<<<<< + * lastpos = pos + * pos += 1 + */ + } + + /* "dawg.pyx":267 + * if self.dct.has_value(index): + * lastpos = pos + * pos += 1 # <<<<<<<<<<<<<< + * + * if lastpos: + */ + __pyx_v_pos = (__pyx_v_pos + 1); + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dawg.pyx":269 + * pos += 1 + * + * if lastpos: # <<<<<<<<<<<<<< + * return key[:lastpos] + * else: + */ + __pyx_t_8 = (__pyx_v_lastpos != 0); + if (likely(__pyx_t_8)) { + + /* "dawg.pyx":270 + * + * if lastpos: + * return key[:lastpos] # <<<<<<<<<<<<<< + * else: + * raise KeyError("No prefix found") + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_key == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 270, __pyx_L1_error) + } + __pyx_t_9 = __Pyx_PyUnicode_Substring(__pyx_v_key, 0, __pyx_v_lastpos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; + + /* "dawg.pyx":269 + * pos += 1 + * + * if lastpos: # <<<<<<<<<<<<<< + * return key[:lastpos] + * else: + */ + } + + /* "dawg.pyx":272 + * return key[:lastpos] + * else: + * raise KeyError("No prefix found") # <<<<<<<<<<<<<< + * + * def iterprefixes(self, unicode key): + */ + /*else*/ { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(0, 272, __pyx_L1_error) + } + + /* "dawg.pyx":256 + * return res + * + * def longest_prefix(self, unicode key): # <<<<<<<<<<<<<< + * cdef BaseType index = self.dct.root() + * cdef int pos = 1 + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("dawg.DAWG.longest_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_4dawg_4DAWG_44generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "dawg.pyx":274 + * raise KeyError("No prefix found") + * * def iterprefixes(self, unicode key): # <<<<<<<<<<<<<< * ''' * Return a generator with keys of this DAWG that are prefixes of the ``key``. */ /* Python wrapper */ -static PyObject *__pyx_pw_4dawg_4DAWG_41iterprefixes(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ -static char __pyx_doc_4dawg_4DAWG_40iterprefixes[] = "DAWG.iterprefixes(self, unicode key)\n\n Return a generator with keys of this DAWG that are prefixes of the ``key``.\n "; -static PyObject *__pyx_pw_4dawg_4DAWG_41iterprefixes(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { +static PyObject *__pyx_pw_4dawg_4DAWG_43iterprefixes(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_4dawg_4DAWG_42iterprefixes[] = "DAWG.iterprefixes(self, unicode key)\n\n Return a generator with keys of this DAWG that are prefixes of the ``key``.\n "; +static PyObject *__pyx_pw_4dawg_4DAWG_43iterprefixes(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("iterprefixes (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 256, __pyx_L1_error) - __pyx_r = __pyx_pf_4dawg_4DAWG_40iterprefixes(((struct __pyx_obj_4dawg_DAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_r = __pyx_pf_4dawg_4DAWG_42iterprefixes(((struct __pyx_obj_4dawg_DAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ goto __pyx_L0; @@ -6482,7 +6739,7 @@ static PyObject *__pyx_pw_4dawg_4DAWG_41iterprefixes(PyObject *__pyx_v_self, PyO return __pyx_r; } -static PyObject *__pyx_pf_4dawg_4DAWG_40iterprefixes(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key) { +static PyObject *__pyx_pf_4dawg_4DAWG_42iterprefixes(struct __pyx_obj_4dawg_DAWG *__pyx_v_self, PyObject *__pyx_v_key) { struct __pyx_obj_4dawg___pyx_scope_struct__iterprefixes *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6491,7 +6748,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_40iterprefixes(struct __pyx_obj_4dawg_DAWG if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct__iterprefixes *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 256, __pyx_L1_error) + __PYX_ERR(0, 274, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -6502,7 +6759,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_40iterprefixes(struct __pyx_obj_4dawg_DAWG __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_4DAWG_42generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterprefixes, __pyx_n_s_DAWG_iterprefixes, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_4DAWG_44generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterprefixes, __pyx_n_s_DAWG_iterprefixes, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -6518,7 +6775,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_40iterprefixes(struct __pyx_obj_4dawg_DAWG return __pyx_r; } -static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4dawg_4DAWG_44generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_4dawg___pyx_scope_struct__iterprefixes *__pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct__iterprefixes *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -6540,9 +6797,9 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 256, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 274, __pyx_L1_error) - /* "dawg.pyx":260 + /* "dawg.pyx":278 * Return a generator with keys of this DAWG that are prefixes of the ``key``. * ''' * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -6551,7 +6808,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ __pyx_cur_scope->__pyx_v_index = __pyx_cur_scope->__pyx_v_self->dct.root(); - /* "dawg.pyx":261 + /* "dawg.pyx":279 * ''' * cdef BaseType index = self.dct.root() * cdef bytes b_key = key.encode('utf8') # <<<<<<<<<<<<<< @@ -6560,9 +6817,9 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ if (unlikely(__pyx_cur_scope->__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 261, __pyx_L1_error) + __PYX_ERR(0, 279, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); @@ -6571,7 +6828,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __pyx_cur_scope->__pyx_v_b_key = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dawg.pyx":262 + /* "dawg.pyx":280 * cdef BaseType index = self.dct.root() * cdef bytes b_key = key.encode('utf8') * cdef int pos = 1 # <<<<<<<<<<<<<< @@ -6580,7 +6837,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ __pyx_cur_scope->__pyx_v_pos = 1; - /* "dawg.pyx":265 + /* "dawg.pyx":283 * cdef CharType ch * * for ch in b_key: # <<<<<<<<<<<<<< @@ -6589,7 +6846,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ if (unlikely(__pyx_cur_scope->__pyx_v_b_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(0, 265, __pyx_L1_error) + __PYX_ERR(0, 283, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_b_key); __pyx_t_3 = __pyx_cur_scope->__pyx_v_b_key; @@ -6599,7 +6856,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __pyx_t_4 = __pyx_t_7; __pyx_cur_scope->__pyx_v_ch = (__pyx_t_4[0]); - /* "dawg.pyx":266 + /* "dawg.pyx":284 * * for ch in b_key: * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< @@ -6609,7 +6866,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __pyx_t_8 = ((!(__pyx_cur_scope->__pyx_v_self->dct.Follow(__pyx_cur_scope->__pyx_v_ch, (&__pyx_cur_scope->__pyx_v_index)) != 0)) != 0); if (__pyx_t_8) { - /* "dawg.pyx":267 + /* "dawg.pyx":285 * for ch in b_key: * if not self.dct.Follow(ch, &index): * return # <<<<<<<<<<<<<< @@ -6621,7 +6878,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "dawg.pyx":266 + /* "dawg.pyx":284 * * for ch in b_key: * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< @@ -6630,7 +6887,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ } - /* "dawg.pyx":268 + /* "dawg.pyx":286 * if not self.dct.Follow(ch, &index): * return * if self._has_value(index): # <<<<<<<<<<<<<< @@ -6640,7 +6897,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __pyx_t_8 = (((struct __pyx_vtabstruct_4dawg_DAWG *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_has_value(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_index) != 0); if (__pyx_t_8) { - /* "dawg.pyx":269 + /* "dawg.pyx":287 * return * if self._has_value(index): * yield b_key[:pos].decode('utf8') # <<<<<<<<<<<<<< @@ -6649,9 +6906,9 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ if (unlikely(__pyx_cur_scope->__pyx_v_b_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 269, __pyx_L1_error) + __PYX_ERR(0, 287, __pyx_L1_error) } - __pyx_t_2 = __Pyx_decode_bytes(__pyx_cur_scope->__pyx_v_b_key, 0, __pyx_cur_scope->__pyx_v_pos, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_2 = __Pyx_decode_bytes(__pyx_cur_scope->__pyx_v_b_key, 0, __pyx_cur_scope->__pyx_v_pos, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -6675,9 +6932,9 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; __pyx_t_6 = __pyx_cur_scope->__pyx_t_3; __pyx_t_7 = __pyx_cur_scope->__pyx_t_4; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 287, __pyx_L1_error) - /* "dawg.pyx":268 + /* "dawg.pyx":286 * if not self.dct.Follow(ch, &index): * return * if self._has_value(index): # <<<<<<<<<<<<<< @@ -6686,7 +6943,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ } - /* "dawg.pyx":270 + /* "dawg.pyx":288 * if self._has_value(index): * yield b_key[:pos].decode('utf8') * pos += 1 # <<<<<<<<<<<<<< @@ -6698,8 +6955,8 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":256 - * return res + /* "dawg.pyx":274 + * raise KeyError("No prefix found") * * def iterprefixes(self, unicode key): # <<<<<<<<<<<<<< * ''' @@ -6725,7 +6982,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g return __pyx_r; } -/* "dawg.pyx":273 +/* "dawg.pyx":291 * * @classmethod * def compile_replaces(cls, replaces): # <<<<<<<<<<<<<< @@ -6734,13 +6991,13 @@ static PyObject *__pyx_gb_4dawg_4DAWG_42generator(__pyx_CoroutineObject *__pyx_g */ /* Python wrapper */ -static PyObject *__pyx_pw_4dawg_4DAWG_44compile_replaces(PyObject *__pyx_v_cls, PyObject *__pyx_v_replaces); /*proto*/ -static char __pyx_doc_4dawg_4DAWG_43compile_replaces[] = "DAWG.compile_replaces(type cls, replaces)"; -static PyObject *__pyx_pw_4dawg_4DAWG_44compile_replaces(PyObject *__pyx_v_cls, PyObject *__pyx_v_replaces) { +static PyObject *__pyx_pw_4dawg_4DAWG_46compile_replaces(PyObject *__pyx_v_cls, PyObject *__pyx_v_replaces); /*proto*/ +static char __pyx_doc_4dawg_4DAWG_45compile_replaces[] = "DAWG.compile_replaces(type cls, replaces)"; +static PyObject *__pyx_pw_4dawg_4DAWG_46compile_replaces(PyObject *__pyx_v_cls, PyObject *__pyx_v_replaces) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("compile_replaces (wrapper)", 0); - __pyx_r = __pyx_pf_4dawg_4DAWG_43compile_replaces(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_replaces)); + __pyx_r = __pyx_pf_4dawg_4DAWG_45compile_replaces(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_replaces)); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -6748,7 +7005,7 @@ static PyObject *__pyx_pw_4dawg_4DAWG_44compile_replaces(PyObject *__pyx_v_cls, } static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":281 +/* "dawg.pyx":299 * return dict( * ( * k.encode('utf8'), # <<<<<<<<<<<<<< @@ -6765,7 +7022,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_16compile_replaces_genexpr(PyObject *__pyx if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_2_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 281, __pyx_L1_error) + __PYX_ERR(0, 299, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -6773,7 +7030,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_16compile_replaces_genexpr(PyObject *__pyx __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_compile_replaces_locals_genexpr, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_compile_replaces_locals_genexpr, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -6810,19 +7067,19 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 281, __pyx_L1_error) - __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 281, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_r); - /* "dawg.pyx":284 + /* "dawg.pyx":302 * (v.encode('utf8'), unicode(v)) * ) * for k, v in replaces.items() # <<<<<<<<<<<<<< * ) * */ - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_replaces)) { __Pyx_RaiseClosureNameError("replaces"); __PYX_ERR(0, 284, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_replaces, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_replaces)) { __Pyx_RaiseClosureNameError("replaces"); __PYX_ERR(0, 302, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_replaces, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -6836,16 +7093,16 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 302, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -6853,17 +7110,17 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 302, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 302, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -6873,7 +7130,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 284, __pyx_L1_error) + else __PYX_ERR(0, 302, __pyx_L1_error) } break; } @@ -6885,7 +7142,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 284, __pyx_L1_error) + __PYX_ERR(0, 302, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6898,15 +7155,15 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -6914,7 +7171,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 284, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 302, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; @@ -6922,7 +7179,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 284, __pyx_L1_error) + __PYX_ERR(0, 302, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); @@ -6934,14 +7191,14 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dawg.pyx":281 + /* "dawg.pyx":299 * return dict( * ( * k.encode('utf8'), # <<<<<<<<<<<<<< * (v.encode('utf8'), unicode(v)) * ) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_k, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_k, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -6955,18 +7212,18 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_u_utf8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dawg.pyx":282 + /* "dawg.pyx":300 * ( * k.encode('utf8'), * (v.encode('utf8'), unicode(v)) # <<<<<<<<<<<<<< * ) * for k, v in replaces.items() */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -6980,12 +7237,12 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_utf8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_cur_scope->__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_cur_scope->__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); @@ -6993,11 +7250,11 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3); __pyx_t_6 = 0; __pyx_t_3 = 0; - if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 281, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dawg.pyx":284 + /* "dawg.pyx":302 * (v.encode('utf8'), unicode(v)) * ) * for k, v in replaces.items() # <<<<<<<<<<<<<< @@ -7008,7 +7265,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":281 + /* "dawg.pyx":299 * return dict( * ( * k.encode('utf8'), # <<<<<<<<<<<<<< @@ -7037,7 +7294,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou return __pyx_r; } -/* "dawg.pyx":273 +/* "dawg.pyx":291 * * @classmethod * def compile_replaces(cls, replaces): # <<<<<<<<<<<<<< @@ -7045,7 +7302,7 @@ static PyObject *__pyx_gb_4dawg_4DAWG_16compile_replaces_2generator6(__pyx_Corou * for k,v in replaces.items(): */ -static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_replaces) { +static PyObject *__pyx_pf_4dawg_4DAWG_45compile_replaces(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_replaces) { struct __pyx_obj_4dawg___pyx_scope_struct_1_compile_replaces *__pyx_cur_scope; PyObject *__pyx_v_k = NULL; PyObject *__pyx_v_v = NULL; @@ -7067,7 +7324,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_1_compile_replaces *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 273, __pyx_L1_error) + __PYX_ERR(0, 291, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -7075,14 +7332,14 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj __Pyx_INCREF(__pyx_cur_scope->__pyx_v_replaces); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_replaces); - /* "dawg.pyx":275 + /* "dawg.pyx":293 * def compile_replaces(cls, replaces): * * for k,v in replaces.items(): # <<<<<<<<<<<<<< * if len(k) != 1 or len(v) != 1: * raise ValueError("Keys and values must be single-char unicode strings.") */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_replaces, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_replaces, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -7096,16 +7353,16 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -7113,17 +7370,17 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 293, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 293, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -7133,7 +7390,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 275, __pyx_L1_error) + else __PYX_ERR(0, 293, __pyx_L1_error) } break; } @@ -7145,7 +7402,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 275, __pyx_L1_error) + __PYX_ERR(0, 293, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7158,15 +7415,15 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -7174,7 +7431,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 275, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 293, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; @@ -7182,7 +7439,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 275, __pyx_L1_error) + __PYX_ERR(0, 293, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); @@ -7190,40 +7447,40 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); __pyx_t_6 = 0; - /* "dawg.pyx":276 + /* "dawg.pyx":294 * * for k,v in replaces.items(): * if len(k) != 1 or len(v) != 1: # <<<<<<<<<<<<<< * raise ValueError("Keys and values must be single-char unicode strings.") * */ - __pyx_t_10 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_10 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 294, __pyx_L1_error) __pyx_t_11 = ((__pyx_t_10 != 1) != 0); if (!__pyx_t_11) { } else { __pyx_t_9 = __pyx_t_11; goto __pyx_L8_bool_binop_done; } - __pyx_t_10 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_10 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 294, __pyx_L1_error) __pyx_t_11 = ((__pyx_t_10 != 1) != 0); __pyx_t_9 = __pyx_t_11; __pyx_L8_bool_binop_done:; if (unlikely(__pyx_t_9)) { - /* "dawg.pyx":277 + /* "dawg.pyx":295 * for k,v in replaces.items(): * if len(k) != 1 or len(v) != 1: * raise ValueError("Keys and values must be single-char unicode strings.") # <<<<<<<<<<<<<< * * return dict( */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __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, 277, __pyx_L1_error) + __PYX_ERR(0, 295, __pyx_L1_error) - /* "dawg.pyx":276 + /* "dawg.pyx":294 * * for k,v in replaces.items(): * if len(k) != 1 or len(v) != 1: # <<<<<<<<<<<<<< @@ -7232,7 +7489,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj */ } - /* "dawg.pyx":275 + /* "dawg.pyx":293 * def compile_replaces(cls, replaces): * * for k,v in replaces.items(): # <<<<<<<<<<<<<< @@ -7242,7 +7499,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dawg.pyx":279 + /* "dawg.pyx":297 * raise ValueError("Keys and values must be single-char unicode strings.") * * return dict( # <<<<<<<<<<<<<< @@ -7251,31 +7508,31 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj */ __Pyx_XDECREF(__pyx_r); - /* "dawg.pyx":281 + /* "dawg.pyx":299 * return dict( * ( * k.encode('utf8'), # <<<<<<<<<<<<<< * (v.encode('utf8'), unicode(v)) * ) */ - __pyx_t_2 = __pyx_pf_4dawg_4DAWG_16compile_replaces_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_2 = __pyx_pf_4dawg_4DAWG_16compile_replaces_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "dawg.pyx":279 + /* "dawg.pyx":297 * raise ValueError("Keys and values must be single-char unicode strings.") * * return dict( # <<<<<<<<<<<<<< * ( * k.encode('utf8'), */ - __pyx_t_1 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_1 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":273 + /* "dawg.pyx":291 * * @classmethod * def compile_replaces(cls, replaces): # <<<<<<<<<<<<<< @@ -7301,7 +7558,7 @@ static PyObject *__pyx_pf_4dawg_4DAWG_43compile_replaces(CYTHON_UNUSED PyTypeObj return __pyx_r; } -/* "dawg.pyx":288 +/* "dawg.pyx":306 * * * cdef void init_completer(Completer& completer, Dictionary& dic, Guide& guide): # <<<<<<<<<<<<<< @@ -7313,7 +7570,7 @@ static void __pyx_f_4dawg_init_completer(dawgdic::Completer &__pyx_v_completer, __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_completer", 0); - /* "dawg.pyx":289 + /* "dawg.pyx":307 * * cdef void init_completer(Completer& completer, Dictionary& dic, Guide& guide): * completer.set_dic(dic) # <<<<<<<<<<<<<< @@ -7322,7 +7579,7 @@ static void __pyx_f_4dawg_init_completer(dawgdic::Completer &__pyx_v_completer, */ __pyx_v_completer.set_dic(__pyx_v_dic); - /* "dawg.pyx":290 + /* "dawg.pyx":308 * cdef void init_completer(Completer& completer, Dictionary& dic, Guide& guide): * completer.set_dic(dic) * completer.set_guide(guide) # <<<<<<<<<<<<<< @@ -7331,7 +7588,7 @@ static void __pyx_f_4dawg_init_completer(dawgdic::Completer &__pyx_v_completer, */ __pyx_v_completer.set_guide(__pyx_v_guide); - /* "dawg.pyx":288 + /* "dawg.pyx":306 * * * cdef void init_completer(Completer& completer, Dictionary& dic, Guide& guide): # <<<<<<<<<<<<<< @@ -7343,7 +7600,7 @@ static void __pyx_f_4dawg_init_completer(dawgdic::Completer &__pyx_v_completer, __Pyx_RefNannyFinishContext(); } -/* "dawg.pyx":299 +/* "dawg.pyx":317 * cdef Guide guide * * def __init__(self, arg=None, input_is_sorted=False): # <<<<<<<<<<<<<< @@ -7390,7 +7647,7 @@ static int __pyx_pw_4dawg_14CompletionDAWG_1__init__(PyObject *__pyx_v_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 299, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 317, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7407,7 +7664,7 @@ static int __pyx_pw_4dawg_14CompletionDAWG_1__init__(PyObject *__pyx_v_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 299, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 317, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.CompletionDAWG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7431,14 +7688,14 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl int __pyx_t_6; __Pyx_RefNannySetupContext("__init__", 0); - /* "dawg.pyx":300 + /* "dawg.pyx":318 * * def __init__(self, arg=None, input_is_sorted=False): * super(CompletionDAWG, self).__init__(arg, input_is_sorted) # <<<<<<<<<<<<<< * if not _guide_builder.Build(self.dawg, self.dct, &self.guide): * raise Error("Error building completion information") */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_CompletionDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_CompletionDAWG)); @@ -7446,10 +7703,10 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -7467,7 +7724,7 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_arg, __pyx_v_input_is_sorted}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -7475,13 +7732,13 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_arg, __pyx_v_input_is_sorted}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -7492,14 +7749,14 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl __Pyx_INCREF(__pyx_v_input_is_sorted); __Pyx_GIVEREF(__pyx_v_input_is_sorted); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_input_is_sorted); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":301 + /* "dawg.pyx":319 * def __init__(self, arg=None, input_is_sorted=False): * super(CompletionDAWG, self).__init__(arg, input_is_sorted) * if not _guide_builder.Build(self.dawg, self.dct, &self.guide): # <<<<<<<<<<<<<< @@ -7509,14 +7766,14 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl __pyx_t_6 = ((!(dawgdic::GuideBuilder::Build(__pyx_v_self->__pyx_base.dawg, __pyx_v_self->__pyx_base.dct, (&__pyx_v_self->guide)) != 0)) != 0); if (unlikely(__pyx_t_6)) { - /* "dawg.pyx":302 + /* "dawg.pyx":320 * super(CompletionDAWG, self).__init__(arg, input_is_sorted) * if not _guide_builder.Build(self.dawg, self.dct, &self.guide): * raise Error("Error building completion information") # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -7530,14 +7787,14 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_u_Error_building_completion_inform) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Error_building_completion_inform); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 302, __pyx_L1_error) + __PYX_ERR(0, 320, __pyx_L1_error) - /* "dawg.pyx":301 + /* "dawg.pyx":319 * def __init__(self, arg=None, input_is_sorted=False): * super(CompletionDAWG, self).__init__(arg, input_is_sorted) * if not _guide_builder.Build(self.dawg, self.dct, &self.guide): # <<<<<<<<<<<<<< @@ -7546,7 +7803,7 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl */ } - /* "dawg.pyx":299 + /* "dawg.pyx":317 * cdef Guide guide * * def __init__(self, arg=None, input_is_sorted=False): # <<<<<<<<<<<<<< @@ -7569,7 +7826,7 @@ static int __pyx_pf_4dawg_14CompletionDAWG___init__(struct __pyx_obj_4dawg_Compl return __pyx_r; } -/* "dawg.pyx":304 +/* "dawg.pyx":322 * raise Error("Error building completion information") * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -7592,7 +7849,7 @@ static void __pyx_pf_4dawg_14CompletionDAWG_2__dealloc__(struct __pyx_obj_4dawg_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "dawg.pyx":305 + /* "dawg.pyx":323 * * def __dealloc__(self): * self.guide.Clear() # <<<<<<<<<<<<<< @@ -7601,7 +7858,7 @@ static void __pyx_pf_4dawg_14CompletionDAWG_2__dealloc__(struct __pyx_obj_4dawg_ */ __pyx_v_self->guide.Clear(); - /* "dawg.pyx":304 + /* "dawg.pyx":322 * raise Error("Error building completion information") * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -7613,7 +7870,7 @@ static void __pyx_pf_4dawg_14CompletionDAWG_2__dealloc__(struct __pyx_obj_4dawg_ __Pyx_RefNannyFinishContext(); } -/* "dawg.pyx":307 +/* "dawg.pyx":325 * self.guide.Clear() * * cpdef list keys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -7654,7 +7911,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_14CompletionDAWG_5keys)) { __Pyx_XDECREF(__pyx_r); @@ -7671,10 +7928,10 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_prefix); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 307, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 325, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7693,7 +7950,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp #endif } - /* "dawg.pyx":308 + /* "dawg.pyx":326 * * cpdef list keys(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -7702,14 +7959,14 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp */ if (unlikely(__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 308, __pyx_L1_error) + __PYX_ERR(0, 326, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":309 + /* "dawg.pyx":327 * cpdef list keys(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -7718,19 +7975,19 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp */ __pyx_v_index = __pyx_v_self->__pyx_base.dct.root(); - /* "dawg.pyx":310 + /* "dawg.pyx":328 * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() * cdef list res = [] # <<<<<<<<<<<<<< * * if not self.dct.Follow(b_prefix, &index): */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":312 + /* "dawg.pyx":330 * cdef list res = [] * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -7739,13 +7996,13 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 312, __pyx_L1_error) + __PYX_ERR(0, 330, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 312, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 330, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_v_self->__pyx_base.dct.Follow(__pyx_t_5, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":313 + /* "dawg.pyx":331 * * if not self.dct.Follow(b_prefix, &index): * return res # <<<<<<<<<<<<<< @@ -7757,7 +8014,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":312 + /* "dawg.pyx":330 * cdef list res = [] * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -7766,7 +8023,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp */ } - /* "dawg.pyx":316 + /* "dawg.pyx":334 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -7775,7 +8032,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp */ __pyx_f_4dawg_init_completer(__pyx_v_completer, __pyx_v_self->__pyx_base.dct, __pyx_v_self->guide); - /* "dawg.pyx":317 + /* "dawg.pyx":335 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -7784,12 +8041,12 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 317, __pyx_L1_error) + __PYX_ERR(0, 335, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 317, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error) __pyx_v_completer.Start(__pyx_v_index, __pyx_t_7); - /* "dawg.pyx":319 + /* "dawg.pyx":337 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -7800,7 +8057,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp __pyx_t_6 = (__pyx_v_completer.Next() != 0); if (!__pyx_t_6) break; - /* "dawg.pyx":320 + /* "dawg.pyx":338 * * while completer.Next(): * key = (completer.key()).decode('utf8') # <<<<<<<<<<<<<< @@ -7808,23 +8065,23 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp * */ __pyx_t_7 = ((char *)__pyx_v_completer.key()); - __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_7, 0, strlen(__pyx_t_7), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_7, 0, strlen(__pyx_t_7), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":321 + /* "dawg.pyx":339 * while completer.Next(): * key = (completer.key()).decode('utf8') * res.append(key) # <<<<<<<<<<<<<< * * return res */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_key); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_key); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 339, __pyx_L1_error) } - /* "dawg.pyx":323 + /* "dawg.pyx":341 * res.append(key) * * return res # <<<<<<<<<<<<<< @@ -7836,7 +8093,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_keys(struct __pyx_obj_4dawg_Comp __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":307 + /* "dawg.pyx":325 * self.guide.Clear() * * cpdef list keys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -7891,7 +8148,7 @@ static PyObject *__pyx_pw_4dawg_14CompletionDAWG_5keys(PyObject *__pyx_v_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keys") < 0)) __PYX_ERR(0, 307, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keys") < 0)) __PYX_ERR(0, 325, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7905,13 +8162,13 @@ static PyObject *__pyx_pw_4dawg_14CompletionDAWG_5keys(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("keys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 307, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 325, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.CompletionDAWG.keys", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 307, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 325, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_14CompletionDAWG_4keys(((struct __pyx_obj_4dawg_CompletionDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -7932,7 +8189,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_4keys(struct __pyx_obj_4dawg_Co __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.prefix = __pyx_v_prefix; - __pyx_t_1 = __pyx_vtabptr_4dawg_CompletionDAWG->keys(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_CompletionDAWG->keys(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7950,7 +8207,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_4keys(struct __pyx_obj_4dawg_Co } static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":325 +/* "dawg.pyx":343 * return res * * def iterkeys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -7988,7 +8245,7 @@ static PyObject *__pyx_pw_4dawg_14CompletionDAWG_7iterkeys(PyObject *__pyx_v_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterkeys") < 0)) __PYX_ERR(0, 325, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterkeys") < 0)) __PYX_ERR(0, 343, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -8002,13 +8259,13 @@ static PyObject *__pyx_pw_4dawg_14CompletionDAWG_7iterkeys(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iterkeys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 325, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("iterkeys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 343, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.CompletionDAWG.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 325, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 343, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_14CompletionDAWG_6iterkeys(((struct __pyx_obj_4dawg_CompletionDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -8029,7 +8286,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_6iterkeys(struct __pyx_obj_4daw if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_3_iterkeys *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 325, __pyx_L1_error) + __PYX_ERR(0, 343, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -8040,7 +8297,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_6iterkeys(struct __pyx_obj_4daw __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_14CompletionDAWG_8generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterkeys, __pyx_n_s_CompletionDAWG_iterkeys, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 325, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_14CompletionDAWG_8generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterkeys, __pyx_n_s_CompletionDAWG_iterkeys, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -8074,9 +8331,9 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 325, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L1_error) - /* "dawg.pyx":326 + /* "dawg.pyx":344 * * def iterkeys(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -8085,15 +8342,15 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje */ if (unlikely(__pyx_cur_scope->__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 326, __pyx_L1_error) + __PYX_ERR(0, 344, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":327 + /* "dawg.pyx":345 * def iterkeys(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -8102,7 +8359,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje */ __pyx_cur_scope->__pyx_v_index = __pyx_cur_scope->__pyx_v_self->__pyx_base.dct.root(); - /* "dawg.pyx":329 + /* "dawg.pyx":347 * cdef BaseType index = self.dct.root() * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -8111,13 +8368,13 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 329, __pyx_L1_error) + __PYX_ERR(0, 347, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L1_error) __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_self->__pyx_base.dct.Follow(__pyx_t_2, (&__pyx_cur_scope->__pyx_v_index)) != 0)) != 0); if (__pyx_t_3) { - /* "dawg.pyx":330 + /* "dawg.pyx":348 * * if not self.dct.Follow(b_prefix, &index): * return # <<<<<<<<<<<<<< @@ -8128,7 +8385,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje __pyx_r = NULL; goto __pyx_L0; - /* "dawg.pyx":329 + /* "dawg.pyx":347 * cdef BaseType index = self.dct.root() * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -8137,7 +8394,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje */ } - /* "dawg.pyx":333 + /* "dawg.pyx":351 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -8146,7 +8403,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje */ __pyx_f_4dawg_init_completer(__pyx_cur_scope->__pyx_v_completer, __pyx_cur_scope->__pyx_v_self->__pyx_base.dct, __pyx_cur_scope->__pyx_v_self->guide); - /* "dawg.pyx":334 + /* "dawg.pyx":352 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -8155,12 +8412,12 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 334, __pyx_L1_error) + __PYX_ERR(0, 352, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) __pyx_cur_scope->__pyx_v_completer.Start(__pyx_cur_scope->__pyx_v_index, __pyx_t_4); - /* "dawg.pyx":336 + /* "dawg.pyx":354 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -8171,7 +8428,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje __pyx_t_3 = (__pyx_cur_scope->__pyx_v_completer.Next() != 0); if (!__pyx_t_3) break; - /* "dawg.pyx":337 + /* "dawg.pyx":355 * * while completer.Next(): * key = (completer.key()).decode('utf8') # <<<<<<<<<<<<<< @@ -8179,7 +8436,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje * */ __pyx_t_4 = ((char *)__pyx_cur_scope->__pyx_v_completer.key()); - __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key); @@ -8187,7 +8444,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje __Pyx_GIVEREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":338 + /* "dawg.pyx":356 * while completer.Next(): * key = (completer.key()).decode('utf8') * yield key # <<<<<<<<<<<<<< @@ -8203,11 +8460,11 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L7_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 338, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 356, __pyx_L1_error) } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":325 + /* "dawg.pyx":343 * return res * * def iterkeys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -8232,7 +8489,7 @@ static PyObject *__pyx_gb_4dawg_14CompletionDAWG_8generator1(__pyx_CoroutineObje return __pyx_r; } -/* "dawg.pyx":340 +/* "dawg.pyx":358 * yield key * * def has_keys_with_prefix(self, unicode prefix): # <<<<<<<<<<<<<< @@ -8247,7 +8504,7 @@ static PyObject *__pyx_pw_4dawg_14CompletionDAWG_10has_keys_with_prefix(PyObject PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_keys_with_prefix (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 358, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(((struct __pyx_obj_4dawg_CompletionDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_prefix)); /* function exit code */ @@ -8271,7 +8528,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ char *__pyx_t_4; __Pyx_RefNannySetupContext("has_keys_with_prefix", 0); - /* "dawg.pyx":341 + /* "dawg.pyx":359 * * def has_keys_with_prefix(self, unicode prefix): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -8280,14 +8537,14 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ */ if (unlikely(__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 341, __pyx_L1_error) + __PYX_ERR(0, 359, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":342 + /* "dawg.pyx":360 * def has_keys_with_prefix(self, unicode prefix): * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -8296,7 +8553,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ */ __pyx_v_index = __pyx_v_self->__pyx_base.dct.root(); - /* "dawg.pyx":344 + /* "dawg.pyx":362 * cdef BaseType index = self.dct.root() * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -8305,13 +8562,13 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 344, __pyx_L1_error) + __PYX_ERR(0, 362, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 344, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error) __pyx_t_3 = ((!(__pyx_v_self->__pyx_base.dct.Follow(__pyx_t_2, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_3) { - /* "dawg.pyx":345 + /* "dawg.pyx":363 * * if not self.dct.Follow(b_prefix, &index): * return False # <<<<<<<<<<<<<< @@ -8323,7 +8580,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ __pyx_r = Py_False; goto __pyx_L0; - /* "dawg.pyx":344 + /* "dawg.pyx":362 * cdef BaseType index = self.dct.root() * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -8332,7 +8589,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ */ } - /* "dawg.pyx":348 + /* "dawg.pyx":366 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -8341,7 +8598,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ */ __pyx_f_4dawg_init_completer(__pyx_v_completer, __pyx_v_self->__pyx_base.dct, __pyx_v_self->guide); - /* "dawg.pyx":349 + /* "dawg.pyx":367 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -8350,12 +8607,12 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 349, __pyx_L1_error) + __PYX_ERR(0, 367, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error) __pyx_v_completer.Start(__pyx_v_index, __pyx_t_4); - /* "dawg.pyx":351 + /* "dawg.pyx":369 * completer.Start(index, b_prefix) * * return completer.Next() # <<<<<<<<<<<<<< @@ -8363,13 +8620,13 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ * cpdef bytes tobytes(self) except +: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_completer.Next()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_completer.Next()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":340 + /* "dawg.pyx":358 * yield key * * def has_keys_with_prefix(self, unicode prefix): # <<<<<<<<<<<<<< @@ -8389,7 +8646,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_9has_keys_with_prefix(struct __ return __pyx_r; } -/* "dawg.pyx":353 +/* "dawg.pyx":371 * return completer.Next() * * cpdef bytes tobytes(self) except +: # <<<<<<<<<<<<<< @@ -8417,7 +8674,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_tobytes(struct __pyx_obj_4dawg_C if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tobytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tobytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_14CompletionDAWG_12tobytes)) { __Pyx_XDECREF(__pyx_r); @@ -8434,10 +8691,10 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_tobytes(struct __pyx_obj_4dawg_C } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 353, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 371, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8456,7 +8713,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_tobytes(struct __pyx_obj_4dawg_C #endif } - /* "dawg.pyx":358 + /* "dawg.pyx":376 * """ * cdef stringstream stream * self.dct.Write( &stream) # <<<<<<<<<<<<<< @@ -8467,10 +8724,10 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_tobytes(struct __pyx_obj_4dawg_C __pyx_v_self->__pyx_base.dct.Write(((std::ostream *)(&__pyx_v_stream))); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 358, __pyx_L1_error) + __PYX_ERR(0, 376, __pyx_L1_error) } - /* "dawg.pyx":359 + /* "dawg.pyx":377 * cdef stringstream stream * self.dct.Write( &stream) * self.guide.Write( &stream) # <<<<<<<<<<<<<< @@ -8479,19 +8736,19 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_tobytes(struct __pyx_obj_4dawg_C */ (void)(__pyx_v_self->guide.Write(((std::ostream *)(&__pyx_v_stream)))); - /* "dawg.pyx":360 + /* "dawg.pyx":378 * self.dct.Write( &stream) * self.guide.Write( &stream) * cdef bytes res = stream.str() # <<<<<<<<<<<<<< * return res * */ - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_stream.str()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_stream.str()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":361 + /* "dawg.pyx":379 * self.guide.Write( &stream) * cdef bytes res = stream.str() * return res # <<<<<<<<<<<<<< @@ -8503,7 +8760,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_tobytes(struct __pyx_obj_4dawg_C __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":353 + /* "dawg.pyx":371 * return completer.Next() * * cpdef bytes tobytes(self) except +: # <<<<<<<<<<<<<< @@ -8548,10 +8805,10 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_11tobytes(struct __pyx_obj_4daw __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_f_4dawg_14CompletionDAWG_tobytes(__pyx_v_self, 1); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 353, __pyx_L1_error) + __PYX_ERR(0, 371, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; @@ -8569,7 +8826,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_11tobytes(struct __pyx_obj_4daw return __pyx_r; } -/* "dawg.pyx":363 +/* "dawg.pyx":381 * return res * * cpdef frombytes(self, bytes data): # <<<<<<<<<<<<<< @@ -8601,7 +8858,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_frombytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_frombytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_14CompletionDAWG_14frombytes)) { __Pyx_XDECREF(__pyx_r); @@ -8618,7 +8875,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_data); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -8639,7 +8896,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg #endif } - /* "dawg.pyx":370 + /* "dawg.pyx":388 * loaded using frombytes vs load). * """ * cdef char* c_data = data # <<<<<<<<<<<<<< @@ -8648,12 +8905,12 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ if (unlikely(__pyx_v_data == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 370, __pyx_L1_error) + __PYX_ERR(0, 388, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 388, __pyx_L1_error) __pyx_v_c_data = __pyx_t_5; - /* "dawg.pyx":372 + /* "dawg.pyx":390 * cdef char* c_data = data * cdef stringstream stream * stream.write(c_data, len(data)) # <<<<<<<<<<<<<< @@ -8662,12 +8919,12 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ if (unlikely(__pyx_v_data == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 372, __pyx_L1_error) + __PYX_ERR(0, 390, __pyx_L1_error) } - __pyx_t_6 = PyBytes_GET_SIZE(__pyx_v_data); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_6 = PyBytes_GET_SIZE(__pyx_v_data); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 390, __pyx_L1_error) (void)(__pyx_v_stream.write(__pyx_v_c_data, __pyx_t_6)); - /* "dawg.pyx":373 + /* "dawg.pyx":391 * cdef stringstream stream * stream.write(c_data, len(data)) * stream.seekg(0) # <<<<<<<<<<<<<< @@ -8676,7 +8933,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ (void)(__pyx_v_stream.seekg(0)); - /* "dawg.pyx":375 + /* "dawg.pyx":393 * stream.seekg(0) * * res = self.dct.Read( &stream) # <<<<<<<<<<<<<< @@ -8687,11 +8944,11 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg __pyx_t_7 = __pyx_v_self->__pyx_base.dct.Read(((std::istream *)(&__pyx_v_stream))); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 375, __pyx_L1_error) + __PYX_ERR(0, 393, __pyx_L1_error) } __pyx_v_res = __pyx_t_7; - /* "dawg.pyx":376 + /* "dawg.pyx":394 * * res = self.dct.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -8701,7 +8958,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg __pyx_t_7 = ((!(__pyx_v_res != 0)) != 0); if (unlikely(__pyx_t_7)) { - /* "dawg.pyx":377 + /* "dawg.pyx":395 * res = self.dct.Read( &stream) * if not res: * self.dct.Clear() # <<<<<<<<<<<<<< @@ -8710,20 +8967,20 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ __pyx_v_self->__pyx_base.dct.Clear(); - /* "dawg.pyx":378 + /* "dawg.pyx":396 * if not res: * self.dct.Clear() * raise IOError("Invalid data format: can't load _dawg.Dictionary") # <<<<<<<<<<<<<< * * res = self.guide.Read( &stream) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __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, 378, __pyx_L1_error) + __PYX_ERR(0, 396, __pyx_L1_error) - /* "dawg.pyx":376 + /* "dawg.pyx":394 * * res = self.dct.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -8732,7 +8989,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ } - /* "dawg.pyx":380 + /* "dawg.pyx":398 * raise IOError("Invalid data format: can't load _dawg.Dictionary") * * res = self.guide.Read( &stream) # <<<<<<<<<<<<<< @@ -8741,7 +8998,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ __pyx_v_res = __pyx_v_self->guide.Read(((std::istream *)(&__pyx_v_stream))); - /* "dawg.pyx":381 + /* "dawg.pyx":399 * * res = self.guide.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -8751,7 +9008,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg __pyx_t_7 = ((!(__pyx_v_res != 0)) != 0); if (unlikely(__pyx_t_7)) { - /* "dawg.pyx":382 + /* "dawg.pyx":400 * res = self.guide.Read( &stream) * if not res: * self.guide.Clear() # <<<<<<<<<<<<<< @@ -8760,7 +9017,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ __pyx_v_self->guide.Clear(); - /* "dawg.pyx":383 + /* "dawg.pyx":401 * if not res: * self.guide.Clear() * self.dct.Clear() # <<<<<<<<<<<<<< @@ -8769,20 +9026,20 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ __pyx_v_self->__pyx_base.dct.Clear(); - /* "dawg.pyx":384 + /* "dawg.pyx":402 * self.guide.Clear() * self.dct.Clear() * raise IOError("Invalid data format: can't load _dawg.Guide") # <<<<<<<<<<<<<< * * return self */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __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, 384, __pyx_L1_error) + __PYX_ERR(0, 402, __pyx_L1_error) - /* "dawg.pyx":381 + /* "dawg.pyx":399 * * res = self.guide.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -8791,7 +9048,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg */ } - /* "dawg.pyx":386 + /* "dawg.pyx":404 * raise IOError("Invalid data format: can't load _dawg.Guide") * * return self # <<<<<<<<<<<<<< @@ -8803,7 +9060,7 @@ static PyObject *__pyx_f_4dawg_14CompletionDAWG_frombytes(struct __pyx_obj_4dawg __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "dawg.pyx":363 + /* "dawg.pyx":381 * return res * * cpdef frombytes(self, bytes data): # <<<<<<<<<<<<<< @@ -8832,7 +9089,7 @@ static PyObject *__pyx_pw_4dawg_14CompletionDAWG_14frombytes(PyObject *__pyx_v_s PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("frombytes (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 363, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 381, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_14CompletionDAWG_13frombytes(((struct __pyx_obj_4dawg_CompletionDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_data)); /* function exit code */ @@ -8850,7 +9107,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_13frombytes(struct __pyx_obj_4d PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("frombytes", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_14CompletionDAWG_frombytes(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_14CompletionDAWG_frombytes(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8867,7 +9124,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_13frombytes(struct __pyx_obj_4d return __pyx_r; } -/* "dawg.pyx":388 +/* "dawg.pyx":406 * return self * * def load(self, path): # <<<<<<<<<<<<<< @@ -8915,7 +9172,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __Pyx_RefNannySetupContext("load", 0); __Pyx_INCREF(__pyx_v_path); - /* "dawg.pyx":392 + /* "dawg.pyx":410 * Load DAWG from a file. * """ * if isinstance(path, unicode): # <<<<<<<<<<<<<< @@ -8926,18 +9183,18 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "dawg.pyx":393 + /* "dawg.pyx":411 * """ * if isinstance(path, unicode): * path = path.encode(sys.getfilesystemencoding()) # <<<<<<<<<<<<<< * * cdef ifstream stream */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -8952,7 +9209,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C } __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -8968,13 +9225,13 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3); __pyx_t_3 = 0; - /* "dawg.pyx":392 + /* "dawg.pyx":410 * Load DAWG from a file. * """ * if isinstance(path, unicode): # <<<<<<<<<<<<<< @@ -8983,22 +9240,22 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ } - /* "dawg.pyx":396 + /* "dawg.pyx":414 * * cdef ifstream stream * stream.open(path, iostream.binary) # <<<<<<<<<<<<<< * if stream.fail(): * raise IOError("It's not possible to read file stream") */ - __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_v_path); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_v_path); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) try { __pyx_v_stream.open(__pyx_t_8, std::stringstream::binary); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 396, __pyx_L1_error) + __PYX_ERR(0, 414, __pyx_L1_error) } - /* "dawg.pyx":397 + /* "dawg.pyx":415 * cdef ifstream stream * stream.open(path, iostream.binary) * if stream.fail(): # <<<<<<<<<<<<<< @@ -9009,25 +9266,25 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_t_9 = __pyx_v_stream.fail(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 397, __pyx_L1_error) + __PYX_ERR(0, 415, __pyx_L1_error) } __pyx_t_2 = (__pyx_t_9 != 0); if (unlikely(__pyx_t_2)) { - /* "dawg.pyx":398 + /* "dawg.pyx":416 * stream.open(path, iostream.binary) * if stream.fail(): * raise IOError("It's not possible to read file stream") # <<<<<<<<<<<<<< * * try: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 398, __pyx_L1_error) + __PYX_ERR(0, 416, __pyx_L1_error) - /* "dawg.pyx":397 + /* "dawg.pyx":415 * cdef ifstream stream * stream.open(path, iostream.binary) * if stream.fail(): # <<<<<<<<<<<<<< @@ -9036,7 +9293,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ } - /* "dawg.pyx":400 + /* "dawg.pyx":418 * raise IOError("It's not possible to read file stream") * * try: # <<<<<<<<<<<<<< @@ -9045,7 +9302,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ /*try:*/ { - /* "dawg.pyx":401 + /* "dawg.pyx":419 * * try: * res = self.dct.Read( &stream) # <<<<<<<<<<<<<< @@ -9056,11 +9313,11 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_t_2 = __pyx_v_self->__pyx_base.dct.Read(((std::istream *)(&__pyx_v_stream))); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 401, __pyx_L6_error) + __PYX_ERR(0, 419, __pyx_L6_error) } __pyx_v_res = __pyx_t_2; - /* "dawg.pyx":402 + /* "dawg.pyx":420 * try: * res = self.dct.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -9070,7 +9327,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_t_2 = ((!(__pyx_v_res != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "dawg.pyx":403 + /* "dawg.pyx":421 * res = self.dct.Read( &stream) * if not res: * self.dct.Clear() # <<<<<<<<<<<<<< @@ -9079,20 +9336,20 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ __pyx_v_self->__pyx_base.dct.Clear(); - /* "dawg.pyx":404 + /* "dawg.pyx":422 * if not res: * self.dct.Clear() * raise IOError("Invalid data format: can't load _dawg.Dictionary") # <<<<<<<<<<<<<< * * res = self.guide.Read( &stream) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 404, __pyx_L6_error) + __PYX_ERR(0, 422, __pyx_L6_error) - /* "dawg.pyx":402 + /* "dawg.pyx":420 * try: * res = self.dct.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -9101,7 +9358,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ } - /* "dawg.pyx":406 + /* "dawg.pyx":424 * raise IOError("Invalid data format: can't load _dawg.Dictionary") * * res = self.guide.Read( &stream) # <<<<<<<<<<<<<< @@ -9110,7 +9367,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ __pyx_v_res = __pyx_v_self->guide.Read(((std::istream *)(&__pyx_v_stream))); - /* "dawg.pyx":407 + /* "dawg.pyx":425 * * res = self.guide.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -9120,7 +9377,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_t_2 = ((!(__pyx_v_res != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "dawg.pyx":408 + /* "dawg.pyx":426 * res = self.guide.Read( &stream) * if not res: * self.guide.Clear() # <<<<<<<<<<<<<< @@ -9129,7 +9386,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ __pyx_v_self->guide.Clear(); - /* "dawg.pyx":409 + /* "dawg.pyx":427 * if not res: * self.guide.Clear() * self.dct.Clear() # <<<<<<<<<<<<<< @@ -9138,20 +9395,20 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C */ __pyx_v_self->__pyx_base.dct.Clear(); - /* "dawg.pyx":410 + /* "dawg.pyx":428 * self.guide.Clear() * self.dct.Clear() * raise IOError("Invalid data format: can't load _dawg.Guide") # <<<<<<<<<<<<<< * * finally: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 410, __pyx_L6_error) + __PYX_ERR(0, 428, __pyx_L6_error) - /* "dawg.pyx":407 + /* "dawg.pyx":425 * * res = self.guide.Read( &stream) * if not res: # <<<<<<<<<<<<<< @@ -9161,7 +9418,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C } } - /* "dawg.pyx":413 + /* "dawg.pyx":431 * * finally: * stream.close() # <<<<<<<<<<<<<< @@ -9174,7 +9431,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_v_stream.close(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 413, __pyx_L1_error) + __PYX_ERR(0, 431, __pyx_L1_error) } goto __pyx_L7; } @@ -9202,7 +9459,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_v_stream.close(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 413, __pyx_L11_error) + __PYX_ERR(0, 431, __pyx_L11_error) } } if (PY_MAJOR_VERSION >= 3) { @@ -9234,7 +9491,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_L7:; } - /* "dawg.pyx":415 + /* "dawg.pyx":433 * stream.close() * * return self # <<<<<<<<<<<<<< @@ -9246,7 +9503,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "dawg.pyx":388 + /* "dawg.pyx":406 * return self * * def load(self, path): # <<<<<<<<<<<<<< @@ -9270,7 +9527,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_15load(struct __pyx_obj_4dawg_C return __pyx_r; } -/* "dawg.pyx":417 +/* "dawg.pyx":435 * return self * * def _transitions(self): # <<<<<<<<<<<<<< @@ -9312,19 +9569,19 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj int __pyx_t_9; __Pyx_RefNannySetupContext("_transitions", 0); - /* "dawg.pyx":418 + /* "dawg.pyx":436 * * def _transitions(self): * transitions = set() # <<<<<<<<<<<<<< * cdef BaseType index, prev_index, completer_index * cdef char* key */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_transitions = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":423 + /* "dawg.pyx":441 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -9333,7 +9590,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj */ __pyx_f_4dawg_init_completer(__pyx_v_completer, __pyx_v_self->__pyx_base.dct, __pyx_v_self->guide); - /* "dawg.pyx":424 + /* "dawg.pyx":442 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(self.dct.root()) # <<<<<<<<<<<<<< @@ -9342,7 +9599,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj */ __pyx_v_completer.Start(__pyx_v_self->__pyx_base.dct.root()); - /* "dawg.pyx":426 + /* "dawg.pyx":444 * completer.Start(self.dct.root()) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -9353,7 +9610,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj __pyx_t_2 = (__pyx_v_completer.Next() != 0); if (!__pyx_t_2) break; - /* "dawg.pyx":427 + /* "dawg.pyx":445 * * while completer.Next(): * key = completer.key() # <<<<<<<<<<<<<< @@ -9362,7 +9619,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj */ __pyx_v_key = ((char *)__pyx_v_completer.key()); - /* "dawg.pyx":429 + /* "dawg.pyx":447 * key = completer.key() * * index = self.dct.root() # <<<<<<<<<<<<<< @@ -9371,7 +9628,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj */ __pyx_v_index = __pyx_v_self->__pyx_base.dct.root(); - /* "dawg.pyx":431 + /* "dawg.pyx":449 * index = self.dct.root() * * for i in range(completer.length()): # <<<<<<<<<<<<<< @@ -9383,7 +9640,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "dawg.pyx":432 + /* "dawg.pyx":450 * * for i in range(completer.length()): * prev_index = index # <<<<<<<<<<<<<< @@ -9392,7 +9649,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj */ __pyx_v_prev_index = __pyx_v_index; - /* "dawg.pyx":433 + /* "dawg.pyx":451 * for i in range(completer.length()): * prev_index = index * self.dct.Follow(&(key[i]), 1, &index) # <<<<<<<<<<<<<< @@ -9401,20 +9658,20 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj */ (void)(__pyx_v_self->__pyx_base.dct.Follow((&(__pyx_v_key[__pyx_v_i])), 1, (&__pyx_v_index))); - /* "dawg.pyx":435 + /* "dawg.pyx":453 * self.dct.Follow(&(key[i]), 1, &index) * transitions.add( * (prev_index, key[i], index) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_1 = __Pyx_PyInt_From_dawgdic_3a__3a_BaseType(__pyx_v_prev_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_dawgdic_3a__3a_BaseType(__pyx_v_prev_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyInt_From_unsigned_char(((unsigned char)(__pyx_v_key[__pyx_v_i]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_unsigned_char(((unsigned char)(__pyx_v_key[__pyx_v_i]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_dawgdic_3a__3a_BaseType(__pyx_v_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_dawgdic_3a__3a_BaseType(__pyx_v_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); @@ -9426,19 +9683,19 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj __pyx_t_6 = 0; __pyx_t_7 = 0; - /* "dawg.pyx":434 + /* "dawg.pyx":452 * prev_index = index * self.dct.Follow(&(key[i]), 1, &index) * transitions.add( # <<<<<<<<<<<<<< * (prev_index, key[i], index) * ) */ - __pyx_t_9 = PySet_Add(__pyx_v_transitions, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_t_9 = PySet_Add(__pyx_v_transitions, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } } - /* "dawg.pyx":438 + /* "dawg.pyx":456 * ) * * return sorted(list(transitions)) # <<<<<<<<<<<<<< @@ -9446,19 +9703,19 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = PySequence_List(__pyx_v_transitions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_7 = PySequence_List(__pyx_v_transitions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_6 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = PyList_Sort(__pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_9 = PyList_Sort(__pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 456, __pyx_L1_error) __pyx_r = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L0; - /* "dawg.pyx":417 + /* "dawg.pyx":435 * return self * * def _transitions(self): # <<<<<<<<<<<<<< @@ -9481,7 +9738,7 @@ static PyObject *__pyx_pf_4dawg_14CompletionDAWG_17_transitions(struct __pyx_obj return __pyx_r; } -/* "dawg.pyx":473 +/* "dawg.pyx":491 * cdef Completer* _completer * * def __init__(self, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -9507,7 +9764,7 @@ static int __pyx_pw_4dawg_9BytesDAWG_1__init__(PyObject *__pyx_v_self, PyObject PyObject* values[3] = {0,0,0}; values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_False); - values[2] = __pyx_k__10; + values[2] = __pyx_k__11; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -9542,7 +9799,7 @@ static int __pyx_pw_4dawg_9BytesDAWG_1__init__(PyObject *__pyx_v_self, PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 473, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 491, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -9562,13 +9819,13 @@ static int __pyx_pw_4dawg_9BytesDAWG_1__init__(PyObject *__pyx_v_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 473, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 491, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload_separator), (&PyBytes_Type), 1, "payload_separator", 1))) __PYX_ERR(0, 473, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload_separator), (&PyBytes_Type), 1, "payload_separator", 1))) __PYX_ERR(0, 491, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG___init__(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_arg, __pyx_v_input_is_sorted, __pyx_v_payload_separator); /* function exit code */ @@ -9581,7 +9838,7 @@ static int __pyx_pw_4dawg_9BytesDAWG_1__init__(PyObject *__pyx_v_self, PyObject } static PyObject *__pyx_gb_4dawg_9BytesDAWG_8__init___2generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":483 +/* "dawg.pyx":501 * self._c_payload_separator = ord(payload_separator) * * keys = (self._raw_key(d[0], d[1]) for d in arg) # <<<<<<<<<<<<<< @@ -9598,7 +9855,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_8__init___genexpr(PyObject *__pyx_sel if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_5_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 483, __pyx_L1_error) + __PYX_ERR(0, 501, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -9606,7 +9863,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_8__init___genexpr(PyObject *__pyx_sel __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_9BytesDAWG_8__init___2generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_9BytesDAWG_8__init___2generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -9642,32 +9899,32 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_8__init___2generator7(__pyx_Coroutine return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 483, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 483, __pyx_L1_error) } + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 501, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 501, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 501, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 501, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -9677,7 +9934,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_8__init___2generator7(__pyx_Coroutine PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 483, __pyx_L1_error) + else __PYX_ERR(0, 501, __pyx_L1_error) } break; } @@ -9687,14 +9944,14 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_8__init___2generator7(__pyx_Coroutine __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 483, __pyx_L1_error) } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 501, __pyx_L1_error) } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 483, __pyx_L1_error) - __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error) + if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 483, __pyx_L1_error) - __pyx_t_6 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_raw_key(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_5), 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 483, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_raw_key(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_5), 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9716,7 +9973,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_8__init___2generator7(__pyx_Coroutine __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 483, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 501, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -9741,7 +9998,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_8__init___2generator7(__pyx_Coroutine return __pyx_r; } -/* "dawg.pyx":473 +/* "dawg.pyx":491 * cdef Completer* _completer * * def __init__(self, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -9767,7 +10024,7 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_4___init__ *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 473, __pyx_L1_error) + __PYX_ERR(0, 491, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -9778,7 +10035,7 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * __Pyx_INCREF(__pyx_cur_scope->__pyx_v_arg); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_arg); - /* "dawg.pyx":477 + /* "dawg.pyx":495 * ``arg`` must be an iterable of tuples (unicode_key, bytes_payload). * """ * if arg is None: # <<<<<<<<<<<<<< @@ -9789,21 +10046,21 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "dawg.pyx":478 + /* "dawg.pyx":496 * """ * if arg is None: * arg = [] # <<<<<<<<<<<<<< * * self._b_payload_separator = payload_separator */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arg); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_arg, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dawg.pyx":477 + /* "dawg.pyx":495 * ``arg`` must be an iterable of tuples (unicode_key, bytes_payload). * """ * if arg is None: # <<<<<<<<<<<<<< @@ -9812,7 +10069,7 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * */ } - /* "dawg.pyx":480 + /* "dawg.pyx":498 * arg = [] * * self._b_payload_separator = payload_separator # <<<<<<<<<<<<<< @@ -9825,36 +10082,36 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_b_payload_separator); __pyx_cur_scope->__pyx_v_self->_b_payload_separator = __pyx_v_payload_separator; - /* "dawg.pyx":481 + /* "dawg.pyx":499 * * self._b_payload_separator = payload_separator * self._c_payload_separator = ord(payload_separator) # <<<<<<<<<<<<<< * * keys = (self._raw_key(d[0], d[1]) for d in arg) */ - __pyx_t_4 = __Pyx_PyObject_Ord(__pyx_v_payload_separator); if (unlikely(__pyx_t_4 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Ord(__pyx_v_payload_separator); if (unlikely(__pyx_t_4 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 499, __pyx_L1_error) __pyx_cur_scope->__pyx_v_self->_c_payload_separator = ((unsigned int)__pyx_t_4); - /* "dawg.pyx":483 + /* "dawg.pyx":501 * self._c_payload_separator = ord(payload_separator) * * keys = (self._raw_key(d[0], d[1]) for d in arg) # <<<<<<<<<<<<<< * super(BytesDAWG, self).__init__(keys, input_is_sorted) * */ - __pyx_t_3 = __pyx_pf_4dawg_9BytesDAWG_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_3 = __pyx_pf_4dawg_9BytesDAWG_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_keys = __pyx_t_3; __pyx_t_3 = 0; - /* "dawg.pyx":484 + /* "dawg.pyx":502 * * keys = (self._raw_key(d[0], d[1]) for d in arg) * super(BytesDAWG, self).__init__(keys, input_is_sorted) # <<<<<<<<<<<<<< * * self._update_completer() */ - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_BytesDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_BytesDAWG)); @@ -9862,10 +10119,10 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_self)); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -9883,7 +10140,7 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_keys, __pyx_v_input_is_sorted}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); } else @@ -9891,13 +10148,13 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_keys, __pyx_v_input_is_sorted}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -9908,25 +10165,25 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * __Pyx_INCREF(__pyx_v_input_is_sorted); __Pyx_GIVEREF(__pyx_v_input_is_sorted); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_input_is_sorted); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dawg.pyx":486 + /* "dawg.pyx":504 * super(BytesDAWG, self).__init__(keys, input_is_sorted) * * self._update_completer() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_t_3 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_update_completer(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_update_completer(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dawg.pyx":473 + /* "dawg.pyx":491 * cdef Completer* _completer * * def __init__(self, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -9951,7 +10208,7 @@ static int __pyx_pf_4dawg_9BytesDAWG___init__(struct __pyx_obj_4dawg_BytesDAWG * return __pyx_r; } -/* "dawg.pyx":488 +/* "dawg.pyx":506 * self._update_completer() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -9975,7 +10232,7 @@ static void __pyx_pf_4dawg_9BytesDAWG_2__dealloc__(struct __pyx_obj_4dawg_BytesD int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "dawg.pyx":489 + /* "dawg.pyx":507 * * def __dealloc__(self): * if self._completer: # <<<<<<<<<<<<<< @@ -9985,7 +10242,7 @@ static void __pyx_pf_4dawg_9BytesDAWG_2__dealloc__(struct __pyx_obj_4dawg_BytesD __pyx_t_1 = (__pyx_v_self->_completer != 0); if (__pyx_t_1) { - /* "dawg.pyx":490 + /* "dawg.pyx":508 * def __dealloc__(self): * if self._completer: * del self._completer # <<<<<<<<<<<<<< @@ -9994,7 +10251,7 @@ static void __pyx_pf_4dawg_9BytesDAWG_2__dealloc__(struct __pyx_obj_4dawg_BytesD */ delete __pyx_v_self->_completer; - /* "dawg.pyx":489 + /* "dawg.pyx":507 * * def __dealloc__(self): * if self._completer: # <<<<<<<<<<<<<< @@ -10003,7 +10260,7 @@ static void __pyx_pf_4dawg_9BytesDAWG_2__dealloc__(struct __pyx_obj_4dawg_BytesD */ } - /* "dawg.pyx":488 + /* "dawg.pyx":506 * self._update_completer() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -10015,7 +10272,7 @@ static void __pyx_pf_4dawg_9BytesDAWG_2__dealloc__(struct __pyx_obj_4dawg_BytesD __Pyx_RefNannyFinishContext(); } -/* "dawg.pyx":492 +/* "dawg.pyx":510 * del self._completer * * cpdef bytes _raw_key(self, unicode key, bytes payload): # <<<<<<<<<<<<<< @@ -10049,7 +10306,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raw_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raw_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_5_raw_key)) { __Pyx_XDECREF(__pyx_r); @@ -10069,7 +10326,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_payload}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else @@ -10077,13 +10334,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_payload}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -10094,12 +10351,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD __Pyx_INCREF(__pyx_v_payload); __Pyx_GIVEREF(__pyx_v_payload); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_payload); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 492, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 510, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10118,7 +10375,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD #endif } - /* "dawg.pyx":493 + /* "dawg.pyx":511 * * cpdef bytes _raw_key(self, unicode key, bytes payload): * cdef bytes b_key = key.encode('utf8') # <<<<<<<<<<<<<< @@ -10127,9 +10384,9 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 493, __pyx_L1_error) + __PYX_ERR(0, 511, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); @@ -10137,27 +10394,27 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD __pyx_v_b_key = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dawg.pyx":495 + /* "dawg.pyx":513 * cdef bytes b_key = key.encode('utf8') * * if self._b_payload_separator in b_key: # <<<<<<<<<<<<<< * raise Error("Payload separator (%r) is found within utf8-encoded key ('%s')" % (self._b_payload_separator, key)) * */ - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_self->_b_payload_separator, __pyx_v_b_key, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 495, __pyx_L1_error) + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_self->_b_payload_separator, __pyx_v_b_key, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 513, __pyx_L1_error) __pyx_t_8 = (__pyx_t_7 != 0); if (unlikely(__pyx_t_8)) { - /* "dawg.pyx":496 + /* "dawg.pyx":514 * * if self._b_payload_separator in b_key: * raise Error("Payload separator (%r) is found within utf8-encoded key ('%s')" % (self._b_payload_separator, key)) # <<<<<<<<<<<<<< * * cdef bytes encoded_payload = b2a_base64(payload) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = 0; __pyx_t_10 = 127; @@ -10165,7 +10422,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD __pyx_t_9 += 19; __Pyx_GIVEREF(__pyx_kp_u_Payload_separator); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Payload_separator); - __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_self->_b_payload_separator), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_self->_b_payload_separator), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_10; __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -10176,18 +10433,18 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD __pyx_t_9 += 37; __Pyx_GIVEREF(__pyx_kp_u_is_found_within_utf8_encoded_ke); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_is_found_within_utf8_encoded_ke); - __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_10; __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6); __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u__11); + __Pyx_INCREF(__pyx_kp_u__12); __pyx_t_9 += 2; - __Pyx_GIVEREF(__pyx_kp_u__11); - PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__11); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_kp_u__12); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__12); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -10203,14 +10460,14 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 496, __pyx_L1_error) + __PYX_ERR(0, 514, __pyx_L1_error) - /* "dawg.pyx":495 + /* "dawg.pyx":513 * cdef bytes b_key = key.encode('utf8') * * if self._b_payload_separator in b_key: # <<<<<<<<<<<<<< @@ -10219,14 +10476,14 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD */ } - /* "dawg.pyx":498 + /* "dawg.pyx":516 * raise Error("Payload separator (%r) is found within utf8-encoded key ('%s')" % (self._b_payload_separator, key)) * * cdef bytes encoded_payload = b2a_base64(payload) # <<<<<<<<<<<<<< * return b_key + self._b_payload_separator + encoded_payload * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_b2a_base64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_b2a_base64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -10240,14 +10497,14 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD } __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_payload) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_payload); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 498, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 516, __pyx_L1_error) __pyx_v_encoded_payload = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dawg.pyx":499 + /* "dawg.pyx":517 * * cdef bytes encoded_payload = b2a_base64(payload) * return b_key + self._b_payload_separator + encoded_payload # <<<<<<<<<<<<<< @@ -10255,16 +10512,16 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__raw_key(struct __pyx_obj_4dawg_BytesD * cdef _update_completer(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyNumber_Add(__pyx_v_b_key, __pyx_v_self->_b_payload_separator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_v_b_key, __pyx_v_self->_b_payload_separator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_encoded_payload); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_encoded_payload); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":492 + /* "dawg.pyx":510 * del self._completer * * cpdef bytes _raw_key(self, unicode key, bytes payload): # <<<<<<<<<<<<<< @@ -10321,11 +10578,11 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_5_raw_key(PyObject *__pyx_v_self, PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_payload)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_raw_key", 1, 2, 2, 1); __PYX_ERR(0, 492, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_raw_key", 1, 2, 2, 1); __PYX_ERR(0, 510, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_raw_key") < 0)) __PYX_ERR(0, 492, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_raw_key") < 0)) __PYX_ERR(0, 510, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -10338,14 +10595,14 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_5_raw_key(PyObject *__pyx_v_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_raw_key", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 492, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_raw_key", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 510, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG._raw_key", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 492, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) __PYX_ERR(0, 492, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 510, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) __PYX_ERR(0, 510, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_4_raw_key(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_key, __pyx_v_payload); /* function exit code */ @@ -10363,7 +10620,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_4_raw_key(struct __pyx_obj_4dawg_Byte PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_raw_key", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG__raw_key(__pyx_v_self, __pyx_v_key, __pyx_v_payload, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG__raw_key(__pyx_v_self, __pyx_v_key, __pyx_v_payload, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10380,7 +10637,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_4_raw_key(struct __pyx_obj_4dawg_Byte return __pyx_r; } -/* "dawg.pyx":501 +/* "dawg.pyx":519 * return b_key + self._b_payload_separator + encoded_payload * * cdef _update_completer(self): # <<<<<<<<<<<<<< @@ -10394,7 +10651,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__update_completer(struct __pyx_obj_4da int __pyx_t_1; __Pyx_RefNannySetupContext("_update_completer", 0); - /* "dawg.pyx":502 + /* "dawg.pyx":520 * * cdef _update_completer(self): * if self._completer: # <<<<<<<<<<<<<< @@ -10404,7 +10661,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__update_completer(struct __pyx_obj_4da __pyx_t_1 = (__pyx_v_self->_completer != 0); if (__pyx_t_1) { - /* "dawg.pyx":503 + /* "dawg.pyx":521 * cdef _update_completer(self): * if self._completer: * del self._completer # <<<<<<<<<<<<<< @@ -10413,7 +10670,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__update_completer(struct __pyx_obj_4da */ delete __pyx_v_self->_completer; - /* "dawg.pyx":502 + /* "dawg.pyx":520 * * cdef _update_completer(self): * if self._completer: # <<<<<<<<<<<<<< @@ -10422,7 +10679,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__update_completer(struct __pyx_obj_4da */ } - /* "dawg.pyx":504 + /* "dawg.pyx":522 * if self._completer: * del self._completer * self._completer = new Completer(self.dct, self.guide) # <<<<<<<<<<<<<< @@ -10431,7 +10688,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__update_completer(struct __pyx_obj_4da */ __pyx_v_self->_completer = new dawgdic::Completer(__pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":501 + /* "dawg.pyx":519 * return b_key + self._b_payload_separator + encoded_payload * * cdef _update_completer(self): # <<<<<<<<<<<<<< @@ -10446,7 +10703,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__update_completer(struct __pyx_obj_4da return __pyx_r; } -/* "dawg.pyx":506 +/* "dawg.pyx":524 * self._completer = new Completer(self.dct, self.guide) * * def load(self, path): # <<<<<<<<<<<<<< @@ -10477,14 +10734,14 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_6load(struct __pyx_obj_4dawg_BytesDAW PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("load", 0); - /* "dawg.pyx":507 + /* "dawg.pyx":525 * * def load(self, path): * res = super(BytesDAWG, self).load(path) # <<<<<<<<<<<<<< * self._update_completer() * return res */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_BytesDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_BytesDAWG)); @@ -10492,10 +10749,10 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_6load(struct __pyx_obj_4dawg_BytesDAW __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -10510,24 +10767,24 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_6load(struct __pyx_obj_4dawg_BytesDAW } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_path); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_res = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":508 + /* "dawg.pyx":526 * def load(self, path): * res = super(BytesDAWG, self).load(path) * self._update_completer() # <<<<<<<<<<<<<< * return res * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_update_completer(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_update_completer(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":509 + /* "dawg.pyx":527 * res = super(BytesDAWG, self).load(path) * self._update_completer() * return res # <<<<<<<<<<<<<< @@ -10539,7 +10796,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_6load(struct __pyx_obj_4dawg_BytesDAW __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":506 + /* "dawg.pyx":524 * self._completer = new Completer(self.dct, self.guide) * * def load(self, path): # <<<<<<<<<<<<<< @@ -10561,7 +10818,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_6load(struct __pyx_obj_4dawg_BytesDAW return __pyx_r; } -/* "dawg.pyx":511 +/* "dawg.pyx":529 * return res * * cpdef frombytes(self, bytes data): # <<<<<<<<<<<<<< @@ -10588,7 +10845,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_frombytes(struct __pyx_obj_4dawg_Bytes if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_frombytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_frombytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_9frombytes)) { __Pyx_XDECREF(__pyx_r); @@ -10605,7 +10862,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_frombytes(struct __pyx_obj_4dawg_Bytes } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_data); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -10626,14 +10883,14 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_frombytes(struct __pyx_obj_4dawg_Bytes #endif } - /* "dawg.pyx":512 + /* "dawg.pyx":530 * * cpdef frombytes(self, bytes data): * res = super(BytesDAWG, self).frombytes(data) # <<<<<<<<<<<<<< * self._update_completer() * return res */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_BytesDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_BytesDAWG)); @@ -10641,10 +10898,10 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_frombytes(struct __pyx_obj_4dawg_Bytes __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -10659,24 +10916,24 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_frombytes(struct __pyx_obj_4dawg_Bytes } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_data); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_res = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":513 + /* "dawg.pyx":531 * cpdef frombytes(self, bytes data): * res = super(BytesDAWG, self).frombytes(data) * self._update_completer() # <<<<<<<<<<<<<< * return res * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_update_completer(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_update_completer(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":514 + /* "dawg.pyx":532 * res = super(BytesDAWG, self).frombytes(data) * self._update_completer() * return res # <<<<<<<<<<<<<< @@ -10688,7 +10945,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_frombytes(struct __pyx_obj_4dawg_Bytes __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":511 + /* "dawg.pyx":529 * return res * * cpdef frombytes(self, bytes data): # <<<<<<<<<<<<<< @@ -10718,7 +10975,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_9frombytes(PyObject *__pyx_v_self, Py PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("frombytes (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 511, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 529, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_8frombytes(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_data)); /* function exit code */ @@ -10736,7 +10993,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_8frombytes(struct __pyx_obj_4dawg_Byt PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("frombytes", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_frombytes(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_frombytes(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10753,7 +11010,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_8frombytes(struct __pyx_obj_4dawg_Byt return __pyx_r; } -/* "dawg.pyx":516 +/* "dawg.pyx":534 * return res * * cpdef bint b_has_key(self, bytes key) except -1: # <<<<<<<<<<<<<< @@ -10781,7 +11038,7 @@ static int __pyx_f_4dawg_9BytesDAWG_b_has_key(struct __pyx_obj_4dawg_BytesDAWG * if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_has_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_has_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_11b_has_key)) { __Pyx_INCREF(__pyx_t_1); @@ -10797,10 +11054,10 @@ static int __pyx_f_4dawg_9BytesDAWG_b_has_key(struct __pyx_obj_4dawg_BytesDAWG * } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10819,7 +11076,7 @@ static int __pyx_f_4dawg_9BytesDAWG_b_has_key(struct __pyx_obj_4dawg_BytesDAWG * #endif } - /* "dawg.pyx":518 + /* "dawg.pyx":536 * cpdef bint b_has_key(self, bytes key) except -1: * cdef BaseType index * return self._follow_key(key, &index) # <<<<<<<<<<<<<< @@ -10829,7 +11086,7 @@ static int __pyx_f_4dawg_9BytesDAWG_b_has_key(struct __pyx_obj_4dawg_BytesDAWG * __pyx_r = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_follow_key(__pyx_v_self, __pyx_v_key, (&__pyx_v_index)); goto __pyx_L0; - /* "dawg.pyx":516 + /* "dawg.pyx":534 * return res * * cpdef bint b_has_key(self, bytes key) except -1: # <<<<<<<<<<<<<< @@ -10857,7 +11114,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_11b_has_key(PyObject *__pyx_v_self, P PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("b_has_key (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 516, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 534, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_10b_has_key(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -10876,8 +11133,8 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_10b_has_key(struct __pyx_obj_4dawg_By PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("b_has_key", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_b_has_key(__pyx_v_self, __pyx_v_key, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 516, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_b_has_key(__pyx_v_self, __pyx_v_key, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 534, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -10894,7 +11151,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_10b_has_key(struct __pyx_obj_4dawg_By return __pyx_r; } -/* "dawg.pyx":520 +/* "dawg.pyx":538 * return self._follow_key(key, &index) * * def __getitem__(self, key): # <<<<<<<<<<<<<< @@ -10924,19 +11181,19 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_12__getitem__(struct __pyx_obj_4dawg_ int __pyx_t_3; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "dawg.pyx":521 + /* "dawg.pyx":539 * * def __getitem__(self, key): * res = self.get(key) # <<<<<<<<<<<<<< * if res is None: * raise KeyError(key) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get(__pyx_v_self, __pyx_v_key, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get(__pyx_v_self, __pyx_v_key, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":522 + /* "dawg.pyx":540 * def __getitem__(self, key): * res = self.get(key) * if res is None: # <<<<<<<<<<<<<< @@ -10947,20 +11204,20 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_12__getitem__(struct __pyx_obj_4dawg_ __pyx_t_3 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_3)) { - /* "dawg.pyx":523 + /* "dawg.pyx":541 * res = self.get(key) * if res is None: * raise KeyError(key) # <<<<<<<<<<<<<< * return res * */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __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, 523, __pyx_L1_error) + __PYX_ERR(0, 541, __pyx_L1_error) - /* "dawg.pyx":522 + /* "dawg.pyx":540 * def __getitem__(self, key): * res = self.get(key) * if res is None: # <<<<<<<<<<<<<< @@ -10969,7 +11226,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_12__getitem__(struct __pyx_obj_4dawg_ */ } - /* "dawg.pyx":524 + /* "dawg.pyx":542 * if res is None: * raise KeyError(key) * return res # <<<<<<<<<<<<<< @@ -10981,7 +11238,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_12__getitem__(struct __pyx_obj_4dawg_ __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":520 + /* "dawg.pyx":538 * return self._follow_key(key, &index) * * def __getitem__(self, key): # <<<<<<<<<<<<<< @@ -11001,7 +11258,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_12__getitem__(struct __pyx_obj_4dawg_ return __pyx_r; } -/* "dawg.pyx":526 +/* "dawg.pyx":544 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -11038,7 +11295,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_15get)) { __Pyx_XDECREF(__pyx_r); @@ -11058,7 +11315,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_default}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else @@ -11066,13 +11323,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_default}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -11083,7 +11340,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * __Pyx_INCREF(__pyx_v_default); __Pyx_GIVEREF(__pyx_v_default); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_default); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -11106,7 +11363,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * #endif } - /* "dawg.pyx":531 + /* "dawg.pyx":549 * or ``default`` if the key is not found. * """ * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -11117,19 +11374,19 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { - /* "dawg.pyx":532 + /* "dawg.pyx":550 * """ * if isinstance(key, unicode): * res = self.get_value(key) # <<<<<<<<<<<<<< * else: * res = self.b_get_value(key) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":531 + /* "dawg.pyx":549 * or ``default`` if the key is not found. * """ * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -11139,7 +11396,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * goto __pyx_L3; } - /* "dawg.pyx":534 + /* "dawg.pyx":552 * res = self.get_value(key) * else: * res = self.b_get_value(key) # <<<<<<<<<<<<<< @@ -11147,15 +11404,15 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * * if not res: */ /*else*/ { - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(0, 534, __pyx_L1_error) - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->b_get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(0, 552, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->b_get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; } __pyx_L3:; - /* "dawg.pyx":536 + /* "dawg.pyx":554 * res = self.b_get_value(key) * * if not res: # <<<<<<<<<<<<<< @@ -11166,7 +11423,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * __pyx_t_7 = ((!__pyx_t_8) != 0); if (__pyx_t_7) { - /* "dawg.pyx":537 + /* "dawg.pyx":555 * * if not res: * return default # <<<<<<<<<<<<<< @@ -11178,7 +11435,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * __pyx_r = __pyx_v_default; goto __pyx_L0; - /* "dawg.pyx":536 + /* "dawg.pyx":554 * res = self.b_get_value(key) * * if not res: # <<<<<<<<<<<<<< @@ -11187,7 +11444,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * */ } - /* "dawg.pyx":538 + /* "dawg.pyx":556 * if not res: * return default * return res # <<<<<<<<<<<<<< @@ -11199,7 +11456,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get(struct __pyx_obj_4dawg_BytesDAWG * __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":526 + /* "dawg.pyx":544 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -11260,7 +11517,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_15get(PyObject *__pyx_v_self, PyObjec } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 526, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 544, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -11276,7 +11533,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_15get(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 526, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 544, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -11298,7 +11555,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_14get(struct __pyx_obj_4dawg_BytesDAW __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.__pyx_default = __pyx_v_default; - __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->get(__pyx_v_self, __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->get(__pyx_v_self, __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11315,7 +11572,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_14get(struct __pyx_obj_4dawg_BytesDAW return __pyx_r; } -/* "dawg.pyx":540 +/* "dawg.pyx":558 * return res * * cdef bint _follow_key(self, bytes key, BaseType* index): # <<<<<<<<<<<<<< @@ -11331,7 +11588,7 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG int __pyx_t_3; __Pyx_RefNannySetupContext("_follow_key", 0); - /* "dawg.pyx":541 + /* "dawg.pyx":559 * * cdef bint _follow_key(self, bytes key, BaseType* index): * index[0] = self.dct.root() # <<<<<<<<<<<<<< @@ -11340,7 +11597,7 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG */ (__pyx_v_index[0]) = __pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":542 + /* "dawg.pyx":560 * cdef bint _follow_key(self, bytes key, BaseType* index): * index[0] = self.dct.root() * if not self.dct.Follow(key, len(key), index): # <<<<<<<<<<<<<< @@ -11349,18 +11606,18 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 542, __pyx_L1_error) + __PYX_ERR(0, 560, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L1_error) if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 542, __pyx_L1_error) + __PYX_ERR(0, 560, __pyx_L1_error) } - __pyx_t_2 = PyBytes_GET_SIZE(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 542, __pyx_L1_error) + __pyx_t_2 = PyBytes_GET_SIZE(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 560, __pyx_L1_error) __pyx_t_3 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_1, __pyx_t_2, __pyx_v_index) != 0)) != 0); if (__pyx_t_3) { - /* "dawg.pyx":543 + /* "dawg.pyx":561 * index[0] = self.dct.root() * if not self.dct.Follow(key, len(key), index): * return False # <<<<<<<<<<<<<< @@ -11370,7 +11627,7 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = 0; goto __pyx_L0; - /* "dawg.pyx":542 + /* "dawg.pyx":560 * cdef bint _follow_key(self, bytes key, BaseType* index): * index[0] = self.dct.root() * if not self.dct.Follow(key, len(key), index): # <<<<<<<<<<<<<< @@ -11379,7 +11636,7 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG */ } - /* "dawg.pyx":544 + /* "dawg.pyx":562 * if not self.dct.Follow(key, len(key), index): * return False * return self.dct.Follow(self._c_payload_separator, index) # <<<<<<<<<<<<<< @@ -11389,7 +11646,7 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = __pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_v_self->_c_payload_separator, __pyx_v_index); goto __pyx_L0; - /* "dawg.pyx":540 + /* "dawg.pyx":558 * return res * * cdef bint _follow_key(self, bytes key, BaseType* index): # <<<<<<<<<<<<<< @@ -11406,7 +11663,7 @@ static int __pyx_f_4dawg_9BytesDAWG__follow_key(struct __pyx_obj_4dawg_BytesDAWG return __pyx_r; } -/* "dawg.pyx":546 +/* "dawg.pyx":564 * return self.dct.Follow(self._c_payload_separator, index) * * cpdef list get_value(self, unicode key): # <<<<<<<<<<<<<< @@ -11432,7 +11689,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get_value(struct __pyx_obj_4dawg_Bytes if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_17get_value)) { __Pyx_XDECREF(__pyx_r); @@ -11449,10 +11706,10 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get_value(struct __pyx_obj_4dawg_Bytes } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 546, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 564, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11471,7 +11728,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get_value(struct __pyx_obj_4dawg_Bytes #endif } - /* "dawg.pyx":547 + /* "dawg.pyx":565 * * cpdef list get_value(self, unicode key): * return self.b_get_value(key.encode('utf8')) # <<<<<<<<<<<<<< @@ -11481,18 +11738,18 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_get_value(struct __pyx_obj_4dawg_Bytes __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 547, __pyx_L1_error) + __PYX_ERR(0, 565, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->b_get_value(__pyx_v_self, ((PyObject*)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->b_get_value(__pyx_v_self, ((PyObject*)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "dawg.pyx":546 + /* "dawg.pyx":564 * return self.dct.Follow(self._c_payload_separator, index) * * cpdef list get_value(self, unicode key): # <<<<<<<<<<<<<< @@ -11521,7 +11778,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_17get_value(PyObject *__pyx_v_self, P PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_value (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 546, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 564, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_16get_value(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -11539,7 +11796,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_16get_value(struct __pyx_obj_4dawg_By PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_value", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_get_value(__pyx_v_self, __pyx_v_key, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_get_value(__pyx_v_self, __pyx_v_key, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11556,7 +11813,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_16get_value(struct __pyx_obj_4dawg_By return __pyx_r; } -/* "dawg.pyx":549 +/* "dawg.pyx":567 * return self.b_get_value(key.encode('utf8')) * * cdef list _value_for_index(self, BaseType index): # <<<<<<<<<<<<<< @@ -11576,7 +11833,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("_value_for_index", 0); - /* "dawg.pyx":563 + /* "dawg.pyx":581 * cdef vector[string] results * * self._completer.Start(index) # <<<<<<<<<<<<<< @@ -11585,7 +11842,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw */ __pyx_v_self->_completer->Start(__pyx_v_index); - /* "dawg.pyx":565 + /* "dawg.pyx":583 * self._completer.Start(index) * * while self._completer.Next(): # <<<<<<<<<<<<<< @@ -11596,7 +11853,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw __pyx_t_1 = (__pyx_v_self->_completer->Next() != 0); if (!__pyx_t_1) break; - /* "dawg.pyx":566 + /* "dawg.pyx":584 * * while self._completer.Next(): * b64_decoder.init() # <<<<<<<<<<<<<< @@ -11605,7 +11862,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw */ __pyx_v_b64_decoder.init(); - /* "dawg.pyx":567 + /* "dawg.pyx":585 * while self._completer.Next(): * b64_decoder.init() * key_len = b64_decoder.decode( # <<<<<<<<<<<<<< @@ -11614,7 +11871,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw */ __pyx_v_key_len = __pyx_v_b64_decoder.decode(__pyx_v_self->_completer->key(), __pyx_v_self->_completer->length(), __pyx_v_b64_decoder_storage); - /* "dawg.pyx":572 + /* "dawg.pyx":590 * b64_decoder_storage * ) * results.push_back(string(b64_decoder_storage, key_len)) # <<<<<<<<<<<<<< @@ -11625,17 +11882,17 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw __pyx_t_2 = std::string(__pyx_v_b64_decoder_storage, __pyx_v_key_len); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 572, __pyx_L1_error) + __PYX_ERR(0, 590, __pyx_L1_error) } try { __pyx_v_results.push_back(__pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 572, __pyx_L1_error) + __PYX_ERR(0, 590, __pyx_L1_error) } } - /* "dawg.pyx":574 + /* "dawg.pyx":592 * results.push_back(string(b64_decoder_storage, key_len)) * * return results # <<<<<<<<<<<<<< @@ -11643,14 +11900,14 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw * cpdef list b_get_value(self, bytes key): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_results); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_results); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyList_CheckExact(__pyx_t_3))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 574, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_3))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 592, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "dawg.pyx":549 + /* "dawg.pyx":567 * return self.b_get_value(key.encode('utf8')) * * cdef list _value_for_index(self, BaseType index): # <<<<<<<<<<<<<< @@ -11669,7 +11926,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__value_for_index(struct __pyx_obj_4daw return __pyx_r; } -/* "dawg.pyx":576 +/* "dawg.pyx":594 * return results * * cpdef list b_get_value(self, bytes key): # <<<<<<<<<<<<<< @@ -11697,7 +11954,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_19b_get_value)) { __Pyx_XDECREF(__pyx_r); @@ -11714,10 +11971,10 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 576, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 594, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11736,7 +11993,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt #endif } - /* "dawg.pyx":578 + /* "dawg.pyx":596 * cpdef list b_get_value(self, bytes key): * cdef BaseType index * if not self._follow_key(key, &index): # <<<<<<<<<<<<<< @@ -11746,7 +12003,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt __pyx_t_5 = ((!(((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_follow_key(__pyx_v_self, __pyx_v_key, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_5) { - /* "dawg.pyx":579 + /* "dawg.pyx":597 * cdef BaseType index * if not self._follow_key(key, &index): * return [] # <<<<<<<<<<<<<< @@ -11754,13 +12011,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":578 + /* "dawg.pyx":596 * cpdef list b_get_value(self, bytes key): * cdef BaseType index * if not self._follow_key(key, &index): # <<<<<<<<<<<<<< @@ -11769,7 +12026,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt */ } - /* "dawg.pyx":580 + /* "dawg.pyx":598 * if not self._follow_key(key, &index): * return [] * return self._value_for_index(index) # <<<<<<<<<<<<<< @@ -11777,13 +12034,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_b_get_value(struct __pyx_obj_4dawg_Byt * cpdef list items(self, unicode prefix=""): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":576 + /* "dawg.pyx":594 * return results * * cpdef list b_get_value(self, bytes key): # <<<<<<<<<<<<<< @@ -11812,7 +12069,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_19b_get_value(PyObject *__pyx_v_self, PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("b_get_value (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 576, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 594, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_18b_get_value(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -11830,7 +12087,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_18b_get_value(struct __pyx_obj_4dawg_ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("b_get_value", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_b_get_value(__pyx_v_self, __pyx_v_key, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_b_get_value(__pyx_v_self, __pyx_v_key, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11847,7 +12104,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_18b_get_value(struct __pyx_obj_4dawg_ return __pyx_r; } -/* "dawg.pyx":582 +/* "dawg.pyx":600 * return self._value_for_index(index) * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -11899,7 +12156,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_21items)) { __Pyx_XDECREF(__pyx_r); @@ -11916,10 +12173,10 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_prefix); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 582, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 600, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11938,7 +12195,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG #endif } - /* "dawg.pyx":583 + /* "dawg.pyx":601 * * cpdef list items(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -11947,26 +12204,26 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 583, __pyx_L1_error) + __PYX_ERR(0, 601, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":586 + /* "dawg.pyx":604 * cdef bytes value * cdef int i * cdef list res = [] # <<<<<<<<<<<<<< * cdef char* raw_key * cdef char* raw_value */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":591 + /* "dawg.pyx":609 * cdef int raw_value_len * * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -11975,7 +12232,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v_index = __pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":592 + /* "dawg.pyx":610 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -11984,13 +12241,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 592, __pyx_L1_error) + __PYX_ERR(0, 610, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 610, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_5, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":593 + /* "dawg.pyx":611 * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): * return res # <<<<<<<<<<<<<< @@ -12002,7 +12259,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":592 + /* "dawg.pyx":610 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -12011,7 +12268,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ } - /* "dawg.pyx":600 + /* "dawg.pyx":618 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -12020,7 +12277,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_f_4dawg_init_completer(__pyx_v_completer, __pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":601 + /* "dawg.pyx":619 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -12029,12 +12286,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 601, __pyx_L1_error) + __PYX_ERR(0, 619, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 601, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 619, __pyx_L1_error) __pyx_v_completer.Start(__pyx_v_index, __pyx_t_7); - /* "dawg.pyx":603 + /* "dawg.pyx":621 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -12045,7 +12302,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG __pyx_t_6 = (__pyx_v_completer.Next() != 0); if (!__pyx_t_6) break; - /* "dawg.pyx":604 + /* "dawg.pyx":622 * * while completer.Next(): * raw_key = completer.key() # <<<<<<<<<<<<<< @@ -12054,7 +12311,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v_raw_key = ((char *)__pyx_v_completer.key()); - /* "dawg.pyx":606 + /* "dawg.pyx":624 * raw_key = completer.key() * * for i in range(0, completer.length()): # <<<<<<<<<<<<<< @@ -12066,7 +12323,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "dawg.pyx":607 + /* "dawg.pyx":625 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -12076,7 +12333,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG __pyx_t_6 = (((__pyx_v_raw_key[__pyx_v_i]) == __pyx_v_self->_c_payload_separator) != 0); if (__pyx_t_6) { - /* "dawg.pyx":608 + /* "dawg.pyx":626 * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: * break # <<<<<<<<<<<<<< @@ -12085,7 +12342,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ goto __pyx_L7_break; - /* "dawg.pyx":607 + /* "dawg.pyx":625 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -12096,7 +12353,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG } __pyx_L7_break:; - /* "dawg.pyx":610 + /* "dawg.pyx":628 * break * * raw_value = &(raw_key[i]) # <<<<<<<<<<<<<< @@ -12105,7 +12362,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v_raw_value = (&(__pyx_v_raw_key[__pyx_v_i])); - /* "dawg.pyx":611 + /* "dawg.pyx":629 * * raw_value = &(raw_key[i]) * raw_value_len = completer.length() - i # <<<<<<<<<<<<<< @@ -12114,7 +12371,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v_raw_value_len = (__pyx_v_completer.length() - __pyx_v_i); - /* "dawg.pyx":613 + /* "dawg.pyx":631 * raw_value_len = completer.length() - i * * _b64_decoder.init() # <<<<<<<<<<<<<< @@ -12123,7 +12380,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v__b64_decoder.init(); - /* "dawg.pyx":614 + /* "dawg.pyx":632 * * _b64_decoder.init() * _len = _b64_decoder.decode(raw_value, raw_value_len, _b64_decoder_storage) # <<<<<<<<<<<<<< @@ -12132,38 +12389,38 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v__len = __pyx_v__b64_decoder.decode(__pyx_v_raw_value, __pyx_v_raw_value_len, __pyx_v__b64_decoder_storage); - /* "dawg.pyx":615 + /* "dawg.pyx":633 * _b64_decoder.init() * _len = _b64_decoder.decode(raw_value, raw_value_len, _b64_decoder_storage) * value = _b64_decoder_storage[:_len] # <<<<<<<<<<<<<< * * u_key = raw_key[:i].decode('utf8') */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v__b64_decoder_storage) + 0, __pyx_v__len - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v__b64_decoder_storage) + 0, __pyx_v__len - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_value, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "dawg.pyx":617 + /* "dawg.pyx":635 * value = _b64_decoder_storage[:_len] * * u_key = raw_key[:i].decode('utf8') # <<<<<<<<<<<<<< * res.append( * (u_key, value) */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_raw_key, 0, __pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_raw_key, 0, __pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_u_key, __pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":619 + /* "dawg.pyx":637 * u_key = raw_key[:i].decode('utf8') * res.append( * (u_key, value) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_u_key); __Pyx_GIVEREF(__pyx_v_u_key); @@ -12172,18 +12429,18 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); - /* "dawg.pyx":618 + /* "dawg.pyx":636 * * u_key = raw_key[:i].decode('utf8') * res.append( # <<<<<<<<<<<<<< * (u_key, value) * ) */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "dawg.pyx":622 + /* "dawg.pyx":640 * ) * * return res # <<<<<<<<<<<<<< @@ -12195,7 +12452,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_items(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":582 + /* "dawg.pyx":600 * return self._value_for_index(index) * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -12251,7 +12508,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_21items(PyObject *__pyx_v_self, PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "items") < 0)) __PYX_ERR(0, 582, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "items") < 0)) __PYX_ERR(0, 600, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -12265,13 +12522,13 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_21items(PyObject *__pyx_v_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("items", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 582, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("items", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 600, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.items", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 582, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 600, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_20items(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -12292,7 +12549,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_20items(struct __pyx_obj_4dawg_BytesD __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.prefix = __pyx_v_prefix; - __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->items(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->items(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -12310,7 +12567,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_20items(struct __pyx_obj_4dawg_BytesD } static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":624 +/* "dawg.pyx":642 * return res * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -12348,7 +12605,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_23iteritems(PyObject *__pyx_v_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 624, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 642, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -12362,13 +12619,13 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_23iteritems(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 624, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 642, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 624, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 642, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_22iteritems(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -12389,7 +12646,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_22iteritems(struct __pyx_obj_4dawg_By if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_6_iteritems *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 624, __pyx_L1_error) + __PYX_ERR(0, 642, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -12400,7 +12657,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_22iteritems(struct __pyx_obj_4dawg_By __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_9BytesDAWG_24generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_BytesDAWG_iteritems, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_9BytesDAWG_24generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_BytesDAWG_iteritems, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12437,9 +12694,9 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 624, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 642, __pyx_L1_error) - /* "dawg.pyx":625 + /* "dawg.pyx":643 * * def iteritems(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -12448,15 +12705,15 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ if (unlikely(__pyx_cur_scope->__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 625, __pyx_L1_error) + __PYX_ERR(0, 643, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":632 + /* "dawg.pyx":650 * cdef int raw_value_len * * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -12465,7 +12722,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v_index = __pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":633 + /* "dawg.pyx":651 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -12474,13 +12731,13 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 633, __pyx_L1_error) + __PYX_ERR(0, 651, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 633, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 651, __pyx_L1_error) __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_2, (&__pyx_cur_scope->__pyx_v_index)) != 0)) != 0); if (__pyx_t_3) { - /* "dawg.pyx":634 + /* "dawg.pyx":652 * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): * return # <<<<<<<<<<<<<< @@ -12491,7 +12748,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ __pyx_r = NULL; goto __pyx_L0; - /* "dawg.pyx":633 + /* "dawg.pyx":651 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -12500,7 +12757,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ } - /* "dawg.pyx":641 + /* "dawg.pyx":659 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -12509,7 +12766,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_f_4dawg_init_completer(__pyx_cur_scope->__pyx_v_completer, __pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_cur_scope->__pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":642 + /* "dawg.pyx":660 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -12518,12 +12775,12 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 642, __pyx_L1_error) + __PYX_ERR(0, 660, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 642, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 660, __pyx_L1_error) __pyx_cur_scope->__pyx_v_completer.Start(__pyx_cur_scope->__pyx_v_index, __pyx_t_4); - /* "dawg.pyx":644 + /* "dawg.pyx":662 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -12534,7 +12791,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ __pyx_t_3 = (__pyx_cur_scope->__pyx_v_completer.Next() != 0); if (!__pyx_t_3) break; - /* "dawg.pyx":645 + /* "dawg.pyx":663 * * while completer.Next(): * raw_key = completer.key() # <<<<<<<<<<<<<< @@ -12543,7 +12800,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v_raw_key = ((char *)__pyx_cur_scope->__pyx_v_completer.key()); - /* "dawg.pyx":647 + /* "dawg.pyx":665 * raw_key = completer.key() * * for i in range(0, completer.length()): # <<<<<<<<<<<<<< @@ -12555,7 +12812,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_7; - /* "dawg.pyx":648 + /* "dawg.pyx":666 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -12565,7 +12822,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ __pyx_t_3 = (((__pyx_cur_scope->__pyx_v_raw_key[__pyx_cur_scope->__pyx_v_i]) == __pyx_cur_scope->__pyx_v_self->_c_payload_separator) != 0); if (__pyx_t_3) { - /* "dawg.pyx":649 + /* "dawg.pyx":667 * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: * break # <<<<<<<<<<<<<< @@ -12574,7 +12831,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ goto __pyx_L8_break; - /* "dawg.pyx":648 + /* "dawg.pyx":666 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -12585,7 +12842,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ } __pyx_L8_break:; - /* "dawg.pyx":651 + /* "dawg.pyx":669 * break * * raw_value = &(raw_key[i]) # <<<<<<<<<<<<<< @@ -12594,7 +12851,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v_raw_value = (&(__pyx_cur_scope->__pyx_v_raw_key[__pyx_cur_scope->__pyx_v_i])); - /* "dawg.pyx":652 + /* "dawg.pyx":670 * * raw_value = &(raw_key[i]) * raw_value_len = completer.length() - i # <<<<<<<<<<<<<< @@ -12603,7 +12860,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v_raw_value_len = (__pyx_cur_scope->__pyx_v_completer.length() - __pyx_cur_scope->__pyx_v_i); - /* "dawg.pyx":654 + /* "dawg.pyx":672 * raw_value_len = completer.length() - i * * _b64_decoder.init() # <<<<<<<<<<<<<< @@ -12612,7 +12869,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v__b64_decoder.init(); - /* "dawg.pyx":655 + /* "dawg.pyx":673 * * _b64_decoder.init() * _len = _b64_decoder.decode(raw_value, raw_value_len, _b64_decoder_storage) # <<<<<<<<<<<<<< @@ -12621,42 +12878,42 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v__len = __pyx_cur_scope->__pyx_v__b64_decoder.decode(__pyx_cur_scope->__pyx_v_raw_value, __pyx_cur_scope->__pyx_v_raw_value_len, __pyx_cur_scope->__pyx_v__b64_decoder_storage); - /* "dawg.pyx":656 + /* "dawg.pyx":674 * _b64_decoder.init() * _len = _b64_decoder.decode(raw_value, raw_value_len, _b64_decoder_storage) * value = _b64_decoder_storage[:_len] # <<<<<<<<<<<<<< * * u_key = raw_key[:i].decode('utf8') */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_cur_scope->__pyx_v__b64_decoder_storage) + 0, __pyx_cur_scope->__pyx_v__len - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_cur_scope->__pyx_v__b64_decoder_storage) + 0, __pyx_cur_scope->__pyx_v__len - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":658 + /* "dawg.pyx":676 * value = _b64_decoder_storage[:_len] * * u_key = raw_key[:i].decode('utf8') # <<<<<<<<<<<<<< * yield (u_key, value) * */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_cur_scope->__pyx_v_raw_key, 0, __pyx_cur_scope->__pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_cur_scope->__pyx_v_raw_key, 0, __pyx_cur_scope->__pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_u_key); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_u_key, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":659 + /* "dawg.pyx":677 * * u_key = raw_key[:i].decode('utf8') * yield (u_key, value) # <<<<<<<<<<<<<< * * cpdef list keys(self, unicode prefix=""): */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_u_key); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_u_key); @@ -12673,11 +12930,11 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L10_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 659, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 677, __pyx_L1_error) } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":624 + /* "dawg.pyx":642 * return res * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -12702,7 +12959,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_24generator2(__pyx_CoroutineObject *_ return __pyx_r; } -/* "dawg.pyx":661 +/* "dawg.pyx":679 * yield (u_key, value) * * cpdef list keys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -12748,7 +13005,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_26keys)) { __Pyx_XDECREF(__pyx_r); @@ -12765,10 +13022,10 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_prefix); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 661, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 679, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -12787,7 +13044,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG #endif } - /* "dawg.pyx":662 + /* "dawg.pyx":680 * * cpdef list keys(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -12796,26 +13053,26 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 662, __pyx_L1_error) + __PYX_ERR(0, 680, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":664 + /* "dawg.pyx":682 * cdef bytes b_prefix = prefix.encode('utf8') * cdef int i * cdef list res = [] # <<<<<<<<<<<<<< * cdef char* raw_key * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":667 + /* "dawg.pyx":685 * cdef char* raw_key * * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -12824,7 +13081,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v_index = __pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":668 + /* "dawg.pyx":686 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -12833,13 +13090,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 668, __pyx_L1_error) + __PYX_ERR(0, 686, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 686, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_5, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":669 + /* "dawg.pyx":687 * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): * return res # <<<<<<<<<<<<<< @@ -12851,7 +13108,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":668 + /* "dawg.pyx":686 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -12860,7 +13117,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ } - /* "dawg.pyx":672 + /* "dawg.pyx":690 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -12869,7 +13126,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_f_4dawg_init_completer(__pyx_v_completer, __pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":673 + /* "dawg.pyx":691 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -12878,12 +13135,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 673, __pyx_L1_error) + __PYX_ERR(0, 691, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error) __pyx_v_completer.Start(__pyx_v_index, __pyx_t_7); - /* "dawg.pyx":675 + /* "dawg.pyx":693 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -12894,7 +13151,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG __pyx_t_6 = (__pyx_v_completer.Next() != 0); if (!__pyx_t_6) break; - /* "dawg.pyx":676 + /* "dawg.pyx":694 * * while completer.Next(): * raw_key = completer.key() # <<<<<<<<<<<<<< @@ -12903,7 +13160,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v_raw_key = ((char *)__pyx_v_completer.key()); - /* "dawg.pyx":678 + /* "dawg.pyx":696 * raw_key = completer.key() * * for i in range(0, completer.length()): # <<<<<<<<<<<<<< @@ -12915,7 +13172,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "dawg.pyx":679 + /* "dawg.pyx":697 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -12925,7 +13182,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG __pyx_t_6 = (((__pyx_v_raw_key[__pyx_v_i]) == __pyx_v_self->_c_payload_separator) != 0); if (__pyx_t_6) { - /* "dawg.pyx":680 + /* "dawg.pyx":698 * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: * break # <<<<<<<<<<<<<< @@ -12934,7 +13191,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG */ goto __pyx_L7_break; - /* "dawg.pyx":679 + /* "dawg.pyx":697 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -12945,29 +13202,29 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG } __pyx_L7_break:; - /* "dawg.pyx":682 + /* "dawg.pyx":700 * break * * u_key = raw_key[:i].decode('utf8') # <<<<<<<<<<<<<< * res.append(u_key) * return res */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_raw_key, 0, __pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_raw_key, 0, __pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_u_key, __pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":683 + /* "dawg.pyx":701 * * u_key = raw_key[:i].decode('utf8') * res.append(u_key) # <<<<<<<<<<<<<< * return res * */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_u_key); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 683, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_u_key); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 701, __pyx_L1_error) } - /* "dawg.pyx":684 + /* "dawg.pyx":702 * u_key = raw_key[:i].decode('utf8') * res.append(u_key) * return res # <<<<<<<<<<<<<< @@ -12979,7 +13236,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_keys(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":661 + /* "dawg.pyx":679 * yield (u_key, value) * * cpdef list keys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -13034,7 +13291,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_26keys(PyObject *__pyx_v_self, PyObje } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keys") < 0)) __PYX_ERR(0, 661, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "keys") < 0)) __PYX_ERR(0, 679, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -13048,13 +13305,13 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_26keys(PyObject *__pyx_v_self, PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("keys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 661, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("keys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 679, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.keys", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 661, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 679, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_25keys(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -13075,7 +13332,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_25keys(struct __pyx_obj_4dawg_BytesDA __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.prefix = __pyx_v_prefix; - __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->__pyx_base.keys(((struct __pyx_obj_4dawg_CompletionDAWG *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->__pyx_base.keys(((struct __pyx_obj_4dawg_CompletionDAWG *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13093,7 +13350,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_25keys(struct __pyx_obj_4dawg_BytesDA } static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":686 +/* "dawg.pyx":704 * return res * * def iterkeys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -13131,7 +13388,7 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_28iterkeys(PyObject *__pyx_v_self, Py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterkeys") < 0)) __PYX_ERR(0, 686, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterkeys") < 0)) __PYX_ERR(0, 704, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -13145,13 +13402,13 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_28iterkeys(PyObject *__pyx_v_self, Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iterkeys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 686, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("iterkeys", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 704, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 686, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 704, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_27iterkeys(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -13172,7 +13429,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_27iterkeys(struct __pyx_obj_4dawg_Byt if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_7_iterkeys *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 686, __pyx_L1_error) + __PYX_ERR(0, 704, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -13183,7 +13440,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_27iterkeys(struct __pyx_obj_4dawg_Byt __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_9BytesDAWG_29generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterkeys, __pyx_n_s_BytesDAWG_iterkeys, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 686, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_9BytesDAWG_29generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterkeys, __pyx_n_s_BytesDAWG_iterkeys, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -13220,9 +13477,9 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 686, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 704, __pyx_L1_error) - /* "dawg.pyx":687 + /* "dawg.pyx":705 * * def iterkeys(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -13231,15 +13488,15 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ if (unlikely(__pyx_cur_scope->__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 687, __pyx_L1_error) + __PYX_ERR(0, 705, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":691 + /* "dawg.pyx":709 * cdef char* raw_key * * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -13248,7 +13505,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v_index = __pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":692 + /* "dawg.pyx":710 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -13257,13 +13514,13 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 692, __pyx_L1_error) + __PYX_ERR(0, 710, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 710, __pyx_L1_error) __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_2, (&__pyx_cur_scope->__pyx_v_index)) != 0)) != 0); if (__pyx_t_3) { - /* "dawg.pyx":693 + /* "dawg.pyx":711 * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): * return # <<<<<<<<<<<<<< @@ -13274,7 +13531,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ __pyx_r = NULL; goto __pyx_L0; - /* "dawg.pyx":692 + /* "dawg.pyx":710 * * cdef BaseType index = self.dct.root() * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -13283,7 +13540,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ } - /* "dawg.pyx":696 + /* "dawg.pyx":714 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -13292,7 +13549,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ __pyx_f_4dawg_init_completer(__pyx_cur_scope->__pyx_v_completer, __pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_cur_scope->__pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":697 + /* "dawg.pyx":715 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -13301,12 +13558,12 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 697, __pyx_L1_error) + __PYX_ERR(0, 715, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 715, __pyx_L1_error) __pyx_cur_scope->__pyx_v_completer.Start(__pyx_cur_scope->__pyx_v_index, __pyx_t_4); - /* "dawg.pyx":699 + /* "dawg.pyx":717 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -13317,7 +13574,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ __pyx_t_3 = (__pyx_cur_scope->__pyx_v_completer.Next() != 0); if (!__pyx_t_3) break; - /* "dawg.pyx":700 + /* "dawg.pyx":718 * * while completer.Next(): * raw_key = completer.key() # <<<<<<<<<<<<<< @@ -13326,7 +13583,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ __pyx_cur_scope->__pyx_v_raw_key = ((char *)__pyx_cur_scope->__pyx_v_completer.key()); - /* "dawg.pyx":702 + /* "dawg.pyx":720 * raw_key = completer.key() * * for i in range(0, completer.length()): # <<<<<<<<<<<<<< @@ -13338,7 +13595,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_7; - /* "dawg.pyx":703 + /* "dawg.pyx":721 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -13348,7 +13605,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ __pyx_t_3 = (((__pyx_cur_scope->__pyx_v_raw_key[__pyx_cur_scope->__pyx_v_i]) == __pyx_cur_scope->__pyx_v_self->_c_payload_separator) != 0); if (__pyx_t_3) { - /* "dawg.pyx":704 + /* "dawg.pyx":722 * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: * break # <<<<<<<<<<<<<< @@ -13357,7 +13614,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ */ goto __pyx_L8_break; - /* "dawg.pyx":703 + /* "dawg.pyx":721 * * for i in range(0, completer.length()): * if raw_key[i] == self._c_payload_separator: # <<<<<<<<<<<<<< @@ -13368,21 +13625,21 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ } __pyx_L8_break:; - /* "dawg.pyx":706 + /* "dawg.pyx":724 * break * * u_key = raw_key[:i].decode('utf8') # <<<<<<<<<<<<<< * yield u_key * */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_cur_scope->__pyx_v_raw_key, 0, __pyx_cur_scope->__pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_cur_scope->__pyx_v_raw_key, 0, __pyx_cur_scope->__pyx_v_i, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_u_key); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_u_key, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":707 + /* "dawg.pyx":725 * * u_key = raw_key[:i].decode('utf8') * yield u_key # <<<<<<<<<<<<<< @@ -13398,11 +13655,11 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L10_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 707, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 725, __pyx_L1_error) } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":686 + /* "dawg.pyx":704 * return res * * def iterkeys(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -13427,7 +13684,7 @@ static PyObject *__pyx_gb_4dawg_9BytesDAWG_29generator3(__pyx_CoroutineObject *_ return __pyx_r; } -/* "dawg.pyx":709 +/* "dawg.pyx":727 * yield u_key * * cdef bint _has_value(self, BaseType index): # <<<<<<<<<<<<<< @@ -13441,7 +13698,7 @@ static int __pyx_f_4dawg_9BytesDAWG__has_value(struct __pyx_obj_4dawg_BytesDAWG __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_has_value", 0); - /* "dawg.pyx":710 + /* "dawg.pyx":728 * * cdef bint _has_value(self, BaseType index): * cdef BaseType _index = index # <<<<<<<<<<<<<< @@ -13450,7 +13707,7 @@ static int __pyx_f_4dawg_9BytesDAWG__has_value(struct __pyx_obj_4dawg_BytesDAWG */ __pyx_v__index = __pyx_v_index; - /* "dawg.pyx":711 + /* "dawg.pyx":729 * cdef bint _has_value(self, BaseType index): * cdef BaseType _index = index * return self.dct.Follow(self._c_payload_separator, &_index) # <<<<<<<<<<<<<< @@ -13460,7 +13717,7 @@ static int __pyx_f_4dawg_9BytesDAWG__has_value(struct __pyx_obj_4dawg_BytesDAWG __pyx_r = __pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_v_self->_c_payload_separator, (&__pyx_v__index)); goto __pyx_L0; - /* "dawg.pyx":709 + /* "dawg.pyx":727 * yield u_key * * cdef bint _has_value(self, BaseType index): # <<<<<<<<<<<<<< @@ -13474,7 +13731,7 @@ static int __pyx_f_4dawg_9BytesDAWG__has_value(struct __pyx_obj_4dawg_BytesDAWG return __pyx_r; } -/* "dawg.pyx":713 +/* "dawg.pyx":731 * return self.dct.Follow(self._c_payload_separator, &_index) * * cdef list _similar_items(self, unicode current_prefix, unicode key, BaseType cur_index, dict replace_chars): # <<<<<<<<<<<<<< @@ -13509,7 +13766,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ int __pyx_t_9; __Pyx_RefNannySetupContext("_similar_items", 0); - /* "dawg.pyx":714 + /* "dawg.pyx":732 * * cdef list _similar_items(self, unicode current_prefix, unicode key, BaseType cur_index, dict replace_chars): * cdef BaseType next_index, index = cur_index # <<<<<<<<<<<<<< @@ -13518,19 +13775,19 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ __pyx_v_index = __pyx_v_cur_index; - /* "dawg.pyx":717 + /* "dawg.pyx":735 * cdef unicode prefix, u_replace_char, found_key * cdef bytes b_step, b_replace_char * cdef list res = [] # <<<<<<<<<<<<<< * cdef list extra_items, value * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":720 + /* "dawg.pyx":738 * cdef list extra_items, value * * cdef int start_pos = len(current_prefix) # <<<<<<<<<<<<<< @@ -13539,12 +13796,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_current_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 720, __pyx_L1_error) + __PYX_ERR(0, 738, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_current_prefix); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 720, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_current_prefix); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 738, __pyx_L1_error) __pyx_v_start_pos = __pyx_t_2; - /* "dawg.pyx":721 + /* "dawg.pyx":739 * * cdef int start_pos = len(current_prefix) * cdef int end_pos = len(key) # <<<<<<<<<<<<<< @@ -13553,12 +13810,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 721, __pyx_L1_error) + __PYX_ERR(0, 739, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 739, __pyx_L1_error) __pyx_v_end_pos = __pyx_t_2; - /* "dawg.pyx":722 + /* "dawg.pyx":740 * cdef int start_pos = len(current_prefix) * cdef int end_pos = len(key) * cdef int word_pos = start_pos # <<<<<<<<<<<<<< @@ -13567,7 +13824,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ __pyx_v_word_pos = __pyx_v_start_pos; - /* "dawg.pyx":724 + /* "dawg.pyx":742 * cdef int word_pos = start_pos * * while word_pos < end_pos: # <<<<<<<<<<<<<< @@ -13578,17 +13835,17 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __pyx_t_3 = ((__pyx_v_word_pos < __pyx_v_end_pos) != 0); if (!__pyx_t_3) break; - /* "dawg.pyx":725 + /* "dawg.pyx":743 * * while word_pos < end_pos: * b_step = (key[word_pos].encode('utf8')) # <<<<<<<<<<<<<< * * if b_step in replace_chars: */ - __pyx_t_4 = __Pyx_GetItemInt_Unicode(__pyx_v_key, __pyx_v_word_pos, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == (Py_UCS4)-1)) __PYX_ERR(0, 725, __pyx_L1_error) - __pyx_t_1 = PyUnicode_FromOrdinal(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt_Unicode(__pyx_v_key, __pyx_v_word_pos, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == (Py_UCS4)-1)) __PYX_ERR(0, 743, __pyx_L1_error) + __pyx_t_1 = PyUnicode_FromOrdinal(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L1_error) + __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_5; @@ -13597,7 +13854,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __Pyx_XDECREF_SET(__pyx_v_b_step, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "dawg.pyx":727 + /* "dawg.pyx":745 * b_step = (key[word_pos].encode('utf8')) * * if b_step in replace_chars: # <<<<<<<<<<<<<< @@ -13606,13 +13863,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_replace_chars == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 727, __pyx_L1_error) + __PYX_ERR(0, 745, __pyx_L1_error) } - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_b_step, __pyx_v_replace_chars, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 727, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_b_step, __pyx_v_replace_chars, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 745, __pyx_L1_error) __pyx_t_6 = (__pyx_t_3 != 0); if (__pyx_t_6) { - /* "dawg.pyx":728 + /* "dawg.pyx":746 * * if b_step in replace_chars: * next_index = index # <<<<<<<<<<<<<< @@ -13621,7 +13878,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ __pyx_v_next_index = __pyx_v_index; - /* "dawg.pyx":729 + /* "dawg.pyx":747 * if b_step in replace_chars: * next_index = index * b_replace_char, u_replace_char = replace_chars[b_step] # <<<<<<<<<<<<<< @@ -13630,9 +13887,9 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_replace_chars == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 729, __pyx_L1_error) + __PYX_ERR(0, 747, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_replace_chars, __pyx_v_b_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_replace_chars, __pyx_v_b_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); @@ -13643,7 +13900,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 729, __pyx_L1_error) + __PYX_ERR(0, 747, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); @@ -13651,23 +13908,23 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_7); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 729, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 729, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 747, __pyx_L1_error) } - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 729, __pyx_L1_error) - if (!(likely(PyUnicode_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 729, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 747, __pyx_L1_error) + if (!(likely(PyUnicode_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_b_replace_char, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_u_replace_char, ((PyObject*)__pyx_t_7)); __pyx_t_7 = 0; - /* "dawg.pyx":731 + /* "dawg.pyx":749 * b_replace_char, u_replace_char = replace_chars[b_step] * * if self.dct.Follow(b_replace_char, &next_index): # <<<<<<<<<<<<<< @@ -13676,13 +13933,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_b_replace_char == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 731, __pyx_L1_error) + __PYX_ERR(0, 749, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_replace_char); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_replace_char); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 749, __pyx_L1_error) __pyx_t_6 = (__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_8, (&__pyx_v_next_index)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":732 + /* "dawg.pyx":750 * * if self.dct.Follow(b_replace_char, &next_index): * prefix = current_prefix + key[start_pos:word_pos] + u_replace_char # <<<<<<<<<<<<<< @@ -13691,41 +13948,41 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 732, __pyx_L1_error) + __PYX_ERR(0, 750, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyUnicode_Substring(__pyx_v_key, __pyx_v_start_pos, __pyx_v_word_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Substring(__pyx_v_key, __pyx_v_start_pos, __pyx_v_word_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_current_prefix, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_current_prefix, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyUnicode_ConcatSafe(__pyx_t_7, __pyx_v_u_replace_char); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_ConcatSafe(__pyx_t_7, __pyx_v_u_replace_char); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "dawg.pyx":733 + /* "dawg.pyx":751 * if self.dct.Follow(b_replace_char, &next_index): * prefix = current_prefix + key[start_pos:word_pos] + u_replace_char * extra_items = self._similar_items(prefix, key, next_index, replace_chars) # <<<<<<<<<<<<<< * res.extend(extra_items) * */ - __pyx_t_5 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_items(__pyx_v_self, __pyx_v_prefix, __pyx_v_key, __pyx_v_next_index, __pyx_v_replace_chars); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L1_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_items(__pyx_v_self, __pyx_v_prefix, __pyx_v_key, __pyx_v_next_index, __pyx_v_replace_chars); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 751, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_extra_items, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "dawg.pyx":734 + /* "dawg.pyx":752 * prefix = current_prefix + key[start_pos:word_pos] + u_replace_char * extra_items = self._similar_items(prefix, key, next_index, replace_chars) * res.extend(extra_items) # <<<<<<<<<<<<<< * * if not self.dct.Follow(b_step, &index): */ - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_res, __pyx_v_extra_items); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 734, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_res, __pyx_v_extra_items); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 752, __pyx_L1_error) - /* "dawg.pyx":731 + /* "dawg.pyx":749 * b_replace_char, u_replace_char = replace_chars[b_step] * * if self.dct.Follow(b_replace_char, &next_index): # <<<<<<<<<<<<<< @@ -13734,7 +13991,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ } - /* "dawg.pyx":727 + /* "dawg.pyx":745 * b_step = (key[word_pos].encode('utf8')) * * if b_step in replace_chars: # <<<<<<<<<<<<<< @@ -13743,7 +14000,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ } - /* "dawg.pyx":736 + /* "dawg.pyx":754 * res.extend(extra_items) * * if not self.dct.Follow(b_step, &index): # <<<<<<<<<<<<<< @@ -13752,13 +14009,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_b_step == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 736, __pyx_L1_error) + __PYX_ERR(0, 754, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_step); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_step); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 754, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_8, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":737 + /* "dawg.pyx":755 * * if not self.dct.Follow(b_step, &index): * break # <<<<<<<<<<<<<< @@ -13767,7 +14024,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ goto __pyx_L4_break; - /* "dawg.pyx":736 + /* "dawg.pyx":754 * res.extend(extra_items) * * if not self.dct.Follow(b_step, &index): # <<<<<<<<<<<<<< @@ -13776,7 +14033,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ } - /* "dawg.pyx":738 + /* "dawg.pyx":756 * if not self.dct.Follow(b_step, &index): * break * word_pos += 1 # <<<<<<<<<<<<<< @@ -13786,7 +14043,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __pyx_v_word_pos = (__pyx_v_word_pos + 1); } - /* "dawg.pyx":741 + /* "dawg.pyx":759 * * else: * if self.dct.Follow(self._c_payload_separator, &index): # <<<<<<<<<<<<<< @@ -13797,7 +14054,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __pyx_t_6 = (__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_v_self->_c_payload_separator, (&__pyx_v_index)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":742 + /* "dawg.pyx":760 * else: * if self.dct.Follow(self._c_payload_separator, &index): * found_key = current_prefix + key[start_pos:] # <<<<<<<<<<<<<< @@ -13806,36 +14063,36 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 742, __pyx_L1_error) + __PYX_ERR(0, 760, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyUnicode_Substring(__pyx_v_key, __pyx_v_start_pos, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 742, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Substring(__pyx_v_key, __pyx_v_start_pos, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_current_prefix, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 742, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_current_prefix, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_found_key = ((PyObject*)__pyx_t_7); __pyx_t_7 = 0; - /* "dawg.pyx":743 + /* "dawg.pyx":761 * if self.dct.Follow(self._c_payload_separator, &index): * found_key = current_prefix + key[start_pos:] * value = self._value_for_index(index) # <<<<<<<<<<<<<< * res.insert(0, (found_key, value)) * */ - __pyx_t_7 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 743, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_value = ((PyObject*)__pyx_t_7); __pyx_t_7 = 0; - /* "dawg.pyx":744 + /* "dawg.pyx":762 * found_key = current_prefix + key[start_pos:] * value = self._value_for_index(index) * res.insert(0, (found_key, value)) # <<<<<<<<<<<<<< * * return res */ - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_found_key); __Pyx_GIVEREF(__pyx_v_found_key); @@ -13843,10 +14100,10 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_value); - __pyx_t_9 = PyList_Insert(__pyx_v_res, 0, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_9 = PyList_Insert(__pyx_v_res, 0, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dawg.pyx":741 + /* "dawg.pyx":759 * * else: * if self.dct.Follow(self._c_payload_separator, &index): # <<<<<<<<<<<<<< @@ -13857,7 +14114,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ } __pyx_L4_break:; - /* "dawg.pyx":746 + /* "dawg.pyx":764 * res.insert(0, (found_key, value)) * * return res # <<<<<<<<<<<<<< @@ -13869,7 +14126,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":713 + /* "dawg.pyx":731 * return self.dct.Follow(self._c_payload_separator, &_index) * * cdef list _similar_items(self, unicode current_prefix, unicode key, BaseType cur_index, dict replace_chars): # <<<<<<<<<<<<<< @@ -13898,7 +14155,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_items(struct __pyx_obj_4dawg_ return __pyx_r; } -/* "dawg.pyx":748 +/* "dawg.pyx":766 * return res * * cpdef list similar_items(self, unicode key, dict replaces): # <<<<<<<<<<<<<< @@ -13926,7 +14183,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_items(struct __pyx_obj_4dawg_B if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_similar_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_similar_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_31similar_items)) { __Pyx_XDECREF(__pyx_r); @@ -13946,7 +14203,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_items(struct __pyx_obj_4dawg_B #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_replaces}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else @@ -13954,13 +14211,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_items(struct __pyx_obj_4dawg_B #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_replaces}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -13971,12 +14228,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_items(struct __pyx_obj_4dawg_B __Pyx_INCREF(__pyx_v_replaces); __Pyx_GIVEREF(__pyx_v_replaces); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_replaces); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 748, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 766, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13995,7 +14252,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_items(struct __pyx_obj_4dawg_B #endif } - /* "dawg.pyx":758 + /* "dawg.pyx":776 * unicode strings. * """ * return self._similar_items("", key, self.dct.root(), replaces) # <<<<<<<<<<<<<< @@ -14003,13 +14260,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_items(struct __pyx_obj_4dawg_B * cdef list _similar_item_values(self, int start_pos, unicode key, BaseType cur_index, dict replace_chars): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_items(__pyx_v_self, __pyx_kp_u__6, __pyx_v_key, __pyx_v_self->__pyx_base.__pyx_base.dct.root(), __pyx_v_replaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_items(__pyx_v_self, __pyx_kp_u__6, __pyx_v_key, __pyx_v_self->__pyx_base.__pyx_base.dct.root(), __pyx_v_replaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":748 + /* "dawg.pyx":766 * return res * * cpdef list similar_items(self, unicode key, dict replaces): # <<<<<<<<<<<<<< @@ -14064,11 +14321,11 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_31similar_items(PyObject *__pyx_v_sel case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_replaces)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("similar_items", 1, 2, 2, 1); __PYX_ERR(0, 748, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("similar_items", 1, 2, 2, 1); __PYX_ERR(0, 766, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "similar_items") < 0)) __PYX_ERR(0, 748, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "similar_items") < 0)) __PYX_ERR(0, 766, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -14081,14 +14338,14 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_31similar_items(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("similar_items", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 748, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("similar_items", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 766, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.similar_items", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 748, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_replaces), (&PyDict_Type), 1, "replaces", 1))) __PYX_ERR(0, 748, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 766, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_replaces), (&PyDict_Type), 1, "replaces", 1))) __PYX_ERR(0, 766, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_30similar_items(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_key, __pyx_v_replaces); /* function exit code */ @@ -14106,7 +14363,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_30similar_items(struct __pyx_obj_4daw PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("similar_items", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_similar_items(__pyx_v_self, __pyx_v_key, __pyx_v_replaces, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_similar_items(__pyx_v_self, __pyx_v_key, __pyx_v_replaces, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14123,7 +14380,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_30similar_items(struct __pyx_obj_4daw return __pyx_r; } -/* "dawg.pyx":760 +/* "dawg.pyx":778 * return self._similar_items("", key, self.dct.root(), replaces) * * cdef list _similar_item_values(self, int start_pos, unicode key, BaseType cur_index, dict replace_chars): # <<<<<<<<<<<<<< @@ -14155,7 +14412,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ int __pyx_t_9; __Pyx_RefNannySetupContext("_similar_item_values", 0); - /* "dawg.pyx":761 + /* "dawg.pyx":779 * * cdef list _similar_item_values(self, int start_pos, unicode key, BaseType cur_index, dict replace_chars): * cdef BaseType next_index, index = cur_index # <<<<<<<<<<<<<< @@ -14164,19 +14421,19 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ __pyx_v_index = __pyx_v_cur_index; - /* "dawg.pyx":764 + /* "dawg.pyx":782 * cdef unicode prefix, u_replace_char, found_key * cdef bytes b_step, b_replace_char * cdef list res = [] # <<<<<<<<<<<<<< * cdef list extra_items, value * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":768 + /* "dawg.pyx":786 * * #cdef int start_pos = len(current_prefix) * cdef int end_pos = len(key) # <<<<<<<<<<<<<< @@ -14185,12 +14442,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 768, __pyx_L1_error) + __PYX_ERR(0, 786, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 768, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 786, __pyx_L1_error) __pyx_v_end_pos = __pyx_t_2; - /* "dawg.pyx":769 + /* "dawg.pyx":787 * #cdef int start_pos = len(current_prefix) * cdef int end_pos = len(key) * cdef int word_pos = start_pos # <<<<<<<<<<<<<< @@ -14199,7 +14456,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ __pyx_v_word_pos = __pyx_v_start_pos; - /* "dawg.pyx":771 + /* "dawg.pyx":789 * cdef int word_pos = start_pos * * while word_pos < end_pos: # <<<<<<<<<<<<<< @@ -14210,17 +14467,17 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ __pyx_t_3 = ((__pyx_v_word_pos < __pyx_v_end_pos) != 0); if (!__pyx_t_3) break; - /* "dawg.pyx":772 + /* "dawg.pyx":790 * * while word_pos < end_pos: * b_step = (key[word_pos].encode('utf8')) # <<<<<<<<<<<<<< * * if b_step in replace_chars: */ - __pyx_t_4 = __Pyx_GetItemInt_Unicode(__pyx_v_key, __pyx_v_word_pos, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == (Py_UCS4)-1)) __PYX_ERR(0, 772, __pyx_L1_error) - __pyx_t_1 = PyUnicode_FromOrdinal(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt_Unicode(__pyx_v_key, __pyx_v_word_pos, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == (Py_UCS4)-1)) __PYX_ERR(0, 790, __pyx_L1_error) + __pyx_t_1 = PyUnicode_FromOrdinal(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 772, __pyx_L1_error) + __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_5; @@ -14229,7 +14486,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ __Pyx_XDECREF_SET(__pyx_v_b_step, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "dawg.pyx":774 + /* "dawg.pyx":792 * b_step = (key[word_pos].encode('utf8')) * * if b_step in replace_chars: # <<<<<<<<<<<<<< @@ -14238,13 +14495,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ if (unlikely(__pyx_v_replace_chars == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 774, __pyx_L1_error) + __PYX_ERR(0, 792, __pyx_L1_error) } - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_b_step, __pyx_v_replace_chars, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 774, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_b_step, __pyx_v_replace_chars, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 792, __pyx_L1_error) __pyx_t_6 = (__pyx_t_3 != 0); if (__pyx_t_6) { - /* "dawg.pyx":775 + /* "dawg.pyx":793 * * if b_step in replace_chars: * next_index = index # <<<<<<<<<<<<<< @@ -14253,7 +14510,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ __pyx_v_next_index = __pyx_v_index; - /* "dawg.pyx":776 + /* "dawg.pyx":794 * if b_step in replace_chars: * next_index = index * b_replace_char, u_replace_char = replace_chars[b_step] # <<<<<<<<<<<<<< @@ -14262,9 +14519,9 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ if (unlikely(__pyx_v_replace_chars == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 776, __pyx_L1_error) + __PYX_ERR(0, 794, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_replace_chars, __pyx_v_b_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_replace_chars, __pyx_v_b_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); @@ -14275,7 +14532,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 776, __pyx_L1_error) + __PYX_ERR(0, 794, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); @@ -14283,23 +14540,23 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_7); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 776, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 794, __pyx_L1_error) } - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 776, __pyx_L1_error) - if (!(likely(PyUnicode_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 776, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 794, __pyx_L1_error) + if (!(likely(PyUnicode_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_b_replace_char, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_u_replace_char, ((PyObject*)__pyx_t_7)); __pyx_t_7 = 0; - /* "dawg.pyx":778 + /* "dawg.pyx":796 * b_replace_char, u_replace_char = replace_chars[b_step] * * if self.dct.Follow(b_replace_char, &next_index): # <<<<<<<<<<<<<< @@ -14308,34 +14565,34 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ if (unlikely(__pyx_v_b_replace_char == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 778, __pyx_L1_error) + __PYX_ERR(0, 796, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_replace_char); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_replace_char); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L1_error) __pyx_t_6 = (__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_8, (&__pyx_v_next_index)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":779 + /* "dawg.pyx":797 * * if self.dct.Follow(b_replace_char, &next_index): * extra_items = self._similar_item_values(word_pos+1, key, next_index, replace_chars) # <<<<<<<<<<<<<< * res.extend(extra_items) * */ - __pyx_t_5 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_item_values(__pyx_v_self, (__pyx_v_word_pos + 1), __pyx_v_key, __pyx_v_next_index, __pyx_v_replace_chars); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 779, __pyx_L1_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_item_values(__pyx_v_self, (__pyx_v_word_pos + 1), __pyx_v_key, __pyx_v_next_index, __pyx_v_replace_chars); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_extra_items, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "dawg.pyx":780 + /* "dawg.pyx":798 * if self.dct.Follow(b_replace_char, &next_index): * extra_items = self._similar_item_values(word_pos+1, key, next_index, replace_chars) * res.extend(extra_items) # <<<<<<<<<<<<<< * * if not self.dct.Follow(b_step, &index): */ - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_res, __pyx_v_extra_items); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 780, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_res, __pyx_v_extra_items); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 798, __pyx_L1_error) - /* "dawg.pyx":778 + /* "dawg.pyx":796 * b_replace_char, u_replace_char = replace_chars[b_step] * * if self.dct.Follow(b_replace_char, &next_index): # <<<<<<<<<<<<<< @@ -14344,7 +14601,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ } - /* "dawg.pyx":774 + /* "dawg.pyx":792 * b_step = (key[word_pos].encode('utf8')) * * if b_step in replace_chars: # <<<<<<<<<<<<<< @@ -14353,7 +14610,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ } - /* "dawg.pyx":782 + /* "dawg.pyx":800 * res.extend(extra_items) * * if not self.dct.Follow(b_step, &index): # <<<<<<<<<<<<<< @@ -14362,13 +14619,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ if (unlikely(__pyx_v_b_step == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 782, __pyx_L1_error) + __PYX_ERR(0, 800, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_step); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 782, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_step); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_8, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":783 + /* "dawg.pyx":801 * * if not self.dct.Follow(b_step, &index): * break # <<<<<<<<<<<<<< @@ -14377,7 +14634,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ goto __pyx_L4_break; - /* "dawg.pyx":782 + /* "dawg.pyx":800 * res.extend(extra_items) * * if not self.dct.Follow(b_step, &index): # <<<<<<<<<<<<<< @@ -14386,7 +14643,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ */ } - /* "dawg.pyx":784 + /* "dawg.pyx":802 * if not self.dct.Follow(b_step, &index): * break * word_pos += 1 # <<<<<<<<<<<<<< @@ -14396,7 +14653,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ __pyx_v_word_pos = (__pyx_v_word_pos + 1); } - /* "dawg.pyx":787 + /* "dawg.pyx":805 * * else: * if self.dct.Follow(self._c_payload_separator, &index): # <<<<<<<<<<<<<< @@ -14407,28 +14664,28 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ __pyx_t_6 = (__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_v_self->_c_payload_separator, (&__pyx_v_index)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":788 + /* "dawg.pyx":806 * else: * if self.dct.Follow(self._c_payload_separator, &index): * value = self._value_for_index(index) # <<<<<<<<<<<<<< * res.insert(0, value) * */ - __pyx_t_5 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 788, __pyx_L1_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_value = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; - /* "dawg.pyx":789 + /* "dawg.pyx":807 * if self.dct.Follow(self._c_payload_separator, &index): * value = self._value_for_index(index) * res.insert(0, value) # <<<<<<<<<<<<<< * * return res */ - __pyx_t_9 = PyList_Insert(__pyx_v_res, 0, __pyx_v_value); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 789, __pyx_L1_error) + __pyx_t_9 = PyList_Insert(__pyx_v_res, 0, __pyx_v_value); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 807, __pyx_L1_error) - /* "dawg.pyx":787 + /* "dawg.pyx":805 * * else: * if self.dct.Follow(self._c_payload_separator, &index): # <<<<<<<<<<<<<< @@ -14439,7 +14696,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ } __pyx_L4_break:; - /* "dawg.pyx":791 + /* "dawg.pyx":809 * res.insert(0, value) * * return res # <<<<<<<<<<<<<< @@ -14451,7 +14708,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":760 + /* "dawg.pyx":778 * return self._similar_items("", key, self.dct.root(), replaces) * * cdef list _similar_item_values(self, int start_pos, unicode key, BaseType cur_index, dict replace_chars): # <<<<<<<<<<<<<< @@ -14478,7 +14735,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG__similar_item_values(struct __pyx_obj_ return __pyx_r; } -/* "dawg.pyx":793 +/* "dawg.pyx":811 * return res * * cpdef list similar_item_values(self, unicode key, dict replaces): # <<<<<<<<<<<<<< @@ -14506,7 +14763,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_item_values(struct __pyx_obj_4 if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_similar_item_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_similar_item_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_9BytesDAWG_33similar_item_values)) { __Pyx_XDECREF(__pyx_r); @@ -14526,7 +14783,7 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_item_values(struct __pyx_obj_4 #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_replaces}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else @@ -14534,13 +14791,13 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_item_values(struct __pyx_obj_4 #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_replaces}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 793, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -14551,12 +14808,12 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_item_values(struct __pyx_obj_4 __Pyx_INCREF(__pyx_v_replaces); __Pyx_GIVEREF(__pyx_v_replaces); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_replaces); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 793, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 811, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -14575,21 +14832,21 @@ static PyObject *__pyx_f_4dawg_9BytesDAWG_similar_item_values(struct __pyx_obj_4 #endif } - /* "dawg.pyx":803 + /* "dawg.pyx":821 * unicode strings. * """ * return self._similar_item_values(0, key, self.dct.root(), replaces) # <<<<<<<<<<<<<< * - * + * def longest_prefix(self, unicode key): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_item_values(__pyx_v_self, 0, __pyx_v_key, __pyx_v_self->__pyx_base.__pyx_base.dct.root(), __pyx_v_replaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_similar_item_values(__pyx_v_self, 0, __pyx_v_key, __pyx_v_self->__pyx_base.__pyx_base.dct.root(), __pyx_v_replaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":793 + /* "dawg.pyx":811 * return res * * cpdef list similar_item_values(self, unicode key, dict replaces): # <<<<<<<<<<<<<< @@ -14644,11 +14901,11 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_33similar_item_values(PyObject *__pyx case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_replaces)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("similar_item_values", 1, 2, 2, 1); __PYX_ERR(0, 793, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("similar_item_values", 1, 2, 2, 1); __PYX_ERR(0, 811, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "similar_item_values") < 0)) __PYX_ERR(0, 793, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "similar_item_values") < 0)) __PYX_ERR(0, 811, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -14661,14 +14918,14 @@ static PyObject *__pyx_pw_4dawg_9BytesDAWG_33similar_item_values(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("similar_item_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 793, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("similar_item_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 811, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.BytesDAWG.similar_item_values", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 793, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_replaces), (&PyDict_Type), 1, "replaces", 1))) __PYX_ERR(0, 793, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 811, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_replaces), (&PyDict_Type), 1, "replaces", 1))) __PYX_ERR(0, 811, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_9BytesDAWG_32similar_item_values(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_key, __pyx_v_replaces); /* function exit code */ @@ -14686,7 +14943,7 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_32similar_item_values(struct __pyx_ob PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("similar_item_values", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_similar_item_values(__pyx_v_self, __pyx_v_key, __pyx_v_replaces, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG_similar_item_values(__pyx_v_self, __pyx_v_key, __pyx_v_replaces, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14703,7 +14960,271 @@ static PyObject *__pyx_pf_4dawg_9BytesDAWG_32similar_item_values(struct __pyx_ob return __pyx_r; } -/* "dawg.pyx":824 +/* "dawg.pyx":823 + * return self._similar_item_values(0, key, self.dct.root(), replaces) + * + * def longest_prefix(self, unicode key): # <<<<<<<<<<<<<< + * cdef BaseType index = self.dct.root() + * cdef BaseType tmp + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4dawg_9BytesDAWG_35longest_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_4dawg_9BytesDAWG_34longest_prefix[] = "BytesDAWG.longest_prefix(self, unicode key)"; +static PyObject *__pyx_pw_4dawg_9BytesDAWG_35longest_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("longest_prefix (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 823, __pyx_L1_error) + __pyx_r = __pyx_pf_4dawg_9BytesDAWG_34longest_prefix(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4dawg_9BytesDAWG_34longest_prefix(struct __pyx_obj_4dawg_BytesDAWG *__pyx_v_self, PyObject *__pyx_v_key) { + dawgdic::BaseType __pyx_v_index; + dawgdic::BaseType __pyx_v_tmp; + dawgdic::BaseType __pyx_v_lastindex; + int __pyx_v_pos; + int __pyx_v_lastpos; + dawgdic::CharType __pyx_v_ch; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("longest_prefix", 0); + + /* "dawg.pyx":824 + * + * def longest_prefix(self, unicode key): + * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< + * cdef BaseType tmp + * cdef BaseType lastindex + */ + __pyx_v_index = __pyx_v_self->__pyx_base.__pyx_base.dct.root(); + + /* "dawg.pyx":827 + * cdef BaseType tmp + * cdef BaseType lastindex + * cdef int pos = 1 # <<<<<<<<<<<<<< + * cdef int lastpos = 0 + * cdef CharType ch + */ + __pyx_v_pos = 1; + + /* "dawg.pyx":828 + * cdef BaseType lastindex + * cdef int pos = 1 + * cdef int lastpos = 0 # <<<<<<<<<<<<<< + * cdef CharType ch + * + */ + __pyx_v_lastpos = 0; + + /* "dawg.pyx":831 + * cdef CharType ch + * + * for ch in key: # <<<<<<<<<<<<<< + * if not self.dct.Follow(ch, &index): + * break + */ + if (unlikely(__pyx_v_key == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(0, 831, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_key); + __pyx_t_1 = __pyx_v_key; + __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 831, __pyx_L1_error) + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) { + __pyx_t_2 = __pyx_t_7; + __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2); + + /* "dawg.pyx":832 + * + * for ch in key: + * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_8 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_v_ch, (&__pyx_v_index)) != 0)) != 0); + if (__pyx_t_8) { + + /* "dawg.pyx":833 + * for ch in key: + * if not self.dct.Follow(ch, &index): + * break # <<<<<<<<<<<<<< + * + * tmp = index + */ + goto __pyx_L4_break; + + /* "dawg.pyx":832 + * + * for ch in key: + * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< + * break + * + */ + } + + /* "dawg.pyx":835 + * break + * + * tmp = index # <<<<<<<<<<<<<< + * if self.dct.Follow(self._c_payload_separator, &tmp): + * lastpos = pos + */ + __pyx_v_tmp = __pyx_v_index; + + /* "dawg.pyx":836 + * + * tmp = index + * if self.dct.Follow(self._c_payload_separator, &tmp): # <<<<<<<<<<<<<< + * lastpos = pos + * lastindex = tmp + */ + __pyx_t_8 = (__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_v_self->_c_payload_separator, (&__pyx_v_tmp)) != 0); + if (__pyx_t_8) { + + /* "dawg.pyx":837 + * tmp = index + * if self.dct.Follow(self._c_payload_separator, &tmp): + * lastpos = pos # <<<<<<<<<<<<<< + * lastindex = tmp + * pos += 1 + */ + __pyx_v_lastpos = __pyx_v_pos; + + /* "dawg.pyx":838 + * if self.dct.Follow(self._c_payload_separator, &tmp): + * lastpos = pos + * lastindex = tmp # <<<<<<<<<<<<<< + * pos += 1 + * + */ + __pyx_v_lastindex = __pyx_v_tmp; + + /* "dawg.pyx":836 + * + * tmp = index + * if self.dct.Follow(self._c_payload_separator, &tmp): # <<<<<<<<<<<<<< + * lastpos = pos + * lastindex = tmp + */ + } + + /* "dawg.pyx":839 + * lastpos = pos + * lastindex = tmp + * pos += 1 # <<<<<<<<<<<<<< + * + * if lastpos: + */ + __pyx_v_pos = (__pyx_v_pos + 1); + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dawg.pyx":841 + * pos += 1 + * + * if lastpos: # <<<<<<<<<<<<<< + * return key[:lastpos], self._value_for_index(lastindex) + * else: + */ + __pyx_t_8 = (__pyx_v_lastpos != 0); + if (likely(__pyx_t_8)) { + + /* "dawg.pyx":842 + * + * if lastpos: + * return key[:lastpos], self._value_for_index(lastindex) # <<<<<<<<<<<<<< + * else: + * raise KeyError("No prefix found") + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_key == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 842, __pyx_L1_error) + } + __pyx_t_9 = __Pyx_PyUnicode_Substring(__pyx_v_key, 0, __pyx_v_lastpos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = ((struct __pyx_vtabstruct_4dawg_BytesDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_value_for_index(__pyx_v_self, __pyx_v_lastindex); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + goto __pyx_L0; + + /* "dawg.pyx":841 + * pos += 1 + * + * if lastpos: # <<<<<<<<<<<<<< + * return key[:lastpos], self._value_for_index(lastindex) + * else: + */ + } + + /* "dawg.pyx":844 + * return key[:lastpos], self._value_for_index(lastindex) + * else: + * raise KeyError("No prefix found") # <<<<<<<<<<<<<< + * + * cdef class RecordDAWG(BytesDAWG): + */ + /*else*/ { + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 844, __pyx_L1_error) + } + + /* "dawg.pyx":823 + * return self._similar_item_values(0, key, self.dct.root(), replaces) + * + * def longest_prefix(self, unicode key): # <<<<<<<<<<<<<< + * cdef BaseType index = self.dct.root() + * cdef BaseType tmp + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dawg.BytesDAWG.longest_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dawg.pyx":863 * cdef _struct * * def __init__(self, fmt, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -14730,7 +15251,7 @@ static int __pyx_pw_4dawg_10RecordDAWG_1__init__(PyObject *__pyx_v_self, PyObjec PyObject* values[4] = {0,0,0,0}; values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_False); - values[3] = __pyx_k__12; + values[3] = __pyx_k__13; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -14771,7 +15292,7 @@ static int __pyx_pw_4dawg_10RecordDAWG_1__init__(PyObject *__pyx_v_self, PyObjec } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 824, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 863, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -14793,13 +15314,13 @@ static int __pyx_pw_4dawg_10RecordDAWG_1__init__(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 824, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 863, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.RecordDAWG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload_separator), (&PyBytes_Type), 1, "payload_separator", 1))) __PYX_ERR(0, 824, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload_separator), (&PyBytes_Type), 1, "payload_separator", 1))) __PYX_ERR(0, 863, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_10RecordDAWG___init__(((struct __pyx_obj_4dawg_RecordDAWG *)__pyx_v_self), __pyx_v_fmt, __pyx_v_arg, __pyx_v_input_is_sorted, __pyx_v_payload_separator); /* function exit code */ @@ -14812,7 +15333,7 @@ static int __pyx_pw_4dawg_10RecordDAWG_1__init__(PyObject *__pyx_v_self, PyObjec } static PyObject *__pyx_gb_4dawg_10RecordDAWG_8__init___2generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":839 +/* "dawg.pyx":878 * arg = [] * * keys = ((d[0], self._struct.pack(*d[1])) for d in arg) # <<<<<<<<<<<<<< @@ -14829,7 +15350,7 @@ static PyObject *__pyx_pf_4dawg_10RecordDAWG_8__init___genexpr(PyObject *__pyx_s if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_9_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 839, __pyx_L1_error) + __PYX_ERR(0, 878, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -14837,7 +15358,7 @@ static PyObject *__pyx_pf_4dawg_10RecordDAWG_8__init___genexpr(PyObject *__pyx_s __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_10RecordDAWG_8__init___2generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_10RecordDAWG_8__init___2generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -14874,32 +15395,32 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_8__init___2generator8(__pyx_Corouti return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 839, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 839, __pyx_L1_error) } + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 878, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 878, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 878, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 878, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 878, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -14909,7 +15430,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_8__init___2generator8(__pyx_Corouti PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 839, __pyx_L1_error) + else __PYX_ERR(0, 878, __pyx_L1_error) } break; } @@ -14919,21 +15440,21 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_8__init___2generator8(__pyx_Corouti __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 839, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 839, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 878, __pyx_L1_error) } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_d, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); @@ -14959,7 +15480,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_8__init___2generator8(__pyx_Corouti __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 839, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 878, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -14985,7 +15506,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_8__init___2generator8(__pyx_Corouti return __pyx_r; } -/* "dawg.pyx":824 +/* "dawg.pyx":863 * cdef _struct * * def __init__(self, fmt, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -15010,7 +15531,7 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_8___init__ *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 824, __pyx_L1_error) + __PYX_ERR(0, 863, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -15021,19 +15542,19 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW __Pyx_INCREF(__pyx_cur_scope->__pyx_v_arg); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_arg); - /* "dawg.pyx":834 + /* "dawg.pyx":873 * format string specification. * """ * self._struct = struct.Struct(str(fmt)) # <<<<<<<<<<<<<< * * if arg is None: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Struct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 834, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Struct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_fmt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_fmt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -15048,7 +15569,7 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); @@ -15057,7 +15578,7 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW __pyx_cur_scope->__pyx_v_self->_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":836 + /* "dawg.pyx":875 * self._struct = struct.Struct(str(fmt)) * * if arg is None: # <<<<<<<<<<<<<< @@ -15068,21 +15589,21 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "dawg.pyx":837 + /* "dawg.pyx":876 * * if arg is None: * arg = [] # <<<<<<<<<<<<<< * * keys = ((d[0], self._struct.pack(*d[1])) for d in arg) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arg); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_arg, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":836 + /* "dawg.pyx":875 * self._struct = struct.Struct(str(fmt)) * * if arg is None: # <<<<<<<<<<<<<< @@ -15091,26 +15612,26 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW */ } - /* "dawg.pyx":839 + /* "dawg.pyx":878 * arg = [] * * keys = ((d[0], self._struct.pack(*d[1])) for d in arg) # <<<<<<<<<<<<<< * super(RecordDAWG, self).__init__(keys, input_is_sorted, payload_separator) * */ - __pyx_t_1 = __pyx_pf_4dawg_10RecordDAWG_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_t_1 = __pyx_pf_4dawg_10RecordDAWG_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_keys = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":840 + /* "dawg.pyx":879 * * keys = ((d[0], self._struct.pack(*d[1])) for d in arg) * super(RecordDAWG, self).__init__(keys, input_is_sorted, payload_separator) # <<<<<<<<<<<<<< * * cdef list _value_for_index(self, BaseType index): */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_RecordDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_RecordDAWG)); @@ -15118,10 +15639,10 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_self)); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -15139,7 +15660,7 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_keys, __pyx_v_input_is_sorted, __pyx_v_payload_separator}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -15147,13 +15668,13 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_keys, __pyx_v_input_is_sorted, __pyx_v_payload_separator}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_4 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; @@ -15167,14 +15688,14 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW __Pyx_INCREF(__pyx_v_payload_separator); __Pyx_GIVEREF(__pyx_v_payload_separator); PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_v_payload_separator); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":824 + /* "dawg.pyx":863 * cdef _struct * * def __init__(self, fmt, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -15199,7 +15720,7 @@ static int __pyx_pf_4dawg_10RecordDAWG___init__(struct __pyx_obj_4dawg_RecordDAW return __pyx_r; } -/* "dawg.pyx":842 +/* "dawg.pyx":881 * super(RecordDAWG, self).__init__(keys, input_is_sorted, payload_separator) * * cdef list _value_for_index(self, BaseType index): # <<<<<<<<<<<<<< @@ -15220,19 +15741,19 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG__value_for_index(struct __pyx_obj_4d PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_value_for_index", 0); - /* "dawg.pyx":843 + /* "dawg.pyx":882 * * cdef list _value_for_index(self, BaseType index): * cdef list value = BytesDAWG._value_for_index(self, index) # <<<<<<<<<<<<<< * return [self._struct.unpack(val) for val in value] * */ - __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG__value_for_index(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error) + __pyx_t_1 = __pyx_f_4dawg_9BytesDAWG__value_for_index(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":844 + /* "dawg.pyx":883 * cdef list _value_for_index(self, BaseType index): * cdef list value = BytesDAWG._value_for_index(self, index) * return [self._struct.unpack(val) for val in value] # <<<<<<<<<<<<<< @@ -15240,24 +15761,24 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG__value_for_index(struct __pyx_obj_4d * cpdef list items(self, unicode prefix=""): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_value == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 844, __pyx_L1_error) + __PYX_ERR(0, 883, __pyx_L1_error) } __pyx_t_2 = __pyx_v_value; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; for (;;) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 844, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 883, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 844, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { @@ -15271,10 +15792,10 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG__value_for_index(struct __pyx_obj_4d } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_val); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 844, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -15282,7 +15803,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG__value_for_index(struct __pyx_obj_4d __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":842 + /* "dawg.pyx":881 * super(RecordDAWG, self).__init__(keys, input_is_sorted, payload_separator) * * cdef list _value_for_index(self, BaseType index): # <<<<<<<<<<<<<< @@ -15307,7 +15828,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG__value_for_index(struct __pyx_obj_4d return __pyx_r; } -/* "dawg.pyx":846 +/* "dawg.pyx":885 * return [self._struct.unpack(val) for val in value] * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -15347,7 +15868,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_10RecordDAWG_3items)) { __Pyx_XDECREF(__pyx_r); @@ -15364,10 +15885,10 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_prefix); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 846, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 846, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 885, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -15386,7 +15907,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD #endif } - /* "dawg.pyx":847 + /* "dawg.pyx":886 * * cpdef list items(self, unicode prefix=""): * cdef list items = BytesDAWG.items(self, prefix) # <<<<<<<<<<<<<< @@ -15395,12 +15916,12 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD */ __pyx_t_5.__pyx_n = 1; __pyx_t_5.prefix = __pyx_v_prefix; - __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->items(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), 1, &__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_BytesDAWG->items(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), 1, &__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_items = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":848 + /* "dawg.pyx":887 * cpdef list items(self, unicode prefix=""): * cdef list items = BytesDAWG.items(self, prefix) * return [(key, self._struct.unpack(val)) for (key, val) in items] # <<<<<<<<<<<<<< @@ -15408,19 +15929,19 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD * def iteritems(self, unicode prefix=""): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_items == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 848, __pyx_L1_error) + __PYX_ERR(0, 887, __pyx_L1_error) } __pyx_t_2 = __pyx_v_items; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; for (;;) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 887, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { @@ -15429,7 +15950,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 848, __pyx_L1_error) + __PYX_ERR(0, 887, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -15442,15 +15963,15 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; @@ -15458,7 +15979,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD __Pyx_GOTREF(__pyx_t_4); index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 848, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 887, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L6_unpacking_done; @@ -15466,14 +15987,14 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 848, __pyx_L1_error) + __PYX_ERR(0, 887, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -15487,10 +16008,10 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_val); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); @@ -15498,7 +16019,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 848, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -15506,7 +16027,7 @@ static PyObject *__pyx_f_4dawg_10RecordDAWG_items(struct __pyx_obj_4dawg_RecordD __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":846 + /* "dawg.pyx":885 * return [self._struct.unpack(val) for val in value] * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -15563,7 +16084,7 @@ static PyObject *__pyx_pw_4dawg_10RecordDAWG_3items(PyObject *__pyx_v_self, PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "items") < 0)) __PYX_ERR(0, 846, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "items") < 0)) __PYX_ERR(0, 885, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -15577,13 +16098,13 @@ static PyObject *__pyx_pw_4dawg_10RecordDAWG_3items(PyObject *__pyx_v_self, PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("items", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 846, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("items", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 885, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.RecordDAWG.items", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 846, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 885, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_10RecordDAWG_2items(((struct __pyx_obj_4dawg_RecordDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -15604,7 +16125,7 @@ static PyObject *__pyx_pf_4dawg_10RecordDAWG_2items(struct __pyx_obj_4dawg_Recor __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.prefix = __pyx_v_prefix; - __pyx_t_1 = __pyx_vtabptr_4dawg_RecordDAWG->__pyx_base.items(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_RecordDAWG->__pyx_base.items(((struct __pyx_obj_4dawg_BytesDAWG *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15622,7 +16143,7 @@ static PyObject *__pyx_pf_4dawg_10RecordDAWG_2items(struct __pyx_obj_4dawg_Recor } static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":850 +/* "dawg.pyx":889 * return [(key, self._struct.unpack(val)) for (key, val) in items] * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -15660,7 +16181,7 @@ static PyObject *__pyx_pw_4dawg_10RecordDAWG_5iteritems(PyObject *__pyx_v_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 850, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 889, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -15674,13 +16195,13 @@ static PyObject *__pyx_pw_4dawg_10RecordDAWG_5iteritems(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 850, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 889, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.RecordDAWG.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 850, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 889, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_10RecordDAWG_4iteritems(((struct __pyx_obj_4dawg_RecordDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -15701,7 +16222,7 @@ static PyObject *__pyx_pf_4dawg_10RecordDAWG_4iteritems(struct __pyx_obj_4dawg_R if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_10_iteritems *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 850, __pyx_L1_error) + __PYX_ERR(0, 889, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -15712,7 +16233,7 @@ static PyObject *__pyx_pf_4dawg_10RecordDAWG_4iteritems(struct __pyx_obj_4dawg_R __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_10RecordDAWG_6generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_RecordDAWG_iteritems, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 850, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_10RecordDAWG_6generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_RecordDAWG_iteritems, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -15751,16 +16272,16 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 850, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 889, __pyx_L1_error) - /* "dawg.pyx":851 + /* "dawg.pyx":890 * * def iteritems(self, unicode prefix=""): * for key, val in BytesDAWG.iteritems(self, prefix): # <<<<<<<<<<<<<< * yield (key, self._struct.unpack(val)) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4dawg_BytesDAWG), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4dawg_BytesDAWG), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -15777,7 +16298,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_prefix}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -15785,13 +16306,13 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_prefix}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -15802,7 +16323,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_prefix); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -15811,9 +16332,9 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __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, 851, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 890, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -15821,17 +16342,17 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 890, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 890, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -15841,7 +16362,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 851, __pyx_L1_error) + else __PYX_ERR(0, 890, __pyx_L1_error) } break; } @@ -15853,7 +16374,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 851, __pyx_L1_error) + __PYX_ERR(0, 890, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -15866,15 +16387,15 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __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, 851, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; @@ -15882,7 +16403,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 851, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 890, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L7_unpacking_done; @@ -15890,7 +16411,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 851, __pyx_L1_error) + __PYX_ERR(0, 890, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key); @@ -15902,14 +16423,14 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dawg.pyx":852 + /* "dawg.pyx":891 * def iteritems(self, unicode prefix=""): * for key, val in BytesDAWG.iteritems(self, prefix): * yield (key, self._struct.unpack(val)) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -15923,10 +16444,10 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_cur_scope->__pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_val); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key); @@ -15952,9 +16473,9 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_XGOTREF(__pyx_t_2); __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 852, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 891, __pyx_L1_error) - /* "dawg.pyx":851 + /* "dawg.pyx":890 * * def iteritems(self, unicode prefix=""): * for key, val in BytesDAWG.iteritems(self, prefix): # <<<<<<<<<<<<<< @@ -15965,7 +16486,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":850 + /* "dawg.pyx":889 * return [(key, self._struct.unpack(val)) for (key, val) in items] * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -15994,7 +16515,7 @@ static PyObject *__pyx_gb_4dawg_10RecordDAWG_6generator4(__pyx_CoroutineObject * return __pyx_r; } -/* "dawg.pyx":855 +/* "dawg.pyx":894 * * * def _iterable_from_argument(arg): # <<<<<<<<<<<<<< @@ -16018,7 +16539,7 @@ static PyObject *__pyx_pw_4dawg_1_iterable_from_argument(PyObject *__pyx_self, P } static PyObject *__pyx_gb_4dawg_23_iterable_from_argument_2generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":860 +/* "dawg.pyx":899 * * if isinstance(arg, Mapping): * return ((key, arg[key]) for key in arg) # <<<<<<<<<<<<<< @@ -16035,7 +16556,7 @@ static PyObject *__pyx_pf_4dawg_23_iterable_from_argument_genexpr(PyObject *__py if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_12_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 860, __pyx_L1_error) + __PYX_ERR(0, 899, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -16043,7 +16564,7 @@ static PyObject *__pyx_pf_4dawg_23_iterable_from_argument_genexpr(PyObject *__py __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_23_iterable_from_argument_2generator9, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_iterable_from_argument_locals_g, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_23_iterable_from_argument_2generator9, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_iterable_from_argument_locals_g, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -16078,32 +16599,32 @@ static PyObject *__pyx_gb_4dawg_23_iterable_from_argument_2generator9(__pyx_Coro return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 860, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 860, __pyx_L1_error) } + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 899, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 899, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 899, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 899, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -16113,7 +16634,7 @@ static PyObject *__pyx_gb_4dawg_23_iterable_from_argument_2generator9(__pyx_Coro PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 860, __pyx_L1_error) + else __PYX_ERR(0, 899, __pyx_L1_error) } break; } @@ -16123,10 +16644,10 @@ static PyObject *__pyx_gb_4dawg_23_iterable_from_argument_2generator9(__pyx_Coro __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 860, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg, __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg)) { __Pyx_RaiseClosureNameError("arg"); __PYX_ERR(0, 899, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_arg, __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key); @@ -16152,7 +16673,7 @@ static PyObject *__pyx_gb_4dawg_23_iterable_from_argument_2generator9(__pyx_Coro __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 860, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 899, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -16176,7 +16697,7 @@ static PyObject *__pyx_gb_4dawg_23_iterable_from_argument_2generator9(__pyx_Coro return __pyx_r; } -/* "dawg.pyx":855 +/* "dawg.pyx":894 * * * def _iterable_from_argument(arg): # <<<<<<<<<<<<<< @@ -16197,7 +16718,7 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_11__iterable_from_argument *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 855, __pyx_L1_error) + __PYX_ERR(0, 894, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -16205,7 +16726,7 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * __Pyx_INCREF(__pyx_cur_scope->__pyx_v_arg); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_arg); - /* "dawg.pyx":856 + /* "dawg.pyx":895 * * def _iterable_from_argument(arg): * if arg is None: # <<<<<<<<<<<<<< @@ -16216,21 +16737,21 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "dawg.pyx":857 + /* "dawg.pyx":896 * def _iterable_from_argument(arg): * if arg is None: * arg = [] # <<<<<<<<<<<<<< * * if isinstance(arg, Mapping): */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arg); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_arg, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dawg.pyx":856 + /* "dawg.pyx":895 * * def _iterable_from_argument(arg): * if arg is None: # <<<<<<<<<<<<<< @@ -16239,7 +16760,7 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * */ } - /* "dawg.pyx":859 + /* "dawg.pyx":898 * arg = [] * * if isinstance(arg, Mapping): # <<<<<<<<<<<<<< @@ -16248,15 +16769,15 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * */ __pyx_t_3 = __pyx_cur_scope->__pyx_v_arg; __Pyx_INCREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_IsInstance(__pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 859, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "dawg.pyx":860 + /* "dawg.pyx":899 * * if isinstance(arg, Mapping): * return ((key, arg[key]) for key in arg) # <<<<<<<<<<<<<< @@ -16264,13 +16785,13 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * * return arg */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_pf_4dawg_23_iterable_from_argument_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_4 = __pyx_pf_4dawg_23_iterable_from_argument_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "dawg.pyx":859 + /* "dawg.pyx":898 * arg = [] * * if isinstance(arg, Mapping): # <<<<<<<<<<<<<< @@ -16279,7 +16800,7 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * */ } - /* "dawg.pyx":862 + /* "dawg.pyx":901 * return ((key, arg[key]) for key in arg) * else: * return arg # <<<<<<<<<<<<<< @@ -16293,7 +16814,7 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * goto __pyx_L0; } - /* "dawg.pyx":855 + /* "dawg.pyx":894 * * * def _iterable_from_argument(arg): # <<<<<<<<<<<<<< @@ -16314,7 +16835,7 @@ static PyObject *__pyx_pf_4dawg__iterable_from_argument(CYTHON_UNUSED PyObject * return __pyx_r; } -/* "dawg.pyx":871 +/* "dawg.pyx":910 * It can store integer values for unicode keys. * """ * def __init__(self, arg=None, input_is_sorted=False): # <<<<<<<<<<<<<< @@ -16365,7 +16886,7 @@ static int __pyx_pw_4dawg_7IntDAWG_1__init__(PyObject *__pyx_v_self, PyObject *_ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 871, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 910, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -16382,7 +16903,7 @@ static int __pyx_pw_4dawg_7IntDAWG_1__init__(PyObject *__pyx_v_self, PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 871, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 910, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.IntDAWG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -16406,14 +16927,14 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "dawg.pyx":876 + /* "dawg.pyx":915 * or a dict {unicode_key: int_value}. * """ * iterable = _iterable_from_argument(arg) # <<<<<<<<<<<<<< * super(IntDAWG, self).__init__(iterable, input_is_sorted) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_iterable_from_argument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_iterable_from_argument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -16427,20 +16948,20 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_arg); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_iterable = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":877 + /* "dawg.pyx":916 * """ * iterable = _iterable_from_argument(arg) * super(IntDAWG, self).__init__(iterable, input_is_sorted) # <<<<<<<<<<<<<< * * def __getitem__(self, key): */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_IntDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_IntDAWG)); @@ -16448,10 +16969,10 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -16469,7 +16990,7 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_iterable, __pyx_v_input_is_sorted}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -16477,13 +16998,13 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_iterable, __pyx_v_input_is_sorted}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -16494,14 +17015,14 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py __Pyx_INCREF(__pyx_v_input_is_sorted); __Pyx_GIVEREF(__pyx_v_input_is_sorted); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_input_is_sorted); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":871 + /* "dawg.pyx":910 * It can store integer values for unicode keys. * """ * def __init__(self, arg=None, input_is_sorted=False): # <<<<<<<<<<<<<< @@ -16525,7 +17046,7 @@ static int __pyx_pf_4dawg_7IntDAWG___init__(struct __pyx_obj_4dawg_IntDAWG *__py return __pyx_r; } -/* "dawg.pyx":879 +/* "dawg.pyx":918 * super(IntDAWG, self).__init__(iterable, input_is_sorted) * * def __getitem__(self, key): # <<<<<<<<<<<<<< @@ -16556,7 +17077,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int int __pyx_t_4; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "dawg.pyx":880 + /* "dawg.pyx":919 * * def __getitem__(self, key): * cdef int res = self.get(key, LOOKUP_ERROR) # <<<<<<<<<<<<<< @@ -16565,13 +17086,13 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int */ __pyx_t_2.__pyx_n = 1; __pyx_t_2.__pyx_default = __pyx_int_neg_1; - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_IntDAWG *)__pyx_v_self->__pyx_base.__pyx_vtab)->get(__pyx_v_self, __pyx_v_key, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_IntDAWG *)__pyx_v_self->__pyx_base.__pyx_vtab)->get(__pyx_v_self, __pyx_v_key, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_res = __pyx_t_3; - /* "dawg.pyx":881 + /* "dawg.pyx":920 * def __getitem__(self, key): * cdef int res = self.get(key, LOOKUP_ERROR) * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -16581,20 +17102,20 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int __pyx_t_4 = ((__pyx_v_res == -1L) != 0); if (unlikely(__pyx_t_4)) { - /* "dawg.pyx":882 + /* "dawg.pyx":921 * cdef int res = self.get(key, LOOKUP_ERROR) * if res == LOOKUP_ERROR: * raise KeyError(key) # <<<<<<<<<<<<<< * return res * */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __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, 882, __pyx_L1_error) + __PYX_ERR(0, 921, __pyx_L1_error) - /* "dawg.pyx":881 + /* "dawg.pyx":920 * def __getitem__(self, key): * cdef int res = self.get(key, LOOKUP_ERROR) * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -16603,7 +17124,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int */ } - /* "dawg.pyx":883 + /* "dawg.pyx":922 * if res == LOOKUP_ERROR: * raise KeyError(key) * return res # <<<<<<<<<<<<<< @@ -16611,13 +17132,13 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int * cpdef get(self, key, default=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":879 + /* "dawg.pyx":918 * super(IntDAWG, self).__init__(iterable, input_is_sorted) * * def __getitem__(self, key): # <<<<<<<<<<<<<< @@ -16636,7 +17157,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_2__getitem__(struct __pyx_obj_4dawg_Int return __pyx_r; } -/* "dawg.pyx":885 +/* "dawg.pyx":924 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -16673,7 +17194,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_7IntDAWG_5get)) { __Pyx_XDECREF(__pyx_r); @@ -16693,7 +17214,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_default}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else @@ -16701,13 +17222,13 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_default}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -16718,7 +17239,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py __Pyx_INCREF(__pyx_v_default); __Pyx_GIVEREF(__pyx_v_default); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_default); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -16741,7 +17262,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py #endif } - /* "dawg.pyx":891 + /* "dawg.pyx":930 * cdef int res * * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -16752,7 +17273,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { - /* "dawg.pyx":892 + /* "dawg.pyx":931 * * if isinstance(key, unicode): * res = self.get_value(key) # <<<<<<<<<<<<<< @@ -16761,7 +17282,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py */ __pyx_v_res = ((struct __pyx_vtabstruct_4dawg_IntDAWG *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); - /* "dawg.pyx":891 + /* "dawg.pyx":930 * cdef int res * * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -16771,7 +17292,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py goto __pyx_L3; } - /* "dawg.pyx":894 + /* "dawg.pyx":933 * res = self.get_value(key) * else: * res = self.b_get_value(key) # <<<<<<<<<<<<<< @@ -16779,12 +17300,12 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py * if res == LOOKUP_ERROR: */ /*else*/ { - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(0, 894, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(0, 933, __pyx_L1_error) __pyx_v_res = ((struct __pyx_vtabstruct_4dawg_IntDAWG *)__pyx_v_self->__pyx_base.__pyx_vtab)->b_get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); } __pyx_L3:; - /* "dawg.pyx":896 + /* "dawg.pyx":935 * res = self.b_get_value(key) * * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -16794,7 +17315,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py __pyx_t_8 = ((__pyx_v_res == -1L) != 0); if (__pyx_t_8) { - /* "dawg.pyx":897 + /* "dawg.pyx":936 * * if res == LOOKUP_ERROR: * return default # <<<<<<<<<<<<<< @@ -16806,7 +17327,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py __pyx_r = __pyx_v_default; goto __pyx_L0; - /* "dawg.pyx":896 + /* "dawg.pyx":935 * res = self.b_get_value(key) * * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -16815,7 +17336,7 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py */ } - /* "dawg.pyx":898 + /* "dawg.pyx":937 * if res == LOOKUP_ERROR: * return default * return res # <<<<<<<<<<<<<< @@ -16823,13 +17344,13 @@ static PyObject *__pyx_f_4dawg_7IntDAWG_get(struct __pyx_obj_4dawg_IntDAWG *__py * cpdef int get_value(self, unicode key): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":885 + /* "dawg.pyx":924 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -16889,7 +17410,7 @@ static PyObject *__pyx_pw_4dawg_7IntDAWG_5get(PyObject *__pyx_v_self, PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 885, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 924, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -16905,7 +17426,7 @@ static PyObject *__pyx_pw_4dawg_7IntDAWG_5get(PyObject *__pyx_v_self, PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 885, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.IntDAWG.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -16927,7 +17448,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_4get(struct __pyx_obj_4dawg_IntDAWG *__ __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.__pyx_default = __pyx_v_default; - __pyx_t_1 = __pyx_vtabptr_4dawg_IntDAWG->get(__pyx_v_self, __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_IntDAWG->get(__pyx_v_self, __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -16944,7 +17465,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_4get(struct __pyx_obj_4dawg_IntDAWG *__ return __pyx_r; } -/* "dawg.pyx":900 +/* "dawg.pyx":939 * return res * * cpdef int get_value(self, unicode key): # <<<<<<<<<<<<<< @@ -16973,7 +17494,7 @@ static int __pyx_f_4dawg_7IntDAWG_get_value(struct __pyx_obj_4dawg_IntDAWG *__py if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_7IntDAWG_7get_value)) { __Pyx_INCREF(__pyx_t_1); @@ -16989,10 +17510,10 @@ static int __pyx_f_4dawg_7IntDAWG_get_value(struct __pyx_obj_4dawg_IntDAWG *__py } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 900, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17011,7 +17532,7 @@ static int __pyx_f_4dawg_7IntDAWG_get_value(struct __pyx_obj_4dawg_IntDAWG *__py #endif } - /* "dawg.pyx":901 + /* "dawg.pyx":940 * * cpdef int get_value(self, unicode key): * cdef bytes b_key = key.encode('utf8') # <<<<<<<<<<<<<< @@ -17020,9 +17541,9 @@ static int __pyx_f_4dawg_7IntDAWG_get_value(struct __pyx_obj_4dawg_IntDAWG *__py */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 901, __pyx_L1_error) + __PYX_ERR(0, 940, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); @@ -17030,7 +17551,7 @@ static int __pyx_f_4dawg_7IntDAWG_get_value(struct __pyx_obj_4dawg_IntDAWG *__py __pyx_v_b_key = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dawg.pyx":902 + /* "dawg.pyx":941 * cpdef int get_value(self, unicode key): * cdef bytes b_key = key.encode('utf8') * return self.dct.Find(b_key) # <<<<<<<<<<<<<< @@ -17039,13 +17560,13 @@ static int __pyx_f_4dawg_7IntDAWG_get_value(struct __pyx_obj_4dawg_IntDAWG *__py */ if (unlikely(__pyx_v_b_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 902, __pyx_L1_error) + __PYX_ERR(0, 941, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 902, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 941, __pyx_L1_error) __pyx_r = __pyx_v_self->__pyx_base.dct.Find(__pyx_t_6); goto __pyx_L0; - /* "dawg.pyx":900 + /* "dawg.pyx":939 * return res * * cpdef int get_value(self, unicode key): # <<<<<<<<<<<<<< @@ -17074,7 +17595,7 @@ static PyObject *__pyx_pw_4dawg_7IntDAWG_7get_value(PyObject *__pyx_v_self, PyOb PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_value (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 900, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 939, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_7IntDAWG_6get_value(((struct __pyx_obj_4dawg_IntDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -17092,7 +17613,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_6get_value(struct __pyx_obj_4dawg_IntDA PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_value", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_7IntDAWG_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_7IntDAWG_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -17109,7 +17630,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_6get_value(struct __pyx_obj_4dawg_IntDA return __pyx_r; } -/* "dawg.pyx":904 +/* "dawg.pyx":943 * return self.dct.Find(b_key) * * cpdef int b_get_value(self, bytes key): # <<<<<<<<<<<<<< @@ -17137,7 +17658,7 @@ static int __pyx_f_4dawg_7IntDAWG_b_get_value(struct __pyx_obj_4dawg_IntDAWG *__ if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_7IntDAWG_9b_get_value)) { __Pyx_INCREF(__pyx_t_1); @@ -17153,10 +17674,10 @@ static int __pyx_f_4dawg_7IntDAWG_b_get_value(struct __pyx_obj_4dawg_IntDAWG *__ } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 904, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17175,22 +17696,22 @@ static int __pyx_f_4dawg_7IntDAWG_b_get_value(struct __pyx_obj_4dawg_IntDAWG *__ #endif } - /* "dawg.pyx":905 + /* "dawg.pyx":944 * * cpdef int b_get_value(self, bytes key): * return self.dct.Find(key) # <<<<<<<<<<<<<< * - * + * def longest_prefix(self, unicode key): */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 905, __pyx_L1_error) + __PYX_ERR(0, 944, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 905, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L1_error) __pyx_r = __pyx_v_self->__pyx_base.dct.Find(__pyx_t_6); goto __pyx_L0; - /* "dawg.pyx":904 + /* "dawg.pyx":943 * return self.dct.Find(b_key) * * cpdef int b_get_value(self, bytes key): # <<<<<<<<<<<<<< @@ -17218,7 +17739,7 @@ static PyObject *__pyx_pw_4dawg_7IntDAWG_9b_get_value(PyObject *__pyx_v_self, Py PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("b_get_value (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 904, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 943, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_7IntDAWG_8b_get_value(((struct __pyx_obj_4dawg_IntDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -17236,7 +17757,7 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_8b_get_value(struct __pyx_obj_4dawg_Int PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("b_get_value", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_7IntDAWG_b_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_7IntDAWG_b_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -17253,7 +17774,261 @@ static PyObject *__pyx_pf_4dawg_7IntDAWG_8b_get_value(struct __pyx_obj_4dawg_Int return __pyx_r; } -/* "dawg.pyx":915 +/* "dawg.pyx":946 + * return self.dct.Find(key) + * + * def longest_prefix(self, unicode key): # <<<<<<<<<<<<<< + * cdef BaseType index = self.dct.root() + * cdef BaseType lastindex + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4dawg_7IntDAWG_11longest_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_4dawg_7IntDAWG_10longest_prefix[] = "IntDAWG.longest_prefix(self, unicode key)"; +static PyObject *__pyx_pw_4dawg_7IntDAWG_11longest_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("longest_prefix (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 946, __pyx_L1_error) + __pyx_r = __pyx_pf_4dawg_7IntDAWG_10longest_prefix(((struct __pyx_obj_4dawg_IntDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4dawg_7IntDAWG_10longest_prefix(struct __pyx_obj_4dawg_IntDAWG *__pyx_v_self, PyObject *__pyx_v_key) { + dawgdic::BaseType __pyx_v_index; + dawgdic::BaseType __pyx_v_lastindex; + int __pyx_v_pos; + int __pyx_v_lastpos; + dawgdic::CharType __pyx_v_ch; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("longest_prefix", 0); + + /* "dawg.pyx":947 + * + * def longest_prefix(self, unicode key): + * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< + * cdef BaseType lastindex + * cdef int pos = 1 + */ + __pyx_v_index = __pyx_v_self->__pyx_base.dct.root(); + + /* "dawg.pyx":949 + * cdef BaseType index = self.dct.root() + * cdef BaseType lastindex + * cdef int pos = 1 # <<<<<<<<<<<<<< + * cdef int lastpos = 0 + * cdef CharType ch + */ + __pyx_v_pos = 1; + + /* "dawg.pyx":950 + * cdef BaseType lastindex + * cdef int pos = 1 + * cdef int lastpos = 0 # <<<<<<<<<<<<<< + * cdef CharType ch + * + */ + __pyx_v_lastpos = 0; + + /* "dawg.pyx":953 + * cdef CharType ch + * + * for ch in key: # <<<<<<<<<<<<<< + * if not self.dct.Follow(ch, &index): + * break + */ + if (unlikely(__pyx_v_key == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(0, 953, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_key); + __pyx_t_1 = __pyx_v_key; + __pyx_t_6 = __Pyx_init_unicode_iteration(__pyx_t_1, (&__pyx_t_3), (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 953, __pyx_L1_error) + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7++) { + __pyx_t_2 = __pyx_t_7; + __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_5, __pyx_t_4, __pyx_t_2); + + /* "dawg.pyx":954 + * + * for ch in key: + * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_8 = ((!(__pyx_v_self->__pyx_base.dct.Follow(__pyx_v_ch, (&__pyx_v_index)) != 0)) != 0); + if (__pyx_t_8) { + + /* "dawg.pyx":955 + * for ch in key: + * if not self.dct.Follow(ch, &index): + * break # <<<<<<<<<<<<<< + * + * if self.dct.has_value(index): + */ + goto __pyx_L4_break; + + /* "dawg.pyx":954 + * + * for ch in key: + * if not self.dct.Follow(ch, &index): # <<<<<<<<<<<<<< + * break + * + */ + } + + /* "dawg.pyx":957 + * break + * + * if self.dct.has_value(index): # <<<<<<<<<<<<<< + * lastpos = pos + * lastindex = index + */ + __pyx_t_8 = (__pyx_v_self->__pyx_base.dct.has_value(__pyx_v_index) != 0); + if (__pyx_t_8) { + + /* "dawg.pyx":958 + * + * if self.dct.has_value(index): + * lastpos = pos # <<<<<<<<<<<<<< + * lastindex = index + * pos += 1 + */ + __pyx_v_lastpos = __pyx_v_pos; + + /* "dawg.pyx":959 + * if self.dct.has_value(index): + * lastpos = pos + * lastindex = index # <<<<<<<<<<<<<< + * pos += 1 + * + */ + __pyx_v_lastindex = __pyx_v_index; + + /* "dawg.pyx":957 + * break + * + * if self.dct.has_value(index): # <<<<<<<<<<<<<< + * lastpos = pos + * lastindex = index + */ + } + + /* "dawg.pyx":960 + * lastpos = pos + * lastindex = index + * pos += 1 # <<<<<<<<<<<<<< + * + * if lastpos: + */ + __pyx_v_pos = (__pyx_v_pos + 1); + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dawg.pyx":962 + * pos += 1 + * + * if lastpos: # <<<<<<<<<<<<<< + * return key[:lastpos], self.dct.value(lastindex) + * else: + */ + __pyx_t_8 = (__pyx_v_lastpos != 0); + if (likely(__pyx_t_8)) { + + /* "dawg.pyx":963 + * + * if lastpos: + * return key[:lastpos], self.dct.value(lastindex) # <<<<<<<<<<<<<< + * else: + * raise KeyError("No prefix found") + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_key == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 963, __pyx_L1_error) + } + __pyx_t_9 = __Pyx_PyUnicode_Substring(__pyx_v_key, 0, __pyx_v_lastpos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyInt_From_dawgdic_3a__3a_ValueType(__pyx_v_self->__pyx_base.dct.value(__pyx_v_lastindex)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + goto __pyx_L0; + + /* "dawg.pyx":962 + * pos += 1 + * + * if lastpos: # <<<<<<<<<<<<<< + * return key[:lastpos], self.dct.value(lastindex) + * else: + */ + } + + /* "dawg.pyx":965 + * return key[:lastpos], self.dct.value(lastindex) + * else: + * raise KeyError("No prefix found") # <<<<<<<<<<<<<< + * + * # FIXME: code duplication. + */ + /*else*/ { + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 965, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 965, __pyx_L1_error) + } + + /* "dawg.pyx":946 + * return self.dct.Find(key) + * + * def longest_prefix(self, unicode key): # <<<<<<<<<<<<<< + * cdef BaseType index = self.dct.root() + * cdef BaseType lastindex + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dawg.IntDAWG.longest_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dawg.pyx":974 * """ * * def __init__(self, arg=None, input_is_sorted=False): # <<<<<<<<<<<<<< @@ -17304,7 +18079,7 @@ static int __pyx_pw_4dawg_17IntCompletionDAWG_1__init__(PyObject *__pyx_v_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 915, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 974, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -17321,7 +18096,7 @@ static int __pyx_pw_4dawg_17IntCompletionDAWG_1__init__(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 974, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.IntCompletionDAWG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -17345,14 +18120,14 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__init__", 0); - /* "dawg.pyx":920 + /* "dawg.pyx":979 * or a dict {unicode_key: int_value}. * """ * iterable = _iterable_from_argument(arg) # <<<<<<<<<<<<<< * super(IntCompletionDAWG, self).__init__(iterable, input_is_sorted) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_iterable_from_argument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_iterable_from_argument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -17366,20 +18141,20 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_arg); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_iterable = __pyx_t_1; __pyx_t_1 = 0; - /* "dawg.pyx":921 + /* "dawg.pyx":980 * """ * iterable = _iterable_from_argument(arg) * super(IntCompletionDAWG, self).__init__(iterable, input_is_sorted) # <<<<<<<<<<<<<< * * def __getitem__(self, key): */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_4dawg_IntCompletionDAWG)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_4dawg_IntCompletionDAWG)); @@ -17387,10 +18162,10 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -17408,7 +18183,7 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_iterable, __pyx_v_input_is_sorted}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -17416,13 +18191,13 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_iterable, __pyx_v_input_is_sorted}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -17433,14 +18208,14 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In __Pyx_INCREF(__pyx_v_input_is_sorted); __Pyx_GIVEREF(__pyx_v_input_is_sorted); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_input_is_sorted); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":915 + /* "dawg.pyx":974 * """ * * def __init__(self, arg=None, input_is_sorted=False): # <<<<<<<<<<<<<< @@ -17464,7 +18239,7 @@ static int __pyx_pf_4dawg_17IntCompletionDAWG___init__(struct __pyx_obj_4dawg_In return __pyx_r; } -/* "dawg.pyx":923 +/* "dawg.pyx":982 * super(IntCompletionDAWG, self).__init__(iterable, input_is_sorted) * * def __getitem__(self, key): # <<<<<<<<<<<<<< @@ -17495,7 +18270,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_ob int __pyx_t_4; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "dawg.pyx":924 + /* "dawg.pyx":983 * * def __getitem__(self, key): * cdef int res = self.get(key, LOOKUP_ERROR) # <<<<<<<<<<<<<< @@ -17504,13 +18279,13 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_ob */ __pyx_t_2.__pyx_n = 1; __pyx_t_2.__pyx_default = __pyx_int_neg_1; - __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_IntCompletionDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get(__pyx_v_self, __pyx_v_key, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_4dawg_IntCompletionDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get(__pyx_v_self, __pyx_v_key, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 983, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_res = __pyx_t_3; - /* "dawg.pyx":925 + /* "dawg.pyx":984 * def __getitem__(self, key): * cdef int res = self.get(key, LOOKUP_ERROR) * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -17520,20 +18295,20 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_ob __pyx_t_4 = ((__pyx_v_res == -1L) != 0); if (unlikely(__pyx_t_4)) { - /* "dawg.pyx":926 + /* "dawg.pyx":985 * cdef int res = self.get(key, LOOKUP_ERROR) * if res == LOOKUP_ERROR: * raise KeyError(key) # <<<<<<<<<<<<<< * return res * */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __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, 926, __pyx_L1_error) + __PYX_ERR(0, 985, __pyx_L1_error) - /* "dawg.pyx":925 + /* "dawg.pyx":984 * def __getitem__(self, key): * cdef int res = self.get(key, LOOKUP_ERROR) * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -17542,7 +18317,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_ob */ } - /* "dawg.pyx":927 + /* "dawg.pyx":986 * if res == LOOKUP_ERROR: * raise KeyError(key) * return res # <<<<<<<<<<<<<< @@ -17550,13 +18325,13 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_ob * cpdef get(self, key, default=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 986, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":923 + /* "dawg.pyx":982 * super(IntCompletionDAWG, self).__init__(iterable, input_is_sorted) * * def __getitem__(self, key): # <<<<<<<<<<<<<< @@ -17575,7 +18350,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_2__getitem__(struct __pyx_ob return __pyx_r; } -/* "dawg.pyx":929 +/* "dawg.pyx":988 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -17612,7 +18387,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_17IntCompletionDAWG_5get)) { __Pyx_XDECREF(__pyx_r); @@ -17632,7 +18407,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_default}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else @@ -17640,13 +18415,13 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_key, __pyx_v_default}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -17657,7 +18432,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In __Pyx_INCREF(__pyx_v_default); __Pyx_GIVEREF(__pyx_v_default); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_default); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -17680,7 +18455,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In #endif } - /* "dawg.pyx":935 + /* "dawg.pyx":994 * cdef int res * * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -17691,7 +18466,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { - /* "dawg.pyx":936 + /* "dawg.pyx":995 * * if isinstance(key, unicode): * res = self.get_value(key) # <<<<<<<<<<<<<< @@ -17700,7 +18475,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In */ __pyx_v_res = ((struct __pyx_vtabstruct_4dawg_IntCompletionDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); - /* "dawg.pyx":935 + /* "dawg.pyx":994 * cdef int res * * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -17710,7 +18485,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In goto __pyx_L3; } - /* "dawg.pyx":938 + /* "dawg.pyx":997 * res = self.get_value(key) * else: * res = self.b_get_value(key) # <<<<<<<<<<<<<< @@ -17718,12 +18493,12 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In * if res == LOOKUP_ERROR: */ /*else*/ { - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(0, 938, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(0, 997, __pyx_L1_error) __pyx_v_res = ((struct __pyx_vtabstruct_4dawg_IntCompletionDAWG *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->b_get_value(__pyx_v_self, ((PyObject*)__pyx_v_key), 0); } __pyx_L3:; - /* "dawg.pyx":940 + /* "dawg.pyx":999 * res = self.b_get_value(key) * * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -17733,7 +18508,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In __pyx_t_8 = ((__pyx_v_res == -1L) != 0); if (__pyx_t_8) { - /* "dawg.pyx":941 + /* "dawg.pyx":1000 * * if res == LOOKUP_ERROR: * return default # <<<<<<<<<<<<<< @@ -17745,7 +18520,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In __pyx_r = __pyx_v_default; goto __pyx_L0; - /* "dawg.pyx":940 + /* "dawg.pyx":999 * res = self.b_get_value(key) * * if res == LOOKUP_ERROR: # <<<<<<<<<<<<<< @@ -17754,7 +18529,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In */ } - /* "dawg.pyx":942 + /* "dawg.pyx":1001 * if res == LOOKUP_ERROR: * return default * return res # <<<<<<<<<<<<<< @@ -17762,13 +18537,13 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_get(struct __pyx_obj_4dawg_In * cpdef int get_value(self, unicode key): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1001, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dawg.pyx":929 + /* "dawg.pyx":988 * return res * * cpdef get(self, key, default=None): # <<<<<<<<<<<<<< @@ -17828,7 +18603,7 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_5get(PyObject *__pyx_v_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 929, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 988, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -17844,7 +18619,7 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_5get(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 929, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 988, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.IntCompletionDAWG.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -17866,7 +18641,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_4get(struct __pyx_obj_4dawg_ __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.__pyx_default = __pyx_v_default; - __pyx_t_1 = __pyx_vtabptr_4dawg_IntCompletionDAWG->get(__pyx_v_self, __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_IntCompletionDAWG->get(__pyx_v_self, __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -17883,7 +18658,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_4get(struct __pyx_obj_4dawg_ return __pyx_r; } -/* "dawg.pyx":944 +/* "dawg.pyx":1003 * return res * * cpdef int get_value(self, unicode key): # <<<<<<<<<<<<<< @@ -17912,7 +18687,7 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_get_value(struct __pyx_obj_4dawg_In if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_17IntCompletionDAWG_7get_value)) { __Pyx_INCREF(__pyx_t_1); @@ -17928,10 +18703,10 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_get_value(struct __pyx_obj_4dawg_In } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17950,7 +18725,7 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_get_value(struct __pyx_obj_4dawg_In #endif } - /* "dawg.pyx":945 + /* "dawg.pyx":1004 * * cpdef int get_value(self, unicode key): * cdef bytes b_key = key.encode('utf8') # <<<<<<<<<<<<<< @@ -17959,9 +18734,9 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_get_value(struct __pyx_obj_4dawg_In */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 945, __pyx_L1_error) + __PYX_ERR(0, 1004, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); @@ -17969,7 +18744,7 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_get_value(struct __pyx_obj_4dawg_In __pyx_v_b_key = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dawg.pyx":946 + /* "dawg.pyx":1005 * cpdef int get_value(self, unicode key): * cdef bytes b_key = key.encode('utf8') * return self.dct.Find(b_key) # <<<<<<<<<<<<<< @@ -17978,13 +18753,13 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_get_value(struct __pyx_obj_4dawg_In */ if (unlikely(__pyx_v_b_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 946, __pyx_L1_error) + __PYX_ERR(0, 1005, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 946, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1005, __pyx_L1_error) __pyx_r = __pyx_v_self->__pyx_base.__pyx_base.dct.Find(__pyx_t_6); goto __pyx_L0; - /* "dawg.pyx":944 + /* "dawg.pyx":1003 * return res * * cpdef int get_value(self, unicode key): # <<<<<<<<<<<<<< @@ -18013,7 +18788,7 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_7get_value(PyObject *__pyx_v PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_value (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 944, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 1003, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_17IntCompletionDAWG_6get_value(((struct __pyx_obj_4dawg_IntCompletionDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -18031,7 +18806,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_6get_value(struct __pyx_obj_ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_value", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_17IntCompletionDAWG_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_17IntCompletionDAWG_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -18048,7 +18823,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_6get_value(struct __pyx_obj_ return __pyx_r; } -/* "dawg.pyx":948 +/* "dawg.pyx":1007 * return self.dct.Find(b_key) * * cpdef int b_get_value(self, bytes key): # <<<<<<<<<<<<<< @@ -18076,7 +18851,7 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_b_get_value(struct __pyx_obj_4dawg_ if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_b_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_17IntCompletionDAWG_9b_get_value)) { __Pyx_INCREF(__pyx_t_1); @@ -18092,10 +18867,10 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_b_get_value(struct __pyx_obj_4dawg_ } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18114,7 +18889,7 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_b_get_value(struct __pyx_obj_4dawg_ #endif } - /* "dawg.pyx":949 + /* "dawg.pyx":1008 * * cpdef int b_get_value(self, bytes key): * return self.dct.Find(key) # <<<<<<<<<<<<<< @@ -18123,13 +18898,13 @@ static int __pyx_f_4dawg_17IntCompletionDAWG_b_get_value(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 949, __pyx_L1_error) + __PYX_ERR(0, 1008, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1008, __pyx_L1_error) __pyx_r = __pyx_v_self->__pyx_base.__pyx_base.dct.Find(__pyx_t_6); goto __pyx_L0; - /* "dawg.pyx":948 + /* "dawg.pyx":1007 * return self.dct.Find(b_key) * * cpdef int b_get_value(self, bytes key): # <<<<<<<<<<<<<< @@ -18157,7 +18932,7 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_9b_get_value(PyObject *__pyx PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("b_get_value (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 948, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) __PYX_ERR(0, 1007, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_17IntCompletionDAWG_8b_get_value(((struct __pyx_obj_4dawg_IntCompletionDAWG *)__pyx_v_self), ((PyObject*)__pyx_v_key)); /* function exit code */ @@ -18175,7 +18950,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_8b_get_value(struct __pyx_ob PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("b_get_value", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_17IntCompletionDAWG_b_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4dawg_17IntCompletionDAWG_b_get_value(__pyx_v_self, __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -18192,7 +18967,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_8b_get_value(struct __pyx_ob return __pyx_r; } -/* "dawg.pyx":951 +/* "dawg.pyx":1010 * return self.dct.Find(key) * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -18234,7 +19009,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4dawg_17IntCompletionDAWG_11items)) { __Pyx_XDECREF(__pyx_r); @@ -18251,10 +19026,10 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_prefix); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 951, __pyx_L1_error) + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1010, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18273,7 +19048,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ #endif } - /* "dawg.pyx":952 + /* "dawg.pyx":1011 * * cpdef list items(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -18282,14 +19057,14 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 952, __pyx_L1_error) + __PYX_ERR(0, 1011, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":953 + /* "dawg.pyx":1012 * cpdef list items(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -18298,19 +19073,19 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ __pyx_v_index = __pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":954 + /* "dawg.pyx":1013 * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() * cdef list res = [] # <<<<<<<<<<<<<< * cdef int value * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":957 + /* "dawg.pyx":1016 * cdef int value * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -18319,13 +19094,13 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 957, __pyx_L1_error) + __PYX_ERR(0, 1016, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 957, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1016, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_5, (&__pyx_v_index)) != 0)) != 0); if (__pyx_t_6) { - /* "dawg.pyx":958 + /* "dawg.pyx":1017 * * if not self.dct.Follow(b_prefix, &index): * return res # <<<<<<<<<<<<<< @@ -18337,7 +19112,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":957 + /* "dawg.pyx":1016 * cdef int value * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -18346,7 +19121,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ } - /* "dawg.pyx":961 + /* "dawg.pyx":1020 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -18355,7 +19130,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ __pyx_f_4dawg_init_completer(__pyx_v_completer, __pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":962 + /* "dawg.pyx":1021 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -18364,12 +19139,12 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ if (unlikely(__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 962, __pyx_L1_error) + __PYX_ERR(0, 1021, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_b_prefix); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) __pyx_v_completer.Start(__pyx_v_index, __pyx_t_7); - /* "dawg.pyx":964 + /* "dawg.pyx":1023 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -18380,7 +19155,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ __pyx_t_6 = (__pyx_v_completer.Next() != 0); if (!__pyx_t_6) break; - /* "dawg.pyx":965 + /* "dawg.pyx":1024 * * while completer.Next(): * key = (completer.key()).decode('utf8') # <<<<<<<<<<<<<< @@ -18388,13 +19163,13 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ * res.append((key, value)) */ __pyx_t_7 = ((char *)__pyx_v_completer.key()); - __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_7, 0, strlen(__pyx_t_7), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_7, 0, strlen(__pyx_t_7), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1024, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":966 + /* "dawg.pyx":1025 * while completer.Next(): * key = (completer.key()).decode('utf8') * value = completer.value() # <<<<<<<<<<<<<< @@ -18403,16 +19178,16 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ */ __pyx_v_value = __pyx_v_completer.value(); - /* "dawg.pyx":967 + /* "dawg.pyx":1026 * key = (completer.key()).decode('utf8') * value = completer.value() * res.append((key, value)) # <<<<<<<<<<<<<< * * return res */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); @@ -18420,11 +19195,11 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 967, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1026, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "dawg.pyx":969 + /* "dawg.pyx":1028 * res.append((key, value)) * * return res # <<<<<<<<<<<<<< @@ -18436,7 +19211,7 @@ static PyObject *__pyx_f_4dawg_17IntCompletionDAWG_items(struct __pyx_obj_4dawg_ __pyx_r = __pyx_v_res; goto __pyx_L0; - /* "dawg.pyx":951 + /* "dawg.pyx":1010 * return self.dct.Find(key) * * cpdef list items(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -18491,7 +19266,7 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_11items(PyObject *__pyx_v_se } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "items") < 0)) __PYX_ERR(0, 951, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "items") < 0)) __PYX_ERR(0, 1010, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -18505,13 +19280,13 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_11items(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("items", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 951, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("items", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1010, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.IntCompletionDAWG.items", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 951, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 1010, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_17IntCompletionDAWG_10items(((struct __pyx_obj_4dawg_IntCompletionDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -18532,7 +19307,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_10items(struct __pyx_obj_4da __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.prefix = __pyx_v_prefix; - __pyx_t_1 = __pyx_vtabptr_4dawg_IntCompletionDAWG->items(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_4dawg_IntCompletionDAWG->items(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -18550,7 +19325,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_10items(struct __pyx_obj_4da } static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dawg.pyx":971 +/* "dawg.pyx":1030 * return res * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -18588,7 +19363,7 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_13iteritems(PyObject *__pyx_ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 971, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iteritems") < 0)) __PYX_ERR(0, 1030, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -18602,13 +19377,13 @@ static PyObject *__pyx_pw_4dawg_17IntCompletionDAWG_13iteritems(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 971, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1030, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("dawg.IntCompletionDAWG.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 971, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prefix), (&PyUnicode_Type), 1, "prefix", 1))) __PYX_ERR(0, 1030, __pyx_L1_error) __pyx_r = __pyx_pf_4dawg_17IntCompletionDAWG_12iteritems(((struct __pyx_obj_4dawg_IntCompletionDAWG *)__pyx_v_self), __pyx_v_prefix); /* function exit code */ @@ -18629,7 +19404,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_12iteritems(struct __pyx_obj if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_4dawg___pyx_scope_struct_13_iteritems *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 971, __pyx_L1_error) + __PYX_ERR(0, 1030, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -18640,7 +19415,7 @@ static PyObject *__pyx_pf_4dawg_17IntCompletionDAWG_12iteritems(struct __pyx_obj __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_17IntCompletionDAWG_14generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_IntCompletionDAWG_iteritems, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 971, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4dawg_17IntCompletionDAWG_14generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_IntCompletionDAWG_iteritems, __pyx_n_s_dawg); if (unlikely(!gen)) __PYX_ERR(0, 1030, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -18675,9 +19450,9 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 971, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1030, __pyx_L1_error) - /* "dawg.pyx":972 + /* "dawg.pyx":1031 * * def iteritems(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') # <<<<<<<<<<<<<< @@ -18686,15 +19461,15 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ if (unlikely(__pyx_cur_scope->__pyx_v_prefix == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 972, __pyx_L1_error) + __PYX_ERR(0, 1031, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_b_prefix = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":973 + /* "dawg.pyx":1032 * def iteritems(self, unicode prefix=""): * cdef bytes b_prefix = prefix.encode('utf8') * cdef BaseType index = self.dct.root() # <<<<<<<<<<<<<< @@ -18703,7 +19478,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ __pyx_cur_scope->__pyx_v_index = __pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct.root(); - /* "dawg.pyx":976 + /* "dawg.pyx":1035 * cdef int value * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -18712,13 +19487,13 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 976, __pyx_L1_error) + __PYX_ERR(0, 1035, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 976, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error) __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct.Follow(__pyx_t_2, (&__pyx_cur_scope->__pyx_v_index)) != 0)) != 0); if (__pyx_t_3) { - /* "dawg.pyx":977 + /* "dawg.pyx":1036 * * if not self.dct.Follow(b_prefix, &index): * return # <<<<<<<<<<<<<< @@ -18729,7 +19504,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine __pyx_r = NULL; goto __pyx_L0; - /* "dawg.pyx":976 + /* "dawg.pyx":1035 * cdef int value * * if not self.dct.Follow(b_prefix, &index): # <<<<<<<<<<<<<< @@ -18738,7 +19513,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ } - /* "dawg.pyx":980 + /* "dawg.pyx":1039 * * cdef Completer completer * init_completer(completer, self.dct, self.guide) # <<<<<<<<<<<<<< @@ -18747,7 +19522,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ __pyx_f_4dawg_init_completer(__pyx_cur_scope->__pyx_v_completer, __pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_base.dct, __pyx_cur_scope->__pyx_v_self->__pyx_base.guide); - /* "dawg.pyx":981 + /* "dawg.pyx":1040 * cdef Completer completer * init_completer(completer, self.dct, self.guide) * completer.Start(index, b_prefix) # <<<<<<<<<<<<<< @@ -18756,12 +19531,12 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ if (unlikely(__pyx_cur_scope->__pyx_v_b_prefix == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 981, __pyx_L1_error) + __PYX_ERR(0, 1040, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 981, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_cur_scope->__pyx_v_b_prefix); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 1040, __pyx_L1_error) __pyx_cur_scope->__pyx_v_completer.Start(__pyx_cur_scope->__pyx_v_index, __pyx_t_4); - /* "dawg.pyx":983 + /* "dawg.pyx":1042 * completer.Start(index, b_prefix) * * while completer.Next(): # <<<<<<<<<<<<<< @@ -18772,7 +19547,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine __pyx_t_3 = (__pyx_cur_scope->__pyx_v_completer.Next() != 0); if (!__pyx_t_3) break; - /* "dawg.pyx":984 + /* "dawg.pyx":1043 * * while completer.Next(): * key = (completer.key()).decode('utf8') # <<<<<<<<<<<<<< @@ -18780,7 +19555,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine * yield key, value */ __pyx_t_4 = ((char *)__pyx_cur_scope->__pyx_v_completer.key()); - __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key); @@ -18788,7 +19563,7 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine __Pyx_GIVEREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dawg.pyx":985 + /* "dawg.pyx":1044 * while completer.Next(): * key = (completer.key()).decode('utf8') * value = completer.value() # <<<<<<<<<<<<<< @@ -18796,14 +19571,14 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine */ __pyx_cur_scope->__pyx_v_value = __pyx_cur_scope->__pyx_v_completer.value(); - /* "dawg.pyx":986 + /* "dawg.pyx":1045 * key = (completer.key()).decode('utf8') * value = completer.value() * yield key, value # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 986, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1045, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 986, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1045, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key); @@ -18820,11 +19595,11 @@ static PyObject *__pyx_gb_4dawg_17IntCompletionDAWG_14generator5(__pyx_Coroutine __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L7_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 986, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1045, __pyx_L1_error) } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "dawg.pyx":971 + /* "dawg.pyx":1030 * return res * * def iteritems(self, unicode prefix=""): # <<<<<<<<<<<<<< @@ -19263,8 +20038,9 @@ static PyMethodDef __pyx_methods_4dawg_DAWG[] = { {"similar_keys", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dawg_4DAWG_35similar_keys, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dawg_4DAWG_34similar_keys}, {"prefixes", (PyCFunction)__pyx_pw_4dawg_4DAWG_37prefixes, METH_O, __pyx_doc_4dawg_4DAWG_36prefixes}, {"b_prefixes", (PyCFunction)__pyx_pw_4dawg_4DAWG_39b_prefixes, METH_O, __pyx_doc_4dawg_4DAWG_38b_prefixes}, - {"iterprefixes", (PyCFunction)__pyx_pw_4dawg_4DAWG_41iterprefixes, METH_O, __pyx_doc_4dawg_4DAWG_40iterprefixes}, - {"compile_replaces", (PyCFunction)__pyx_pw_4dawg_4DAWG_44compile_replaces, METH_O, __pyx_doc_4dawg_4DAWG_43compile_replaces}, + {"longest_prefix", (PyCFunction)__pyx_pw_4dawg_4DAWG_41longest_prefix, METH_O, __pyx_doc_4dawg_4DAWG_40longest_prefix}, + {"iterprefixes", (PyCFunction)__pyx_pw_4dawg_4DAWG_43iterprefixes, METH_O, __pyx_doc_4dawg_4DAWG_42iterprefixes}, + {"compile_replaces", (PyCFunction)__pyx_pw_4dawg_4DAWG_46compile_replaces, METH_O, __pyx_doc_4dawg_4DAWG_45compile_replaces}, {0, 0, 0, 0} }; @@ -19511,6 +20287,7 @@ static PyMethodDef __pyx_methods_4dawg_BytesDAWG[] = { {"iterkeys", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dawg_9BytesDAWG_28iterkeys, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dawg_9BytesDAWG_27iterkeys}, {"similar_items", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dawg_9BytesDAWG_31similar_items, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dawg_9BytesDAWG_30similar_items}, {"similar_item_values", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dawg_9BytesDAWG_33similar_item_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dawg_9BytesDAWG_32similar_item_values}, + {"longest_prefix", (PyCFunction)__pyx_pw_4dawg_9BytesDAWG_35longest_prefix, METH_O, __pyx_doc_4dawg_9BytesDAWG_34longest_prefix}, {0, 0, 0, 0} }; @@ -19749,6 +20526,7 @@ static PyMethodDef __pyx_methods_4dawg_IntDAWG[] = { {"get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dawg_7IntDAWG_5get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dawg_7IntDAWG_4get}, {"get_value", (PyCFunction)__pyx_pw_4dawg_7IntDAWG_7get_value, METH_O, __pyx_doc_4dawg_7IntDAWG_6get_value}, {"b_get_value", (PyCFunction)__pyx_pw_4dawg_7IntDAWG_9b_get_value, METH_O, __pyx_doc_4dawg_7IntDAWG_8b_get_value}, + {"longest_prefix", (PyCFunction)__pyx_pw_4dawg_7IntDAWG_11longest_prefix, METH_O, __pyx_doc_4dawg_7IntDAWG_10longest_prefix}, {0, 0, 0, 0} }; @@ -21657,14 +22435,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Keys_and_values_must_be_single_c, __pyx_k_Keys_and_values_must_be_single_c, sizeof(__pyx_k_Keys_and_values_must_be_single_c), 0, 1, 0, 0}, {&__pyx_n_s_Mapping, __pyx_k_Mapping, sizeof(__pyx_k_Mapping), 0, 0, 1, 1}, {&__pyx_kp_u_Negative_values_are_not_supporte, __pyx_k_Negative_values_are_not_supporte, sizeof(__pyx_k_Negative_values_are_not_supporte), 0, 1, 0, 0}, + {&__pyx_kp_u_No_prefix_found, __pyx_k_No_prefix_found, sizeof(__pyx_k_No_prefix_found), 0, 1, 0, 0}, {&__pyx_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0, 0}, {&__pyx_kp_u_Payload_separator, __pyx_k_Payload_separator, sizeof(__pyx_k_Payload_separator), 0, 1, 0, 0}, {&__pyx_n_s_RecordDAWG, __pyx_k_RecordDAWG, sizeof(__pyx_k_RecordDAWG), 0, 0, 1, 1}, {&__pyx_n_s_RecordDAWG_iteritems, __pyx_k_RecordDAWG_iteritems, sizeof(__pyx_k_RecordDAWG_iteritems), 0, 0, 1, 1}, {&__pyx_n_s_Struct, __pyx_k_Struct, sizeof(__pyx_k_Struct), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0}, - {&__pyx_kp_b__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 0, 0}, + {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0}, + {&__pyx_kp_b__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 0, 0}, {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1}, @@ -21752,9 +22531,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 64, __pyx_L1_error) __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 118, __pyx_L1_error) __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 164, __pyx_L1_error) - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 300, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 431, __pyx_L1_error) - __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 523, __pyx_L1_error) + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 318, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 449, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -21808,50 +22587,61 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "dawg.pyx":277 + /* "dawg.pyx":272 + * return key[:lastpos] + * else: + * raise KeyError("No prefix found") # <<<<<<<<<<<<<< + * + * def iterprefixes(self, unicode key): + */ + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_No_prefix_found); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "dawg.pyx":295 * for k,v in replaces.items(): * if len(k) != 1 or len(v) != 1: * raise ValueError("Keys and values must be single-char unicode strings.") # <<<<<<<<<<<<<< * * return dict( */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Keys_and_values_must_be_single_c); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Keys_and_values_must_be_single_c); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "dawg.pyx":378 + /* "dawg.pyx":396 * if not res: * self.dct.Clear() * raise IOError("Invalid data format: can't load _dawg.Dictionary") # <<<<<<<<<<<<<< * * res = self.guide.Read( &stream) */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Invalid_data_format_can_t_load); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Invalid_data_format_can_t_load); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "dawg.pyx":384 + /* "dawg.pyx":402 * self.guide.Clear() * self.dct.Clear() * raise IOError("Invalid data format: can't load _dawg.Guide") # <<<<<<<<<<<<<< * * return self */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Invalid_data_format_can_t_load_2); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 384, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Invalid_data_format_can_t_load_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "dawg.pyx":855 + /* "dawg.pyx":894 * * * def _iterable_from_argument(arg): # <<<<<<<<<<<<<< * if arg is None: * arg = [] */ - __pyx_tuple__14 = PyTuple_Pack(3, __pyx_n_s_arg, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_dawg_pyx, __pyx_n_s_iterable_from_argument, 855, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 855, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(3, __pyx_n_s_arg, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 894, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_dawg_pyx, __pyx_n_s_iterable_from_argument, 894, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -21930,15 +22720,15 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_4dawg_CompletionDAWG.__pyx_base.frombytes = (PyObject *(*)(struct __pyx_obj_4dawg_DAWG *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4dawg_14CompletionDAWG_frombytes; __pyx_vtable_4dawg_CompletionDAWG.keys = (PyObject *(*)(struct __pyx_obj_4dawg_CompletionDAWG *, int __pyx_skip_dispatch, struct __pyx_opt_args_4dawg_14CompletionDAWG_keys *__pyx_optional_args))__pyx_f_4dawg_14CompletionDAWG_keys; __pyx_type_4dawg_CompletionDAWG.tp_base = __pyx_ptype_4dawg_DAWG; - if (PyType_Ready(&__pyx_type_4dawg_CompletionDAWG) < 0) __PYX_ERR(0, 293, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg_CompletionDAWG) < 0) __PYX_ERR(0, 311, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg_CompletionDAWG.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4dawg_CompletionDAWG.tp_dictoffset && __pyx_type_4dawg_CompletionDAWG.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_4dawg_CompletionDAWG.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_4dawg_CompletionDAWG.tp_dict, __pyx_vtabptr_4dawg_CompletionDAWG) < 0) __PYX_ERR(0, 293, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CompletionDAWG, (PyObject *)&__pyx_type_4dawg_CompletionDAWG) < 0) __PYX_ERR(0, 293, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_4dawg_CompletionDAWG.tp_dict, __pyx_vtabptr_4dawg_CompletionDAWG) < 0) __PYX_ERR(0, 311, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CompletionDAWG, (PyObject *)&__pyx_type_4dawg_CompletionDAWG) < 0) __PYX_ERR(0, 311, __pyx_L1_error) __pyx_ptype_4dawg_CompletionDAWG = &__pyx_type_4dawg_CompletionDAWG; __pyx_vtabptr_4dawg_BytesDAWG = &__pyx_vtable_4dawg_BytesDAWG; __pyx_vtable_4dawg_BytesDAWG.__pyx_base = *__pyx_vtabptr_4dawg_CompletionDAWG; @@ -21959,7 +22749,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_4dawg_BytesDAWG._similar_item_values = (PyObject *(*)(struct __pyx_obj_4dawg_BytesDAWG *, int, PyObject *, dawgdic::BaseType, PyObject *))__pyx_f_4dawg_9BytesDAWG__similar_item_values; __pyx_vtable_4dawg_BytesDAWG.similar_item_values = (PyObject *(*)(struct __pyx_obj_4dawg_BytesDAWG *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4dawg_9BytesDAWG_similar_item_values; __pyx_type_4dawg_BytesDAWG.tp_base = __pyx_ptype_4dawg_CompletionDAWG; - if (PyType_Ready(&__pyx_type_4dawg_BytesDAWG) < 0) __PYX_ERR(0, 460, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg_BytesDAWG) < 0) __PYX_ERR(0, 478, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg_BytesDAWG.tp_print = 0; #endif @@ -21968,7 +22758,7 @@ static int __Pyx_modinit_type_init_code(void) { } #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_BytesDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 460, __pyx_L1_error) + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_BytesDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 478, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4dawg_9BytesDAWG___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4dawg_9BytesDAWG___init__.doc = __pyx_doc_4dawg_9BytesDAWG___init__; @@ -21976,15 +22766,15 @@ static int __Pyx_modinit_type_init_code(void) { } } #endif - if (__Pyx_SetVtable(__pyx_type_4dawg_BytesDAWG.tp_dict, __pyx_vtabptr_4dawg_BytesDAWG) < 0) __PYX_ERR(0, 460, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BytesDAWG, (PyObject *)&__pyx_type_4dawg_BytesDAWG) < 0) __PYX_ERR(0, 460, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_4dawg_BytesDAWG.tp_dict, __pyx_vtabptr_4dawg_BytesDAWG) < 0) __PYX_ERR(0, 478, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BytesDAWG, (PyObject *)&__pyx_type_4dawg_BytesDAWG) < 0) __PYX_ERR(0, 478, __pyx_L1_error) __pyx_ptype_4dawg_BytesDAWG = &__pyx_type_4dawg_BytesDAWG; __pyx_vtabptr_4dawg_RecordDAWG = &__pyx_vtable_4dawg_RecordDAWG; __pyx_vtable_4dawg_RecordDAWG.__pyx_base = *__pyx_vtabptr_4dawg_BytesDAWG; __pyx_vtable_4dawg_RecordDAWG.__pyx_base._value_for_index = (PyObject *(*)(struct __pyx_obj_4dawg_BytesDAWG *, dawgdic::BaseType))__pyx_f_4dawg_10RecordDAWG__value_for_index; __pyx_vtable_4dawg_RecordDAWG.__pyx_base.items = (PyObject *(*)(struct __pyx_obj_4dawg_BytesDAWG *, int __pyx_skip_dispatch, struct __pyx_opt_args_4dawg_9BytesDAWG_items *__pyx_optional_args))__pyx_f_4dawg_10RecordDAWG_items; __pyx_type_4dawg_RecordDAWG.tp_base = __pyx_ptype_4dawg_BytesDAWG; - if (PyType_Ready(&__pyx_type_4dawg_RecordDAWG) < 0) __PYX_ERR(0, 807, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg_RecordDAWG) < 0) __PYX_ERR(0, 846, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg_RecordDAWG.tp_print = 0; #endif @@ -21993,7 +22783,7 @@ static int __Pyx_modinit_type_init_code(void) { } #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_RecordDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 807, __pyx_L1_error) + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_RecordDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 846, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4dawg_10RecordDAWG___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4dawg_10RecordDAWG___init__.doc = __pyx_doc_4dawg_10RecordDAWG___init__; @@ -22001,8 +22791,8 @@ static int __Pyx_modinit_type_init_code(void) { } } #endif - if (__Pyx_SetVtable(__pyx_type_4dawg_RecordDAWG.tp_dict, __pyx_vtabptr_4dawg_RecordDAWG) < 0) __PYX_ERR(0, 807, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RecordDAWG, (PyObject *)&__pyx_type_4dawg_RecordDAWG) < 0) __PYX_ERR(0, 807, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_4dawg_RecordDAWG.tp_dict, __pyx_vtabptr_4dawg_RecordDAWG) < 0) __PYX_ERR(0, 846, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RecordDAWG, (PyObject *)&__pyx_type_4dawg_RecordDAWG) < 0) __PYX_ERR(0, 846, __pyx_L1_error) __pyx_ptype_4dawg_RecordDAWG = &__pyx_type_4dawg_RecordDAWG; __pyx_vtabptr_4dawg_IntDAWG = &__pyx_vtable_4dawg_IntDAWG; __pyx_vtable_4dawg_IntDAWG.__pyx_base = *__pyx_vtabptr_4dawg_DAWG; @@ -22010,7 +22800,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_4dawg_IntDAWG.get_value = (int (*)(struct __pyx_obj_4dawg_IntDAWG *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4dawg_7IntDAWG_get_value; __pyx_vtable_4dawg_IntDAWG.b_get_value = (int (*)(struct __pyx_obj_4dawg_IntDAWG *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4dawg_7IntDAWG_b_get_value; __pyx_type_4dawg_IntDAWG.tp_base = __pyx_ptype_4dawg_DAWG; - if (PyType_Ready(&__pyx_type_4dawg_IntDAWG) < 0) __PYX_ERR(0, 866, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg_IntDAWG) < 0) __PYX_ERR(0, 905, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg_IntDAWG.tp_print = 0; #endif @@ -22019,7 +22809,7 @@ static int __Pyx_modinit_type_init_code(void) { } #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_IntDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 866, __pyx_L1_error) + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_IntDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 905, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4dawg_7IntDAWG___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4dawg_7IntDAWG___init__.doc = __pyx_doc_4dawg_7IntDAWG___init__; @@ -22027,8 +22817,8 @@ static int __Pyx_modinit_type_init_code(void) { } } #endif - if (__Pyx_SetVtable(__pyx_type_4dawg_IntDAWG.tp_dict, __pyx_vtabptr_4dawg_IntDAWG) < 0) __PYX_ERR(0, 866, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IntDAWG, (PyObject *)&__pyx_type_4dawg_IntDAWG) < 0) __PYX_ERR(0, 866, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_4dawg_IntDAWG.tp_dict, __pyx_vtabptr_4dawg_IntDAWG) < 0) __PYX_ERR(0, 905, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IntDAWG, (PyObject *)&__pyx_type_4dawg_IntDAWG) < 0) __PYX_ERR(0, 905, __pyx_L1_error) __pyx_ptype_4dawg_IntDAWG = &__pyx_type_4dawg_IntDAWG; __pyx_vtabptr_4dawg_IntCompletionDAWG = &__pyx_vtable_4dawg_IntCompletionDAWG; __pyx_vtable_4dawg_IntCompletionDAWG.__pyx_base = *__pyx_vtabptr_4dawg_CompletionDAWG; @@ -22037,7 +22827,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_4dawg_IntCompletionDAWG.b_get_value = (int (*)(struct __pyx_obj_4dawg_IntCompletionDAWG *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4dawg_17IntCompletionDAWG_b_get_value; __pyx_vtable_4dawg_IntCompletionDAWG.items = (PyObject *(*)(struct __pyx_obj_4dawg_IntCompletionDAWG *, int __pyx_skip_dispatch, struct __pyx_opt_args_4dawg_17IntCompletionDAWG_items *__pyx_optional_args))__pyx_f_4dawg_17IntCompletionDAWG_items; __pyx_type_4dawg_IntCompletionDAWG.tp_base = __pyx_ptype_4dawg_CompletionDAWG; - if (PyType_Ready(&__pyx_type_4dawg_IntCompletionDAWG) < 0) __PYX_ERR(0, 909, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg_IntCompletionDAWG) < 0) __PYX_ERR(0, 968, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg_IntCompletionDAWG.tp_print = 0; #endif @@ -22046,7 +22836,7 @@ static int __Pyx_modinit_type_init_code(void) { } #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_IntCompletionDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 909, __pyx_L1_error) + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dawg_IntCompletionDAWG, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 968, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4dawg_17IntCompletionDAWG___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4dawg_17IntCompletionDAWG___init__.doc = __pyx_doc_4dawg_17IntCompletionDAWG___init__; @@ -22054,10 +22844,10 @@ static int __Pyx_modinit_type_init_code(void) { } } #endif - if (__Pyx_SetVtable(__pyx_type_4dawg_IntCompletionDAWG.tp_dict, __pyx_vtabptr_4dawg_IntCompletionDAWG) < 0) __PYX_ERR(0, 909, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IntCompletionDAWG, (PyObject *)&__pyx_type_4dawg_IntCompletionDAWG) < 0) __PYX_ERR(0, 909, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_4dawg_IntCompletionDAWG.tp_dict, __pyx_vtabptr_4dawg_IntCompletionDAWG) < 0) __PYX_ERR(0, 968, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IntCompletionDAWG, (PyObject *)&__pyx_type_4dawg_IntCompletionDAWG) < 0) __PYX_ERR(0, 968, __pyx_L1_error) __pyx_ptype_4dawg_IntCompletionDAWG = &__pyx_type_4dawg_IntCompletionDAWG; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct__iterprefixes) < 0) __PYX_ERR(0, 256, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct__iterprefixes) < 0) __PYX_ERR(0, 274, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct__iterprefixes.tp_print = 0; #endif @@ -22065,7 +22855,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct__iterprefixes.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct__iterprefixes = &__pyx_type_4dawg___pyx_scope_struct__iterprefixes; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_1_compile_replaces) < 0) __PYX_ERR(0, 273, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_1_compile_replaces) < 0) __PYX_ERR(0, 291, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_1_compile_replaces.tp_print = 0; #endif @@ -22073,7 +22863,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_1_compile_replaces.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_1_compile_replaces = &__pyx_type_4dawg___pyx_scope_struct_1_compile_replaces; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 281, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 299, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_2_genexpr.tp_print = 0; #endif @@ -22081,7 +22871,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_2_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_2_genexpr = &__pyx_type_4dawg___pyx_scope_struct_2_genexpr; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_3_iterkeys) < 0) __PYX_ERR(0, 325, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_3_iterkeys) < 0) __PYX_ERR(0, 343, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_3_iterkeys.tp_print = 0; #endif @@ -22089,7 +22879,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_3_iterkeys.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_3_iterkeys = &__pyx_type_4dawg___pyx_scope_struct_3_iterkeys; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_4___init__) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_4___init__) < 0) __PYX_ERR(0, 491, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_4___init__.tp_print = 0; #endif @@ -22097,7 +22887,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_4___init__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_4___init__ = &__pyx_type_4dawg___pyx_scope_struct_4___init__; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 483, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 501, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_5_genexpr.tp_print = 0; #endif @@ -22105,7 +22895,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_5_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_5_genexpr = &__pyx_type_4dawg___pyx_scope_struct_5_genexpr; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_6_iteritems) < 0) __PYX_ERR(0, 624, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_6_iteritems) < 0) __PYX_ERR(0, 642, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_6_iteritems.tp_print = 0; #endif @@ -22113,7 +22903,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_6_iteritems.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_6_iteritems = &__pyx_type_4dawg___pyx_scope_struct_6_iteritems; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_7_iterkeys) < 0) __PYX_ERR(0, 686, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_7_iterkeys) < 0) __PYX_ERR(0, 704, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_7_iterkeys.tp_print = 0; #endif @@ -22121,7 +22911,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_7_iterkeys.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_7_iterkeys = &__pyx_type_4dawg___pyx_scope_struct_7_iterkeys; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_8___init__) < 0) __PYX_ERR(0, 824, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_8___init__) < 0) __PYX_ERR(0, 863, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_8___init__.tp_print = 0; #endif @@ -22129,7 +22919,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_8___init__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_8___init__ = &__pyx_type_4dawg___pyx_scope_struct_8___init__; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_9_genexpr) < 0) __PYX_ERR(0, 839, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_9_genexpr) < 0) __PYX_ERR(0, 878, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_9_genexpr.tp_print = 0; #endif @@ -22137,7 +22927,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_9_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_9_genexpr = &__pyx_type_4dawg___pyx_scope_struct_9_genexpr; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_10_iteritems) < 0) __PYX_ERR(0, 850, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_10_iteritems) < 0) __PYX_ERR(0, 889, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_10_iteritems.tp_print = 0; #endif @@ -22145,7 +22935,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_10_iteritems.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_10_iteritems = &__pyx_type_4dawg___pyx_scope_struct_10_iteritems; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_11__iterable_from_argument) < 0) __PYX_ERR(0, 855, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_11__iterable_from_argument) < 0) __PYX_ERR(0, 894, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_11__iterable_from_argument.tp_print = 0; #endif @@ -22153,7 +22943,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_11__iterable_from_argument.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_11__iterable_from_argument = &__pyx_type_4dawg___pyx_scope_struct_11__iterable_from_argument; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_12_genexpr) < 0) __PYX_ERR(0, 860, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_12_genexpr) < 0) __PYX_ERR(0, 899, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_12_genexpr.tp_print = 0; #endif @@ -22161,7 +22951,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_4dawg___pyx_scope_struct_12_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_4dawg___pyx_scope_struct_12_genexpr = &__pyx_type_4dawg___pyx_scope_struct_12_genexpr; - if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_13_iteritems) < 0) __PYX_ERR(0, 971, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_4dawg___pyx_scope_struct_13_iteritems) < 0) __PYX_ERR(0, 1030, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_4dawg___pyx_scope_struct_13_iteritems.tp_print = 0; #endif @@ -22590,43 +23380,43 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dawg.pyx":273 + /* "dawg.pyx":291 * * @classmethod * def compile_replaces(cls, replaces): # <<<<<<<<<<<<<< * * for k,v in replaces.items(): */ - __Pyx_GetNameInClass(__pyx_t_4, (PyObject *)__pyx_ptype_4dawg_DAWG, __pyx_n_s_compile_replaces); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GetNameInClass(__pyx_t_4, (PyObject *)__pyx_ptype_4dawg_DAWG, __pyx_n_s_compile_replaces); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "dawg.pyx":272 + /* "dawg.pyx":290 * pos += 1 * * @classmethod # <<<<<<<<<<<<<< * def compile_replaces(cls, replaces): * */ - __pyx_t_7 = __Pyx_Method_ClassMethod(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_7 = __Pyx_Method_ClassMethod(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_4dawg_DAWG->tp_dict, __pyx_n_s_compile_replaces, __pyx_t_7) < 0) __PYX_ERR(0, 273, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_4dawg_DAWG->tp_dict, __pyx_n_s_compile_replaces, __pyx_t_7) < 0) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; PyType_Modified(__pyx_ptype_4dawg_DAWG); - /* "dawg.pyx":456 + /* "dawg.pyx":474 * # are not supported anyway because dawgdic doesn't support keys containing * # chr(0). * cdef bytes PAYLOAD_SEPARATOR = b'\x01' # <<<<<<<<<<<<<< * * DEF MAX_VALUE_SIZE = 32768 */ - __Pyx_INCREF(__pyx_kp_b__13); + __Pyx_INCREF(__pyx_kp_b__14); __Pyx_XGOTREF(__pyx_v_4dawg_PAYLOAD_SEPARATOR); - __Pyx_DECREF_SET(__pyx_v_4dawg_PAYLOAD_SEPARATOR, __pyx_kp_b__13); - __Pyx_GIVEREF(__pyx_kp_b__13); + __Pyx_DECREF_SET(__pyx_v_4dawg_PAYLOAD_SEPARATOR, __pyx_kp_b__14); + __Pyx_GIVEREF(__pyx_kp_b__14); - /* "dawg.pyx":473 + /* "dawg.pyx":491 * cdef Completer* _completer * * def __init__(self, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -22634,10 +23424,10 @@ if (!__Pyx_RefNanny) { * ``arg`` must be an iterable of tuples (unicode_key, bytes_payload). */ __Pyx_INCREF(__pyx_v_4dawg_PAYLOAD_SEPARATOR); - __pyx_k__10 = __pyx_v_4dawg_PAYLOAD_SEPARATOR; + __pyx_k__11 = __pyx_v_4dawg_PAYLOAD_SEPARATOR; __Pyx_GIVEREF(__pyx_v_4dawg_PAYLOAD_SEPARATOR); - /* "dawg.pyx":824 + /* "dawg.pyx":863 * cdef _struct * * def __init__(self, fmt, arg=None, input_is_sorted=False, bytes payload_separator=PAYLOAD_SEPARATOR): # <<<<<<<<<<<<<< @@ -22645,19 +23435,19 @@ if (!__Pyx_RefNanny) { * ``arg`` must be an iterable of tuples (unicode_key, data_tuple). */ __Pyx_INCREF(__pyx_v_4dawg_PAYLOAD_SEPARATOR); - __pyx_k__12 = __pyx_v_4dawg_PAYLOAD_SEPARATOR; + __pyx_k__13 = __pyx_v_4dawg_PAYLOAD_SEPARATOR; __Pyx_GIVEREF(__pyx_v_4dawg_PAYLOAD_SEPARATOR); - /* "dawg.pyx":855 + /* "dawg.pyx":894 * * * def _iterable_from_argument(arg): # <<<<<<<<<<<<<< * if arg is None: * arg = [] */ - __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4dawg_1_iterable_from_argument, NULL, __pyx_n_s_dawg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 855, __pyx_L1_error) + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4dawg_1_iterable_from_argument, NULL, __pyx_n_s_dawg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_iterable_from_argument, __pyx_t_7) < 0) __PYX_ERR(0, 855, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_iterable_from_argument, __pyx_t_7) < 0) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "dawg.pyx":1 @@ -24003,6 +24793,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( #endif } +/* unicode_iter */ +static CYTHON_INLINE int __Pyx_init_unicode_iteration( + PyObject* ustring, Py_ssize_t *length, void** data, int *kind) { +#if CYTHON_PEP393_ENABLED + if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1; + *kind = PyUnicode_KIND(ustring); + *length = PyUnicode_GET_LENGTH(ustring); + *data = PyUnicode_DATA(ustring); +#else + *kind = 0; + *length = PyUnicode_GET_SIZE(ustring); + *data = (void*)PyUnicode_AS_UNICODE(ustring); +#endif + return 0; +} + /* decode_c_bytes */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, @@ -25044,6 +25850,37 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_dawgdic_3a__3a_ValueType(dawgdic::ValueType value) { + const dawgdic::ValueType neg_one = (dawgdic::ValueType) ((dawgdic::ValueType) 0 - (dawgdic::ValueType) 1), const_zero = (dawgdic::ValueType) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(dawgdic::ValueType) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(dawgdic::ValueType) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(dawgdic::ValueType) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(dawgdic::ValueType) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(dawgdic::ValueType) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(dawgdic::ValueType), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; diff --git a/src/dawg.pyx b/src/dawg.pyx index 6dba921..229d041 100644 --- a/src/dawg.pyx +++ b/src/dawg.pyx @@ -253,6 +253,24 @@ cdef class DAWG: return res + def longest_prefix(self, unicode key): + cdef BaseType index = self.dct.root() + cdef int pos = 1 + cdef int lastpos = 0 + cdef CharType ch + + for ch in key: + if not self.dct.Follow(ch, &index): + break + if self.dct.has_value(index): + lastpos = pos + pos += 1 + + if lastpos: + return key[:lastpos] + else: + raise KeyError("No prefix found") + def iterprefixes(self, unicode key): ''' Return a generator with keys of this DAWG that are prefixes of the ``key``. @@ -802,7 +820,28 @@ cdef class BytesDAWG(CompletionDAWG): """ return self._similar_item_values(0, key, self.dct.root(), replaces) + def longest_prefix(self, unicode key): + cdef BaseType index = self.dct.root() + cdef BaseType tmp + cdef BaseType lastindex + cdef int pos = 1 + cdef int lastpos = 0 + cdef CharType ch + for ch in key: + if not self.dct.Follow(ch, &index): + break + + tmp = index + if self.dct.Follow(self._c_payload_separator, &tmp): + lastpos = pos + lastindex = tmp + pos += 1 + + if lastpos: + return key[:lastpos], self._value_for_index(lastindex) + else: + raise KeyError("No prefix found") cdef class RecordDAWG(BytesDAWG): """ @@ -904,6 +943,26 @@ cdef class IntDAWG(DAWG): cpdef int b_get_value(self, bytes key): return self.dct.Find(key) + def longest_prefix(self, unicode key): + cdef BaseType index = self.dct.root() + cdef BaseType lastindex + cdef int pos = 1 + cdef int lastpos = 0 + cdef CharType ch + + for ch in key: + if not self.dct.Follow(ch, &index): + break + + if self.dct.has_value(index): + lastpos = pos + lastindex = index + pos += 1 + + if lastpos: + return key[:lastpos], self.dct.value(lastindex) + else: + raise KeyError("No prefix found") # FIXME: code duplication. cdef class IntCompletionDAWG(CompletionDAWG): diff --git a/tests/test_dawg.py b/tests/test_dawg.py index 26f6627..92baa4b 100644 --- a/tests/test_dawg.py +++ b/tests/test_dawg.py @@ -83,7 +83,12 @@ def test_unicode_sorting(self): # if data is sorted according to unicode rules. dawg.DAWG([key1, key2]) - + def test_longest_prefix(self): + d = dawg.DAWG(["a", "as", "asdf"]) + assert d.longest_prefix("a") == "a" + assert d.longest_prefix("as") == "as" + assert d.longest_prefix("asd") == "as" + assert d.longest_prefix("asdf") == "asdf" class TestIntDAWG(object): @@ -148,6 +153,13 @@ def test_int_value_ranges(self): with pytest.raises(OverflowError): self.IntDAWG({'f': 2**32-1}) + def test_longest_prefix(self): + d = dawg.IntDAWG([("a", 1), ("as", 2), ("asdf", 3)]) + assert d.longest_prefix("a") == ("a", 1) + assert d.longest_prefix("as") == ("as", 2) + assert d.longest_prefix("asd") == ("as", 2) + assert d.longest_prefix("asdf") == ("asdf", 3) + class TestIntCompletionDAWG(TestIntDAWG): IntDAWG = dawg.IntCompletionDAWG # checks that all tests for IntDAWG pass diff --git a/tests/test_payload_dawg.py b/tests/test_payload_dawg.py index 305ac3f..a8b2b1b 100644 --- a/tests/test_payload_dawg.py +++ b/tests/test_payload_dawg.py @@ -83,7 +83,12 @@ def test_build_error(self): with pytest.raises(dawg.Error): self.dawg(payload_separator=b'f') - + def test_longest_prefix(self): + d = dawg.BytesDAWG([("a", b"a1"), ("a", b"a2"), ("as", b"as"), ("asdf", b"asdf")]) + assert d.longest_prefix("a") == ("a", [b"a1", b"a2"]) + assert d.longest_prefix("as") == ("as", [b"as"]) + assert d.longest_prefix("asd") == ("as", [b"as"]) + assert d.longest_prefix("asdf") == ("asdf", [b"asdf"]) class TestRecordDAWG(object):