diff --git a/pykeyvi/src/pykeyvi.cpp b/pykeyvi/src/pykeyvi.cpp index eee05267..6a6082b9 100644 --- a/pykeyvi/src/pykeyvi.cpp +++ b/pykeyvi/src/pykeyvi.cpp @@ -510,21 +510,27 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__; struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__; struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper; struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2; struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__; struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr; +struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr; /* "dictionary_compiler.pxd":5 * from libc.string cimport const_char @@ -557,7 +563,7 @@ struct __pyx_obj_7pykeyvi_JsonDictionaryMerger { }; -/* "pykeyvi.pyx":64 +/* "pykeyvi.pyx":89 * self.inst.get().Add((in_0)) * * cdef class StringDictionaryCompiler: # <<<<<<<<<<<<<< @@ -570,7 +576,7 @@ struct __pyx_obj_7pykeyvi_StringDictionaryCompiler { }; -/* "pykeyvi.pyx":142 +/* "pykeyvi.pyx":167 * self.inst.get().SetManifestFromString(m) * * cdef class JsonDictionaryCompiler: # <<<<<<<<<<<<<< @@ -583,7 +589,7 @@ struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler { }; -/* "pykeyvi.pyx":228 +/* "pykeyvi.pyx":253 * self.inst.get().SetManifestFromString(m) * * cdef class Dictionary: # <<<<<<<<<<<<<< @@ -596,7 +602,7 @@ struct __pyx_obj_7pykeyvi_Dictionary { }; -/* "pykeyvi.pyx":401 +/* "pykeyvi.pyx":426 * )} * * cdef class FsaTransform: # <<<<<<<<<<<<<< @@ -609,7 +615,7 @@ struct __pyx_obj_7pykeyvi_FsaTransform { }; -/* "pykeyvi.pyx":421 +/* "pykeyvi.pyx":446 * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) * * cdef class PrefixCompletion: # <<<<<<<<<<<<<< @@ -622,7 +628,7 @@ struct __pyx_obj_7pykeyvi_PrefixCompletion { }; -/* "pykeyvi.pyx":454 +/* "pykeyvi.pyx":479 * return py_result * * cdef class ForwardBackwardCompletion: # <<<<<<<<<<<<<< @@ -635,7 +641,7 @@ struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion { }; -/* "pykeyvi.pyx":497 +/* "pykeyvi.pyx":522 * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) * * cdef class loading_strategy_types: # <<<<<<<<<<<<<< @@ -647,7 +653,7 @@ struct __pyx_obj_7pykeyvi_loading_strategy_types { }; -/* "pykeyvi.pyx":507 +/* "pykeyvi.pyx":532 * populate_key_part_no_readahead_value_part = 7 * * cdef class CompletionDictionaryCompiler: # <<<<<<<<<<<<<< @@ -660,7 +666,7 @@ struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler { }; -/* "pykeyvi.pyx":590 +/* "pykeyvi.pyx":615 * (py_callback)(a, b) * * cdef class MultiWordCompletion: # <<<<<<<<<<<<<< @@ -673,7 +679,7 @@ struct __pyx_obj_7pykeyvi_MultiWordCompletion { }; -/* "pykeyvi.pyx":631 +/* "pykeyvi.pyx":656 * raise Exception('can not handle type of %s' % (args,)) * * cdef class PredictiveCompression: # <<<<<<<<<<<<<< @@ -686,7 +692,7 @@ struct __pyx_obj_7pykeyvi_PredictiveCompression { }; -/* "pykeyvi.pyx":658 +/* "pykeyvi.pyx":683 * return py_result * * cdef class KeyOnlyDictionaryGenerator: # <<<<<<<<<<<<<< @@ -699,7 +705,7 @@ struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator { }; -/* "pykeyvi.pyx":682 +/* "pykeyvi.pyx":707 * self.inst.get().WriteToFile((in_0)) * * cdef class KeyOnlyDictionaryCompiler: # <<<<<<<<<<<<<< @@ -712,7 +718,7 @@ struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler { }; -/* "pykeyvi.pyx":751 +/* "pykeyvi.pyx":776 * self.inst.get().SetManifestFromString(m) * * cdef class Match: # <<<<<<<<<<<<<< @@ -725,7 +731,7 @@ struct __pyx_obj_7pykeyvi_Match { }; -/* "pykeyvi.pyx":947 +/* "pykeyvi.pyx":972 * from match_iterator cimport MatchIterator as _MatchIterator * * cdef class MatchIterator: # <<<<<<<<<<<<<< @@ -739,8 +745,8 @@ struct __pyx_obj_7pykeyvi_MatchIterator { }; -/* "pykeyvi.pyx":80 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":59 + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -752,7 +758,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 { }; -/* "pykeyvi.pyx":82 +/* "pykeyvi.pyx":61 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< @@ -772,7 +778,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr { }; -/* "pykeyvi.pyx":90 +/* "pykeyvi.pyx":69 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -785,7 +791,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ { }; -/* "pykeyvi.pyx":95 +/* "pykeyvi.pyx":74 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -805,8 +811,8 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr { }; -/* "pykeyvi.pyx":165 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":105 + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -818,7 +824,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 { }; -/* "pykeyvi.pyx":167 +/* "pykeyvi.pyx":107 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< @@ -838,7 +844,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr { }; -/* "pykeyvi.pyx":175 +/* "pykeyvi.pyx":115 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -851,7 +857,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ { }; -/* "pykeyvi.pyx":180 +/* "pykeyvi.pyx":120 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -871,14 +877,80 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr { }; -/* "pykeyvi.pyx":353 +/* "pykeyvi.pyx":190 + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) + * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + */ +struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 { + PyObject_HEAD + PyObject *__pyx_v_value_store_params; +}; + + +/* "pykeyvi.pyx":192 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + */ +struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr { + PyObject_HEAD + struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *__pyx_outer_scope; + PyObject *__pyx_v_k; +}; + +struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr { + PyObject_HEAD + struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *__pyx_outer_scope; + PyObject *__pyx_v_v; +}; + + +/* "pykeyvi.pyx":200 + * del v1 + * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) + */ +struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ { + PyObject_HEAD + PyObject *__pyx_v_args; +}; + + +/* "pykeyvi.pyx":205 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: + */ +struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr { + PyObject_HEAD + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *__pyx_outer_scope; + PyObject *__pyx_v_k; +}; + +struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr { + PyObject_HEAD + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *__pyx_outer_scope; + PyObject *__pyx_v_v; +}; + + +/* "pykeyvi.pyx":378 * return py_result * * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< * for m in iterator: * yield m.GetMatchedString() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper { PyObject_HEAD PyObject *__pyx_v_iterator; PyObject *__pyx_v_m; @@ -889,14 +961,14 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper { }; -/* "pykeyvi.pyx":357 +/* "pykeyvi.pyx":382 * yield m.GetMatchedString() * * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< * for m in iterator: - * yield m.GetRawValueAsString() + * yield m.GetValue() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper { PyObject_HEAD PyObject *__pyx_v_iterator; PyObject *__pyx_v_m; @@ -907,14 +979,14 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper { }; -/* "pykeyvi.pyx":361 - * yield m.GetRawValueAsString() +/* "pykeyvi.pyx":386 + * yield m.GetValue() * * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< * for m in iterator: - * yield (m.GetMatchedString(), m.GetRawValueAsString()) + * yield (m.GetMatchedString(), m.GetValue()) */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper { PyObject_HEAD PyObject *__pyx_v_iterator; PyObject *__pyx_v_m; @@ -925,134 +997,134 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper { }; -/* "pykeyvi.pyx":537 +/* "pykeyvi.pyx":562 * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 { PyObject_HEAD PyObject *__pyx_v_value_store_params; }; -/* "pykeyvi.pyx":539 +/* "pykeyvi.pyx":564 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; PyObject *__pyx_v_k; }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; PyObject *__pyx_v_v; }; -/* "pykeyvi.pyx":547 +/* "pykeyvi.pyx":572 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< * if not args: * self._init_0(*args) */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ { PyObject_HEAD PyObject *__pyx_v_args; }; -/* "pykeyvi.pyx":552 +/* "pykeyvi.pyx":577 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< * self._init_2(*args) * else: */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; PyObject *__pyx_v_k; }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; PyObject *__pyx_v_v; }; -/* "pykeyvi.pyx":698 +/* "pykeyvi.pyx":723 * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 { PyObject_HEAD PyObject *__pyx_v_value_store_params; }; -/* "pykeyvi.pyx":700 +/* "pykeyvi.pyx":725 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *__pyx_outer_scope; PyObject *__pyx_v_k; }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *__pyx_outer_scope; PyObject *__pyx_v_v; }; -/* "pykeyvi.pyx":708 +/* "pykeyvi.pyx":733 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< * if not args: * self._init_0(*args) */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ { PyObject_HEAD PyObject *__pyx_v_args; }; -/* "pykeyvi.pyx":713 +/* "pykeyvi.pyx":738 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< * self._init_2(*args) * else: */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *__pyx_outer_scope; PyObject *__pyx_v_k; }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *__pyx_outer_scope; PyObject *__pyx_v_v; }; @@ -1149,8 +1221,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); @@ -1193,6 +1263,8 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif @@ -1573,21 +1645,27 @@ static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_8_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_9___init__ = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_10_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_11_genexpr = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_15__init_2 = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_12__init_2 = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_13_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_14_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_15___init__ = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_16_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_17_genexpr = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_18___init__ = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_19_genexpr = 0; -static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_20_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_21__init_2 = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_22_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_23_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_24___init__ = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_25_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_26_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_27__init_2 = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_28_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_29_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_30___init__ = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_31_genexpr = 0; +static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_32_genexpr = 0; static void __pyx_f_7pykeyvi_callback_wrapper(size_t, size_t, void *); /*proto*/ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ @@ -1648,6 +1726,7 @@ static char __pyx_k_default[] = "default"; static char __pyx_k_genexpr[] = "genexpr"; static char __pyx_k_msgpack[] = "msgpack"; static char __pyx_k_pykeyvi[] = "pykeyvi"; +static char __pyx_k_GetValue[] = "GetValue"; static char __pyx_k_KeyError[] = "KeyError"; static char __pyx_k_SetScore[] = "SetScore"; static char __pyx_k_SetStart[] = "SetStart"; @@ -1679,7 +1758,6 @@ static char __pyx_k_max_edit_distance[] = "max_edit_distance"; static char __pyx_k_populate_key_part[] = "populate_key_part"; static char __pyx_k_arg_end_wrong_type[] = "arg end wrong type"; static char __pyx_k_value_store_params[] = "value_store_params"; -static char __pyx_k_GetRawValueAsString[] = "GetRawValueAsString"; static char __pyx_k_arg_in_0_wrong_type[] = "arg in_0 wrong type"; static char __pyx_k_arg_in_1_wrong_type[] = "arg in_1 wrong type"; static char __pyx_k_arg_score_wrong_type[] = "arg score wrong type"; @@ -1717,8 +1795,8 @@ static PyObject *__pyx_n_s_GetCompletions_1; static PyObject *__pyx_n_s_GetMatchedString; static PyObject *__pyx_n_s_GetNear_0; static PyObject *__pyx_n_s_GetNear_1; -static PyObject *__pyx_n_s_GetRawValueAsString; static PyObject *__pyx_n_s_GetStatistics_locals_lambda; +static PyObject *__pyx_n_s_GetValue; static PyObject *__pyx_n_s_JumpConsistentHashString; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_n_s_SetEnd; @@ -1812,9 +1890,16 @@ static PyObject *__pyx_n_s_values; static PyObject *__pyx_n_s_zlib; static PyObject *__pyx_pf_7pykeyvi_JumpConsistentHashString(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /* proto */ static void __pyx_pf_7pykeyvi_20JsonDictionaryMerger___dealloc__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self); /* proto */ -static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4Merge(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6Add(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_2_init_0(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_memory_limit); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(PyObject *__pyx_self); /* proto */ +static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_10Merge(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_12Add(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ static void __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_4_init_1(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit); /* proto */ @@ -1868,7 +1953,7 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(struct __pyx_obj_7p static PyObject *__pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_43GetManifest(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda12(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv); /* proto */ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ static void __pyx_pf_7pykeyvi_12FsaTransform___dealloc__(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7pykeyvi_12FsaTransform_2Normalize(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ @@ -1979,21 +2064,27 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(PyTypeObject static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_15__init_2(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__init_2(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_15___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_27__init_2(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_28_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_29_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_30___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_32_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0}; static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values = {0, &__pyx_n_s_values, 0, 0, 0}; @@ -2269,42 +2360,39 @@ static void __pyx_pf_7pykeyvi_20JsonDictionaryMerger___dealloc__(struct __pyx_ob /* "pykeyvi.pyx":51 * * - * def __init__(self): # <<<<<<<<<<<<<< + * def _init_0(self): # <<<<<<<<<<<<<< * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_20JsonDictionaryMerger_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_20JsonDictionaryMerger_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2__init__(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self)); + __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2_init_0(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self) { - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_2_init_0(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations keyvi::dictionary::JsonDictionaryMerger *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("_init_0", 0); /* "pykeyvi.pyx":52 * - * def __init__(self): + * def _init_0(self): * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) # <<<<<<<<<<<<<< * - * def Merge(self, bytes in_0 ): + * def _init_1(self, memory_limit ): */ try { __pyx_t_1 = new keyvi::dictionary::JsonDictionaryMerger(); @@ -2317,18 +2405,19 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2__init__(struct __pyx_obj_7 /* "pykeyvi.pyx":51 * * - * def __init__(self): # <<<<<<<<<<<<<< + * def _init_0(self): # <<<<<<<<<<<<<< * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -2336,74 +2425,85 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2__init__(struct __pyx_obj_7 /* "pykeyvi.pyx":54 * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * - * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5Merge(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5Merge(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Merge (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_4Merge(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_4_init_1(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4Merge(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_memory_limit) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; + int __pyx_t_2; + int __pyx_t_3; + size_t __pyx_t_4; + keyvi::dictionary::JsonDictionaryMerger *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Merge", 0); + __Pyx_RefNannySetupContext("_init_1", 0); /* "pykeyvi.pyx":55 * - * def Merge(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * def _init_1(self, memory_limit ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< * - * self.inst.get().Merge((in_0)) + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif /* "pykeyvi.pyx":57 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * self.inst.get().Merge((in_0)) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) # <<<<<<<<<<<<<< * - * def Add(self, bytes in_0 ): + * def _init_2(self, memory_limit , dict value_store_params ): */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->Merge(((std::string)__pyx_t_2)); + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_5 = new keyvi::dictionary::JsonDictionaryMerger(((size_t)__pyx_t_4)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); /* "pykeyvi.pyx":54 * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * - * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * */ @@ -2411,7 +2511,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4Merge(struct __pyx_ob __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.Merge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2420,24 +2520,69 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4Merge(struct __pyx_ob } /* "pykeyvi.pyx":59 - * self.inst.get().Merge((in_0)) - * - * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_memory_limit = 0; + PyObject *__pyx_v_value_store_params = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_6Add(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_memory_limit = values[0]; + __pyx_v_value_store_params = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); /* function exit code */ goto __pyx_L0; @@ -2447,395 +2592,195 @@ static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7Add(PyObject *__pyx_v __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "pykeyvi.pyx":61 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + */ -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6Add(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Add", 0); - - /* "pykeyvi.pyx":60 - * - * def Add(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * self.inst.get().Add((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; } - #endif - - /* "pykeyvi.pyx":62 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< - * - * cdef class StringDictionaryCompiler: - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *) __pyx_self; + __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_7pykeyvi_20JsonDictionaryMerger_7_init_2_2generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - /* "pykeyvi.pyx":59 - * self.inst.get().Merge((in_0)) - * - * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":68 - * cdef shared_ptr[_StringDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_24StringDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_24StringDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":69 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":68 - * cdef shared_ptr[_StringDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":72 - * - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - keyvi::dictionary::StringDictionaryCompiler *__pyx_t_1; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_0", 0); - - /* "pykeyvi.pyx":73 - * - * def _init_0(self): - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) # <<<<<<<<<<<<<< - * - * def _init_1(self, memory_limit ): - */ - try { - __pyx_t_1 = new keyvi::dictionary::StringDictionaryCompiler(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - - /* "pykeyvi.pyx":72 - * - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) - * - */ + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + } + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":75 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) - * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { - PyObject *__pyx_r = 0; +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_4_init_1(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *) __pyx_self; + __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_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_4_init_1(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - size_t __pyx_t_4; - keyvi::dictionary::StringDictionaryCompiler *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_1", 0); - - /* "pykeyvi.pyx":76 - * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< - * - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":78 - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< - * - * def _init_2(self, memory_limit , dict value_store_params ): - */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_5 = new keyvi::dictionary::StringDictionaryCompiler(((size_t)__pyx_t_4)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); - - /* "pykeyvi.pyx":75 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) - * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":80 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) - * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_memory_limit = 0; - PyObject *__pyx_v_value_store_params = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_memory_limit = values[0]; - __pyx_v_value_store_params = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "pykeyvi.pyx":82 - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - */ - -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *) __pyx_self; - __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_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -2855,21 +2800,21 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generato return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -2877,17 +2822,17 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generato if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -2897,17 +2842,17 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generato PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); if (__pyx_t_6) { __Pyx_XDECREF(__pyx_r); @@ -2939,222 +2884,80 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generato __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *__pyx_cur_scope; +/* "pykeyvi.pyx":59 + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) + * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + */ + +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *__pyx_cur_scope; + std::map *__pyx_v_v1; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + std::map *__pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + std::string __pyx_t_13; + std::string __pyx_t_14; + size_t __pyx_t_15; + keyvi::dictionary::JsonDictionaryMerger *__pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL); + __Pyx_RefNannySetupContext("_init_2", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct___init_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *) __pyx_self; - __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_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; + __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); + + /* "pykeyvi.pyx":60 + * + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); - if (__pyx_t_6) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } - } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":80 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) - * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' - */ - -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *__pyx_cur_scope; - std::map *__pyx_v_v1; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - std::map *__pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *(*__pyx_t_12)(PyObject *); - std::string __pyx_t_13; - std::string __pyx_t_14; - size_t __pyx_t_15; - keyvi::dictionary::StringDictionaryCompiler *__pyx_t_16; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_2", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct___init_2, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); - - /* "pykeyvi.pyx":81 - * - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":82 + /* "pykeyvi.pyx":61 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< @@ -3173,35 +2976,35 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_t_4 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_t_5 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L5_bool_binop_done:; if (unlikely(!__pyx_t_1)) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":84 + /* "pykeyvi.pyx":63 * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< @@ -3212,30 +3015,30 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __pyx_t_6 = new std::map (); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":85 + /* "pykeyvi.pyx":64 * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< * deref(v1)[ key ] = value - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) */ if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -3243,17 +3046,17 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } @@ -3263,7 +3066,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3279,7 +3082,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -3292,15 +3095,15 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -3308,7 +3111,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L11_unpacking_done; @@ -3316,7 +3119,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L11_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); @@ -3324,54 +3127,54 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); __pyx_t_10 = 0; - /* "pykeyvi.pyx":86 + /* "pykeyvi.pyx":65 * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): * deref(v1)[ key ] = value # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) * del v1 */ - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); - /* "pykeyvi.pyx":85 + /* "pykeyvi.pyx":64 * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< * deref(v1)[ key ] = value - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pykeyvi.pyx":87 + /* "pykeyvi.pyx":66 * for key, value in value_store_params.items(): * deref(v1)[ key ] = value - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) # <<<<<<<<<<<<<< * del v1 * */ - __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_16 = new keyvi::dictionary::StringDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); + __pyx_t_16 = new keyvi::dictionary::JsonDictionaryMerger(((size_t)__pyx_t_15), (*__pyx_v_v1)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - /* "pykeyvi.pyx":88 + /* "pykeyvi.pyx":67 * deref(v1)[ key ] = value - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) * del v1 # <<<<<<<<<<<<<< * * def __init__(self, *args): */ delete __pyx_v_v1; - /* "pykeyvi.pyx":80 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) + /* "pykeyvi.pyx":59 + * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -3387,7 +3190,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_key); @@ -3398,7 +3201,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ return __pyx_r; } -/* "pykeyvi.pyx":90 +/* "pykeyvi.pyx":69 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -3407,8 +3210,8 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __ */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7pykeyvi_20JsonDictionaryMerger_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_20JsonDictionaryMerger_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; int __pyx_r; __Pyx_RefNannyDeclarations @@ -3416,16 +3219,16 @@ static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__(PyObject *__py if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":95 +/* "pykeyvi.pyx":74 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -3433,7 +3236,7 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat * else: */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3451,7 +3254,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr( __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_7pykeyvi_24StringDictionaryCompiler_8__init___2generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -3459,7 +3262,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr( /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -3467,7 +3270,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr( return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -3490,13 +3293,13 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3509,10 +3312,10 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat } } if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3520,9 +3323,9 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -3530,17 +3333,17 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -3550,7 +3353,7 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3593,9 +3396,9 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generat __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3613,7 +3416,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr __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_7pykeyvi_24StringDictionaryCompiler_8__init___5generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -3621,7 +3424,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -3629,7 +3432,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -3652,13 +3455,13 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3671,10 +3474,10 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat } } if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3682,9 +3485,9 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -3692,17 +3495,17 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -3712,7 +3515,7 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3756,7 +3559,7 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat return __pyx_r; } -/* "pykeyvi.pyx":90 +/* "pykeyvi.pyx":69 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -3764,7 +3567,7 @@ static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generat * self._init_0(*args) */ -static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { +static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_args) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *__pyx_cur_scope; int __pyx_r; __Pyx_RefNannyDeclarations @@ -3789,7 +3592,7 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - /* "pykeyvi.pyx":91 + /* "pykeyvi.pyx":70 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -3800,21 +3603,21 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":92 + /* "pykeyvi.pyx":71 * def __init__(self, *args): * if not args: * self._init_0(*args) # <<<<<<<<<<<<<< * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":91 + /* "pykeyvi.pyx":70 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -3824,7 +3627,7 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o goto __pyx_L3; } - /* "pykeyvi.pyx":93 + /* "pykeyvi.pyx":72 * if not args: * self._init_0(*args) * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< @@ -3835,9 +3638,9 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __Pyx_INCREF(__pyx_t_4); if (unlikely(__pyx_t_4 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = ((__pyx_t_5 == 1) != 0); if (__pyx_t_1) { @@ -3867,21 +3670,21 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":94 + /* "pykeyvi.pyx":73 * self._init_0(*args) * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) # <<<<<<<<<<<<<< * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): * self._init_2(*args) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":93 + /* "pykeyvi.pyx":72 * if not args: * self._init_0(*args) * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< @@ -3891,7 +3694,7 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o goto __pyx_L3; } - /* "pykeyvi.pyx":95 + /* "pykeyvi.pyx":74 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -3902,9 +3705,9 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __Pyx_INCREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((__pyx_t_5 == 2) != 0); if (__pyx_t_6) { @@ -3945,44 +3748,44 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_t_3 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_t_4 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":96 + /* "pykeyvi.pyx":75 * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): * self._init_2(*args) # <<<<<<<<<<<<<< * else: * raise Exception('can not handle type of %s' % (args,)) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":95 + /* "pykeyvi.pyx":74 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -3992,37 +3795,37 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o goto __pyx_L3; } - /* "pykeyvi.pyx":98 + /* "pykeyvi.pyx":77 * self._init_2(*args) * else: * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def Add(self, bytes in_0 , bytes in_1 ): + * def Merge(self, bytes in_0 ): */ /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; - /* "pykeyvi.pyx":90 + /* "pykeyvi.pyx":69 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -4036,7 +3839,7 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -4044,155 +3847,85 @@ static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_o return __pyx_r; } -/* "pykeyvi.pyx":100 +/* "pykeyvi.pyx":79 * raise Exception('can not handle type of %s' % (args,)) * - * def Add(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - PyObject *__pyx_v_in_1 = 0; +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_11Merge(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_11Merge(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Merge (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_10Merge(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_10Merge(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_in_1 = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), (&PyBytes_Type), 1, "in_1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_10Add(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_10Add(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - std::string __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Add", 0); + __Pyx_RefNannySetupContext("Merge", 0); - /* "pykeyvi.pyx":101 + /* "pykeyvi.pyx":80 * - * def Add(self, bytes in_0 , bytes in_1 ): + * def Merge(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' * + * self.inst.get().Merge((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":102 - * def Add(self, bytes in_0 , bytes in_1 ): + /* "pykeyvi.pyx":82 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' # <<<<<<<<<<<<<< - * - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_1); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":105 - * * - * self.inst.get().Add((in_0), (in_1)) # <<<<<<<<<<<<<< + * self.inst.get().Merge((in_0)) # <<<<<<<<<<<<<< * - * def __setitem__(self, bytes in_0 , bytes in_1 ): + * def Add(self, bytes in_0 ): */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2), ((std::string)__pyx_t_3)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->Merge(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":100 + /* "pykeyvi.pyx":79 * raise Exception('can not handle type of %s' % (args,)) * - * def Add(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.Merge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4200,283 +3933,329 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_10Add(struct __pyx return __pyx_r; } -/* "pykeyvi.pyx":107 - * self.inst.get().Add((in_0), (in_1)) +/* "pykeyvi.pyx":84 + * self.inst.get().Merge((in_0)) * - * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /*proto*/ -static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_13Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_13Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), (&PyBytes_Type), 1, "in_1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_12__setitem__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0), ((PyObject*)__pyx_v_in_1)); + __Pyx_RefNannySetupContext("Add (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_12Add(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = -1; + __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_12__setitem__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_12Add(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; std::string __pyx_t_2; - std::string __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":108 + /* "pykeyvi.pyx":85 * - * def __setitem__(self, bytes in_0 , bytes in_1 ): + * def Add(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' * + * self.inst.get().Add((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":109 - * def __setitem__(self, bytes in_0 , bytes in_1 ): + /* "pykeyvi.pyx":87 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' # <<<<<<<<<<<<<< - * - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_1); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":112 * + * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< * - * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): + * cdef class StringDictionaryCompiler: */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_v_self->inst.get()->__setitem__(((std::string)__pyx_t_2), ((std::string)__pyx_t_3)); + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":107 - * self.inst.get().Add((in_0), (in_1)) + /* "pykeyvi.pyx":84 + * self.inst.get().Merge((in_0)) * - * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":114 - * self.inst.get().__setitem__((in_0), (in_1)) +/* "pykeyvi.pyx":93 + * cdef shared_ptr[_StringDictionaryCompiler] inst * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_pw_7pykeyvi_24StringDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_24StringDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_14WriteToFile(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { - PyObject *__pyx_r = NULL; +static void __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("WriteToFile", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":115 + /* "pykeyvi.pyx":94 * - * def WriteToFile(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * self.inst.get().WriteToFile((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":117 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< * - * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * def __enter__(self): */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->WriteToFile(((std::string)__pyx_t_2)); + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":114 - * self.inst.get().__setitem__((in_0), (in_1)) + /* "pykeyvi.pyx":93 + * cdef shared_ptr[_StringDictionaryCompiler] inst * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "pykeyvi.pyx":119 - * self.inst.get().WriteToFile((in_0)) +/* "pykeyvi.pyx":97 * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); + __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); + keyvi::dictionary::StringDictionaryCompiler *__pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_init_0", 0); - /* "pykeyvi.pyx":120 - * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":98 * + * def _init_0(self): + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) # <<<<<<<<<<<<<< * + * def _init_1(self, memory_limit ): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "pykeyvi.pyx":119 - * self.inst.get().WriteToFile((in_0)) + try { + __pyx_t_1 = new keyvi::dictionary::StringDictionaryCompiler(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); + + /* "pykeyvi.pyx":97 * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":123 +/* "pykeyvi.pyx":100 + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) * + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_4_init_1(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_4_init_1(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + size_t __pyx_t_4; + keyvi::dictionary::StringDictionaryCompiler *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_init_1", 0); + + /* "pykeyvi.pyx":101 + * + * def _init_1(self, memory_limit ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":103 + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< + * + * def _init_2(self, memory_limit , dict value_store_params ): + */ + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_5 = new keyvi::dictionary::StringDictionaryCompiler(((size_t)__pyx_t_4)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); + + /* "pykeyvi.pyx":100 + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) + * + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":105 + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_type = 0; - CYTHON_UNUSED PyObject *__pyx_v_value = 0; - CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_memory_limit = 0; + PyObject *__pyx_v_value_store_params = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; + PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; @@ -4485,813 +4264,708 @@ static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__(PyObjec kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_type = values[0]; - __pyx_v_value = values[1]; - __pyx_v_traceback = values[2]; + __pyx_v_memory_limit = values[0]; + __pyx_v_value_store_params = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_18__exit__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_18__exit__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { +/* "pykeyvi.pyx":107 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + */ + +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__exit__", 0); - - /* "pykeyvi.pyx":124 - * - * def __exit__(self, type, value, traceback): - * self.Compile() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *) __pyx_self; + __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_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pykeyvi.pyx":123 - * - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() - * - */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":127 - * - * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Compile (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { - void *__pyx_v_callback; +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("Compile", 0); - - /* "pykeyvi.pyx":128 - * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() - */ - __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "pykeyvi.pyx":129 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); #endif - /*try:*/ { - - /* "pykeyvi.pyx":130 - * if not args: - * with nogil: - * self.inst.get().Compile() # <<<<<<<<<<<<<< - * return - * - */ - __pyx_v_self->inst.get()->Compile(); - } - - /* "pykeyvi.pyx":129 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + break; + } + __Pyx_GOTREF(__pyx_t_1); } - - /* "pykeyvi.pyx":131 - * with nogil: - * self.inst.get().Compile() - * return # <<<<<<<<<<<<<< - * - * cdef void* callback = args[0] - */ + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + } + /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - - /* "pykeyvi.pyx":128 - * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() - */ - } - - /* "pykeyvi.pyx":133 - * return - * - * cdef void* callback = args[0] # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) - */ - __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); - - /* "pykeyvi.pyx":134 - * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) - * - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { - - /* "pykeyvi.pyx":135 - * cdef void* callback = args[0] - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); - } - - /* "pykeyvi.pyx":134 - * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) - * - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L9; - } - __pyx_L9:; - } } - - /* "pykeyvi.pyx":127 - * - * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: - */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator8(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":138 - * - * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { - PyObject *__pyx_r = 0; +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_8_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *) __pyx_self; + __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_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator8, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { - PyObject *__pyx_v_m = NULL; +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator8(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetManifest", 0); - - /* "pykeyvi.pyx":139 - * - * def SetManifest(self, manifest): - * m = json.dumps(manifest) # <<<<<<<<<<<<<< - * self.inst.get().SetManifestFromString(m) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_manifest); - __Pyx_GIVEREF(__pyx_v_manifest); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_m = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":140 - * def SetManifest(self, manifest): - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< - * - * cdef class JsonDictionaryCompiler: - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_m); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - - /* "pykeyvi.pyx":138 - * - * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) - */ + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + } + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_m); __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":146 - * cdef shared_ptr[_JsonDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":147 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":146 - * cdef shared_ptr[_JsonDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":150 - * +/* "pykeyvi.pyx":105 + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) * - * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ -/* Python wrapper */ -static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /*proto*/ -static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), (&PyBytes_Type), 1, "in_1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_2__setitem__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0), ((PyObject*)__pyx_v_in_1)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_2__setitem__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_6_init_2(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *__pyx_cur_scope; + std::map *__pyx_v_v1; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; - std::string __pyx_t_3; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + std::map *__pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + std::string __pyx_t_13; + std::string __pyx_t_14; + size_t __pyx_t_15; + keyvi::dictionary::StringDictionaryCompiler *__pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_RefNannySetupContext("_init_2", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_6__init_2, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); - /* "pykeyvi.pyx":151 + /* "pykeyvi.pyx":106 * - * def __setitem__(self, bytes in_0 , bytes in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":152 - * def __setitem__(self, bytes in_0 , bytes in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":107 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_1); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } + __pyx_t_4 = __pyx_cur_scope->__pyx_v_value_store_params; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = PyDict_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_4 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_5 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_t_3; + __pyx_L5_bool_binop_done:; + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } #endif - /* "pykeyvi.pyx":155 - * - * - * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":109 + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * - * def _init_0(self): + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_v_self->inst.get()->__setitem__(((std::string)__pyx_t_2), ((std::string)__pyx_t_3)); + __pyx_t_6 = new std::map (); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":150 - * + /* "pykeyvi.pyx":110 * - * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) */ + if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_8(__pyx_t_5); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); + __pyx_t_10 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; + index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = NULL; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L11_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); + __pyx_t_10 = 0; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pykeyvi.pyx":111 + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) + * del v1 + */ + __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); -/* "pykeyvi.pyx":157 - * self.inst.get().__setitem__((in_0), (in_1)) - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) + /* "pykeyvi.pyx":110 * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) */ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_5_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_5_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_4_init_0(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_4_init_0(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_0", 0); - - /* "pykeyvi.pyx":158 - * - * def _init_0(self): - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":112 + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< + * del v1 * - * def _init_1(self, memory_limit ): */ + __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_1 = new keyvi::dictionary::JsonDictionaryCompiler(); + __pyx_t_16 = new keyvi::dictionary::StringDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - /* "pykeyvi.pyx":157 - * self.inst.get().__setitem__((in_0), (in_1)) + /* "pykeyvi.pyx":113 + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) + * del v1 # <<<<<<<<<<<<<< * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) + * def __init__(self, *args): + */ + delete __pyx_v_v1; + + /* "pykeyvi.pyx":105 + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":160 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) - * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' +/* "pykeyvi.pyx":115 + * del v1 * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_7_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_7_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { - PyObject *__pyx_r = 0; +static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator9(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - size_t __pyx_t_4; - keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_1", 0); - - /* "pykeyvi.pyx":161 - * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< - * - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":163 - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< - * - * def _init_2(self, memory_limit , dict value_store_params ): - */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_5 = new keyvi::dictionary::JsonDictionaryCompiler(((size_t)__pyx_t_4)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); - - /* "pykeyvi.pyx":160 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) - * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":165 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) - * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_memory_limit = 0; - PyObject *__pyx_v_value_store_params = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_memory_limit = values[0]; - __pyx_v_value_store_params = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8_init_2(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "pykeyvi.pyx":167 - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - */ - -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *__pyx_cur_scope; +/* "pykeyvi.pyx":120 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: + */ + +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_10_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *) __pyx_self; __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_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator9, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5299,7 +4973,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(PyO /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -5307,16 +4981,17 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(PyO return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator9(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)__pyx_generator->closure); + struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - int __pyx_t_5; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5329,49 +5004,67 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7 return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_3 = 0; - __pyx_t_4 = NULL; + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; + __pyx_t_5 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_4)) { + if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); + __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -5381,9 +5074,9 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); - __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); - if (__pyx_t_6) { + __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; @@ -5405,6 +5098,7 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5413,27 +5107,27 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7 __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator10(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_8_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_11_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *) __pyx_self; __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_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator10, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5441,7 +5135,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(Py /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -5449,16 +5143,17 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(Py return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator10(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)__pyx_generator->closure); + struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - int __pyx_t_5; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5471,49 +5166,67 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8 return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_3 = 0; - __pyx_t_4 = NULL; + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; + __pyx_t_5 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_4)) { + if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); + __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -5523,9 +5236,9 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); - if (__pyx_t_6) { + __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; @@ -5547,6 +5260,7 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5556,1108 +5270,700 @@ static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator8 return __pyx_r; } -/* "pykeyvi.pyx":165 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":115 + * del v1 * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8_init_2(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *__pyx_cur_scope; - std::map *__pyx_v_v1; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *__pyx_cur_scope; + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - std::map *__pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *(*__pyx_t_12)(PyObject *); - std::string __pyx_t_13; - std::string __pyx_t_14; - size_t __pyx_t_15; - keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_16; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_2", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_6__init_2, __pyx_empty_tuple, NULL); + __Pyx_RefNannySetupContext("__init__", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_9___init__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); - return NULL; + return -1; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); + __pyx_cur_scope->__pyx_v_args = __pyx_v_args; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - /* "pykeyvi.pyx":166 - * - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + /* "pykeyvi.pyx":116 * + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { - /* "pykeyvi.pyx":167 - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + /* "pykeyvi.pyx":117 + * def __init__(self, *args): + * if not args: + * self._init_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_4 = __pyx_cur_scope->__pyx_v_value_store_params; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_2 = PyDict_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_4 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_5 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __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_3; - __pyx_L5_bool_binop_done:; - if (unlikely(!__pyx_t_1)) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - /* "pykeyvi.pyx":169 - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + /* "pykeyvi.pyx":116 * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< - * for key, value in value_store_params.items(): - * deref(v1)[ key ] = value + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - try { - __pyx_t_6 = new std::map (); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":170 - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) + /* "pykeyvi.pyx":118 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): */ - if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_cur_scope->__pyx_v_args; + __Pyx_INCREF(__pyx_t_4); + if (unlikely(__pyx_t_4 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); + if (__pyx_t_1) { } else { - __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_t_1; + goto __pyx_L4_bool_binop_done; } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = PyInt_Check(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_8(__pyx_t_5); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { - PyObject* sequence = __pyx_t_4; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_9 = PyList_GET_ITEM(sequence, 0); - __pyx_t_10 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L11_unpacking_done; - __pyx_L10_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L11_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); - __pyx_t_10 = 0; + __pyx_t_7 = (__pyx_t_6 != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_1 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = PyLong_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__pyx_t_7 != 0); + __pyx_t_1 = __pyx_t_6; + __pyx_L6_bool_binop_done:; + __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { - /* "pykeyvi.pyx":171 - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - * for key, value in value_store_params.items(): - * deref(v1)[ key ] = value # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) - * del v1 + /* "pykeyvi.pyx":119 + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) # <<<<<<<<<<<<<< + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + * self._init_2(*args) */ - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":170 - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) + /* "pykeyvi.pyx":118 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): */ + goto __pyx_L3; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pykeyvi.pyx":172 - * for key, value in value_store_params.items(): - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< - * del v1 - * + /* "pykeyvi.pyx":120 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: */ - __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_16 = new keyvi::dictionary::JsonDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_cur_scope->__pyx_v_args; + __Pyx_INCREF(__pyx_t_3); + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((__pyx_t_5 == 2) != 0); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyInt_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = (__pyx_t_1 != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = PyLong_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_t_7 != 0); + __pyx_t_6 = __pyx_t_1; + __pyx_L11_bool_binop_done:; + __pyx_t_1 = (__pyx_t_6 != 0); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyDict_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_4 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_6; + __pyx_L8_bool_binop_done:; + if (__pyx_t_2) { - /* "pykeyvi.pyx":173 - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) - * del v1 # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":121 + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + * self._init_2(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pykeyvi.pyx":120 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: + */ + goto __pyx_L3; + } + + /* "pykeyvi.pyx":123 + * self._init_2(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def __init__(self, *args): + * def Add(self, bytes in_0 , bytes in_1 ): */ - delete __pyx_v_v1; + /*else*/ { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; - /* "pykeyvi.pyx":165 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) + /* "pykeyvi.pyx":115 + * del v1 * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":175 - * del v1 +/* "pykeyvi.pyx":125 + * raise Exception('can not handle type of %s' % (args,)) * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) + * def Add(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + PyObject *__pyx_v_in_1 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_10__init__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __Pyx_RefNannySetupContext("Add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_in_1 = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), (&PyBytes_Type), 1, "in_1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_10Add(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator9(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":180 - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< - * self._init_2(*args) - * else: - */ - -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_10Add(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::string __pyx_t_2; + std::string __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_10_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; + __Pyx_RefNannySetupContext("Add", 0); + + /* "pykeyvi.pyx":126 + * + * def Add(self, bytes in_0 , bytes in_1 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *) __pyx_self; - __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_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator9, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; + #endif + + /* "pykeyvi.pyx":127 + * def Add(self, bytes in_0 , bytes in_1 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + * + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_1); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":130 + * + * + * self.inst.get().Add((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def __setitem__(self, bytes in_0 , bytes in_1 ): + */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2), ((std::string)__pyx_t_3)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + /* "pykeyvi.pyx":125 + * raise Exception('can not handle type of %s' % (args,)) + * + * def Add(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + */ + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator9(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +/* "pykeyvi.pyx":132 + * self.inst.get().Add((in_0), (in_1)) + * + * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + */ + +/* Python wrapper */ +static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /*proto*/ +static int __pyx_pw_7pykeyvi_24StringDictionaryCompiler_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); - __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_7) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } - } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), (&PyBytes_Type), 1, "in_1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_12__setitem__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0), ((PyObject*)__pyx_v_in_1)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator10(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_12__setitem__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { + int __pyx_r; __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::string __pyx_t_2; + std::string __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_11_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *) __pyx_self; - __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_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator10, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "pykeyvi.pyx":133 + * + * def __setitem__(self, bytes in_0 , bytes in_1 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pykeyvi.pyx":134 + * def __setitem__(self, bytes in_0 , bytes in_1 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + * + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_1); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator10(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_7) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } - } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + /* "pykeyvi.pyx":137 + * + * + * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def WriteToFile(self, bytes in_0 ): + */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->__setitem__(((std::string)__pyx_t_2), ((std::string)__pyx_t_3)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pykeyvi.pyx":132 + * self.inst.get().Add((in_0), (in_1)) + * + * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' + */ /* function exit code */ + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":175 - * del v1 +/* "pykeyvi.pyx":139 + * self.inst.get().__setitem__((in_0), (in_1)) + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) */ -static int __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_10__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *__pyx_cur_scope; - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_14WriteToFile(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_9___init__, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_args = __pyx_v_args; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":176 + /* "pykeyvi.pyx":140 * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * self.inst.get().WriteToFile((in_0)) */ - __pyx_t_1 = (__pyx_cur_scope->__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_args) != 0); - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":177 - * def __init__(self, *args): - * if not args: - * self._init_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) + /* "pykeyvi.pyx":142 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< + * + * def __enter__(self): */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->WriteToFile(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":176 + /* "pykeyvi.pyx":139 + * self.inst.get().__setitem__((in_0), (in_1)) + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - goto __pyx_L3; - } - /* "pykeyvi.pyx":178 - * if not args: - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - */ - __pyx_t_4 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_4); - if (unlikely(__pyx_t_4 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = ((__pyx_t_5 == 1) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_6 = PyInt_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = (__pyx_t_6 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_1 = __pyx_t_7; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_7 = PyLong_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_7 != 0); - __pyx_t_1 = __pyx_t_6; - __pyx_L6_bool_binop_done:; - __pyx_t_6 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":179 - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) # <<<<<<<<<<<<<< - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - * self._init_2(*args) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "pykeyvi.pyx":178 - * if not args: - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - */ - goto __pyx_L3; - } - - /* "pykeyvi.pyx":180 - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< - * self._init_2(*args) - * else: - */ - __pyx_t_3 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_3); - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((__pyx_t_5 == 2) != 0); - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = PyInt_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = (__pyx_t_1 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_7 = PyLong_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = (__pyx_t_7 != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L11_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = PyDict_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_3 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_4 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __pyx_t_6; - __pyx_L8_bool_binop_done:; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":181 - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - * self._init_2(*args) # <<<<<<<<<<<<<< - * else: - * raise Exception('can not handle type of %s' % (args,)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "pykeyvi.pyx":180 - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< - * self._init_2(*args) - * else: - */ - goto __pyx_L3; - } - - /* "pykeyvi.pyx":183 - * self._init_2(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): - */ - /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; - - /* "pykeyvi.pyx":175 - * del v1 - * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":185 - * raise Exception('can not handle type of %s' % (args,)) - * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":144 + * self.inst.get().WriteToFile((in_0)) + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_12WriteToFile(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("WriteToFile", 0); + __Pyx_RefNannySetupContext("__enter__", 0); - /* "pykeyvi.pyx":186 - * - * def WriteToFile(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":145 * - * self.inst.get().WriteToFile((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":188 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __enter__(self): + * return self # <<<<<<<<<<<<<< * - * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * def __enter__(self): */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->WriteToFile(((std::string)__pyx_t_2)); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "pykeyvi.pyx":185 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":144 + * self.inst.get().WriteToFile((in_0)) * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __enter__(self): # <<<<<<<<<<<<<< + * return self * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":190 - * self.inst.get().WriteToFile((in_0)) - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_14__enter__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_14__enter__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); - - /* "pykeyvi.pyx":191 - * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "pykeyvi.pyx":190 - * self.inst.get().WriteToFile((in_0)) - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":194 +/* "pykeyvi.pyx":148 * * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -6666,8 +5972,8 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_14__enter__(struct _ */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_type = 0; CYTHON_UNUSED PyObject *__pyx_v_value = 0; CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; @@ -6698,16 +6004,16 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -6722,20 +6028,20 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_18__exit__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_18__exit__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6746,14 +6052,14 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__exit__", 0); - /* "pykeyvi.pyx":195 + /* "pykeyvi.pyx":149 * * def __exit__(self, type, value, traceback): * self.Compile() # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -6766,16 +6072,16 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(struct __ } } if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":194 + /* "pykeyvi.pyx":148 * * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -6790,7 +6096,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(struct __ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6798,392 +6104,123 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(struct __ return __pyx_r; } -/* "pykeyvi.pyx":198 +/* "pykeyvi.pyx":152 * * - * def Add(self, key , value ): # <<<<<<<<<<<<<< - * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' + * def Compile(self, *args): # <<<<<<<<<<<<<< + * if not args: + * with nogil: */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_key = 0; - PyObject *__pyx_v_value = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_key = values[0]; - __pyx_v_value = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_18Add(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_key, __pyx_v_value); + __Pyx_RefNannySetupContext("Compile (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_18Add(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { - std::string __pyx_v_input_in_0; - std::string __pyx_v_input_in_1; +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { + void *__pyx_v_callback; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - std::string __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Add", 0); - __Pyx_INCREF(__pyx_v_key); - __Pyx_INCREF(__pyx_v_value); + __Pyx_RefNannySetupContext("Compile", 0); - /* "pykeyvi.pyx":199 + /* "pykeyvi.pyx":153 * - * def Add(self, key , value ): - * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() + */ + __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":154 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "pykeyvi.pyx":155 + * if not args: + * with nogil: + * self.inst.get().Compile() # <<<<<<<<<<<<<< + * return * */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyBytes_Check(__pyx_v_key); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->Compile(); + } + + /* "pykeyvi.pyx":154 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - } - #endif - /* "pykeyvi.pyx":200 - * def Add(self, key , value ): - * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":156 + * with nogil: + * self.inst.get().Compile() + * return # <<<<<<<<<<<<<< * - * if isinstance(key, unicode): + * cdef void* callback = args[0] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pykeyvi.pyx":153 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyBytes_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_3 = PyUnicode_Check(__pyx_v_value); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L5_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } } - #endif - /* "pykeyvi.pyx":202 - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' + /* "pykeyvi.pyx":158 + * return * - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('UTF-8') - * cdef libcpp_string input_in_0 = key + * cdef void* callback = args[0] # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); - /* "pykeyvi.pyx":203 - * - * if isinstance(key, unicode): - * key = key.encode('UTF-8') # <<<<<<<<<<<<<< - * cdef libcpp_string input_in_0 = key - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_5); - __pyx_t_5 = 0; - - /* "pykeyvi.pyx":202 - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' - * - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('UTF-8') - * cdef libcpp_string input_in_0 = key - */ - } - - /* "pykeyvi.pyx":204 - * if isinstance(key, unicode): - * key = key.encode('UTF-8') - * cdef libcpp_string input_in_0 = key # <<<<<<<<<<<<<< - * - * if isinstance(value, unicode): - */ - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((std::string)__pyx_t_6); - - /* "pykeyvi.pyx":206 - * cdef libcpp_string input_in_0 = key - * - * if isinstance(value, unicode): # <<<<<<<<<<<<<< - * value = value.encode('UTF-8') - * cdef libcpp_string input_in_1 = value - */ - __pyx_t_2 = PyUnicode_Check(__pyx_v_value); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "pykeyvi.pyx":207 - * - * if isinstance(value, unicode): - * value = value.encode('UTF-8') # <<<<<<<<<<<<<< - * cdef libcpp_string input_in_1 = value - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4); - __pyx_t_4 = 0; - - /* "pykeyvi.pyx":206 - * cdef libcpp_string input_in_0 = key - * - * if isinstance(value, unicode): # <<<<<<<<<<<<<< - * value = value.encode('UTF-8') - * cdef libcpp_string input_in_1 = value - */ - } - - /* "pykeyvi.pyx":208 - * if isinstance(value, unicode): - * value = value.encode('UTF-8') - * cdef libcpp_string input_in_1 = value # <<<<<<<<<<<<<< - * - * self.inst.get().Add(input_in_0, input_in_1) - */ - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_1 = ((std::string)__pyx_t_6); - - /* "pykeyvi.pyx":210 - * cdef libcpp_string input_in_1 = value - * - * self.inst.get().Add(input_in_0, input_in_1) # <<<<<<<<<<<<<< - * - * - */ - try { - __pyx_v_self->inst.get()->Add(__pyx_v_input_in_0, __pyx_v_input_in_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":198 - * - * - * def Add(self, key , value ): # <<<<<<<<<<<<<< - * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":213 - * - * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Compile (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { - void *__pyx_v_callback; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("Compile", 0); - - /* "pykeyvi.pyx":214 - * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() - */ - __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "pykeyvi.pyx":215 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { - - /* "pykeyvi.pyx":216 - * if not args: - * with nogil: - * self.inst.get().Compile() # <<<<<<<<<<<<<< - * return - * - */ - __pyx_v_self->inst.get()->Compile(); - } - - /* "pykeyvi.pyx":215 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "pykeyvi.pyx":217 - * with nogil: - * self.inst.get().Compile() - * return # <<<<<<<<<<<<<< - * - * cdef void* callback = args[0] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "pykeyvi.pyx":214 - * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() - */ - } - - /* "pykeyvi.pyx":219 - * return - * - * cdef void* callback = args[0] # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) - */ - __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); - - /* "pykeyvi.pyx":220 + /* "pykeyvi.pyx":159 * * cdef void* callback = args[0] * with nogil: # <<<<<<<<<<<<<< @@ -7197,7 +6234,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __p #endif /*try:*/ { - /* "pykeyvi.pyx":221 + /* "pykeyvi.pyx":160 * cdef void* callback = args[0] * with nogil: * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< @@ -7207,7 +6244,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __p __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); } - /* "pykeyvi.pyx":220 + /* "pykeyvi.pyx":159 * * cdef void* callback = args[0] * with nogil: # <<<<<<<<<<<<<< @@ -7225,7 +6262,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __p } } - /* "pykeyvi.pyx":213 + /* "pykeyvi.pyx":152 * * * def Compile(self, *args): # <<<<<<<<<<<<<< @@ -7241,7 +6278,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __p return __pyx_r; } -/* "pykeyvi.pyx":224 +/* "pykeyvi.pyx":163 * * * def SetManifest(self, manifest): # <<<<<<<<<<<<<< @@ -7250,19 +6287,19 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __p */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { PyObject *__pyx_v_m = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7276,16 +6313,16 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetManifest", 0); - /* "pykeyvi.pyx":225 + /* "pykeyvi.pyx":164 * * def SetManifest(self, manifest): * m = json.dumps(manifest) # <<<<<<<<<<<<<< * self.inst.get().SetManifestFromString(m) * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -7299,16 +6336,16 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_manifest); __Pyx_GIVEREF(__pyx_v_manifest); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -7316,22 +6353,17 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; - /* "pykeyvi.pyx":226 + /* "pykeyvi.pyx":165 * def SetManifest(self, manifest): * m = json.dumps(manifest) * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< * - * cdef class Dictionary: + * cdef class JsonDictionaryCompiler: */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_m); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_m); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - /* "pykeyvi.pyx":224 + /* "pykeyvi.pyx":163 * * * def SetManifest(self, manifest): # <<<<<<<<<<<<<< @@ -7347,7 +6379,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_m); @@ -7356,8 +6388,8 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct return __pyx_r; } -/* "pykeyvi.pyx":232 - * cdef shared_ptr[_Dictionary] inst +/* "pykeyvi.pyx":171 + * cdef shared_ptr[_JsonDictionaryCompiler] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -7365,21 +6397,21 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct */ /* Python wrapper */ -static void __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_10Dictionary___dealloc__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } -static void __pyx_pf_7pykeyvi_10Dictionary___dealloc__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { +static void __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":233 + /* "pykeyvi.pyx":172 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -7388,8 +6420,8 @@ static void __pyx_pf_7pykeyvi_10Dictionary___dealloc__(struct __pyx_obj_7pykeyvi */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":232 - * cdef shared_ptr[_Dictionary] inst + /* "pykeyvi.pyx":171 + * cdef shared_ptr[_JsonDictionaryCompiler] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -7400,513 +6432,304 @@ static void __pyx_pf_7pykeyvi_10Dictionary___dealloc__(struct __pyx_obj_7pykeyvi __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":236 +/* "pykeyvi.pyx":175 * * - * def LookupText(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_3LookupText(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_3LookupText(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { +static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /*proto*/ +static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("LookupText (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_2LookupText(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), (&PyBytes_Type), 1, "in_1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_2__setitem__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0), ((PyObject*)__pyx_v_in_1)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_2LookupText(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_2__setitem__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + std::string __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("LookupText", 0); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "pykeyvi.pyx":237 + /* "pykeyvi.pyx":176 * - * def LookupText(self, bytes in_0 ): + * def __setitem__(self, bytes in_0 , bytes in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' * - * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":239 + /* "pykeyvi.pyx":177 + * def __setitem__(self, bytes in_0 , bytes in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' # <<<<<<<<<<<<<< * - * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->LookupText(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":240 * - * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pykeyvi.pyx":241 - * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result */ - __pyx_v_py_result->it = __pyx_v__r.begin(); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_1); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":242 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result + /* "pykeyvi.pyx":180 * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":243 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< * - * def Lookup(self, bytes in_0 ): + * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def _init_0(self): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->__setitem__(((std::string)__pyx_t_2), ((std::string)__pyx_t_3)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } - /* "pykeyvi.pyx":236 + /* "pykeyvi.pyx":175 * * - * def LookupText(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def __setitem__(self, bytes in_0 , bytes in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * + * assert isinstance(in_1, bytes), 'arg in_1 wrong type' */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.LookupText", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":245 - * return py_result +/* "pykeyvi.pyx":182 + * self.inst.get().__setitem__((in_0), (in_1)) * - * def Lookup(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_5Lookup(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_5Lookup(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_5_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_5_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Lookup (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_4Lookup(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_4_init_0(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_4_init_0(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Lookup", 0); + __Pyx_RefNannySetupContext("_init_0", 0); - /* "pykeyvi.pyx":246 + /* "pykeyvi.pyx":183 * - * def Lookup(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * def _init_0(self): + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) # <<<<<<<<<<<<<< * - * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) + * def _init_1(self, memory_limit ): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + try { + __pyx_t_1 = new keyvi::dictionary::JsonDictionaryCompiler(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - #endif - - /* "pykeyvi.pyx":248 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->Lookup(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":249 - * - * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pykeyvi.pyx":250 - * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":251 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":252 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< - * - * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":245 - * return py_result + /* "pykeyvi.pyx":182 + * self.inst.get().__setitem__((in_0), (in_1)) * - * def Lookup(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.Lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":254 - * return py_result +/* "pykeyvi.pyx":185 + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) + * + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - PyObject *__pyx_v_minimum_prefix_length = 0; +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_7_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_7_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + size_t __pyx_t_4; + keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_GetNear_0 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_minimum_prefix_length,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minimum_prefix_length)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_GetNear_0", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetNear_0") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_minimum_prefix_length = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_GetNear_0", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_0", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_6_GetNear_0(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_in_0, __pyx_v_minimum_prefix_length); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_6_GetNear_0(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_minimum_prefix_length) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - std::string __pyx_t_4; - size_t __pyx_t_5; - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_GetNear_0", 0); - - /* "pykeyvi.pyx":255 - * - * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __Pyx_RefNannySetupContext("_init_1", 0); - /* "pykeyvi.pyx":256 - * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":186 * + * def _init_1(self, memory_limit ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< * + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_minimum_prefix_length); + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_t_3 = PyLong_Check(__pyx_v_minimum_prefix_length); + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); __pyx_t_2 = (__pyx_t_3 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_minimum_prefix_length_wrong); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":259 + /* "pykeyvi.pyx":188 + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< * - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() + * def _init_2(self, memory_limit , dict value_store_params ): */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_minimum_prefix_length); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_6 = __pyx_v_self->inst.get()->GetNear(((std::string)__pyx_t_4), ((size_t)__pyx_t_5)); + __pyx_t_5 = new keyvi::dictionary::JsonDictionaryCompiler(((size_t)__pyx_t_4)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v__r = __pyx_t_6; - - /* "pykeyvi.pyx":260 - * - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_7 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_7); - __pyx_t_7 = 0; - - /* "pykeyvi.pyx":261 - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":262 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); - /* "pykeyvi.pyx":263 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":185 + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) * - * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; - - /* "pykeyvi.pyx":254 - * return py_result + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":265 - * return py_result +/* "pykeyvi.pyx":190 + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) * - * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - PyObject *__pyx_v_minimum_prefix_length = 0; - PyObject *__pyx_v_greedy = 0; +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_memory_limit = 0; + PyObject *__pyx_v_value_store_params = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_GetNear_1 (wrapper)", 0); + __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_minimum_prefix_length,&__pyx_n_s_greedy,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; + PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; @@ -7915,43 +6738,36 @@ static PyObject *__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1(PyObject *__pyx_v_se kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minimum_prefix_length)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_greedy)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetNear_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_minimum_prefix_length = values[1]; - __pyx_v_greedy = values[2]; + __pyx_v_memory_limit = values[0]; + __pyx_v_value_store_params = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_8_GetNear_1(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_in_0, __pyx_v_minimum_prefix_length, __pyx_v_greedy); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8_init_2(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); /* function exit code */ goto __pyx_L0; @@ -7961,707 +6777,626 @@ static PyObject *__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1(PyObject *__pyx_v_se __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator11(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_8_GetNear_1(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_minimum_prefix_length, PyObject *__pyx_v_greedy) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +/* "pykeyvi.pyx":192 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + */ + +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - std::string __pyx_t_4; - size_t __pyx_t_5; - bool __pyx_t_6; - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_t_7; - PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_GetNear_1", 0); - - /* "pykeyvi.pyx":266 - * - * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' - * assert isinstance(greedy, (int, long)), 'arg greedy wrong type' - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_13_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_13_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *) __pyx_self; + __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_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator11, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - #endif - /* "pykeyvi.pyx":267 - * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' # <<<<<<<<<<<<<< - * assert isinstance(greedy, (int, long)), 'arg greedy wrong type' - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_minimum_prefix_length); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_minimum_prefix_length); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_minimum_prefix_length_wrong); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":268 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' - * assert isinstance(greedy, (int, long)), 'arg greedy wrong type' # <<<<<<<<<<<<<< - * - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_greedy); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator11(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_3 = PyLong_Check(__pyx_v_greedy); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L5_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_greedy_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; } } - #endif - - /* "pykeyvi.pyx":272 - * - * - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length), (greedy)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_minimum_prefix_length); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_greedy); if (unlikely((__pyx_t_6 == (bool)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_7 = __pyx_v_self->inst.get()->GetNear(((std::string)__pyx_t_4), ((size_t)__pyx_t_5), ((bool)__pyx_t_6)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; } - __pyx_v__r = __pyx_t_7; - - /* "pykeyvi.pyx":273 - * - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length), (greedy)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_8 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (!(likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "pykeyvi.pyx":274 - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length), (greedy)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":275 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":276 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< - * - * def GetNear(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; - - /* "pykeyvi.pyx":265 - * return py_result - * - * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' - */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator12(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":278 - * return py_result - * - * def GetNear(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetNear_0(*args) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_11GetNear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_11GetNear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetNear (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "GetNear", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_10GetNear(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_args); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_14_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_14_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *) __pyx_self; + __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_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator12, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_10GetNear(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator12(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetNear", 0); - - /* "pykeyvi.pyx":279 - * - * def GetNear(self, *args): - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< - * return self._GetNear_0(*args) - * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): - */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 2) != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyBytes_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - if (__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyInt_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_3 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_6 = PyLong_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = (__pyx_t_6 != 0); - __pyx_t_5 = __pyx_t_3; - __pyx_L7_bool_binop_done:; - __pyx_t_3 = (__pyx_t_5 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "pykeyvi.pyx":280 - * def GetNear(self, *args): - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetNear_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): - * return self._GetNear_1(*args) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetNear_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - - /* "pykeyvi.pyx":279 - * - * def GetNear(self, *args): - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< - * return self._GetNear_0(*args) - * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): - */ - } - - /* "pykeyvi.pyx":281 - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetNear_0(*args) - * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): # <<<<<<<<<<<<<< - * return self._GetNear_1(*args) - * else: - */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 3) != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_3 = PyBytes_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - if (__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_3 = PyInt_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_6 = (__pyx_t_3 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L13_bool_binop_done; + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = PyLong_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__pyx_t_6 != 0); - __pyx_t_5 = __pyx_t_3; - __pyx_L13_bool_binop_done:; - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L9_bool_binop_done; + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 2); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_5 = PyInt_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_3 = __pyx_t_6; - goto __pyx_L15_bool_binop_done; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } } - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 2); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = PyLong_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = (__pyx_t_6 != 0); - __pyx_t_3 = __pyx_t_5; - __pyx_L15_bool_binop_done:; - __pyx_t_5 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L9_bool_binop_done:; - if (__pyx_t_1) { - - /* "pykeyvi.pyx":282 - * return self._GetNear_0(*args) - * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): - * return self._GetNear_1(*args) # <<<<<<<<<<<<<< - * else: - * raise Exception('can not handle type of %s' % (args,)) - */ + /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetNear_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - - /* "pykeyvi.pyx":281 - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetNear_0(*args) - * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): # <<<<<<<<<<<<<< - * return self._GetNear_1(*args) - * else: - */ - } - - /* "pykeyvi.pyx":284 - * return self._GetNear_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< - * - * def _init_0(self, bytes filename ): - */ - /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - - /* "pykeyvi.pyx":278 - * return py_result - * - * def GetNear(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetNear_0(*args) - */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetNear", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":286 - * raise Exception('can not handle type of %s' % (args,)) - * - * def _init_0(self, bytes filename ): # <<<<<<<<<<<<<< - * assert isinstance(filename, bytes), 'arg filename wrong type' +/* "pykeyvi.pyx":190 + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13_init_0(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13_init_0(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyBytes_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_12_init_0(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_filename)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_12_init_0(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_filename) { +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8_init_2(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *__pyx_cur_scope; + std::map *__pyx_v_v1; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; - keyvi::dictionary::Dictionary *__pyx_t_3; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + std::map *__pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + std::string __pyx_t_13; + std::string __pyx_t_14; + size_t __pyx_t_15; + keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_0", 0); + __Pyx_RefNannySetupContext("_init_2", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_12__init_2, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); - /* "pykeyvi.pyx":287 + /* "pykeyvi.pyx":191 * - * def _init_0(self, bytes filename ): - * assert isinstance(filename, bytes), 'arg filename wrong type' # <<<<<<<<<<<<<< + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_filename); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_filename_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":289 - * assert isinstance(filename, bytes), 'arg filename wrong type' - * - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) # <<<<<<<<<<<<<< - * - * def _init_1(self, bytes filename , int in_1 ): - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_filename); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_3 = new keyvi::dictionary::Dictionary(((std::string)__pyx_t_2)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - - /* "pykeyvi.pyx":286 - * raise Exception('can not handle type of %s' % (args,)) - * - * def _init_0(self, bytes filename ): # <<<<<<<<<<<<<< - * assert isinstance(filename, bytes), 'arg filename wrong type' - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":291 - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) - * - * def _init_1(self, bytes filename , int in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(filename, bytes), 'arg filename wrong type' - * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_15_init_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_15_init_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_filename = 0; - int __pyx_v_in_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_in_1,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_init_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; } - __pyx_v_filename = ((PyObject*)values[0]); - __pyx_v_in_1 = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_in_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_init_1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyBytes_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_14_init_1(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_filename, __pyx_v_in_1); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_14_init_1(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_v_in_1) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - keyvi::dictionary::Dictionary *__pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_1", 0); - - /* "pykeyvi.pyx":292 - * - * def _init_1(self, bytes filename , int in_1 ): - * assert isinstance(filename, bytes), 'arg filename wrong type' # <<<<<<<<<<<<<< - * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_filename); + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_filename_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":293 - * def _init_1(self, bytes filename , int in_1 ): - * assert isinstance(filename, bytes), 'arg filename wrong type' - * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":192 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - switch (__pyx_v_in_1) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - __pyx_t_1 = 1; - break; - default: - __pyx_t_1 = 0; - break; + __pyx_t_4 = __pyx_cur_scope->__pyx_v_value_store_params; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = PyDict_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; } - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_5 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_t_3; + __pyx_L5_bool_binop_done:; + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":296 - * - * - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":194 + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * - * def __init__(self, *args): + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_filename); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_3 = new keyvi::dictionary::Dictionary(((std::string)__pyx_t_2), ((keyvi::dictionary::loading_strategy_types)__pyx_v_in_1)); + __pyx_t_6 = new std::map (); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":291 - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) + /* "pykeyvi.pyx":195 * - * def _init_1(self, bytes filename , int in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(filename, bytes), 'arg filename wrong type' - * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) + */ + if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_8(__pyx_t_5); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); + __pyx_t_10 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; + index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = NULL; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L11_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); + __pyx_t_10 = 0; + + /* "pykeyvi.pyx":196 + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) + * del v1 + */ + __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); + + /* "pykeyvi.pyx":195 + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) + */ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":197 + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< + * del v1 + * + */ + __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_16 = new keyvi::dictionary::JsonDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); + + /* "pykeyvi.pyx":198 + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit), deref(v1))) + * del v1 # <<<<<<<<<<<<<< + * + * def __init__(self, *args): + */ + delete __pyx_v_v1; + + /* "pykeyvi.pyx":190 + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) + * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":298 - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) +/* "pykeyvi.pyx":200 + * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==1) and (isinstance(args[0], bytes)): + * if not args: * self._init_0(*args) */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_10Dictionary_17__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_10Dictionary_17__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; int __pyx_r; __Pyx_RefNannyDeclarations @@ -8669,1925 +7404,1640 @@ static int __pyx_pw_7pykeyvi_10Dictionary_17__init__(PyObject *__pyx_v_self, PyO if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_16__init__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_args); + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_10__init__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator13(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static int __pyx_pf_7pykeyvi_10Dictionary_16__init__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { - int __pyx_r; +/* "pykeyvi.pyx":205 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: + */ + +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_16_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *) __pyx_self; + __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_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator13, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "pykeyvi.pyx":299 - * - * def __init__(self, *args): - * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): - */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 1) != 0); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator13(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyBytes_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "pykeyvi.pyx":300 - * def __init__(self, *args): - * if (len(args)==1) and (isinstance(args[0], bytes)): - * self._init_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): - * self._init_1(*args) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "pykeyvi.pyx":299 - * - * def __init__(self, *args): - * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): - */ - goto __pyx_L3; - } - - /* "pykeyvi.pyx":301 - * if (len(args)==1) and (isinstance(args[0], bytes)): - * self._init_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): # <<<<<<<<<<<<<< - * self._init_1(*args) - * else: - */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((__pyx_t_2 == 2) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = PyBytes_Check(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L6_bool_binop_done; - } - __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v_args, 1)); - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_6, 6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { + __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_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_7, 7, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __pyx_t_5; - __pyx_L9_bool_binop_done:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L6_bool_binop_done:; - if (__pyx_t_1) { - - /* "pykeyvi.pyx":302 - * self._init_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): - * self._init_1(*args) # <<<<<<<<<<<<<< - * else: - * raise Exception('can not handle type of %s' % (args,)) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "pykeyvi.pyx":301 - * if (len(args)==1) and (isinstance(args[0], bytes)): - * self._init_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): # <<<<<<<<<<<<<< - * self._init_1(*args) - * else: - */ - goto __pyx_L3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } } - - /* "pykeyvi.pyx":304 - * self._init_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< - * - * def Get(self, bytes in_0 ): - */ /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; } - __pyx_L3:; - - /* "pykeyvi.pyx":298 - * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) - * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==1) and (isinstance(args[0], bytes)): - * self._init_0(*args) - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.Dictionary.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":306 - * raise Exception('can not handle type of %s' % (args,)) - * - * def Get(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_19Get(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_19Get(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Get (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_18Get(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator14(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_18Get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Get", 0); - - /* "pykeyvi.pyx":307 - * - * def Get(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_17_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *) __pyx_self; + __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_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator14, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - #endif - - /* "pykeyvi.pyx":309 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->Get(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":310 - * - * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pykeyvi.pyx":311 - * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":312 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":313 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< - * - * def get (self, key, default = None): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; - - /* "pykeyvi.pyx":306 - * raise Exception('can not handle type of %s' % (args,)) - * - * def Get(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.Get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":315 - * return py_result - * - * def get (self, key, default = None): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_21get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_21get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_key = 0; - PyObject *__pyx_v_default = 0; +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator14(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + int __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } break; - default: goto __pyx_L5_argtuple_error; } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; } - __pyx_v_key = values[0]; - __pyx_v_default = values[1]; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary.get", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_20get(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_key, __pyx_v_default); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_20get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) { - boost::shared_ptr __pyx_v__r; - struct __pyx_obj_7pykeyvi_Match *__pyx_v_py_result = 0; - PyObject *__pyx_r = NULL; +/* "pykeyvi.pyx":200 + * del v1 + * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) + */ + +static int __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_10__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *__pyx_cur_scope; + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get", 0); - __Pyx_INCREF(__pyx_v_key); + __Pyx_RefNannySetupContext("__init__", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_15___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_15___init__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_args = __pyx_v_args; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - /* "pykeyvi.pyx":316 + /* "pykeyvi.pyx":201 * - * def get (self, key, default = None): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') - * assert isinstance(key, bytes), 'arg in_0 wrong type' + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":317 - * def get (self, key, default = None): - * if isinstance(key, unicode): - * key = key.encode('utf-8') # <<<<<<<<<<<<<< - * assert isinstance(key, bytes), 'arg in_0 wrong type' - * + /* "pykeyvi.pyx":202 + * def __init__(self, *args): + * if not args: + * self._init_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":316 + /* "pykeyvi.pyx":201 * - * def get (self, key, default = None): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') - * assert isinstance(key, bytes), 'arg in_0 wrong type' + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ + goto __pyx_L3; } - /* "pykeyvi.pyx":318 - * if isinstance(key, unicode): - * key = key.encode('utf-8') - * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) + /* "pykeyvi.pyx":203 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyBytes_Check(__pyx_v_key); - if (unlikely(!(__pyx_t_2 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __pyx_t_4 = __pyx_cur_scope->__pyx_v_args; + __Pyx_INCREF(__pyx_t_4); + if (unlikely(__pyx_t_4 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - #endif - - /* "pykeyvi.pyx":320 - * assert isinstance(key, bytes), 'arg in_0 wrong type' - * - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) # <<<<<<<<<<<<<< - * - * if _r.get().IsEmpty(): - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = boost::shared_ptr (new keyvi::dictionary::Match(((*__pyx_v_self->inst.get())[((std::string)__pyx_t_5)]))); - - /* "pykeyvi.pyx":322 - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) - * - * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< - * return default - * cdef Match py_result = Match.__new__(Match) - */ - __pyx_t_2 = (__pyx_v__r.get()->IsEmpty() != 0); + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = PyInt_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = (__pyx_t_6 != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_1 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = PyLong_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__pyx_t_7 != 0); + __pyx_t_1 = __pyx_t_6; + __pyx_L6_bool_binop_done:; + __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":323 - * - * if _r.get().IsEmpty(): - * return default # <<<<<<<<<<<<<< - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r + /* "pykeyvi.pyx":204 + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) # <<<<<<<<<<<<<< + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + * self._init_2(*args) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_default); - __pyx_r = __pyx_v_default; - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":322 - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) - * - * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< - * return default - * cdef Match py_result = Match.__new__(Match) + /* "pykeyvi.pyx":203 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): */ + goto __pyx_L3; } - /* "pykeyvi.pyx":324 - * if _r.get().IsEmpty(): - * return default - * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< - * py_result.inst = _r - * return py_result + /* "pykeyvi.pyx":205 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: */ - __pyx_t_4 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_cur_scope->__pyx_v_args; + __Pyx_INCREF(__pyx_t_3); + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((__pyx_t_5 == 2) != 0); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyInt_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = (__pyx_t_1 != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = PyLong_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_t_7 != 0); + __pyx_t_6 = __pyx_t_1; + __pyx_L11_bool_binop_done:; + __pyx_t_1 = (__pyx_t_6 != 0); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyDict_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_4 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_6; + __pyx_L8_bool_binop_done:; + if (__pyx_t_2) { - /* "pykeyvi.pyx":325 - * return default - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r # <<<<<<<<<<<<<< - * return py_result - * + /* "pykeyvi.pyx":206 + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + * self._init_2(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) */ - __pyx_v_py_result->inst = __pyx_v__r; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":326 - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r - * return py_result # <<<<<<<<<<<<<< - * - * def __contains__(self, key): + /* "pykeyvi.pyx":205 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + goto __pyx_L3; + } - /* "pykeyvi.pyx":315 - * return py_result + /* "pykeyvi.pyx":208 + * self._init_2(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def get (self, key, default = None): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') + * def WriteToFile(self, bytes in_0 ): + */ + /*else*/ { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "pykeyvi.pyx":200 + * del v1 + * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.get", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":328 - * return py_result +/* "pykeyvi.pyx":210 + * raise Exception('can not handle type of %s' % (args,)) + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __contains__(self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_10Dictionary_23__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ -static int __pyx_pw_7pykeyvi_10Dictionary_23__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_22__contains__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_12WriteToFile(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_10Dictionary_22__contains__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key) { - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__contains__", 0); - __Pyx_INCREF(__pyx_v_key); - - /* "pykeyvi.pyx":329 - * - * def __contains__(self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') - * - */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "pykeyvi.pyx":330 - * def __contains__(self, key): - * if isinstance(key, unicode): - * key = key.encode('utf-8') # <<<<<<<<<<<<<< - * - * assert isinstance(key, bytes), 'arg in_0 wrong type' - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; - - /* "pykeyvi.pyx":329 - * - * def __contains__(self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') - * - */ - } + __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":332 - * key = key.encode('utf-8') + /* "pykeyvi.pyx":211 * - * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * return self.inst.get().Contains(key) + * self.inst.get().WriteToFile((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyBytes_Check(__pyx_v_key); - if (unlikely(!(__pyx_t_2 != 0))) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":334 - * assert isinstance(key, bytes), 'arg in_0 wrong type' + /* "pykeyvi.pyx":213 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * return self.inst.get().Contains(key) # <<<<<<<<<<<<<< + * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * def __len__(self): + * def __enter__(self): */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_v_self->inst.get()->Contains(__pyx_t_5); - goto __pyx_L0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->WriteToFile(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":328 - * return py_result + /* "pykeyvi.pyx":210 + * raise Exception('can not handle type of %s' % (args,)) + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __contains__(self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":336 - * return self.inst.get().Contains(key) +/* "pykeyvi.pyx":215 + * self.inst.get().WriteToFile((in_0)) * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.inst.get().GetSize() + * def __enter__(self): # <<<<<<<<<<<<<< + * return self * */ /* Python wrapper */ -static Py_ssize_t __pyx_pw_7pykeyvi_10Dictionary_25__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_7pykeyvi_10Dictionary_25__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_24__len__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_14__enter__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_pf_7pykeyvi_10Dictionary_24__len__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_14__enter__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); + __Pyx_RefNannySetupContext("__enter__", 0); - /* "pykeyvi.pyx":337 + /* "pykeyvi.pyx":216 + * + * def __enter__(self): + * return self # <<<<<<<<<<<<<< * - * def __len__(self): - * return self.inst.get().GetSize() # <<<<<<<<<<<<<< * - * def __getitem__ (self, key): */ - __pyx_r = __pyx_v_self->inst.get()->GetSize(); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "pykeyvi.pyx":336 - * return self.inst.get().Contains(key) + /* "pykeyvi.pyx":215 + * self.inst.get().WriteToFile((in_0)) * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.inst.get().GetSize() + * def __enter__(self): # <<<<<<<<<<<<<< + * return self * */ /* function exit code */ __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":339 - * return self.inst.get().GetSize() +/* "pykeyvi.pyx":219 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() * - * def __getitem__ (self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_26__getitem__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_key)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_26__getitem__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key) { - boost::shared_ptr __pyx_v__r; - struct __pyx_obj_7pykeyvi_Match *__pyx_v_py_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_type = 0; + CYTHON_UNUSED PyObject *__pyx_v_value = 0; + CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - __Pyx_INCREF(__pyx_v_key); - - /* "pykeyvi.pyx":340 - * - * def __getitem__ (self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') - * - */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "pykeyvi.pyx":341 - * def __getitem__ (self, key): - * if isinstance(key, unicode): - * key = key.encode('utf-8') # <<<<<<<<<<<<<< - * - * assert isinstance(key, bytes), 'arg in_0 wrong type' - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; - - /* "pykeyvi.pyx":340 - * - * def __getitem__ (self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') - * - */ - } - - /* "pykeyvi.pyx":343 - * key = key.encode('utf-8') - * - * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyBytes_Check(__pyx_v_key); - if (unlikely(!(__pyx_t_2 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } + __pyx_v_type = values[0]; + __pyx_v_value = values[1]; + __pyx_v_traceback = values[2]; } - #endif + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); - /* "pykeyvi.pyx":345 - * assert isinstance(key, bytes), 'arg in_0 wrong type' - * - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) # <<<<<<<<<<<<<< - * - * if _r.get().IsEmpty(): - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = boost::shared_ptr (new keyvi::dictionary::Match(((*__pyx_v_self->inst.get())[((std::string)__pyx_t_5)]))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":347 - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) - * - * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) - */ - __pyx_t_2 = (__pyx_v__r.get()->IsEmpty() != 0); - if (__pyx_t_2) { +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_16__exit__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__exit__", 0); - /* "pykeyvi.pyx":348 + /* "pykeyvi.pyx":220 + * + * def __exit__(self, type, value, traceback): + * self.Compile() # <<<<<<<<<<<<<< * - * if _r.get().IsEmpty(): - * raise KeyError(key) # <<<<<<<<<<<<<< - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_key); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pykeyvi.pyx":347 - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) * - * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":349 - * if _r.get().IsEmpty(): - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< - * py_result.inst = _r - * return py_result - */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pykeyvi.pyx":350 - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r # <<<<<<<<<<<<<< - * return py_result + /* "pykeyvi.pyx":219 * - */ - __pyx_v_py_result->inst = __pyx_v__r; - - /* "pykeyvi.pyx":351 - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r - * return py_result # <<<<<<<<<<<<<< * - * def _key_iterator_wrapper(self, iterator): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; - - /* "pykeyvi.pyx":339 - * return self.inst.get().GetSize() + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() * - * def __getitem__ (self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_key); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_30generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":353 - * return py_result +/* "pykeyvi.pyx":223 * - * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetMatchedString() + * + * def Add(self, key , value ): # <<<<<<<<<<<<<< + * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_29_key_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_29_key_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator) { +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_value = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_key_iterator_wrapper (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_28_key_iterator_wrapper(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_iterator)); + __Pyx_RefNannySetupContext("Add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_key = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_18Add(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_key, __pyx_v_value); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_28_key_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_18Add(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + std::string __pyx_v_input_in_0; + std::string __pyx_v_input_in_1; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_key_iterator_wrapper", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(__pyx_ptype_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_v_iterator = __pyx_v_iterator; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_iterator); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_iterator); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_10Dictionary_30generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_key_iterator_wrapper, __pyx_n_s_Dictionary__key_iterator_wrapper); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._key_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_30generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + std::string __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("Add", 0); + __Pyx_INCREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_value); - /* "pykeyvi.pyx":354 + /* "pykeyvi.pyx":224 * - * def _key_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetMatchedString() + * def Add(self, key , value ): + * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' * */ - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_v_iterator; __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_v_iterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyBytes_Check(__pyx_v_key); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_3 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":355 - * def _key_iterator_wrapper(self, iterator): - * for m in iterator: - * yield m.GetMatchedString() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":225 + * def Add(self, key , value ): + * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< * - * def _value_iterator_wrapper(self, iterator): + * if isinstance(key, unicode): */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetMatchedString); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyBytes_Check(__pyx_v_value); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __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_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyUnicode_Check(__pyx_v_value); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":354 + /* "pykeyvi.pyx":227 + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' * - * def _key_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetMatchedString() + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('UTF-8') + * cdef libcpp_string input_in_0 = key + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":228 + * + * if isinstance(key, unicode): + * key = key.encode('UTF-8') # <<<<<<<<<<<<<< + * cdef libcpp_string input_in_0 = key * */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 0; - /* "pykeyvi.pyx":353 - * return py_result + /* "pykeyvi.pyx":227 + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' * - * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetMatchedString() + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('UTF-8') + * cdef libcpp_string input_in_0 = key */ + } - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_key_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_33generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + /* "pykeyvi.pyx":229 + * if isinstance(key, unicode): + * key = key.encode('UTF-8') + * cdef libcpp_string input_in_0 = key # <<<<<<<<<<<<<< + * + * if isinstance(value, unicode): + */ + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((std::string)__pyx_t_6); -/* "pykeyvi.pyx":357 - * yield m.GetMatchedString() + /* "pykeyvi.pyx":231 + * cdef libcpp_string input_in_0 = key * - * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetRawValueAsString() + * if isinstance(value, unicode): # <<<<<<<<<<<<<< + * value = value.encode('UTF-8') + * cdef libcpp_string input_in_1 = value */ + __pyx_t_2 = PyUnicode_Check(__pyx_v_value); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_32_value_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_32_value_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_value_iterator_wrapper (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_31_value_iterator_wrapper(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_iterator)); + /* "pykeyvi.pyx":232 + * + * if isinstance(value, unicode): + * value = value.encode('UTF-8') # <<<<<<<<<<<<<< + * cdef libcpp_string input_in_1 = value + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4); + __pyx_t_4 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_31_value_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_value_iterator_wrapper", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(__pyx_ptype_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_v_iterator = __pyx_v_iterator; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_iterator); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_iterator); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_10Dictionary_33generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_value_iterator_wrapper, __pyx_n_s_Dictionary__value_iterator_wrapp); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._value_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_33generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pykeyvi.pyx":358 - * - * def _value_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetRawValueAsString() + /* "pykeyvi.pyx":231 + * cdef libcpp_string input_in_0 = key * + * if isinstance(value, unicode): # <<<<<<<<<<<<<< + * value = value.encode('UTF-8') + * cdef libcpp_string input_in_1 = value */ - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_v_iterator; __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_v_iterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - /* "pykeyvi.pyx":359 - * def _value_iterator_wrapper(self, iterator): - * for m in iterator: - * yield m.GetRawValueAsString() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":233 + * if isinstance(value, unicode): + * value = value.encode('UTF-8') + * cdef libcpp_string input_in_1 = value # <<<<<<<<<<<<<< * - * def _item_iterator_wrapper(self, iterator): + * self.inst.get().Add(input_in_0, input_in_1) */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetRawValueAsString); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __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_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_1 = ((std::string)__pyx_t_6); - /* "pykeyvi.pyx":358 + /* "pykeyvi.pyx":235 + * cdef libcpp_string input_in_1 = value + * + * self.inst.get().Add(input_in_0, input_in_1) # <<<<<<<<<<<<<< * - * def _value_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetRawValueAsString() * */ + try { + __pyx_v_self->inst.get()->Add(__pyx_v_input_in_0, __pyx_v_input_in_1); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":357 - * yield m.GetMatchedString() + /* "pykeyvi.pyx":223 * - * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetRawValueAsString() + * + * def Add(self, key , value ): # <<<<<<<<<<<<<< + * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' */ /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_value_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_36generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":361 - * yield m.GetRawValueAsString() +/* "pykeyvi.pyx":238 * - * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield (m.GetMatchedString(), m.GetRawValueAsString()) + * + * def Compile(self, *args): # <<<<<<<<<<<<<< + * if not args: + * with nogil: */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_35_item_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_35_item_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator) { +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_item_iterator_wrapper (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_34_item_iterator_wrapper(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_iterator)); + __Pyx_RefNannySetupContext("Compile (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_34_item_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { + void *__pyx_v_callback; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_item_iterator_wrapper", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(__pyx_ptype_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_v_iterator = __pyx_v_iterator; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_iterator); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_iterator); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_10Dictionary_36generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_item_iterator_wrapper, __pyx_n_s_Dictionary__item_iterator_wrappe); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("Compile", 0); - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Dictionary._item_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pykeyvi.pyx":239 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() + */ + __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_36generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /* "pykeyvi.pyx":240 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { - /* "pykeyvi.pyx":362 - * - * def _item_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield (m.GetMatchedString(), m.GetRawValueAsString()) + /* "pykeyvi.pyx":241 + * if not args: + * with nogil: + * self.inst.get().Compile() # <<<<<<<<<<<<<< + * return * */ - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_v_iterator; __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_v_iterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->Compile(); + } + + /* "pykeyvi.pyx":240 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; } - break; - } - __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - /* "pykeyvi.pyx":363 - * def _item_iterator_wrapper(self, iterator): - * for m in iterator: - * yield (m.GetMatchedString(), m.GetRawValueAsString()) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":242 + * with nogil: + * self.inst.get().Compile() + * return # <<<<<<<<<<<<<< * - * def GetAllKeys(self): + * cdef void* callback = args[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetMatchedString); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetRawValueAsString); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pykeyvi.pyx":239 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() + */ + } + + /* "pykeyvi.pyx":244 + * return + * + * cdef void* callback = args[0] # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) + */ + __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); + + /* "pykeyvi.pyx":245 + * + * cdef void* callback = args[0] + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile(callback_wrapper, callback) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "pykeyvi.pyx":246 + * cdef void* callback = args[0] + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); } - } - if (__pyx_t_7) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __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_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "pykeyvi.pyx":362 + /* "pykeyvi.pyx":245 * - * def _item_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield (m.GetMatchedString(), m.GetRawValueAsString()) + * cdef void* callback = args[0] + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile(callback_wrapper, callback) * */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":361 - * yield m.GetRawValueAsString() + /* "pykeyvi.pyx":238 * - * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield (m.GetMatchedString(), m.GetRawValueAsString()) + * + * def Compile(self, *args): # <<<<<<<<<<<<<< + * if not args: + * with nogil: */ /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_item_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":365 - * yield (m.GetMatchedString(), m.GetRawValueAsString()) +/* "pykeyvi.pyx":249 * - * def GetAllKeys(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_38GetAllKeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_38GetAllKeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetAllKeys (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { + PyObject *__pyx_v_m = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetAllKeys", 0); + __Pyx_RefNannySetupContext("SetManifest", 0); - /* "pykeyvi.pyx":366 + /* "pykeyvi.pyx":250 + * + * def SetManifest(self, manifest): + * m = json.dumps(manifest) # <<<<<<<<<<<<<< + * self.inst.get().SetManifestFromString(m) * - * def GetAllKeys(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); - - /* "pykeyvi.pyx":367 - * def GetAllKeys(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":368 - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return self._key_iterator_wrapper(py_result) - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":369 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return self._key_iterator_wrapper(py_result) - * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":370 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return self._key_iterator_wrapper(py_result) # <<<<<<<<<<<<<< - * - * def GetAllValues(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_key_iterator_wrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_py_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_result)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_INCREF(__pyx_v_manifest); + __Pyx_GIVEREF(__pyx_v_manifest); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L0; - /* "pykeyvi.pyx":365 - * yield (m.GetMatchedString(), m.GetRawValueAsString()) + /* "pykeyvi.pyx":251 + * def SetManifest(self, manifest): + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< * - * def GetAllKeys(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * cdef class Dictionary: + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_m); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":249 + * + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllKeys", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_m); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":372 - * return self._key_iterator_wrapper(py_result) +/* "pykeyvi.pyx":257 + * cdef shared_ptr[_Dictionary] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def GetAllValues(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_40GetAllValues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_40GetAllValues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static void __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_10Dictionary___dealloc__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_7pykeyvi_10Dictionary___dealloc__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "pykeyvi.pyx":258 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->inst.reset(); + + /* "pykeyvi.pyx":257 + * cdef shared_ptr[_Dictionary] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":261 + * + * + * def LookupText(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_3LookupText(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_3LookupText(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetAllValues (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __Pyx_RefNannySetupContext("LookupText (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_2LookupText(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_2LookupText(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + std::string __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetAllValues", 0); + __Pyx_RefNannySetupContext("LookupText", 0); - /* "pykeyvi.pyx":373 + /* "pykeyvi.pyx":262 * - * def GetAllValues(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * def LookupText(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":264 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->LookupText(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":374 - * def GetAllValues(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + /* "pykeyvi.pyx":265 + * + * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< * py_result.it = _r.begin() * py_result.end = _r.end() */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); + __pyx_t_3 = 0; - /* "pykeyvi.pyx":375 - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + /* "pykeyvi.pyx":266 + * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() # <<<<<<<<<<<<<< * py_result.end = _r.end() - * return self._value_iterator_wrapper(py_result) + * return py_result */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":376 + /* "pykeyvi.pyx":267 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return self._value_iterator_wrapper(py_result) + * return py_result * */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":377 + /* "pykeyvi.pyx":268 * py_result.it = _r.begin() * py_result.end = _r.end() - * return self._value_iterator_wrapper(py_result) # <<<<<<<<<<<<<< + * return py_result # <<<<<<<<<<<<<< * - * def GetAllItems(self): + * def Lookup(self, bytes in_0 ): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value_iterator_wrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_py_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_result)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":372 - * return self._key_iterator_wrapper(py_result) + /* "pykeyvi.pyx":261 + * + * + * def LookupText(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetAllValues(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllValues", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.LookupText", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_py_result); @@ -10596,135 +9046,130 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(struct __pyx_obj_ return __pyx_r; } -/* "pykeyvi.pyx":379 - * return self._value_iterator_wrapper(py_result) +/* "pykeyvi.pyx":270 + * return py_result + * + * def Lookup(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetAllItems(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_42GetAllItems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_42GetAllItems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_5Lookup(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_5Lookup(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetAllItems (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __Pyx_RefNannySetupContext("Lookup (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_4Lookup(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + std::string __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetAllItems", 0); + __Pyx_RefNannySetupContext("Lookup", 0); - /* "pykeyvi.pyx":380 + /* "pykeyvi.pyx":271 * - * def GetAllItems(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * def Lookup(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":273 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Lookup(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":381 - * def GetAllItems(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + /* "pykeyvi.pyx":274 + * + * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< * py_result.it = _r.begin() * py_result.end = _r.end() */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); + __pyx_t_3 = 0; - /* "pykeyvi.pyx":382 - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + /* "pykeyvi.pyx":275 + * cdef _MatchIteratorPair _r = self.inst.get().Lookup((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() # <<<<<<<<<<<<<< * py_result.end = _r.end() - * return self._item_iterator_wrapper(py_result) + * return py_result */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":383 + /* "pykeyvi.pyx":276 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return self._item_iterator_wrapper(py_result) + * return py_result * */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":384 + /* "pykeyvi.pyx":277 * py_result.it = _r.begin() * py_result.end = _r.end() - * return self._item_iterator_wrapper(py_result) # <<<<<<<<<<<<<< + * return py_result # <<<<<<<<<<<<<< * - * def GetManifest(self): + * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_item_iterator_wrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_py_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_result)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":379 - * return self._value_iterator_wrapper(py_result) + /* "pykeyvi.pyx":270 + * return py_result + * + * def Lookup(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetAllItems(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllItems", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.Lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_py_result); @@ -10733,755 +9178,724 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(struct __pyx_obj_7 return __pyx_r; } -/* "pykeyvi.pyx":386 - * return self._item_iterator_wrapper(py_result) +/* "pykeyvi.pyx":279 + * return py_result * - * def GetManifest(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r + * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_44GetManifest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_44GetManifest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + PyObject *__pyx_v_minimum_prefix_length = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_43GetManifest(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __Pyx_RefNannySetupContext("_GetNear_0 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_minimum_prefix_length,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minimum_prefix_length)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_GetNear_0", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetNear_0") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_minimum_prefix_length = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_GetNear_0", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_6_GetNear_0(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_in_0, __pyx_v_minimum_prefix_length); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_43GetManifest(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { - std::string __pyx_v__r; - PyObject *__pyx_v_py_result = 0; - PyObject *__pyx_v_json = NULL; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_6_GetNear_0(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_minimum_prefix_length) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + std::string __pyx_t_4; + size_t __pyx_t_5; + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetManifest", 0); + __Pyx_RefNannySetupContext("_GetNear_0", 0); - /* "pykeyvi.pyx":387 + /* "pykeyvi.pyx":280 + * + * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' * - * def GetManifest(self): - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() # <<<<<<<<<<<<<< - * cdef bytes py_result = _r - * import json */ - try { - __pyx_t_1 = __pyx_v_self->inst.get()->GetManifestAsString(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } - __pyx_v__r = __pyx_t_1; - - /* "pykeyvi.pyx":388 - * def GetManifest(self): - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r # <<<<<<<<<<<<<< - * import json - * return json.loads(py_result) - */ - __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v__r); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_py_result = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + #endif - /* "pykeyvi.pyx":389 - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r - * import json # <<<<<<<<<<<<<< - * return json.loads(py_result) + /* "pykeyvi.pyx":281 + * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' # <<<<<<<<<<<<<< * - */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_json = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pykeyvi.pyx":390 - * cdef bytes py_result = _r - * import json - * return json.loads(py_result) # <<<<<<<<<<<<<< * - * def GetStatistics(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_minimum_prefix_length); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_minimum_prefix_length); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_minimum_prefix_length_wrong); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_py_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_py_result); - __Pyx_GIVEREF(__pyx_v_py_result); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_py_result); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + + /* "pykeyvi.pyx":284 + * + * + * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_minimum_prefix_length); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_6 = __pyx_v_self->inst.get()->GetNear(((std::string)__pyx_t_4), ((size_t)__pyx_t_5)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v__r = __pyx_t_6; + + /* "pykeyvi.pyx":285 + * + * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() + */ + __pyx_t_7 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_7); + __pyx_t_7 = 0; + + /* "pykeyvi.pyx":286 + * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return py_result + */ + __pyx_v_py_result->it = __pyx_v__r.begin(); + + /* "pykeyvi.pyx":287 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":288 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< + * + * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":386 - * return self._item_iterator_wrapper(py_result) + /* "pykeyvi.pyx":279 + * return py_result * - * def GetManifest(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r + * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_json); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":392 - * return json.loads(py_result) +/* "pykeyvi.pyx":290 + * return py_result * - * def GetStatistics(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _r + * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_46GetStatistics(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_46GetStatistics(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + PyObject *__pyx_v_minimum_prefix_length = 0; + PyObject *__pyx_v_greedy = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetStatistics (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); - - /* function exit code */ + __Pyx_RefNannySetupContext("_GetNear_1 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_minimum_prefix_length,&__pyx_n_s_greedy,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minimum_prefix_length)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_greedy)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetNear_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_minimum_prefix_length = values[1]; + __pyx_v_greedy = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":397 - * import json - * return {k: json.loads(v) for k, v in filter( - * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], # <<<<<<<<<<<<<< - * [s.rstrip().split("\n") for s in py_result.split("\n\n")] - * )} - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_8genexpr8_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_kv); /*proto*/ -static PyMethodDef __pyx_mdef_7pykeyvi_10Dictionary_13GetStatistics_8genexpr8_lambda8 = {"lambda8", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_8genexpr8_lambda8, METH_O, 0}; -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_8genexpr8_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_kv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, ((PyObject *)__pyx_v_kv)); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_8_GetNear_1(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_in_0, __pyx_v_minimum_prefix_length, __pyx_v_greedy); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv) { +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_8_GetNear_1(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_minimum_prefix_length, PyObject *__pyx_v_greedy) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; + int __pyx_t_3; + std::string __pyx_t_4; + size_t __pyx_t_5; + bool __pyx_t_6; + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_t_7; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda8", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_kv); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_kv); - __pyx_t_1 = __pyx_v_kv; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_2 = PyList_Check(__pyx_v_kv); - if (__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_4 = PyObject_Length(__pyx_v_kv); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (__pyx_t_4 > 1); - if (__pyx_t_2) { - } else { - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_kv, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __Pyx_RefNannySetupContext("_GetNear_1", 0); -/* "pykeyvi.pyx":392 - * return json.loads(py_result) + /* "pykeyvi.pyx":291 * - * def GetStatistics(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _r + * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' + * assert isinstance(greedy, (int, long)), 'arg greedy wrong type' */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { - std::string __pyx_v__r; - PyObject *__pyx_v_py_result = 0; - PyObject *__pyx_v_json = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetStatistics", 0); + /* "pykeyvi.pyx":292 + * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' # <<<<<<<<<<<<<< + * assert isinstance(greedy, (int, long)), 'arg greedy wrong type' + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_minimum_prefix_length); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_minimum_prefix_length); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_minimum_prefix_length_wrong); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":393 + /* "pykeyvi.pyx":293 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' + * assert isinstance(greedy, (int, long)), 'arg greedy wrong type' # <<<<<<<<<<<<<< + * * - * def GetStatistics(self): - * cdef libcpp_string _r = self.inst.get().GetStatistics() # <<<<<<<<<<<<<< - * cdef bytes py_result = _r - * import json */ - __pyx_v__r = __pyx_v_self->inst.get()->GetStatistics(); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_greedy); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_greedy); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_greedy_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":394 - * def GetStatistics(self): - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _r # <<<<<<<<<<<<<< - * import json - * return {k: json.loads(v) for k, v in filter( + /* "pykeyvi.pyx":297 + * + * + * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length), (greedy)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v__r); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_py_result = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_minimum_prefix_length); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_greedy); if (unlikely((__pyx_t_6 == (bool)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_7 = __pyx_v_self->inst.get()->GetNear(((std::string)__pyx_t_4), ((size_t)__pyx_t_5), ((bool)__pyx_t_6)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v__r = __pyx_t_7; - /* "pykeyvi.pyx":395 - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _r - * import json # <<<<<<<<<<<<<< - * return {k: json.loads(v) for k, v in filter( - * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], + /* "pykeyvi.pyx":298 + * + * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length), (greedy)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_json = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_8 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (!(likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_8); + __pyx_t_8 = 0; - /* "pykeyvi.pyx":396 - * cdef bytes py_result = _r - * import json - * return {k: json.loads(v) for k, v in filter( # <<<<<<<<<<<<<< - * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], - * [s.rstrip().split("\n") for s in py_result.split("\n\n")] + /* "pykeyvi.pyx":299 + * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length), (greedy)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return py_result */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - PyObject *__pyx_8genexpr8__pyx_v_k = NULL; - PyObject *__pyx_8genexpr8__pyx_v_v = NULL; - PyObject *__pyx_8genexpr8__pyx_v_s = NULL; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":397 - * import json - * return {k: json.loads(v) for k, v in filter( - * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], # <<<<<<<<<<<<<< - * [s.rstrip().split("\n") for s in py_result.split("\n\n")] - * )} + /* "pykeyvi.pyx":300 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result + * */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7pykeyvi_10Dictionary_13GetStatistics_8genexpr8_lambda8, 0, __pyx_n_s_GetStatistics_locals_lambda, NULL, __pyx_n_s_pykeyvi, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":398 - * return {k: json.loads(v) for k, v in filter( - * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], - * [s.rstrip().split("\n") for s in py_result.split("\n\n")] # <<<<<<<<<<<<<< - * )} + /* "pykeyvi.pyx":301 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * + * def GetNear(self, *args): */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_result, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_7(__pyx_t_4); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_s, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr8__pyx_v_s, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (__pyx_t_9) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "pykeyvi.pyx":396 - * cdef bytes py_result = _r - * import json - * return {k: json.loads(v) for k, v in filter( # <<<<<<<<<<<<<< - * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], - * [s.rstrip().split("\n") for s in py_result.split("\n\n")] - */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_filter, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_7(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_5); - #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_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L11_unpacking_done; - __pyx_L10_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __pyx_L11_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_k, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_v, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_2) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_8genexpr8__pyx_v_v); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_8genexpr8__pyx_v_v); - __Pyx_GIVEREF(__pyx_8genexpr8__pyx_v_v); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_8genexpr8__pyx_v_v); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr8__pyx_v_k, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_k); - __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_v); - __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_s); - goto __pyx_L12_exit_scope; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_k); - __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_v); - __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_s); - goto __pyx_L1_error; - __pyx_L12_exit_scope:; - } /* exit inner scope */ - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "pykeyvi.pyx":392 - * return json.loads(py_result) - * - * def GetStatistics(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _r + /* "pykeyvi.pyx":290 + * return py_result + * + * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(minimum_prefix_length, (int, long)), 'arg minimum_prefix_length wrong type' */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_json); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":405 - * cdef shared_ptr[_FsaTransform] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_12FsaTransform___dealloc__(((struct __pyx_obj_7pykeyvi_FsaTransform *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_12FsaTransform___dealloc__(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":406 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":405 - * cdef shared_ptr[_FsaTransform] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":409 - * - * - * def Normalize(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' +/* "pykeyvi.pyx":303 + * return py_result * + * def GetNear(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetNear_0(*args) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_12FsaTransform_3Normalize(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_12FsaTransform_3Normalize(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_11GetNear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_11GetNear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Normalize (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_12FsaTransform_2Normalize(((struct __pyx_obj_7pykeyvi_FsaTransform *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("GetNear (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "GetNear", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_10GetNear(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_args); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_12FsaTransform_2Normalize(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self, PyObject *__pyx_v_in_0) { - std::string __pyx_v__r; - std::string __pyx_v_py_result; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_10GetNear(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Normalize", 0); + __Pyx_RefNannySetupContext("GetNear", 0); - /* "pykeyvi.pyx":410 - * - * def Normalize(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":304 * - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + * def GetNear(self, *args): + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< + * return self._GetNear_0(*args) + * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((__pyx_t_2 == 2) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; } - #endif - - /* "pykeyvi.pyx":412 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->Normalize(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":413 - * - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) - * py_result = _r # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result = ((std::string)__pyx_v__r); - - /* "pykeyvi.pyx":414 - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) - * py_result = _r - * return py_result # <<<<<<<<<<<<<< - * - * def __init__(self, Dictionary in_0 ): + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyBytes_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = (__pyx_t_3 != 0); + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyInt_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__pyx_t_3 != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = PyLong_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = (__pyx_t_6 != 0); + __pyx_t_5 = __pyx_t_3; + __pyx_L7_bool_binop_done:; + __pyx_t_3 = (__pyx_t_5 != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "pykeyvi.pyx":305 + * def GetNear(self, *args): + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetNear_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): + * return self._GetNear_1(*args) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetNear_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; - /* "pykeyvi.pyx":409 + /* "pykeyvi.pyx":304 * + * def GetNear(self, *args): + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< + * return self._GetNear_0(*args) + * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): + */ + } + + /* "pykeyvi.pyx":306 + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetNear_0(*args) + * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): # <<<<<<<<<<<<<< + * return self._GetNear_1(*args) + * else: + */ + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((__pyx_t_2 == 3) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = PyBytes_Check(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = (__pyx_t_3 != 0); + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = PyInt_Check(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = (__pyx_t_3 != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_6 = PyLong_Check(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = (__pyx_t_6 != 0); + __pyx_t_5 = __pyx_t_3; + __pyx_L13_bool_binop_done:; + __pyx_t_3 = (__pyx_t_5 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 2); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_5 = PyInt_Check(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = (__pyx_t_5 != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_3 = __pyx_t_6; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 2); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_6 = PyLong_Check(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = (__pyx_t_6 != 0); + __pyx_t_3 = __pyx_t_5; + __pyx_L15_bool_binop_done:; + __pyx_t_5 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L9_bool_binop_done:; + if (__pyx_t_1) { + + /* "pykeyvi.pyx":307 + * return self._GetNear_0(*args) + * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): + * return self._GetNear_1(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetNear_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":306 + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetNear_0(*args) + * elif (len(args)==3) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))) and (isinstance(args[2], (int, long))): # <<<<<<<<<<<<<< + * return self._GetNear_1(*args) + * else: + */ + } + + /* "pykeyvi.pyx":309 + * return self._GetNear_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def Normalize(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def _init_0(self, bytes filename ): + */ + /*else*/ { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":303 + * return py_result * + * def GetNear(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetNear_0(*args) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.FsaTransform.Normalize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetNear", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11489,209 +9903,120 @@ static PyObject *__pyx_pf_7pykeyvi_12FsaTransform_2Normalize(struct __pyx_obj_7p return __pyx_r; } -/* "pykeyvi.pyx":416 - * return py_result +/* "pykeyvi.pyx":311 + * raise Exception('can not handle type of %s' % (args,)) + * + * def _init_0(self, bytes filename ): # <<<<<<<<<<<<<< + * assert isinstance(filename, bytes), 'arg filename wrong type' * - * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_12FsaTransform_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_12FsaTransform_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13_init_0(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13_init_0(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_in_0 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.FsaTransform.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_12FsaTransform_4__init__(((struct __pyx_obj_7pykeyvi_FsaTransform *)__pyx_v_self), __pyx_v_in_0); + __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyBytes_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_12_init_0(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_filename)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = -1; + __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_12FsaTransform_4__init__(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0) { - boost::shared_ptr __pyx_v_input_in_0; - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_12_init_0(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - boost::shared_ptr __pyx_t_2; - keyvi::transform::FsaTransform *__pyx_t_3; + std::string __pyx_t_2; + keyvi::dictionary::Dictionary *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("_init_0", 0); - /* "pykeyvi.pyx":417 + /* "pykeyvi.pyx":312 * - * def __init__(self, Dictionary in_0 ): - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) + * def _init_0(self, bytes filename ): + * assert isinstance(filename, bytes), 'arg filename wrong type' # <<<<<<<<<<<<<< + * + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); + __pyx_t_1 = PyBytes_Check(__pyx_v_filename); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_filename_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":418 - * def __init__(self, Dictionary in_0 ): - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) + /* "pykeyvi.pyx":314 + * assert isinstance(filename, bytes), 'arg filename wrong type' * - */ - __pyx_t_2 = __pyx_v_in_0->inst; - __pyx_v_input_in_0 = __pyx_t_2; - - /* "pykeyvi.pyx":419 - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) # <<<<<<<<<<<<<< * - * cdef class PrefixCompletion: + * def _init_1(self, bytes filename , int in_1 ): */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_filename); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_3 = new keyvi::transform::FsaTransform(__pyx_v_input_in_0); + __pyx_t_3 = new keyvi::dictionary::Dictionary(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":416 - * return py_result + /* "pykeyvi.pyx":311 + * raise Exception('can not handle type of %s' % (args,)) + * + * def _init_0(self, bytes filename ): # <<<<<<<<<<<<<< + * assert isinstance(filename, bytes), 'arg filename wrong type' * - * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.FsaTransform.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pykeyvi.Dictionary._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":425 - * cdef shared_ptr[_PrefixCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":426 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":425 - * cdef shared_ptr[_PrefixCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":429 - * +/* "pykeyvi.pyx":316 + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) * - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * def _init_1(self, bytes filename , int in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(filename, bytes), 'arg filename wrong type' + * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - PyObject *__pyx_v_max_edit_distance = 0; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_15_init_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_15_init_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + int __pyx_v_in_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetFuzzyCompletions (wrapper)", 0); + __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_max_edit_distance,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_in_1,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -11705,16 +10030,16 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_edit_distance)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("GetFuzzyCompletions", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "GetFuzzyCompletions") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -11722,19 +10047,19 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObj values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_max_edit_distance = values[1]; + __pyx_v_filename = ((PyObject*)values[0]); + __pyx_v_in_1 = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_in_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("GetFuzzyCompletions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetFuzzyCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_max_edit_distance); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyBytes_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_14_init_1(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_filename, __pyx_v_in_1); /* function exit code */ goto __pyx_L0; @@ -11745,473 +10070,383 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObj return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_max_edit_distance) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_14_init_1(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_filename, int __pyx_v_in_1) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - std::string __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + std::string __pyx_t_2; + keyvi::dictionary::Dictionary *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetFuzzyCompletions", 0); + __Pyx_RefNannySetupContext("_init_1", 0); - /* "pykeyvi.pyx":430 + /* "pykeyvi.pyx":317 * - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * def _init_1(self, bytes filename , int in_1 ): + * assert isinstance(filename, bytes), 'arg filename wrong type' # <<<<<<<<<<<<<< + * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + __pyx_t_1 = PyBytes_Check(__pyx_v_filename); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_filename_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":431 - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":318 + * def _init_1(self, bytes filename , int in_1 ): + * assert isinstance(filename, bytes), 'arg filename wrong type' + * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' # <<<<<<<<<<<<<< * * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_max_edit_distance); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; + switch (__pyx_v_in_1) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + __pyx_t_1 = 1; + break; + default: + __pyx_t_1 = 0; + break; } - __pyx_t_3 = PyLong_Check(__pyx_v_max_edit_distance); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_max_edit_distance_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":434 - * - * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions((in_0), (max_edit_distance)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_max_edit_distance); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->GetFuzzyCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); - - /* "pykeyvi.pyx":435 + /* "pykeyvi.pyx":321 * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions((in_0), (max_edit_distance)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "pykeyvi.pyx":436 - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions((in_0), (max_edit_distance)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":437 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":438 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) # <<<<<<<<<<<<<< * - * def __init__(self, Dictionary in_0 ): + * def __init__(self, *args): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_filename); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_3 = new keyvi::dictionary::Dictionary(((std::string)__pyx_t_2), ((keyvi::dictionary::loading_strategy_types)__pyx_v_in_1)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":429 - * + /* "pykeyvi.pyx":316 + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) * - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * def _init_1(self, bytes filename , int in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(filename, bytes), 'arg filename wrong type' + * assert in_1 in [0, 1, 2, 3, 4, 5, 6, 7], 'arg in_1 wrong type' */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetFuzzyCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":440 - * return py_result +/* "pykeyvi.pyx":323 + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) * - * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * self._init_0(*args) */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static int __pyx_pw_7pykeyvi_10Dictionary_17__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_10Dictionary_17__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_in_0 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_16PrefixCompletion_4__init__(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self), __pyx_v_in_0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_16__init__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_args); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_16PrefixCompletion_4__init__(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0) { - boost::shared_ptr __pyx_v_input_in_0; +static int __pyx_pf_7pykeyvi_10Dictionary_16__init__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - boost::shared_ptr __pyx_t_2; - keyvi::dictionary::completion::PrefixCompletion *__pyx_t_3; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":441 + /* "pykeyvi.pyx":324 * - * def __init__(self, Dictionary in_0 ): - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) + * def __init__(self, *args): + * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((__pyx_t_2 == 1) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; } - #endif + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyBytes_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "pykeyvi.pyx":442 - * def __init__(self, Dictionary in_0 ): - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) - * + /* "pykeyvi.pyx":325 + * def __init__(self, *args): + * if (len(args)==1) and (isinstance(args[0], bytes)): + * self._init_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): + * self._init_1(*args) */ - __pyx_t_2 = __pyx_v_in_0->inst; - __pyx_v_input_in_0 = __pyx_t_2; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "pykeyvi.pyx":443 - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":324 * - * def GetCompletions(self, bytes in_0 ): + * def __init__(self, *args): + * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): */ - try { - __pyx_t_3 = new keyvi::dictionary::completion::PrefixCompletion(__pyx_v_input_in_0); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":440 - * return py_result - * - * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + /* "pykeyvi.pyx":326 + * if (len(args)==1) and (isinstance(args[0], bytes)): + * self._init_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): # <<<<<<<<<<<<<< + * self._init_1(*args) + * else: */ + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((__pyx_t_2 == 2) != 0); + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = PyBytes_Check(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = (__pyx_t_5 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L6_bool_binop_done; + } + __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v_args, 1)); + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_6, 6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_7, 7, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __pyx_t_5; + __pyx_L9_bool_binop_done:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":445 - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) - * - * def GetCompletions(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * + /* "pykeyvi.pyx":327 + * self._init_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): + * self._init_1(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetCompletions (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + /* "pykeyvi.pyx":326 + * if (len(args)==1) and (isinstance(args[0], bytes)): + * self._init_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (args[1] in [0, 1, 2, 3, 4, 5, 6, 7]): # <<<<<<<<<<<<<< + * self._init_1(*args) + * else: + */ + goto __pyx_L3; + } - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetCompletions", 0); - - /* "pykeyvi.pyx":446 - * - * def GetCompletions(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":329 + * self._init_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * def Get(self, bytes in_0 ): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + /*else*/ { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - #endif - - /* "pykeyvi.pyx":448 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":449 - * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() - */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pykeyvi.pyx":450 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result - */ - __pyx_v_py_result->it = __pyx_v__r.begin(); - - /* "pykeyvi.pyx":451 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":452 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< - * - * cdef class ForwardBackwardCompletion: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + __pyx_L3:; - /* "pykeyvi.pyx":445 - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) - * - * def GetCompletions(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + /* "pykeyvi.pyx":323 + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * self._init_0(*args) */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pykeyvi.Dictionary.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":458 - * cdef shared_ptr[_ForwardBackwardCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":459 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":458 - * cdef shared_ptr[_ForwardBackwardCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":462 - * +/* "pykeyvi.pyx":331 + * raise Exception('can not handle type of %s' % (args,)) * - * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Get(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_19Get(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_19Get(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_GetCompletions_0 (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("Get (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_18Get(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ goto __pyx_L0; @@ -12222,7 +10457,7 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_ return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_18Get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; @@ -12233,50 +10468,50 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_GetCompletions_0", 0); + __Pyx_RefNannySetupContext("Get", 0); - /* "pykeyvi.pyx":463 + /* "pykeyvi.pyx":332 * - * def _GetCompletions_0(self, bytes in_0 ): + * def Get(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":465 + /* "pykeyvi.pyx":334 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Get(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":466 + /* "pykeyvi.pyx":335 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< * py_result.it = _r.begin() * py_result.end = _r.end() */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":467 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + /* "pykeyvi.pyx":336 + * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() # <<<<<<<<<<<<<< * py_result.end = _r.end() @@ -12284,7 +10519,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":468 + /* "pykeyvi.pyx":337 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< @@ -12293,22 +10528,22 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":469 + /* "pykeyvi.pyx":338 * py_result.it = _r.begin() * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): + * def get (self, key, default = None): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":462 - * + /* "pykeyvi.pyx":331 + * raise Exception('can not handle type of %s' % (args,)) * - * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Get(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ @@ -12316,7 +10551,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.Get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_py_result); @@ -12325,28 +10560,29 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ return __pyx_r; } -/* "pykeyvi.pyx":471 +/* "pykeyvi.pyx":340 * return py_result * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def get (self, key, default = None): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - PyObject *__pyx_v_in_1 = 0; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_21get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_21get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_default = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_GetCompletions_1 (wrapper)", 0); + __Pyx_RefNannySetupContext("get (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0}; PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -12359,3109 +10595,2815 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default); + if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetCompletions_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_in_1 = values[1]; + __pyx_v_key = values[0]; + __pyx_v_default = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_1(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_20get(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_key, __pyx_v_default); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_1(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_20get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) { + boost::shared_ptr __pyx_v__r; + struct __pyx_obj_7pykeyvi_Match *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; - std::string __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_GetCompletions_1", 0); + __Pyx_RefNannySetupContext("get", 0); + __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":472 + /* "pykeyvi.pyx":341 * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def get (self, key, default = None): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') + * assert isinstance(key, bytes), 'arg in_0 wrong type' + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":342 + * def get (self, key, default = None): + * if isinstance(key, unicode): + * key = key.encode('utf-8') # <<<<<<<<<<<<<< + * assert isinstance(key, bytes), 'arg in_0 wrong type' + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + + /* "pykeyvi.pyx":341 + * + * def get (self, key, default = None): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') + * assert isinstance(key, bytes), 'arg in_0 wrong type' + */ + } + + /* "pykeyvi.pyx":343 + * if isinstance(key, unicode): + * key = key.encode('utf-8') + * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { + __pyx_t_2 = PyBytes_Check(__pyx_v_key); + if (unlikely(!(__pyx_t_2 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":473 - * def _GetCompletions_1(self, bytes in_0 , in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":345 + * assert isinstance(key, bytes), 'arg in_0 wrong type' * + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) # <<<<<<<<<<<<<< * + * if _r.get().IsEmpty(): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_in_1); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_in_1); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = boost::shared_ptr (new keyvi::dictionary::Match(((*__pyx_v_self->inst.get())[((std::string)__pyx_t_5)]))); - /* "pykeyvi.pyx":476 + /* "pykeyvi.pyx":347 + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) * + * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< + * return default + * cdef Match py_result = Match.__new__(Match) + */ + __pyx_t_2 = (__pyx_v__r.get()->IsEmpty() != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":348 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() + * if _r.get().IsEmpty(): + * return default # <<<<<<<<<<<<<< + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_default); + __pyx_r = __pyx_v_default; + goto __pyx_L0; - /* "pykeyvi.pyx":477 + /* "pykeyvi.pyx":347 + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() + * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< + * return default + * cdef Match py_result = Match.__new__(Match) */ - __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_6); - __pyx_t_6 = 0; + } - /* "pykeyvi.pyx":478 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() + /* "pykeyvi.pyx":349 + * if _r.get().IsEmpty(): + * return default + * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< + * py_result.inst = _r * return py_result */ - __pyx_v_py_result->it = __pyx_v__r.begin(); + __pyx_t_4 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_4); + __pyx_t_4 = 0; - /* "pykeyvi.pyx":479 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":350 + * return default + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r # <<<<<<<<<<<<<< * return py_result * */ - __pyx_v_py_result->end = __pyx_v__r.end(); + __pyx_v_py_result->inst = __pyx_v__r; - /* "pykeyvi.pyx":480 - * py_result.it = _r.begin() - * py_result.end = _r.end() + /* "pykeyvi.pyx":351 + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r * return py_result # <<<<<<<<<<<<<< * - * def GetCompletions(self, *args): + * def __contains__(self, key): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":471 + /* "pykeyvi.pyx":340 * return py_result * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def get (self, key, default = None): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Dictionary.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_key); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":482 +/* "pykeyvi.pyx":353 * return py_result * - * def GetCompletions(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==1) and (isinstance(args[0], bytes)): - * return self._GetCompletions_0(*args) + * def __contains__(self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; +static int __pyx_pw_7pykeyvi_10Dictionary_23__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static int __pyx_pw_7pykeyvi_10Dictionary_23__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetCompletions (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "GetCompletions", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_6GetCompletions(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), __pyx_v_args); + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_22__contains__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_key)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_10Dictionary_22__contains__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + std::string __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetCompletions", 0); + __Pyx_RefNannySetupContext("__contains__", 0); + __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":483 + /* "pykeyvi.pyx":354 + * + * def __contains__(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * - * def GetCompletions(self, *args): - * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< - * return self._GetCompletions_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 1) != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyBytes_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "pykeyvi.pyx":484 - * def GetCompletions(self, *args): - * if (len(args)==1) and (isinstance(args[0], bytes)): - * return self._GetCompletions_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetCompletions_1(*args) + /* "pykeyvi.pyx":355 + * def __contains__(self, key): + * if isinstance(key, unicode): + * key = key.encode('utf-8') # <<<<<<<<<<<<<< + * + * assert isinstance(key, bytes), 'arg in_0 wrong type' */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; - /* "pykeyvi.pyx":483 + /* "pykeyvi.pyx":354 + * + * def __contains__(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * - * def GetCompletions(self, *args): - * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< - * return self._GetCompletions_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - */ - } - - /* "pykeyvi.pyx":485 - * if (len(args)==1) and (isinstance(args[0], bytes)): - * return self._GetCompletions_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< - * return self._GetCompletions_1(*args) - * else: */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((__pyx_t_2 == 2) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = PyBytes_Check(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = PyInt_Check(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = (__pyx_t_5 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_3 = __pyx_t_7; - goto __pyx_L9_bool_binop_done; } - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = PyLong_Check(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_5 = (__pyx_t_7 != 0); - __pyx_t_3 = __pyx_t_5; - __pyx_L9_bool_binop_done:; - __pyx_t_5 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L6_bool_binop_done:; - if (__pyx_t_1) { - - /* "pykeyvi.pyx":486 - * return self._GetCompletions_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): - * return self._GetCompletions_1(*args) # <<<<<<<<<<<<<< - * else: - * raise Exception('can not handle type of %s' % (args,)) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - /* "pykeyvi.pyx":485 - * if (len(args)==1) and (isinstance(args[0], bytes)): - * return self._GetCompletions_0(*args) - * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< - * return self._GetCompletions_1(*args) - * else: + /* "pykeyvi.pyx":357 + * key = key.encode('utf-8') + * + * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * return self.inst.get().Contains(key) */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyBytes_Check(__pyx_v_key); + if (unlikely(!(__pyx_t_2 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif - /* "pykeyvi.pyx":488 - * return self._GetCompletions_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":359 + * assert isinstance(key, bytes), 'arg in_0 wrong type' * - * def __init__(self, Dictionary in_0 , Dictionary in_1 ): + * return self.inst.get().Contains(key) # <<<<<<<<<<<<<< + * + * def __len__(self): */ - /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_v_self->inst.get()->Contains(__pyx_t_5); + goto __pyx_L0; - /* "pykeyvi.pyx":482 + /* "pykeyvi.pyx":353 * return py_result * - * def GetCompletions(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==1) and (isinstance(args[0], bytes)): - * return self._GetCompletions_0(*args) + * def __contains__(self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.GetCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.Dictionary.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_key); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":490 - * raise Exception('can not handle type of %s' % (args,)) +/* "pykeyvi.pyx":361 + * return self.inst.get().Contains(key) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.inst.get().GetSize() * - * def __init__(self, Dictionary in_0 , Dictionary in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; - struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_1 = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static Py_ssize_t __pyx_pw_7pykeyvi_10Dictionary_25__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_7pykeyvi_10Dictionary_25__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_in_0 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[0]); - __pyx_v_in_1 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_8__init__(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_24__len__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_7pykeyvi_10Dictionary_24__len__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "pykeyvi.pyx":362 + * + * def __len__(self): + * return self.inst.get().GetSize() # <<<<<<<<<<<<<< + * + * def __getitem__ (self, key): + */ + __pyx_r = __pyx_v_self->inst.get()->GetSize(); goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; + + /* "pykeyvi.pyx":361 + * return self.inst.get().Contains(key) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.inst.get().GetSize() + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_8__init__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_1) { - boost::shared_ptr __pyx_v_input_in_0; - boost::shared_ptr __pyx_v_input_in_1; - int __pyx_r; +/* "pykeyvi.pyx":364 + * return self.inst.get().GetSize() + * + * def __getitem__ (self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_26__getitem__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_26__getitem__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key) { + boost::shared_ptr __pyx_v__r; + struct __pyx_obj_7pykeyvi_Match *__pyx_v_py_result = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - boost::shared_ptr __pyx_t_2; - keyvi::dictionary::completion::ForwardBackwardCompletion *__pyx_t_3; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":491 + /* "pykeyvi.pyx":365 + * + * def __getitem__ (self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') + * + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":366 + * def __getitem__ (self, key): + * if isinstance(key, unicode): + * key = key.encode('utf-8') # <<<<<<<<<<<<<< + * + * assert isinstance(key, bytes), 'arg in_0 wrong type' + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + + /* "pykeyvi.pyx":365 + * + * def __getitem__ (self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * - * def __init__(self, Dictionary in_0 , Dictionary in_1 ): - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } } - #endif - /* "pykeyvi.pyx":492 - * def __init__(self, Dictionary in_0 , Dictionary in_1 ): - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' # <<<<<<<<<<<<<< - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst + /* "pykeyvi.pyx":368 + * key = key.encode('utf-8') + * + * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_1), __pyx_ptype_7pykeyvi_Dictionary); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_Check(__pyx_v_key); + if (unlikely(!(__pyx_t_2 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":493 - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< - * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst - * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) + /* "pykeyvi.pyx":370 + * assert isinstance(key, bytes), 'arg in_0 wrong type' + * + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) # <<<<<<<<<<<<<< + * + * if _r.get().IsEmpty(): */ - __pyx_t_2 = __pyx_v_in_0->inst; - __pyx_v_input_in_0 = __pyx_t_2; + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = boost::shared_ptr (new keyvi::dictionary::Match(((*__pyx_v_self->inst.get())[((std::string)__pyx_t_5)]))); - /* "pykeyvi.pyx":494 - * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) + /* "pykeyvi.pyx":372 + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) * + * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< + * raise KeyError(key) + * cdef Match py_result = Match.__new__(Match) */ - __pyx_t_2 = __pyx_v_in_1->inst; - __pyx_v_input_in_1 = __pyx_t_2; + __pyx_t_2 = (__pyx_v__r.get()->IsEmpty() != 0); + if (__pyx_t_2) { - /* "pykeyvi.pyx":495 - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst - * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":373 * - * cdef class loading_strategy_types: + * if _r.get().IsEmpty(): + * raise KeyError(key) # <<<<<<<<<<<<<< + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r */ - try { - __pyx_t_3 = new keyvi::dictionary::completion::ForwardBackwardCompletion(__pyx_v_input_in_0, __pyx_v_input_in_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_key); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "pykeyvi.pyx":490 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":372 + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) * - * def __init__(self, Dictionary in_0 , Dictionary in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' + * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< + * raise KeyError(key) + * cdef Match py_result = Match.__new__(Match) */ + } - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pykeyvi.pyx":374 + * if _r.get().IsEmpty(): + * raise KeyError(key) + * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< + * py_result.inst = _r + * return py_result + */ + __pyx_t_3 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_3); + __pyx_t_3 = 0; -/* "pykeyvi.pyx":511 - * cdef shared_ptr[_CompletionDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() + /* "pykeyvi.pyx":375 + * raise KeyError(key) + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r # <<<<<<<<<<<<<< + * return py_result * */ + __pyx_v_py_result->inst = __pyx_v__r; -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":512 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":376 + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r + * return py_result # <<<<<<<<<<<<<< * + * def _key_iterator_wrapper(self, iterator): */ - __pyx_v_self->inst.reset(); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "pykeyvi.pyx":511 - * cdef shared_ptr[_CompletionDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() + /* "pykeyvi.pyx":364 + * return self.inst.get().GetSize() * + * def __getitem__ (self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Dictionary.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_10Dictionary_30generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":515 - * +/* "pykeyvi.pyx":378 + * return py_result * - * def __setitem__(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetMatchedString() */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /*proto*/ -static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_29_key_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_29_key_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_2__setitem__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0), ((PyObject *)__pyx_v_in_1)); + __Pyx_RefNannySetupContext("_key_iterator_wrapper (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_28_key_iterator_wrapper(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_iterator)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_2__setitem__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_28_key_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *__pyx_cur_scope; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - std::string __pyx_t_4; - int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - - /* "pykeyvi.pyx":516 - * - * def __setitem__(self, bytes in_0 , in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __Pyx_RefNannySetupContext("_key_iterator_wrapper", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(__pyx_ptype_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; } - #endif - - /* "pykeyvi.pyx":517 - * def __setitem__(self, bytes in_0 , in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< - * - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_in_1); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_iterator = __pyx_v_iterator; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_iterator); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_iterator); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_10Dictionary_30generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_key_iterator_wrapper, __pyx_n_s_Dictionary__key_iterator_wrapper); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.Dictionary._key_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_7pykeyvi_10Dictionary_30generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":379 + * + * def _key_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetMatchedString() + * + */ + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_iterator; __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_v_iterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_in_1); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); } - } - #endif + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "pykeyvi.pyx":520 + /* "pykeyvi.pyx":380 + * def _key_iterator_wrapper(self, iterator): + * for m in iterator: + * yield m.GetMatchedString() # <<<<<<<<<<<<<< * + * def _value_iterator_wrapper(self, iterator): + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetMatchedString); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __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_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":379 * - * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + * def _key_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetMatchedString() * - * def Add(self, bytes in_0 , in_1 ): */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->__setitem__(((std::string)__pyx_t_4), ((int)__pyx_t_5)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":515 - * + /* "pykeyvi.pyx":378 + * return py_result * - * def __setitem__(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetMatchedString() */ /* function exit code */ - __pyx_r = 0; + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("_key_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_10Dictionary_33generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":522 - * self.inst.get().__setitem__((in_0), (in_1)) +/* "pykeyvi.pyx":382 + * yield m.GetMatchedString() * - * def Add(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetValue() */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_5Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_5Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - PyObject *__pyx_v_in_1 = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_32_value_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_32_value_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_in_1 = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_4Add(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); + __Pyx_RefNannySetupContext("_value_iterator_wrapper (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_31_value_iterator_wrapper(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_iterator)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_4Add(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_31_value_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - std::string __pyx_t_4; - int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Add", 0); - - /* "pykeyvi.pyx":523 - * - * def Add(self, bytes in_0 , in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __Pyx_RefNannySetupContext("_value_iterator_wrapper", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(__pyx_ptype_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_iterator = __pyx_v_iterator; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_iterator); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_iterator); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_10Dictionary_33generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_value_iterator_wrapper, __pyx_n_s_Dictionary__value_iterator_wrapp); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - #endif - /* "pykeyvi.pyx":524 - * def Add(self, bytes in_0 , in_1 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.Dictionary._value_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_7pykeyvi_10Dictionary_33generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":383 * + * def _value_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetValue() * */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_in_1); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_iterator; __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_v_iterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_in_1); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); } - } - #endif + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "pykeyvi.pyx":527 + /* "pykeyvi.pyx":384 + * def _value_iterator_wrapper(self, iterator): + * for m in iterator: + * yield m.GetValue() # <<<<<<<<<<<<<< * + * def _item_iterator_wrapper(self, iterator): + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetValue); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __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_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":383 * - * self.inst.get().Add((in_0), (in_1)) # <<<<<<<<<<<<<< + * def _value_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetValue() * - * def _init_0(self): */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_4), ((int)__pyx_t_5)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":522 - * self.inst.get().__setitem__((in_0), (in_1)) + /* "pykeyvi.pyx":382 + * yield m.GetMatchedString() * - * def Add(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetValue() */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("_value_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_10Dictionary_36generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":529 - * self.inst.get().Add((in_0), (in_1)) - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) +/* "pykeyvi.pyx":386 + * yield m.GetValue() * + * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield (m.GetMatchedString(), m.GetValue()) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_7_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_7_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_35_item_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_35_item_iterator_wrapper(PyObject *__pyx_v_self, PyObject *__pyx_v_iterator) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_6_init_0(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self)); + __Pyx_RefNannySetupContext("_item_iterator_wrapper (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_34_item_iterator_wrapper(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_iterator)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_6_init_0(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_34_item_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_0", 0); - - /* "pykeyvi.pyx":530 - * - * def _init_0(self): - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) # <<<<<<<<<<<<<< - * - * def _init_1(self, memory_limit ): - */ - try { - __pyx_t_1 = new keyvi::dictionary::CompletionDictionaryCompiler(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("_item_iterator_wrapper", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(__pyx_ptype_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_iterator = __pyx_v_iterator; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_iterator); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_iterator); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_10Dictionary_36generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_item_iterator_wrapper, __pyx_n_s_Dictionary__item_iterator_wrappe); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - - /* "pykeyvi.pyx":529 - * self.inst.get().Add((in_0), (in_1)) - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) - * - */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._item_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":532 - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) - * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_9_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_9_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8_init_1(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8_init_1(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { +static PyObject *__pyx_gb_7pykeyvi_10Dictionary_36generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)__pyx_generator->closure); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - size_t __pyx_t_4; - keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_5; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_1", 0); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "pykeyvi.pyx":533 + /* "pykeyvi.pyx":387 * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * def _item_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield (m.GetMatchedString(), m.GetValue()) * - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_iterator)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_iterator; __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_v_iterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_m); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_m, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "pykeyvi.pyx":388 + * def _item_iterator_wrapper(self, iterator): + * for m in iterator: + * yield (m.GetMatchedString(), m.GetValue()) # <<<<<<<<<<<<<< + * + * def GetAllKeys(self): + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetMatchedString); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } } - } - #endif + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_m, __pyx_n_s_GetValue); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (__pyx_t_7) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __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_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "pykeyvi.pyx":535 - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + /* "pykeyvi.pyx":387 * - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< + * def _item_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield (m.GetMatchedString(), m.GetValue()) * - * def _init_2(self, memory_limit , dict value_store_params ): */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_5 = new keyvi::dictionary::CompletionDictionaryCompiler(((size_t)__pyx_t_4)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":532 - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) - * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + /* "pykeyvi.pyx":386 + * yield m.GetValue() * + * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield (m.GetMatchedString(), m.GetValue()) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("_item_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":537 - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":390 + * yield (m.GetMatchedString(), m.GetValue()) * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * def GetAllKeys(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_11_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_11_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_memory_limit = 0; - PyObject *__pyx_v_value_store_params = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_38GetAllKeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_38GetAllKeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_memory_limit = values[0]; - __pyx_v_value_store_params = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_10_init_2(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); + __Pyx_RefNannySetupContext("GetAllKeys (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator11(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":539 - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - */ - -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_16_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *) __pyx_self; - __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_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator11, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator11(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - int __pyx_t_5; - int __pyx_t_6; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("GetAllKeys", 0); + + /* "pykeyvi.pyx":391 + * + * def GetAllKeys(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); + + /* "pykeyvi.pyx":392 + * def GetAllKeys(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() + */ + __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); - __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); - if (__pyx_t_6) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":393 + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return self._key_iterator_wrapper(py_result) + */ + __pyx_v_py_result->it = __pyx_v__r.begin(); + + /* "pykeyvi.pyx":394 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return self._key_iterator_wrapper(py_result) + * + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":395 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return self._key_iterator_wrapper(py_result) # <<<<<<<<<<<<<< + * + * def GetAllValues(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_key_iterator_wrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_py_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_py_result)); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":390 + * yield (m.GetMatchedString(), m.GetValue()) + * + * def GetAllKeys(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllKeys", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator12(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +/* "pykeyvi.pyx":397 + * return self._key_iterator_wrapper(py_result) + * + * def GetAllValues(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_40GetAllValues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_40GetAllValues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_17_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *) __pyx_self; - __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_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator12, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } + __Pyx_RefNannySetupContext("GetAllValues (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator12(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)__pyx_generator->closure); +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - int __pyx_t_5; - int __pyx_t_6; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("GetAllValues", 0); + + /* "pykeyvi.pyx":398 + * + * def GetAllValues(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); + + /* "pykeyvi.pyx":399 + * def GetAllValues(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() + */ + __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); - if (__pyx_t_6) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":400 + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return self._value_iterator_wrapper(py_result) + */ + __pyx_v_py_result->it = __pyx_v__r.begin(); + + /* "pykeyvi.pyx":401 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return self._value_iterator_wrapper(py_result) + * + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":402 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return self._value_iterator_wrapper(py_result) # <<<<<<<<<<<<<< + * + * def GetAllItems(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value_iterator_wrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_py_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_py_result)); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":397 + * return self._key_iterator_wrapper(py_result) + * + * def GetAllValues(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllValues", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":537 - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":404 + * return self._value_iterator_wrapper(py_result) * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * def GetAllItems(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_10_init_2(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *__pyx_cur_scope; - std::map *__pyx_v_v1; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_42GetAllItems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_42GetAllItems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetAllItems (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - std::map *__pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *(*__pyx_t_12)(PyObject *); - std::string __pyx_t_13; - std::string __pyx_t_14; - size_t __pyx_t_15; - keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_2", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_15__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_15__init_2, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); + __Pyx_RefNannySetupContext("GetAllItems", 0); - /* "pykeyvi.pyx":538 + /* "pykeyvi.pyx":405 * - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * def GetAllItems(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); + + /* "pykeyvi.pyx":406 + * def GetAllItems(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() + */ + __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":407 + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return self._item_iterator_wrapper(py_result) + */ + __pyx_v_py_result->it = __pyx_v__r.begin(); + + /* "pykeyvi.pyx":408 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return self._item_iterator_wrapper(py_result) * */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":539 - * def _init_2(self, memory_limit , dict value_store_params ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":409 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return self._item_iterator_wrapper(py_result) # <<<<<<<<<<<<<< * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * def GetManifest(self): */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_4 = __pyx_cur_scope->__pyx_v_value_store_params; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_2 = PyDict_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_4 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_5 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; - if (unlikely(!__pyx_t_1)) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_item_iterator_wrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - #endif - - /* "pykeyvi.pyx":541 - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< - * for key, value in value_store_params.items(): - * deref(v1)[ key ] = value - */ - try { - __pyx_t_6 = new std::map (); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_v1 = __pyx_t_6; - - /* "pykeyvi.pyx":542 - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) - */ - if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_py_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_8(__pyx_t_5); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { - PyObject* sequence = __pyx_t_4; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_9 = PyList_GET_ITEM(sequence, 0); - __pyx_t_10 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L11_unpacking_done; - __pyx_L10_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L11_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); - __pyx_t_10 = 0; - - /* "pykeyvi.pyx":543 - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - * for key, value in value_store_params.items(): - * deref(v1)[ key ] = value # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) - * del v1 - */ - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); - - /* "pykeyvi.pyx":542 - * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() - * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) - */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pykeyvi.pyx":544 - * for key, value in value_store_params.items(): - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< - * del v1 - * - */ - __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_16 = new keyvi::dictionary::CompletionDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_py_result)); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - - /* "pykeyvi.pyx":545 - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) - * del v1 # <<<<<<<<<<<<<< - * - * def __init__(self, *args): - */ - delete __pyx_v_v1; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "pykeyvi.pyx":537 - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) + /* "pykeyvi.pyx":404 + * return self._value_iterator_wrapper(py_result) * - * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' + * def GetAllItems(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllItems", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":547 - * del v1 +/* "pykeyvi.pyx":411 + * return self._item_iterator_wrapper(py_result) * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) + * def GetManifest(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_44GetManifest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_44GetManifest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_12__init__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __Pyx_RefNannySetupContext("GetManifest (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_43GetManifest(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator13(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "pykeyvi.pyx":552 - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< - * self._init_2(*args) - * else: - */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_43GetManifest(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + std::string __pyx_v__r; + PyObject *__pyx_v_py_result = 0; + PyObject *__pyx_v_json = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_19_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_19_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *) __pyx_self; - __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_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator13, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator13(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("GetManifest", 0); + + /* "pykeyvi.pyx":412 + * + * def GetManifest(self): + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() # <<<<<<<<<<<<<< + * cdef bytes py_result = _r + * import json + */ + try { + __pyx_t_1 = __pyx_v_self->inst.get()->GetManifestAsString(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_t_1; + + /* "pykeyvi.pyx":413 + * def GetManifest(self): + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r # <<<<<<<<<<<<<< + * import json + * return json.loads(py_result) + */ + __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v__r); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __pyx_v_py_result = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "pykeyvi.pyx":414 + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r + * import json # <<<<<<<<<<<<<< + * return json.loads(py_result) + * + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_json = __pyx_t_2; + __pyx_t_2 = 0; + + /* "pykeyvi.pyx":415 + * cdef bytes py_result = _r + * import json + * return json.loads(py_result) # <<<<<<<<<<<<<< + * + * def GetStatistics(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __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; + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_py_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_py_result); + __Pyx_GIVEREF(__pyx_v_py_result); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_py_result); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); - __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_7) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } - } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":411 + * return self._item_iterator_wrapper(py_result) + * + * def GetManifest(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r + */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_json); __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator14(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +/* "pykeyvi.pyx":417 + * return json.loads(py_result) + * + * def GetStatistics(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_46GetStatistics(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_46GetStatistics(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_20_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_20_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *) __pyx_self; - __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_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator14, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } + __Pyx_RefNannySetupContext("GetStatistics (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator14(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)__pyx_generator->closure); +/* "pykeyvi.pyx":422 + * import json + * return {k: json.loads(v) for k, v in filter( + * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], # <<<<<<<<<<<<<< + * [s.rstrip().split("\n") for s in py_result.split("\n\n")] + * )} + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_9genexpr12_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_kv); /*proto*/ +static PyMethodDef __pyx_mdef_7pykeyvi_10Dictionary_13GetStatistics_9genexpr12_lambda12 = {"lambda12", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_9genexpr12_lambda12, METH_O, 0}; +static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_9genexpr12_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_kv) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda12 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda12(__pyx_self, ((PyObject *)__pyx_v_kv)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda12(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_RefNannySetupContext("lambda12", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_kv); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_kv); + __pyx_t_1 = __pyx_v_kv; + goto __pyx_L3_bool_binop_done; } - __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; + __pyx_t_2 = PyList_Check(__pyx_v_kv); + if (__pyx_t_2) { } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_7) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - } + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; } - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_4 = PyObject_Length(__pyx_v_kv); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_4 > 1); + if (__pyx_t_2) { + } else { + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_kv, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":547 - * del v1 +/* "pykeyvi.pyx":417 + * return json.loads(py_result) * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) + * def GetStatistics(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r */ -static int __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_12__init__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *__pyx_cur_scope; - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { + std::string __pyx_v__r; + PyObject *__pyx_v_py_result = 0; + PyObject *__pyx_v_json = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_18___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_18___init__, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_args = __pyx_v_args; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_RefNannySetupContext("GetStatistics", 0); - /* "pykeyvi.pyx":548 + /* "pykeyvi.pyx":418 * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * def GetStatistics(self): + * cdef libcpp_string _r = self.inst.get().GetStatistics() # <<<<<<<<<<<<<< + * cdef bytes py_result = _r + * import json */ - __pyx_t_1 = (__pyx_cur_scope->__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_args) != 0); - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { + __pyx_v__r = __pyx_v_self->inst.get()->GetStatistics(); - /* "pykeyvi.pyx":549 - * def __init__(self, *args): - * if not args: - * self._init_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) + /* "pykeyvi.pyx":419 + * def GetStatistics(self): + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r # <<<<<<<<<<<<<< + * import json + * return {k: json.loads(v) for k, v in filter( */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v__r); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_py_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pykeyvi.pyx":548 - * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): + /* "pykeyvi.pyx":420 + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r + * import json # <<<<<<<<<<<<<< + * return {k: json.loads(v) for k, v in filter( + * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], */ - goto __pyx_L3; - } + __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_json = __pyx_t_1; + __pyx_t_1 = 0; - /* "pykeyvi.pyx":550 - * if not args: - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + /* "pykeyvi.pyx":421 + * cdef bytes py_result = _r + * import json + * return {k: json.loads(v) for k, v in filter( # <<<<<<<<<<<<<< + * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], + * [s.rstrip().split("\n") for s in py_result.split("\n\n")] */ - __pyx_t_4 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_4); - if (unlikely(__pyx_t_4 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = ((__pyx_t_5 == 1) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_6 = PyInt_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = (__pyx_t_6 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_1 = __pyx_t_7; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_7 = PyLong_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_7 != 0); - __pyx_t_1 = __pyx_t_6; - __pyx_L6_bool_binop_done:; - __pyx_t_6 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + PyObject *__pyx_9genexpr12__pyx_v_k = NULL; + PyObject *__pyx_9genexpr12__pyx_v_v = NULL; + PyObject *__pyx_9genexpr12__pyx_v_s = NULL; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_1); - /* "pykeyvi.pyx":551 - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) # <<<<<<<<<<<<<< - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - * self._init_2(*args) + /* "pykeyvi.pyx":422 + * import json + * return {k: json.loads(v) for k, v in filter( + * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], # <<<<<<<<<<<<<< + * [s.rstrip().split("\n") for s in py_result.split("\n\n")] + * )} */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7pykeyvi_10Dictionary_13GetStatistics_9genexpr12_lambda12, 0, __pyx_n_s_GetStatistics_locals_lambda, NULL, __pyx_n_s_pykeyvi, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); - /* "pykeyvi.pyx":550 - * if not args: - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - */ - goto __pyx_L3; - } - - /* "pykeyvi.pyx":552 - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< - * self._init_2(*args) - * else: - */ - __pyx_t_3 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_3); - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((__pyx_t_5 == 2) != 0); - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = PyInt_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = (__pyx_t_1 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_7 = PyLong_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = (__pyx_t_7 != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L11_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = PyDict_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_3 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_4 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __pyx_t_6; - __pyx_L8_bool_binop_done:; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":553 - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): - * self._init_2(*args) # <<<<<<<<<<<<<< - * else: - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":423 + * return {k: json.loads(v) for k, v in filter( + * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], + * [s.rstrip().split("\n") for s in py_result.split("\n\n")] # <<<<<<<<<<<<<< + * )} + * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_result, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_7(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr12__pyx_v_s, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (__pyx_t_9) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":552 - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) - * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< - * self._init_2(*args) - * else: - */ - goto __pyx_L3; - } - - /* "pykeyvi.pyx":555 - * self._init_2(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): + /* "pykeyvi.pyx":421 + * cdef bytes py_result = _r + * import json + * return {k: json.loads(v) for k, v in filter( # <<<<<<<<<<<<<< + * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], + * [s.rstrip().split("\n") for s in py_result.split("\n\n")] */ - /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_filter, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; - - /* "pykeyvi.pyx":547 - * del v1 - * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":557 - * raise Exception('can not handle type of %s' % (args,)) - * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_14WriteToFile(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_in_0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - const char *__pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("WriteToFile", 0); - - /* "pykeyvi.pyx":558 - * - * def WriteToFile(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * self.inst.get().WriteToFile(input_in_0) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_4); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_5); + #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_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_L11_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_k, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_v, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_9genexpr12__pyx_v_v); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_INCREF(__pyx_9genexpr12__pyx_v_v); + __Pyx_GIVEREF(__pyx_9genexpr12__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_9genexpr12__pyx_v_v); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr12__pyx_v_k, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - } - #endif - - /* "pykeyvi.pyx":559 - * def WriteToFile(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * self.inst.get().WriteToFile(input_in_0) - * - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":560 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * self.inst.get().WriteToFile(input_in_0) # <<<<<<<<<<<<<< - * - * def __enter__(self): - */ - __pyx_v_self->inst.get()->WriteToFile(__pyx_v_input_in_0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_k); + __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_v); + __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_s); + goto __pyx_L12_exit_scope; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_k); + __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_v); + __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_s); + goto __pyx_L1_error; + __pyx_L12_exit_scope:; + } /* exit inner scope */ + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "pykeyvi.pyx":557 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":417 + * return json.loads(py_result) * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * def GetStatistics(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_json); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":562 - * self.inst.get().WriteToFile(input_in_0) +/* "pykeyvi.pyx":430 + * cdef shared_ptr[_FsaTransform] inst * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static void __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_16__enter__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_12FsaTransform___dealloc__(((struct __pyx_obj_7pykeyvi_FsaTransform *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_pf_7pykeyvi_12FsaTransform___dealloc__(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":563 + /* "pykeyvi.pyx":431 * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":562 - * self.inst.get().WriteToFile(input_in_0) + /* "pykeyvi.pyx":430 + * cdef shared_ptr[_FsaTransform] inst * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "pykeyvi.pyx":566 +/* "pykeyvi.pyx":434 * * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + * def Normalize(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_type = 0; - CYTHON_UNUSED PyObject *__pyx_v_value = 0; - CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; +static PyObject *__pyx_pw_7pykeyvi_12FsaTransform_3Normalize(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_12FsaTransform_3Normalize(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Normalize (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_12FsaTransform_2Normalize(((struct __pyx_obj_7pykeyvi_FsaTransform *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_12FsaTransform_2Normalize(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self, PyObject *__pyx_v_in_0) { + std::string __pyx_v__r; + std::string __pyx_v_py_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } + __Pyx_RefNannySetupContext("Normalize", 0); + + /* "pykeyvi.pyx":435 + * + * def Normalize(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":437 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Normalize(((std::string)__pyx_t_2)); + + /* "pykeyvi.pyx":438 + * + * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((std::string)__pyx_v__r); + + /* "pykeyvi.pyx":439 + * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def __init__(self, Dictionary in_0 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":434 + * + * + * def Normalize(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.FsaTransform.Normalize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":441 + * return py_result + * + * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + */ + +/* Python wrapper */ +static int __pyx_pw_7pykeyvi_12FsaTransform_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_12FsaTransform_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_type = values[0]; - __pyx_v_value = values[1]; - __pyx_v_traceback = values[2]; + __pyx_v_in_0 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.FsaTransform.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_18__exit__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_12FsaTransform_4__init__(((struct __pyx_obj_7pykeyvi_FsaTransform *)__pyx_v_self), __pyx_v_in_0); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_18__exit__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_12FsaTransform_4__init__(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0) { + boost::shared_ptr __pyx_v_input_in_0; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_1; + boost::shared_ptr __pyx_t_2; + keyvi::transform::FsaTransform *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__exit__", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":567 - * - * def __exit__(self, type, value, traceback): - * self.Compile() # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":442 * + * def __init__(self, Dictionary in_0 ): + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif - /* "pykeyvi.pyx":566 + /* "pykeyvi.pyx":443 + * def __init__(self, Dictionary in_0 ): + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) * + */ + __pyx_t_2 = __pyx_v_in_0->inst; + __pyx_v_input_in_0 = __pyx_t_2; + + /* "pykeyvi.pyx":444 + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) # <<<<<<<<<<<<<< * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + * cdef class PrefixCompletion: + */ + try { + __pyx_t_3 = new keyvi::transform::FsaTransform(__pyx_v_input_in_0); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + + /* "pykeyvi.pyx":441 + * return py_result * + * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.FsaTransform.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":570 +/* "pykeyvi.pyx":450 + * cdef shared_ptr[_PrefixCompletion] inst * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; +static void __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Compile (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { - void *__pyx_v_callback; - PyObject *__pyx_r = NULL; +static void __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self) { __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("Compile", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":571 + /* "pykeyvi.pyx":451 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< + * * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() */ - __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":572 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { - - /* "pykeyvi.pyx":573 - * if not args: - * with nogil: - * self.inst.get().Compile() # <<<<<<<<<<<<<< - * return + /* "pykeyvi.pyx":450 + * cdef shared_ptr[_PrefixCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ - __pyx_v_self->inst.get()->Compile(); - } - /* "pykeyvi.pyx":572 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":454 + * + * + * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + PyObject *__pyx_v_max_edit_distance = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetFuzzyCompletions (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_max_edit_distance,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_edit_distance)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("GetFuzzyCompletions", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "GetFuzzyCompletions") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } + __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_max_edit_distance = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("GetFuzzyCompletions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetFuzzyCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_max_edit_distance); - /* "pykeyvi.pyx":574 - * with nogil: - * self.inst.get().Compile() - * return # <<<<<<<<<<<<<< - * - * cdef void* callback = args[0] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_max_edit_distance) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + std::string __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetFuzzyCompletions", 0); - /* "pykeyvi.pyx":571 + /* "pykeyvi.pyx":455 + * + * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif - /* "pykeyvi.pyx":576 - * return + /* "pykeyvi.pyx":456 + * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' # <<<<<<<<<<<<<< + * * - * cdef void* callback = args[0] # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) */ - __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_max_edit_distance); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_max_edit_distance); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_max_edit_distance_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":577 + /* "pykeyvi.pyx":459 * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) * + * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions((in_0), (max_edit_distance)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_max_edit_distance); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->GetFuzzyCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); - /* "pykeyvi.pyx":578 - * cdef void* callback = args[0] - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":460 * + * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions((in_0), (max_edit_distance)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() */ - __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); - } + __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "pykeyvi.pyx":461 + * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions((in_0), (max_edit_distance)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return py_result + */ + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":577 + /* "pykeyvi.pyx":462 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":463 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * + * def __init__(self, Dictionary in_0 ): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L9; - } - __pyx_L9:; - } - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "pykeyvi.pyx":570 + /* "pykeyvi.pyx":454 * * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: + * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetFuzzyCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":581 - * +/* "pykeyvi.pyx":465 + * return py_result * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) + * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { - PyObject *__pyx_v_m = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - const char *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetManifest", 0); - - /* "pykeyvi.pyx":582 - * - * def SetManifest(self, manifest): - * m = json.dumps(manifest) # <<<<<<<<<<<<<< - * self.inst.get().SetManifestFromString(m) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_manifest); - __Pyx_GIVEREF(__pyx_v_manifest); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __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_v_m = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":583 - * def SetManifest(self, manifest): - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_m); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - - /* "pykeyvi.pyx":581 - * - * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_m); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":587 - * - * # definition for all compilers - * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< - * (py_callback)(a, b) - * - */ - -static void __pyx_f_7pykeyvi_callback_wrapper(size_t __pyx_v_a, size_t __pyx_v_b, void *__pyx_v_py_callback) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("callback_wrapper", 0); - - /* "pykeyvi.pyx":588 - * # definition for all compilers - * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: - * (py_callback)(a, b) # <<<<<<<<<<<<<< - * - * cdef class MultiWordCompletion: - */ - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_b); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_py_callback)); - __pyx_t_4 = ((PyObject *)__pyx_v_py_callback); __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_6 = 1; - } - } - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pykeyvi.pyx":587 - * - * # definition for all compilers - * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< - * (py_callback)(a, b) - * - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("pykeyvi.callback_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif -} - -/* "pykeyvi.pyx":594 - * cdef shared_ptr[_MultiWordCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":595 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":594 - * cdef shared_ptr[_MultiWordCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":598 - * - * - * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - */ - -/* Python wrapper */ -static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -15487,7 +13429,7 @@ static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_s else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -15498,14 +13440,14 @@ static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.PrefixCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), __pyx_v_in_0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_16PrefixCompletion_4__init__(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self), __pyx_v_in_0); /* function exit code */ goto __pyx_L0; @@ -15516,62 +13458,62 @@ static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_s return __pyx_r; } -static int __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0) { +static int __pyx_pf_7pykeyvi_16PrefixCompletion_4__init__(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0) { boost::shared_ptr __pyx_v_input_in_0; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; boost::shared_ptr __pyx_t_2; - keyvi::dictionary::completion::MultiWordCompletion *__pyx_t_3; + keyvi::dictionary::completion::PrefixCompletion *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":599 + /* "pykeyvi.pyx":466 * * def __init__(self, Dictionary in_0 ): * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":600 + /* "pykeyvi.pyx":467 * def __init__(self, Dictionary in_0 ): * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) * */ __pyx_t_2 = __pyx_v_in_0->inst; __pyx_v_input_in_0 = __pyx_t_2; - /* "pykeyvi.pyx":601 + /* "pykeyvi.pyx":468 * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) # <<<<<<<<<<<<<< * - * def _GetCompletions_0(self, bytes in_0 ): + * def GetCompletions(self, bytes in_0 ): */ try { - __pyx_t_3 = new keyvi::dictionary::completion::MultiWordCompletion(__pyx_v_input_in_0); + __pyx_t_3 = new keyvi::dictionary::completion::PrefixCompletion(__pyx_v_input_in_0); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":598 - * + /* "pykeyvi.pyx":465 + * return py_result * * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' @@ -15582,15 +13524,191 @@ static int __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(struct __pyx_obj_7p __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.PrefixCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":603 - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) +/* "pykeyvi.pyx":470 + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) + * + * def GetCompletions(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetCompletions (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetCompletions", 0); + + /* "pykeyvi.pyx":471 + * + * def GetCompletions(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":473 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); + + /* "pykeyvi.pyx":474 + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() + */ + __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "pykeyvi.pyx":475 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return py_result + */ + __pyx_v_py_result->it = __pyx_v__r.begin(); + + /* "pykeyvi.pyx":476 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":477 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< + * + * cdef class ForwardBackwardCompletion: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; + + /* "pykeyvi.pyx":470 + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) + * + * def GetCompletions(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":483 + * cdef shared_ptr[_ForwardBackwardCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * + */ + +/* Python wrapper */ +static void __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "pykeyvi.pyx":484 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->inst.reset(); + + /* "pykeyvi.pyx":483 + * cdef shared_ptr[_ForwardBackwardCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":487 + * * * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' @@ -15598,16 +13716,16 @@ static int __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(struct __pyx_obj_7p */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_GetCompletions_0 (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ goto __pyx_L0; @@ -15618,7 +13736,7 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0(PyOb return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; @@ -15631,7 +13749,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_GetCompletions_0", 0); - /* "pykeyvi.pyx":604 + /* "pykeyvi.pyx":488 * * def _GetCompletions_0(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< @@ -15643,35 +13761,35 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":606 + /* "pykeyvi.pyx":490 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":607 + /* "pykeyvi.pyx":491 * * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< * py_result.it = _r.begin() * py_result.end = _r.end() */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":608 + /* "pykeyvi.pyx":492 * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() # <<<<<<<<<<<<<< @@ -15680,7 +13798,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":609 + /* "pykeyvi.pyx":493 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< @@ -15689,7 +13807,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":610 + /* "pykeyvi.pyx":494 * py_result.it = _r.begin() * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< @@ -15701,8 +13819,8 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":603 - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) + /* "pykeyvi.pyx":487 + * * * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' @@ -15712,7 +13830,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_py_result); @@ -15721,7 +13839,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru return __pyx_r; } -/* "pykeyvi.pyx":612 +/* "pykeyvi.pyx":496 * return py_result * * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< @@ -15730,8 +13848,8 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_in_0 = 0; PyObject *__pyx_v_in_1 = 0; int __pyx_lineno = 0; @@ -15760,11 +13878,11 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetCompletions_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetCompletions_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -15777,14 +13895,14 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_1(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); /* function exit code */ goto __pyx_L0; @@ -15795,7 +13913,7 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyOb return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { +static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_1(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; @@ -15811,7 +13929,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_GetCompletions_1", 0); - /* "pykeyvi.pyx":613 + /* "pykeyvi.pyx":497 * * def _GetCompletions_1(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< @@ -15823,12 +13941,12 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":614 + /* "pykeyvi.pyx":498 * def _GetCompletions_1(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< @@ -15850,36 +13968,36 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":617 + /* "pykeyvi.pyx":501 * * * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); - /* "pykeyvi.pyx":618 + /* "pykeyvi.pyx":502 * * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< * py_result.it = _r.begin() * py_result.end = _r.end() */ - __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_6); __pyx_t_6 = 0; - /* "pykeyvi.pyx":619 + /* "pykeyvi.pyx":503 * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() # <<<<<<<<<<<<<< @@ -15888,7 +14006,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":620 + /* "pykeyvi.pyx":504 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< @@ -15897,7 +14015,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":621 + /* "pykeyvi.pyx":505 * py_result.it = _r.begin() * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< @@ -15909,7 +14027,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":612 + /* "pykeyvi.pyx":496 * return py_result * * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< @@ -15920,7 +14038,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_py_result); @@ -15929,7 +14047,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru return __pyx_r; } -/* "pykeyvi.pyx":623 +/* "pykeyvi.pyx":507 * return py_result * * def GetCompletions(self, *args): # <<<<<<<<<<<<<< @@ -15938,8 +14056,8 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_7GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -15947,7 +14065,7 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions(PyObjec if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "GetCompletions", 0))) return NULL; __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), __pyx_v_args); + __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_6GetCompletions(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); @@ -15955,7 +14073,7 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions(PyObjec return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_args) { +static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_args) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -15970,14 +14088,14 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetCompletions", 0); - /* "pykeyvi.pyx":624 + /* "pykeyvi.pyx":508 * * def GetCompletions(self, *args): * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< * return self._GetCompletions_0(*args) * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((__pyx_t_2 == 1) != 0); if (__pyx_t_3) { } else { @@ -15993,7 +14111,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "pykeyvi.pyx":625 + /* "pykeyvi.pyx":509 * def GetCompletions(self, *args): * if (len(args)==1) and (isinstance(args[0], bytes)): * return self._GetCompletions_0(*args) # <<<<<<<<<<<<<< @@ -16001,16 +14119,16 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct * return self._GetCompletions_1(*args) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "pykeyvi.pyx":624 + /* "pykeyvi.pyx":508 * * def GetCompletions(self, *args): * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< @@ -16019,14 +14137,14 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct */ } - /* "pykeyvi.pyx":626 + /* "pykeyvi.pyx":510 * if (len(args)==1) and (isinstance(args[0], bytes)): * return self._GetCompletions_0(*args) * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< * return self._GetCompletions_1(*args) * else: */ - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((__pyx_t_2 == 2) != 0); if (__pyx_t_5) { } else { @@ -16065,7 +14183,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct __pyx_L6_bool_binop_done:; if (__pyx_t_1) { - /* "pykeyvi.pyx":627 + /* "pykeyvi.pyx":511 * return self._GetCompletions_0(*args) * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): * return self._GetCompletions_1(*args) # <<<<<<<<<<<<<< @@ -16073,16 +14191,16 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct * raise Exception('can not handle type of %s' % (args,)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "pykeyvi.pyx":626 + /* "pykeyvi.pyx":510 * if (len(args)==1) and (isinstance(args[0], bytes)): * return self._GetCompletions_0(*args) * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< @@ -16091,36 +14209,36 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct */ } - /* "pykeyvi.pyx":629 + /* "pykeyvi.pyx":513 * return self._GetCompletions_1(*args) * else: * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * cdef class PredictiveCompression: + * def __init__(self, Dictionary in_0 , Dictionary in_1 ): */ /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_args); __Pyx_GIVEREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":623 + /* "pykeyvi.pyx":507 * return py_result * * def GetCompletions(self, *args): # <<<<<<<<<<<<<< @@ -16132,7 +14250,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.GetCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.GetCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16140,186 +14258,33 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct return __pyx_r; } -/* "pykeyvi.pyx":635 - * cdef shared_ptr[_PredictiveCompression] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() +/* "pykeyvi.pyx":515 + * raise Exception('can not handle type of %s' % (args,)) * + * def __init__(self, Dictionary in_0 , Dictionary in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' */ /* Python wrapper */ -static void __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":636 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":635 - * cdef shared_ptr[_PredictiveCompression] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":639 - * - * - * def Compress(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_3Compress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_3Compress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Compress (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_21PredictiveCompression_2Compress(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_2Compress(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { - std::string __pyx_v__r; - std::string __pyx_v_py_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Compress", 0); - - /* "pykeyvi.pyx":640 - * - * def Compress(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_string _r = self.inst.get().Compress((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":642 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef libcpp_string _r = self.inst.get().Compress((in_0)) # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->Compress(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":643 - * - * cdef libcpp_string _r = self.inst.get().Compress((in_0)) - * py_result = _r # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result = ((std::string)__pyx_v__r); - - /* "pykeyvi.pyx":644 - * cdef libcpp_string _r = self.inst.get().Compress((in_0)) - * py_result = _r - * return py_result # <<<<<<<<<<<<<< - * - * def __init__(self, bytes in_0 ): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "pykeyvi.pyx":639 - * - * - * def Compress(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Compress", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":646 - * return py_result - * - * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - -/* Python wrapper */ -static int __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_in_0 = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static int __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; + struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_1 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,0}; - PyObject* values[1] = {0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; + PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; @@ -16329,27 +14294,35 @@ static int __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__(PyObject *__pyx_v case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_in_0 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[0]); + __pyx_v_in_1 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.PredictiveCompression.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_21PredictiveCompression_4__init__(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self), __pyx_v_in_0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_1), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_8__init__(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); /* function exit code */ goto __pyx_L0; @@ -16360,204 +14333,131 @@ static int __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__(PyObject *__pyx_v return __pyx_r; } -static int __pyx_pf_7pykeyvi_21PredictiveCompression_4__init__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { +static int __pyx_pf_7pykeyvi_25ForwardBackwardCompletion_8__init__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_1) { + boost::shared_ptr __pyx_v_input_in_0; + boost::shared_ptr __pyx_v_input_in_1; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; - keyvi::compression::PredictiveCompression *__pyx_t_3; + boost::shared_ptr __pyx_t_2; + keyvi::dictionary::completion::ForwardBackwardCompletion *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":647 - * - * def __init__(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":516 * - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) + * def __init__(self, Dictionary in_0 , Dictionary in_1 ): + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":649 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + /* "pykeyvi.pyx":517 + * def __init__(self, Dictionary in_0 , Dictionary in_1 ): + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_1), __pyx_ptype_7pykeyvi_Dictionary); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":518 + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< + * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst + * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) + */ + __pyx_t_2 = __pyx_v_in_0->inst; + __pyx_v_input_in_0 = __pyx_t_2; + + /* "pykeyvi.pyx":519 + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) * - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) # <<<<<<<<<<<<<< + */ + __pyx_t_2 = __pyx_v_in_1->inst; + __pyx_v_input_in_1 = __pyx_t_2; + + /* "pykeyvi.pyx":520 + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst + * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) # <<<<<<<<<<<<<< * - * def Uncompress(self, bytes in_0 ): + * cdef class loading_strategy_types: */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_3 = new keyvi::compression::PredictiveCompression(((std::string)__pyx_t_2)); + __pyx_t_3 = new keyvi::dictionary::completion::ForwardBackwardCompletion(__pyx_v_input_in_0, __pyx_v_input_in_1); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":646 - * return py_result - * - * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + /* "pykeyvi.pyx":515 + * raise Exception('can not handle type of %s' % (args,)) * + * def __init__(self, Dictionary in_0 , Dictionary in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.PredictiveCompression.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":651 - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) +/* "pykeyvi.pyx":536 + * cdef shared_ptr[_CompletionDictionaryCompiler] inst * - * def Uncompress(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Uncompress (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { - std::string __pyx_v__r; - std::string __pyx_v_py_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Uncompress", 0); - - /* "pykeyvi.pyx":652 - * - * def Uncompress(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":654 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v__r = __pyx_v_self->inst.get()->Uncompress(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":655 - * - * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) - * py_result = _r # <<<<<<<<<<<<<< - * return py_result - * - */ - __pyx_v_py_result = ((std::string)__pyx_v__r); - - /* "pykeyvi.pyx":656 - * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) - * py_result = _r - * return py_result # <<<<<<<<<<<<<< - * - * cdef class KeyOnlyDictionaryGenerator: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "pykeyvi.pyx":651 - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) - * - * def Uncompress(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Uncompress", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":662 - * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); + __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } -static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { +static void __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":663 + /* "pykeyvi.pyx":537 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -16566,8 +14466,8 @@ static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __ */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":662 - * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst + /* "pykeyvi.pyx":536 + * cdef shared_ptr[_CompletionDictionaryCompiler] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -16578,233 +14478,191 @@ static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __ __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":666 - * - * - * def __init__(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) - * - */ - -/* Python wrapper */ -static int __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - keyvi::dictionary::KeyOnlyDictionaryGenerator *__pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "pykeyvi.pyx":667 - * - * def __init__(self): - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) # <<<<<<<<<<<<<< - * - * def Add(self, bytes in_0 ): - */ - try { - __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryGenerator(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - - /* "pykeyvi.pyx":666 - * +/* "pykeyvi.pyx":540 * - * def __init__(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":669 - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * - * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def __setitem__(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_5Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_5Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { +static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1); /*proto*/ +static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_4Add(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_2__setitem__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0), ((PyObject *)__pyx_v_in_1)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_4Add(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_2__setitem__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; + int __pyx_t_2; + int __pyx_t_3; + std::string __pyx_t_4; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Add", 0); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "pykeyvi.pyx":670 + /* "pykeyvi.pyx":541 * - * def Add(self, bytes in_0 ): + * def __setitem__(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' * - * self.inst.get().Add((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":672 + /* "pykeyvi.pyx":542 + * def __setitem__(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< * - * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< * - * def CloseFeeding(self): */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_in_1); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_in_1); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":545 + * + * + * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def Add(self, bytes in_0 , in_1 ): + */ + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); + __pyx_v_self->inst.get()->__setitem__(((std::string)__pyx_t_4), ((int)__pyx_t_5)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":669 - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) + /* "pykeyvi.pyx":540 * - * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * + * def __setitem__(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":674 - * self.inst.get().Add((in_0)) - * - * def CloseFeeding(self): # <<<<<<<<<<<<<< - * self.inst.get().CloseFeeding() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_7CloseFeeding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_7CloseFeeding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("CloseFeeding (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_6CloseFeeding(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_6CloseFeeding(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("CloseFeeding", 0); - - /* "pykeyvi.pyx":675 - * - * def CloseFeeding(self): - * self.inst.get().CloseFeeding() # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): - */ - __pyx_v_self->inst.get()->CloseFeeding(); - - /* "pykeyvi.pyx":674 - * self.inst.get().Add((in_0)) - * - * def CloseFeeding(self): # <<<<<<<<<<<<<< - * self.inst.get().CloseFeeding() - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":677 - * self.inst.get().CloseFeeding() +/* "pykeyvi.pyx":547 + * self.inst.get().__setitem__((in_0), (in_1)) * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Add(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_5Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_5Add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + PyObject *__pyx_v_in_1 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + __Pyx_RefNannySetupContext("Add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_in_1 = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_4Add(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); /* function exit code */ goto __pyx_L0; @@ -16815,56 +14673,92 @@ static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile(PyO return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_4Add(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; + int __pyx_t_2; + int __pyx_t_3; + std::string __pyx_t_4; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("WriteToFile", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":678 + /* "pykeyvi.pyx":548 * - * def WriteToFile(self, bytes in_0 ): + * def Add(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' * - * self.inst.get().WriteToFile((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":680 + /* "pykeyvi.pyx":549 + * def Add(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< * - * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * cdef class KeyOnlyDictionaryCompiler: */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->WriteToFile(((std::string)__pyx_t_2)); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_in_1); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_in_1); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":677 - * self.inst.get().CloseFeeding() + /* "pykeyvi.pyx":552 * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * + * self.inst.get().Add((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def _init_0(self): + */ + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_4), ((int)__pyx_t_5)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":547 + * self.inst.get().__setitem__((in_0), (in_1)) + * + * def Add(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16872,100 +14766,56 @@ static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(str return __pyx_r; } -/* "pykeyvi.pyx":686 - * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* Python wrapper */ -static void __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":687 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":686 - * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":690 - * +/* "pykeyvi.pyx":554 + * self.inst.get().Add((in_0), (in_1)) * * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_7_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_7_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self)); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_6_init_0(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_6_init_0(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - keyvi::dictionary::KeyOnlyDictionaryCompiler *__pyx_t_1; + keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_init_0", 0); - /* "pykeyvi.pyx":691 + /* "pykeyvi.pyx":555 * * def _init_0(self): - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) # <<<<<<<<<<<<<< * * def _init_1(self, memory_limit ): */ try { - __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(); + __pyx_t_1 = new keyvi::dictionary::CompletionDictionaryCompiler(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":690 - * + /* "pykeyvi.pyx":554 + * self.inst.get().Add((in_0), (in_1)) * * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) * */ @@ -16973,7 +14823,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(struct _ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16981,8 +14831,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(struct _ return __pyx_r; } -/* "pykeyvi.pyx":693 - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) +/* "pykeyvi.pyx":557 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) * * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -16990,37 +14840,37 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(struct _ */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_9_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_9_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8_init_1(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8_init_1(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; size_t __pyx_t_4; - keyvi::dictionary::KeyOnlyDictionaryCompiler *__pyx_t_5; + keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_init_1", 0); - /* "pykeyvi.pyx":694 + /* "pykeyvi.pyx":558 * * def _init_1(self, memory_limit ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< * - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -17037,29 +14887,29 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct _ __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":696 + /* "pykeyvi.pyx":560 * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< * * def _init_2(self, memory_limit , dict value_store_params ): */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_5 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(((size_t)__pyx_t_4)); + __pyx_t_5 = new keyvi::dictionary::CompletionDictionaryCompiler(((size_t)__pyx_t_4)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); - /* "pykeyvi.pyx":693 - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) + /* "pykeyvi.pyx":557 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) * * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -17070,7 +14920,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct _ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17078,8 +14928,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct _ return __pyx_r; } -/* "pykeyvi.pyx":698 - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":562 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -17087,8 +14937,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct _ */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_11_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_11_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_memory_limit = 0; PyObject *__pyx_v_value_store_params = 0; int __pyx_lineno = 0; @@ -17117,11 +14967,11 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -17134,14 +14984,14 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_10_init_2(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); /* function exit code */ goto __pyx_L0; @@ -17151,9 +15001,9 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generator15(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator15(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":700 +/* "pykeyvi.pyx":564 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< @@ -17161,7 +15011,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generat * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -17179,7 +15029,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr( __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_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generator15, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator15, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -17187,7 +15037,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr( /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -17195,7 +15045,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr( return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generator15(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator15(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -17217,21 +15067,21 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generat return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -17239,17 +15089,17 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generat if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -17259,7 +15109,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generat PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -17301,9 +15151,9 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generat __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator16(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator16(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -17321,7 +15171,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr __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_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator16, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator16, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -17329,7 +15179,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -17337,7 +15187,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator16(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator16(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -17359,21 +15209,21 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generat return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -17381,17 +15231,17 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generat if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -17401,7 +15251,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generat PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -17444,15 +15294,15 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generat return __pyx_r; } -/* "pykeyvi.pyx":698 - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":562 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_10_init_2(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_cur_scope; std::map *__pyx_v_v1; PyObject *__pyx_v_key = NULL; @@ -17474,7 +15324,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ std::string __pyx_t_13; std::string __pyx_t_14; size_t __pyx_t_15; - keyvi::dictionary::KeyOnlyDictionaryCompiler *__pyx_t_16; + keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -17489,7 +15339,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); - /* "pykeyvi.pyx":699 + /* "pykeyvi.pyx":563 * * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< @@ -17511,12 +15361,12 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __pyx_L3_bool_binop_done:; if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":700 + /* "pykeyvi.pyx":564 * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< @@ -17535,35 +15385,35 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_t_4 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_t_5 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L5_bool_binop_done:; if (unlikely(!__pyx_t_1)) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":702 + /* "pykeyvi.pyx":566 * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< @@ -17574,30 +15424,30 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __pyx_t_6 = new std::map (); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":703 + /* "pykeyvi.pyx":567 * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< * deref(v1)[ key ] = value - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) */ if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -17605,17 +15455,17 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } @@ -17625,7 +15475,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -17641,7 +15491,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -17654,15 +15504,15 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -17670,7 +15520,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L11_unpacking_done; @@ -17678,7 +15528,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L11_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); @@ -17686,54 +15536,54 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); __pyx_t_10 = 0; - /* "pykeyvi.pyx":704 + /* "pykeyvi.pyx":568 * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): * deref(v1)[ key ] = value # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) * del v1 */ - __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); - /* "pykeyvi.pyx":703 + /* "pykeyvi.pyx":567 * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< * deref(v1)[ key ] = value - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pykeyvi.pyx":705 + /* "pykeyvi.pyx":569 * for key, value in value_store_params.items(): * deref(v1)[ key ] = value - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< * del v1 * */ - __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_16 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); + __pyx_t_16 = new keyvi::dictionary::CompletionDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - /* "pykeyvi.pyx":706 + /* "pykeyvi.pyx":570 * deref(v1)[ key ] = value - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) * del v1 # <<<<<<<<<<<<<< * * def __init__(self, *args): */ delete __pyx_v_v1; - /* "pykeyvi.pyx":698 - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) + /* "pykeyvi.pyx":562 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' @@ -17749,7 +15599,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_key); @@ -17760,7 +15610,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ return __pyx_r; } -/* "pykeyvi.pyx":708 +/* "pykeyvi.pyx":572 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -17769,8 +15619,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; int __pyx_r; __Pyx_RefNannyDeclarations @@ -17778,16 +15628,16 @@ static int __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__(PyObject *__p if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_12__init__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator17(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator17(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":713 +/* "pykeyvi.pyx":577 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -17795,7 +15645,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera * else: */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -17813,7 +15663,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr __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_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator17, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator17, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -17821,7 +15671,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -17829,7 +15679,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator17(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator17(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -17852,13 +15702,13 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -17871,10 +15721,10 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera } } if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17882,9 +15732,9 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -17892,17 +15742,17 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -17912,7 +15762,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -17955,9 +15805,9 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator18(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator18(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -17975,7 +15825,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexp __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_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator18, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator18, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -17983,7 +15833,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexp /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); @@ -17991,7 +15841,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexp return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator18(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator18(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; @@ -18014,13 +15864,13 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -18033,10 +15883,10 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera } } if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -18044,9 +15894,9 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -18054,17 +15904,17 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); #endif } @@ -18074,7 +15924,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -18118,7 +15968,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera return __pyx_r; } -/* "pykeyvi.pyx":708 +/* "pykeyvi.pyx":572 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -18126,7 +15976,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera * self._init_0(*args) */ -static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { +static int __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_12__init__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_cur_scope; int __pyx_r; __Pyx_RefNannyDeclarations @@ -18151,7 +16001,7 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - /* "pykeyvi.pyx":709 + /* "pykeyvi.pyx":573 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -18162,21 +16012,21 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":710 + /* "pykeyvi.pyx":574 * def __init__(self, *args): * if not args: * self._init_0(*args) # <<<<<<<<<<<<<< * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":709 + /* "pykeyvi.pyx":573 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -18186,7 +16036,7 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ goto __pyx_L3; } - /* "pykeyvi.pyx":711 + /* "pykeyvi.pyx":575 * if not args: * self._init_0(*args) * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< @@ -18197,9 +16047,9 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __Pyx_INCREF(__pyx_t_4); if (unlikely(__pyx_t_4 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = ((__pyx_t_5 == 1) != 0); if (__pyx_t_1) { @@ -18229,21 +16079,21 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":712 + /* "pykeyvi.pyx":576 * self._init_0(*args) * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) # <<<<<<<<<<<<<< * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): * self._init_2(*args) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":711 + /* "pykeyvi.pyx":575 * if not args: * self._init_0(*args) * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< @@ -18253,7 +16103,7 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ goto __pyx_L3; } - /* "pykeyvi.pyx":713 + /* "pykeyvi.pyx":577 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -18264,9 +16114,9 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __Pyx_INCREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((__pyx_t_5 == 2) != 0); if (__pyx_t_6) { @@ -18307,44 +16157,44 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_t_3 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_t_4 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":714 + /* "pykeyvi.pyx":578 * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): * self._init_2(*args) # <<<<<<<<<<<<<< * else: * raise Exception('can not handle type of %s' % (args,)) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":713 + /* "pykeyvi.pyx":577 * elif (len(args)==1) and (isinstance(args[0], (int, long))): * self._init_1(*args) * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< @@ -18354,37 +16204,37 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ goto __pyx_L3; } - /* "pykeyvi.pyx":716 + /* "pykeyvi.pyx":580 * self._init_2(*args) * else: * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def Add(self, bytes in_0 ): + * def WriteToFile(self, bytes in_0 ): */ /*else*/ { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; - /* "pykeyvi.pyx":708 + /* "pykeyvi.pyx":572 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -18398,7 +16248,7 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -18406,116 +16256,25 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ return __pyx_r; } -/* "pykeyvi.pyx":718 - * raise Exception('can not handle type of %s' % (args,)) - * - * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Add", 0); - - /* "pykeyvi.pyx":719 - * - * def Add(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * self.inst.get().Add((in_0)) - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); - if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":721 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): - */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":718 +/* "pykeyvi.pyx":582 * raise Exception('can not handle type of %s' % (args,)) * - * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":723 - * self.inst.get().Add((in_0)) - * * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * cdef const_char * input_in_0 = in_0 */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_15WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_14WriteToFile(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ goto __pyx_L0; @@ -18526,7 +16285,7 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile(PyO return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { const char *__pyx_v_input_in_0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18537,7 +16296,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":724 + /* "pykeyvi.pyx":583 * * def WriteToFile(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< @@ -18549,22 +16308,22 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":725 + /* "pykeyvi.pyx":584 * def WriteToFile(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< * self.inst.get().WriteToFile(input_in_0) * */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - /* "pykeyvi.pyx":726 + /* "pykeyvi.pyx":585 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * cdef const_char * input_in_0 = in_0 * self.inst.get().WriteToFile(input_in_0) # <<<<<<<<<<<<<< @@ -18573,8 +16332,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str */ __pyx_v_self->inst.get()->WriteToFile(__pyx_v_input_in_0); - /* "pykeyvi.pyx":723 - * self.inst.get().Add((in_0)) + /* "pykeyvi.pyx":582 + * raise Exception('can not handle type of %s' % (args,)) * * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' @@ -18585,7 +16344,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18593,7 +16352,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str return __pyx_r; } -/* "pykeyvi.pyx":728 +/* "pykeyvi.pyx":587 * self.inst.get().WriteToFile(input_in_0) * * def __enter__(self): # <<<<<<<<<<<<<< @@ -18602,24 +16361,24 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self)); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_16__enter__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__", 0); - /* "pykeyvi.pyx":729 + /* "pykeyvi.pyx":588 * * def __enter__(self): * return self # <<<<<<<<<<<<<< @@ -18631,7 +16390,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struc __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "pykeyvi.pyx":728 + /* "pykeyvi.pyx":587 * self.inst.get().WriteToFile(input_in_0) * * def __enter__(self): # <<<<<<<<<<<<<< @@ -18646,7 +16405,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struc return __pyx_r; } -/* "pykeyvi.pyx":732 +/* "pykeyvi.pyx":591 * * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -18655,8 +16414,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struc */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_type = 0; CYTHON_UNUSED PyObject *__pyx_v_value = 0; CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; @@ -18687,16 +16446,16 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__(PyObje case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -18711,20 +16470,20 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_18__exit__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_18__exit__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -18735,14 +16494,14 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__exit__", 0); - /* "pykeyvi.pyx":733 + /* "pykeyvi.pyx":592 * * def __exit__(self, type, value, traceback): * self.Compile() # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -18755,16 +16514,16 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct } } if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":732 + /* "pykeyvi.pyx":591 * * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -18779,7 +16538,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18787,7 +16546,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct return __pyx_r; } -/* "pykeyvi.pyx":736 +/* "pykeyvi.pyx":595 * * * def Compile(self, *args): # <<<<<<<<<<<<<< @@ -18796,8 +16555,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_21Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -18805,7 +16564,7 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile(PyObjec if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); @@ -18813,7 +16572,7 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile(PyObjec return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { void *__pyx_v_callback; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18821,7 +16580,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct int __pyx_t_2; __Pyx_RefNannySetupContext("Compile", 0); - /* "pykeyvi.pyx":737 + /* "pykeyvi.pyx":596 * * def Compile(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -18832,7 +16591,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":738 + /* "pykeyvi.pyx":597 * def Compile(self, *args): * if not args: * with nogil: # <<<<<<<<<<<<<< @@ -18846,7 +16605,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct #endif /*try:*/ { - /* "pykeyvi.pyx":739 + /* "pykeyvi.pyx":598 * if not args: * with nogil: * self.inst.get().Compile() # <<<<<<<<<<<<<< @@ -18856,7 +16615,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_v_self->inst.get()->Compile(); } - /* "pykeyvi.pyx":738 + /* "pykeyvi.pyx":597 * def Compile(self, *args): * if not args: * with nogil: # <<<<<<<<<<<<<< @@ -18874,7 +16633,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct } } - /* "pykeyvi.pyx":740 + /* "pykeyvi.pyx":599 * with nogil: * self.inst.get().Compile() * return # <<<<<<<<<<<<<< @@ -18885,7 +16644,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pykeyvi.pyx":737 + /* "pykeyvi.pyx":596 * * def Compile(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -18894,7 +16653,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct */ } - /* "pykeyvi.pyx":742 + /* "pykeyvi.pyx":601 * return * * cdef void* callback = args[0] # <<<<<<<<<<<<<< @@ -18903,7 +16662,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct */ __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); - /* "pykeyvi.pyx":743 + /* "pykeyvi.pyx":602 * * cdef void* callback = args[0] * with nogil: # <<<<<<<<<<<<<< @@ -18917,7 +16676,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct #endif /*try:*/ { - /* "pykeyvi.pyx":744 + /* "pykeyvi.pyx":603 * cdef void* callback = args[0] * with nogil: * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< @@ -18927,7 +16686,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); } - /* "pykeyvi.pyx":743 + /* "pykeyvi.pyx":602 * * cdef void* callback = args[0] * with nogil: # <<<<<<<<<<<<<< @@ -18945,7 +16704,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct } } - /* "pykeyvi.pyx":736 + /* "pykeyvi.pyx":595 * * * def Compile(self, *args): # <<<<<<<<<<<<<< @@ -18961,7 +16720,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct return __pyx_r; } -/* "pykeyvi.pyx":747 +/* "pykeyvi.pyx":606 * * * def SetManifest(self, manifest): # <<<<<<<<<<<<<< @@ -18970,19 +16729,19 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_21SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_21SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_23SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); + __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { +static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { PyObject *__pyx_v_m = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18996,16 +16755,16 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetManifest", 0); - /* "pykeyvi.pyx":748 + /* "pykeyvi.pyx":607 * * def SetManifest(self, manifest): * m = json.dumps(manifest) # <<<<<<<<<<<<<< * self.inst.get().SetManifestFromString(m) * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -19019,16 +16778,16 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_manifest); __Pyx_GIVEREF(__pyx_v_manifest); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -19036,17 +16795,17 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; - /* "pykeyvi.pyx":749 + /* "pykeyvi.pyx":608 * def SetManifest(self, manifest): * m = json.dumps(manifest) * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< * - * cdef class Match: + * */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_m); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_m); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - /* "pykeyvi.pyx":747 + /* "pykeyvi.pyx":606 * * * def SetManifest(self, manifest): # <<<<<<<<<<<<<< @@ -19062,7 +16821,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_m); @@ -19071,8 +16830,99 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str return __pyx_r; } -/* "pykeyvi.pyx":755 - * cdef shared_ptr[_Match] inst +/* "pykeyvi.pyx":612 + * + * # definition for all compilers + * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< + * (py_callback)(a, b) + * + */ + +static void __pyx_f_7pykeyvi_callback_wrapper(size_t __pyx_v_a, size_t __pyx_v_b, void *__pyx_v_py_callback) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("callback_wrapper", 0); + + /* "pykeyvi.pyx":613 + * # definition for all compilers + * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: + * (py_callback)(a, b) # <<<<<<<<<<<<<< + * + * cdef class MultiWordCompletion: + */ + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_b); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_py_callback)); + __pyx_t_4 = ((PyObject *)__pyx_v_py_callback); __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":612 + * + * # definition for all compilers + * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< + * (py_callback)(a, b) + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_WriteUnraisable("pykeyvi.callback_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif +} + +/* "pykeyvi.pyx":619 + * cdef shared_ptr[_MultiWordCompletion] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -19080,21 +16930,21 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str */ /* Python wrapper */ -static void __pyx_pw_7pykeyvi_5Match_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_7pykeyvi_5Match_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_5Match___dealloc__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } -static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { +static void __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":756 + /* "pykeyvi.pyx":620 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -19103,8 +16953,8 @@ static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":755 - * cdef shared_ptr[_Match] inst + /* "pykeyvi.pyx":619 + * cdef shared_ptr[_MultiWordCompletion] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -19115,283 +16965,340 @@ static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":759 - * +/* "pykeyvi.pyx":623 * - * def SetEnd(self, end ): # <<<<<<<<<<<<<< - * assert isinstance(end, (int, long)), 'arg end wrong type' * + * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_3SetEnd(PyObject *__pyx_v_self, PyObject *__pyx_v_end); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_3SetEnd(PyObject *__pyx_v_self, PyObject *__pyx_v_end) { - PyObject *__pyx_r = 0; +static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetEnd (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_2SetEnd(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_end)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_in_0 = ((struct __pyx_obj_7pykeyvi_Dictionary *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary, 1, "in_0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), __pyx_v_in_0); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_2SetEnd(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_end) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_in_0) { + boost::shared_ptr __pyx_v_input_in_0; + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - size_t __pyx_t_4; + boost::shared_ptr __pyx_t_2; + keyvi::dictionary::completion::MultiWordCompletion *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetEnd", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":760 - * - * def SetEnd(self, end ): - * assert isinstance(end, (int, long)), 'arg end wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":624 * - * self.inst.get().SetEnd((end)) + * def __init__(self, Dictionary in_0 ): + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_end); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_end); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), __pyx_ptype_7pykeyvi_Dictionary); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_end_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":762 - * assert isinstance(end, (int, long)), 'arg end wrong type' - * - * self.inst.get().SetEnd((end)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":625 + * def __init__(self, Dictionary in_0 ): + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) * - * def GetStart(self): */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_end); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->SetEnd(((size_t)__pyx_t_4)); + __pyx_t_2 = __pyx_v_in_0->inst; + __pyx_v_input_in_0 = __pyx_t_2; - /* "pykeyvi.pyx":759 + /* "pykeyvi.pyx":626 + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) # <<<<<<<<<<<<<< * + * def _GetCompletions_0(self, bytes in_0 ): + */ + try { + __pyx_t_3 = new keyvi::dictionary::completion::MultiWordCompletion(__pyx_v_input_in_0); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + + /* "pykeyvi.pyx":623 * - * def SetEnd(self, end ): # <<<<<<<<<<<<<< - * assert isinstance(end, (int, long)), 'arg end wrong type' * + * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Match.SetEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":764 - * self.inst.get().SetEnd((end)) +/* "pykeyvi.pyx":628 + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) + * + * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetStart(self): # <<<<<<<<<<<<<< - * cdef size_t _r = self.inst.get().GetStart() - * py_result = _r */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_5GetStart(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_5GetStart(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetStart (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_4GetStart(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); +static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_GetCompletions_0 (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - size_t __pyx_v__r; - size_t __pyx_v_py_result; +static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetStart", 0); - - /* "pykeyvi.pyx":765 - * - * def GetStart(self): - * cdef size_t _r = self.inst.get().GetStart() # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_v__r = __pyx_v_self->inst.get()->GetStart(); + __Pyx_RefNannySetupContext("_GetCompletions_0", 0); - /* "pykeyvi.pyx":766 - * def GetStart(self): - * cdef size_t _r = self.inst.get().GetStart() - * py_result = _r # <<<<<<<<<<<<<< - * return py_result + /* "pykeyvi.pyx":629 * - */ - __pyx_v_py_result = ((size_t)__pyx_v__r); - - /* "pykeyvi.pyx":767 - * cdef size_t _r = self.inst.get().GetStart() - * py_result = _r - * return py_result # <<<<<<<<<<<<<< + * def _GetCompletions_0(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * def GetScore(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":764 - * self.inst.get().SetEnd((end)) + /* "pykeyvi.pyx":631 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetStart(self): # <<<<<<<<<<<<<< - * cdef size_t _r = self.inst.get().GetStart() - * py_result = _r + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.GetStart", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":769 - * return py_result + /* "pykeyvi.pyx":632 * - * def GetScore(self): # <<<<<<<<<<<<<< - * cdef float _r = self.inst.get().GetScore() - * py_result = _r + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() */ + __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); + __pyx_t_3 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_7GetScore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_7GetScore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetScore (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_6GetScore(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - float __pyx_v__r; - PyObject *__pyx_v_py_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetScore", 0); - - /* "pykeyvi.pyx":770 - * - * def GetScore(self): - * cdef float _r = self.inst.get().GetScore() # <<<<<<<<<<<<<< - * py_result = _r + /* "pykeyvi.pyx":633 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() * return py_result */ - __pyx_v__r = __pyx_v_self->inst.get()->GetScore(); + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":771 - * def GetScore(self): - * cdef float _r = self.inst.get().GetScore() - * py_result = _r # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":634 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< * return py_result * */ - __pyx_t_1 = PyFloat_FromDouble(((float)__pyx_v__r)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_py_result = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":772 - * cdef float _r = self.inst.get().GetScore() - * py_result = _r + /* "pykeyvi.pyx":635 + * py_result.it = _r.begin() + * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< * - * def SetMatchedString(self, bytes matched_string ): + * def _GetCompletions_1(self, bytes in_0 , in_1 ): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_py_result); - __pyx_r = __pyx_v_py_result; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":769 - * return py_result + /* "pykeyvi.pyx":628 + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) + * + * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetScore(self): # <<<<<<<<<<<<<< - * cdef float _r = self.inst.get().GetScore() - * py_result = _r */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.GetScore", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_result); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":774 +/* "pykeyvi.pyx":637 * return py_result * - * def SetMatchedString(self, bytes matched_string ): # <<<<<<<<<<<<<< - * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' - * + * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_9SetMatchedString(PyObject *__pyx_v_self, PyObject *__pyx_v_matched_string); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_9SetMatchedString(PyObject *__pyx_v_self, PyObject *__pyx_v_matched_string) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + PyObject *__pyx_v_in_1 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetMatchedString (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_matched_string), (&PyBytes_Type), 1, "matched_string", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_5Match_8SetMatchedString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject*)__pyx_v_matched_string)); + __Pyx_RefNannySetupContext("_GetCompletions_1 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_GetCompletions_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_in_0 = ((PyObject*)values[0]); + __pyx_v_in_1 = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), __pyx_v_in_0, __pyx_v_in_1); /* function exit code */ goto __pyx_L0; @@ -19402,323 +17309,344 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_9SetMatchedString(PyObject *__pyx_v_se return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_8SetMatchedString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_matched_string) { +static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { + keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; + struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - std::string __pyx_t_2; + int __pyx_t_2; + int __pyx_t_3; + std::string __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetMatchedString", 0); + __Pyx_RefNannySetupContext("_GetCompletions_1", 0); - /* "pykeyvi.pyx":775 + /* "pykeyvi.pyx":638 * - * def SetMatchedString(self, bytes matched_string ): - * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' # <<<<<<<<<<<<<< + * def _GetCompletions_1(self, bytes in_0 , in_1 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' * - * self.inst.get().SetMatchedString((matched_string)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyBytes_Check(__pyx_v_matched_string); + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_matched_string_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":777 - * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' + /* "pykeyvi.pyx":639 + * def _GetCompletions_1(self, bytes in_0 , in_1 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< * - * self.inst.get().SetMatchedString((matched_string)) # <<<<<<<<<<<<<< * - * def GetValueAsString(self): */ - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_matched_string); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->SetMatchedString(((std::string)__pyx_t_2)); - - /* "pykeyvi.pyx":774 - * return py_result + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_in_1); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_in_1); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_1_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":642 * - * def SetMatchedString(self, bytes matched_string ): # <<<<<<<<<<<<<< - * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_in_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Match.SetMatchedString", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":779 - * self.inst.get().SetMatchedString((matched_string)) + /* "pykeyvi.pyx":643 * - * def GetValueAsString(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetValueAsString() - * py_result = _r + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() */ + __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)__pyx_ptype_7pykeyvi_MatchIterator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7pykeyvi_MatchIterator)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_6); + __pyx_t_6 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_11GetValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_11GetValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetValueAsString (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_10GetValueAsString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - std::string __pyx_v__r; - std::string __pyx_v_py_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetValueAsString", 0); - - /* "pykeyvi.pyx":780 - * - * def GetValueAsString(self): - * cdef libcpp_string _r = self.inst.get().GetValueAsString() # <<<<<<<<<<<<<< - * py_result = _r + /* "pykeyvi.pyx":644 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0), (in_1)) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() * return py_result */ - try { - __pyx_t_1 = __pyx_v_self->inst.get()->GetValueAsString(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v__r = __pyx_t_1; + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":781 - * def GetValueAsString(self): - * cdef libcpp_string _r = self.inst.get().GetValueAsString() - * py_result = _r # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":645 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< * return py_result * */ - __pyx_v_py_result = ((std::string)__pyx_v__r); + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":782 - * cdef libcpp_string _r = self.inst.get().GetValueAsString() - * py_result = _r + /* "pykeyvi.pyx":646 + * py_result.it = _r.begin() + * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< * - * def IsEmpty(self): + * def GetCompletions(self, *args): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":779 - * self.inst.get().SetMatchedString((matched_string)) + /* "pykeyvi.pyx":637 + * return py_result * - * def GetValueAsString(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetValueAsString() - * py_result = _r + * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pykeyvi.Match.GetValueAsString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":784 +/* "pykeyvi.pyx":648 * return py_result * - * def IsEmpty(self): # <<<<<<<<<<<<<< - * cdef bool _r = self.inst.get().IsEmpty() - * py_result = _r + * def GetCompletions(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_13IsEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_13IsEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("IsEmpty (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_12IsEmpty(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("GetCompletions (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "GetCompletions", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__pyx_v_self), __pyx_v_args); /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - bool __pyx_v__r; - bool __pyx_v_py_result; +static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_args) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("IsEmpty", 0); - - /* "pykeyvi.pyx":785 - * - * def IsEmpty(self): - * cdef bool _r = self.inst.get().IsEmpty() # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_v__r = __pyx_v_self->inst.get()->IsEmpty(); + __Pyx_RefNannySetupContext("GetCompletions", 0); - /* "pykeyvi.pyx":786 - * def IsEmpty(self): - * cdef bool _r = self.inst.get().IsEmpty() - * py_result = _r # <<<<<<<<<<<<<< - * return py_result + /* "pykeyvi.pyx":649 * + * def GetCompletions(self, *args): + * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< + * return self._GetCompletions_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): */ - __pyx_v_py_result = ((bool)__pyx_v__r); + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((__pyx_t_2 == 1) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyBytes_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "pykeyvi.pyx":787 - * cdef bool _r = self.inst.get().IsEmpty() - * py_result = _r - * return py_result # <<<<<<<<<<<<<< - * - * def SetScore(self, float score ): + /* "pykeyvi.pyx":650 + * def GetCompletions(self, *args): + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetCompletions_1(*args) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "pykeyvi.pyx":784 - * return py_result + /* "pykeyvi.pyx":649 * - * def IsEmpty(self): # <<<<<<<<<<<<<< - * cdef bool _r = self.inst.get().IsEmpty() - * py_result = _r + * def GetCompletions(self, *args): + * if (len(args)==1) and (isinstance(args[0], bytes)): # <<<<<<<<<<<<<< + * return self._GetCompletions_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.IsEmpty", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":789 - * return py_result - * - * def SetScore(self, float score ): # <<<<<<<<<<<<<< - * assert isinstance(score, float), 'arg score wrong type' - * + /* "pykeyvi.pyx":651 + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< + * return self._GetCompletions_1(*args) + * else: */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_15SetScore(PyObject *__pyx_v_self, PyObject *__pyx_arg_score); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_15SetScore(PyObject *__pyx_v_self, PyObject *__pyx_arg_score) { - float __pyx_v_score; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetScore (wrapper)", 0); - assert(__pyx_arg_score); { - __pyx_v_score = __pyx_PyFloat_AsFloat(__pyx_arg_score); if (unlikely((__pyx_v_score == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((__pyx_t_2 == 2) != 0); + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L6_bool_binop_done; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Match.SetScore", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_5Match_14SetScore(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((float)__pyx_v_score)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = PyBytes_Check(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = (__pyx_t_5 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = PyInt_Check(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = (__pyx_t_5 != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_3 = __pyx_t_7; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyLong_Check(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = (__pyx_t_7 != 0); + __pyx_t_3 = __pyx_t_5; + __pyx_L9_bool_binop_done:; + __pyx_t_5 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { -static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, float __pyx_v_score) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetScore", 0); + /* "pykeyvi.pyx":652 + * return self._GetCompletions_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): + * return self._GetCompletions_1(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "pykeyvi.pyx":790 - * - * def SetScore(self, float score ): - * assert isinstance(score, float), 'arg score wrong type' # <<<<<<<<<<<<<< - * - * self.inst.get().SetScore((score)) + /* "pykeyvi.pyx":651 + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) + * elif (len(args)==2) and (isinstance(args[0], bytes)) and (isinstance(args[1], (int, long))): # <<<<<<<<<<<<<< + * return self._GetCompletions_1(*args) + * else: */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_Check(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!(__pyx_t_2 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_score_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } } - #endif - /* "pykeyvi.pyx":792 - * assert isinstance(score, float), 'arg score wrong type' - * - * self.inst.get().SetScore((score)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":654 + * return self._GetCompletions_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def GetRawValueAsString(self): + * cdef class PredictiveCompression: */ - __pyx_v_self->inst.get()->SetScore(((float)__pyx_v_score)); + /*else*/ { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } - /* "pykeyvi.pyx":789 + /* "pykeyvi.pyx":648 * return py_result * - * def SetScore(self, float score ): # <<<<<<<<<<<<<< - * assert isinstance(score, float), 'arg score wrong type' - * + * def GetCompletions(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.SetScore", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.GetCompletions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19726,179 +17654,154 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_M return __pyx_r; } -/* "pykeyvi.pyx":794 - * self.inst.get().SetScore((score)) +/* "pykeyvi.pyx":660 + * cdef shared_ptr[_PredictiveCompression] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def GetRawValueAsString(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() - * py_result = _r */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_17GetRawValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_17GetRawValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static void __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetRawValueAsString (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - std::string __pyx_v__r; - std::string __pyx_v_py_result; - PyObject *__pyx_r = NULL; +static void __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self) { __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetRawValueAsString", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":795 + /* "pykeyvi.pyx":661 * - * def GetRawValueAsString(self): - * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - try { - __pyx_t_1 = __pyx_v_self->inst.get()->GetRawValueAsString(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v__r = __pyx_t_1; - - /* "pykeyvi.pyx":796 - * def GetRawValueAsString(self): - * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() - * py_result = _r # <<<<<<<<<<<<<< - * return py_result + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< * - */ - __pyx_v_py_result = ((std::string)__pyx_v__r); - - /* "pykeyvi.pyx":797 - * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() - * py_result = _r - * return py_result # <<<<<<<<<<<<<< * - * def SetStart(self, start ): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":794 - * self.inst.get().SetScore((score)) + /* "pykeyvi.pyx":660 + * cdef shared_ptr[_PredictiveCompression] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def GetRawValueAsString(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() - * py_result = _r */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pykeyvi.Match.GetRawValueAsString", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "pykeyvi.pyx":799 - * return py_result +/* "pykeyvi.pyx":664 * - * def SetStart(self, start ): # <<<<<<<<<<<<<< - * assert isinstance(start, (int, long)), 'arg start wrong type' + * + * def Compress(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_19SetStart(PyObject *__pyx_v_self, PyObject *__pyx_v_start); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_19SetStart(PyObject *__pyx_v_self, PyObject *__pyx_v_start) { +static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_3Compress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_3Compress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetStart (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_18SetStart(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_start)); + __Pyx_RefNannySetupContext("Compress (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_21PredictiveCompression_2Compress(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_start) { +static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_2Compress(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { + std::string __pyx_v__r; + std::string __pyx_v_py_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - size_t __pyx_t_4; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetStart", 0); + __Pyx_RefNannySetupContext("Compress", 0); - /* "pykeyvi.pyx":800 - * - * def SetStart(self, start ): - * assert isinstance(start, (int, long)), 'arg start wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":665 * - * self.inst.get().SetStart((start)) + * def Compress(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_start); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = PyLong_Check(__pyx_v_start); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_start_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":802 - * assert isinstance(start, (int, long)), 'arg start wrong type' - * - * self.inst.get().SetStart((start)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":667 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetEnd(self): + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) # <<<<<<<<<<<<<< + * py_result = _r + * return py_result */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_start); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->inst.get()->SetStart(((size_t)__pyx_t_4)); + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Compress(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":799 + /* "pykeyvi.pyx":668 + * + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) + * py_result = _r # <<<<<<<<<<<<<< * return py_result * - * def SetStart(self, start ): # <<<<<<<<<<<<<< - * assert isinstance(start, (int, long)), 'arg start wrong type' + */ + __pyx_v_py_result = ((std::string)__pyx_v__r); + + /* "pykeyvi.pyx":669 + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def __init__(self, bytes in_0 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":664 + * + * + * def Compress(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Match.SetStart", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Compress", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19906,328 +17809,375 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_M return __pyx_r; } -/* "pykeyvi.pyx":804 - * self.inst.get().SetStart((start)) +/* "pykeyvi.pyx":671 + * return py_result + * + * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetEnd(self): # <<<<<<<<<<<<<< - * cdef size_t _r = self.inst.get().GetEnd() - * py_result = _r */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_21GetEnd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_21GetEnd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static int __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_in_0 = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetEnd (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_20GetEnd(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_0)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_in_0 = ((PyObject*)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.PredictiveCompression.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_21PredictiveCompression_4__init__(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self), __pyx_v_in_0); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - size_t __pyx_v__r; - size_t __pyx_v_py_result; - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_21PredictiveCompression_4__init__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + std::string __pyx_t_2; + keyvi::compression::PredictiveCompression *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetEnd", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":805 + /* "pykeyvi.pyx":672 * - * def GetEnd(self): - * cdef size_t _r = self.inst.get().GetEnd() # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_v__r = __pyx_v_self->inst.get()->GetEnd(); - - /* "pykeyvi.pyx":806 - * def GetEnd(self): - * cdef size_t _r = self.inst.get().GetEnd() - * py_result = _r # <<<<<<<<<<<<<< - * return py_result + * def __init__(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * + * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) */ - __pyx_v_py_result = ((size_t)__pyx_v__r); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":807 - * cdef size_t _r = self.inst.get().GetEnd() - * py_result = _r - * return py_result # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":674 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __copy__(self): + * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) # <<<<<<<<<<<<<< + * + * def Uncompress(self, bytes in_0 ): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_3 = new keyvi::compression::PredictiveCompression(((std::string)__pyx_t_2)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":804 - * self.inst.get().SetStart((start)) + /* "pykeyvi.pyx":671 + * return py_result + * + * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetEnd(self): # <<<<<<<<<<<<<< - * cdef size_t _r = self.inst.get().GetEnd() - * py_result = _r */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.GetEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.PredictiveCompression.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":809 - * return py_result +/* "pykeyvi.pyx":676 + * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) + * + * def Uncompress(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __copy__(self): # <<<<<<<<<<<<<< - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_23__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_23__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_22__copy__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("Uncompress (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - struct __pyx_obj_7pykeyvi_Match *__pyx_v_rv = 0; +static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { + std::string __pyx_v__r; + std::string __pyx_v_py_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__copy__", 0); + __Pyx_RefNannySetupContext("Uncompress", 0); - /* "pykeyvi.pyx":810 + /* "pykeyvi.pyx":677 * - * def __copy__(self): - * cdef Match rv = Match.__new__(Match) # <<<<<<<<<<<<<< - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) - * return rv - */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_rv = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":811 - * def __copy__(self): - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) # <<<<<<<<<<<<<< - * return rv + * def Uncompress(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * + * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) */ - __pyx_v_rv->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_self->inst.get()))); - - /* "pykeyvi.pyx":812 - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) - * return rv # <<<<<<<<<<<<<< + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":679 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __deepcopy__(self, memo): + * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Uncompress(((std::string)__pyx_t_2)); + + /* "pykeyvi.pyx":680 + * + * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((std::string)__pyx_v__r); + + /* "pykeyvi.pyx":681 + * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * cdef class KeyOnlyDictionaryGenerator: */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_rv)); - __pyx_r = ((PyObject *)__pyx_v_rv); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "pykeyvi.pyx":809 - * return py_result + /* "pykeyvi.pyx":676 + * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) + * + * def Uncompress(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def __copy__(self): # <<<<<<<<<<<<<< - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Uncompress", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_rv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":814 - * return rv +/* "pykeyvi.pyx":687 + * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_25__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_25__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; +static void __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_24__deepcopy__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) { - struct __pyx_obj_7pykeyvi_Match *__pyx_v_rv = 0; - PyObject *__pyx_r = NULL; +static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__deepcopy__", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":815 + /* "pykeyvi.pyx":688 * - * def __deepcopy__(self, memo): - * cdef Match rv = Match.__new__(Match) # <<<<<<<<<<<<<< - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) - * return rv - */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_rv = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":816 - * def __deepcopy__(self, memo): - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) # <<<<<<<<<<<<<< - * return rv + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< * - */ - __pyx_v_rv->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_self->inst.get()))); - - /* "pykeyvi.pyx":817 - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) - * return rv # <<<<<<<<<<<<<< * - * def _init_0(self): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_rv)); - __pyx_r = ((PyObject *)__pyx_v_rv); - goto __pyx_L0; + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":814 - * return rv + /* "pykeyvi.pyx":687 + * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * cdef Match rv = Match.__new__(Match) - * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_rv); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "pykeyvi.pyx":819 - * return rv +/* "pykeyvi.pyx":691 * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_Match](new _Match()) + * + * def __init__(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_27_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_27_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static int __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_26_init_0(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_26_init_0(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_0", 0); + keyvi::dictionary::KeyOnlyDictionaryGenerator *__pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":820 + /* "pykeyvi.pyx":692 * - * def _init_0(self): - * self.inst = shared_ptr[_Match](new _Match()) # <<<<<<<<<<<<<< + * def __init__(self): + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) # <<<<<<<<<<<<<< * - * def _init_1(self, Match m ): + * def Add(self, bytes in_0 ): */ - __pyx_v_self->inst = boost::shared_ptr (new keyvi::dictionary::Match()); + try { + __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryGenerator(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":819 - * return rv + /* "pykeyvi.pyx":691 * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_Match](new _Match()) + * + * def __init__(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":822 - * self.inst = shared_ptr[_Match](new _Match()) +/* "pykeyvi.pyx":694 + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * - * def _init_1(self, Match m ): # <<<<<<<<<<<<<< - * assert isinstance(m, Match), 'arg m wrong type' + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_29_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_m); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_29_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_m) { +static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_5Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_5Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_7pykeyvi_Match, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7pykeyvi_5Match_28_init_1(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_m)); + __Pyx_RefNannySetupContext("Add (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_4Add(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ goto __pyx_L0; @@ -20238,46 +18188,53 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_29_init_1(PyObject *__pyx_v_self, PyOb return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, struct __pyx_obj_7pykeyvi_Match *__pyx_v_m) { +static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_4Add(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_1", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":823 + /* "pykeyvi.pyx":695 * - * def _init_1(self, Match m ): - * assert isinstance(m, Match), 'arg m wrong type' # <<<<<<<<<<<<<< + * def Add(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) + * self.inst.get().Add((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_m), __pyx_ptype_7pykeyvi_Match); + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_m_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":825 - * assert isinstance(m, Match), 'arg m wrong type' + /* "pykeyvi.pyx":697 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) # <<<<<<<<<<<<<< + * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< * - * def __init__(self, *args): + * def CloseFeeding(self): */ - __pyx_v_self->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_m->inst.get()))); + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } - /* "pykeyvi.pyx":822 - * self.inst = shared_ptr[_Match](new _Match()) + /* "pykeyvi.pyx":694 + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * - * def _init_1(self, Match m ): # <<<<<<<<<<<<<< - * assert isinstance(m, Match), 'arg m wrong type' + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ @@ -20285,7 +18242,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Ma __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Match._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20293,255 +18250,135 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Ma return __pyx_r; } -/* "pykeyvi.pyx":827 - * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) +/* "pykeyvi.pyx":699 + * self.inst.get().Add((in_0)) + * + * def CloseFeeding(self): # <<<<<<<<<<<<<< + * self.inst.get().CloseFeeding() * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) */ /* Python wrapper */ -static int __pyx_pw_7pykeyvi_5Match_31__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7pykeyvi_5Match_31__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - int __pyx_r; +static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_7CloseFeeding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_7CloseFeeding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_7pykeyvi_5Match_30__init__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), __pyx_v_args); + __Pyx_RefNannySetupContext("CloseFeeding (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_6CloseFeeding(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_args) { - int __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_6CloseFeeding(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("CloseFeeding", 0); - /* "pykeyvi.pyx":828 + /* "pykeyvi.pyx":700 * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], Match)): - */ - __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "pykeyvi.pyx":829 - * def __init__(self, *args): - * if not args: - * self._init_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==1) and (isinstance(args[0], Match)): - * self._init_1(*args) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "pykeyvi.pyx":828 + * def CloseFeeding(self): + * self.inst.get().CloseFeeding() # <<<<<<<<<<<<<< * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], Match)): - */ - goto __pyx_L3; - } - - /* "pykeyvi.pyx":830 - * if not args: - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], Match)): # <<<<<<<<<<<<<< - * self._init_1(*args) - * else: - */ - __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((__pyx_t_5 == 1) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_7pykeyvi_Match); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":831 - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], Match)): - * self._init_1(*args) # <<<<<<<<<<<<<< - * else: - * raise Exception('can not handle type of %s' % (args,)) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "pykeyvi.pyx":830 - * if not args: - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], Match)): # <<<<<<<<<<<<<< - * self._init_1(*args) - * else: + * def WriteToFile(self, bytes in_0 ): */ - goto __pyx_L3; - } + __pyx_v_self->inst.get()->CloseFeeding(); - /* "pykeyvi.pyx":833 - * self._init_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":699 + * self.inst.get().Add((in_0)) * - * def GetMatchedString(self): - */ - /*else*/ { - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_args); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; - - /* "pykeyvi.pyx":827 - * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) + * def CloseFeeding(self): # <<<<<<<<<<<<<< + * self.inst.get().CloseFeeding() * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Match.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":835 - * raise Exception('can not handle type of %s' % (args,)) +/* "pykeyvi.pyx":702 + * self.inst.get().CloseFeeding() + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetMatchedString(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetMatchedString() - * py_result = _r */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_33GetMatchedString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_33GetMatchedString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetMatchedString (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_32GetMatchedString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - std::string __pyx_v__r; - std::string __pyx_v_py_result; +static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetMatchedString", 0); + __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":836 + /* "pykeyvi.pyx":703 * - * def GetMatchedString(self): - * cdef libcpp_string _r = self.inst.get().GetMatchedString() # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_v__r = __pyx_v_self->inst.get()->GetMatchedString(); - - /* "pykeyvi.pyx":837 - * def GetMatchedString(self): - * cdef libcpp_string _r = self.inst.get().GetMatchedString() - * py_result = _r # <<<<<<<<<<<<<< - * return py_result + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * + * self.inst.get().WriteToFile((in_0)) */ - __pyx_v_py_result = ((std::string)__pyx_v__r); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":838 - * cdef libcpp_string _r = self.inst.get().GetMatchedString() - * py_result = _r - * return py_result # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":705 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetAttribute(self, key): + * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< + * + * cdef class KeyOnlyDictionaryCompiler: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->WriteToFile(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":835 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":702 + * self.inst.get().CloseFeeding() + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * def GetMatchedString(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetMatchedString() - * py_result = _r */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pykeyvi.Match.GetMatchedString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20549,148 +18386,233 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7p return __pyx_r; } -/* "pykeyvi.pyx":840 - * return py_result +/* "pykeyvi.pyx":711 + * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def GetAttribute(self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode("utf-8") */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_35GetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_35GetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_r = 0; +static void __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetAttribute (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_34GetAttribute(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_v_py_result; - PyObject *__pyx_r = NULL; +static void __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; - PyObject *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetAttribute", 0); - __Pyx_INCREF(__pyx_v_key); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":841 + /* "pykeyvi.pyx":712 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< * - * def GetAttribute(self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode("utf-8") * */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":842 - * def GetAttribute(self, key): - * if isinstance(key, unicode): - * key = key.encode("utf-8") # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":711 + * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * py_result = self.inst.get().GetAttributePy( key) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; - /* "pykeyvi.pyx":841 + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":715 * - * def GetAttribute(self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode("utf-8") + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) * */ - } - /* "pykeyvi.pyx":844 - * key = key.encode("utf-8") +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_3_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + keyvi::dictionary::KeyOnlyDictionaryCompiler *__pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_init_0", 0); + + /* "pykeyvi.pyx":716 * - * py_result = self.inst.get().GetAttributePy( key) # <<<<<<<<<<<<<< - * return py_result + * def _init_0(self): + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) # <<<<<<<<<<<<<< * + * def _init_1(self, memory_limit ): */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_6 = __pyx_v_self->inst.get()->GetAttributePy(((std::string)__pyx_t_5)); + __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_py_result = __pyx_t_6; + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":845 + /* "pykeyvi.pyx":715 * - * py_result = self.inst.get().GetAttributePy( key) - * return py_result # <<<<<<<<<<<<<< * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":840 - * return py_result +/* "pykeyvi.pyx":718 + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) + * + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_5_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_memory_limit) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_memory_limit)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + size_t __pyx_t_4; + keyvi::dictionary::KeyOnlyDictionaryCompiler *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_init_1", 0); + + /* "pykeyvi.pyx":719 + * + * def _init_1(self, memory_limit ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":721 + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< + * + * def _init_2(self, memory_limit , dict value_store_params ): + */ + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_5 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(((size_t)__pyx_t_4)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); + + /* "pykeyvi.pyx":718 + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) + * + * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * def GetAttribute(self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode("utf-8") */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Match.GetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":848 - * +/* "pykeyvi.pyx":723 + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) * - * def SetAttribute(self, key, value): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode("utf-8") + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_key = 0; - PyObject *__pyx_v_value = 0; +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_memory_limit = 0; + PyObject *__pyx_v_value_store_params = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SetAttribute (wrapper)", 0); + __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -20704,16 +18626,16 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memory_limit)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("SetAttribute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SetAttribute") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -20721,1174 +18643,1359 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_key = values[0]; - __pyx_v_value = values[1]; + __pyx_v_memory_limit = values[0]; + __pyx_v_value_store_params = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("SetAttribute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Match.SetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_5Match_36SetAttribute(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), __pyx_v_key, __pyx_v_value); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value_store_params), (&PyDict_Type), 1, "value_store_params", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_memory_limit, __pyx_v_value_store_params); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generator19(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { - PyTypeObject *__pyx_v_t = NULL; - PyObject *__pyx_v_value_utf8 = NULL; +/* "pykeyvi.pyx":725 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + */ + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; - std::string __pyx_t_6; - float __pyx_t_7; - int __pyx_t_8; - bool __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SetAttribute", 0); - __Pyx_INCREF(__pyx_v_key); - - /* "pykeyvi.pyx":849 - * - * def SetAttribute(self, key, value): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode("utf-8") - * - */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "pykeyvi.pyx":850 - * def SetAttribute(self, key, value): - * if isinstance(key, unicode): - * key = key.encode("utf-8") # <<<<<<<<<<<<<< - * - * t = type(value) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; - - /* "pykeyvi.pyx":849 - * - * def SetAttribute(self, key, value): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode("utf-8") - * - */ - } - - /* "pykeyvi.pyx":852 - * key = key.encode("utf-8") - * - * t = type(value) # <<<<<<<<<<<<<< - * if t == str: - * self.inst.get().SetAttribute( key, value) - */ - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_v_t = ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_value))); - - /* "pykeyvi.pyx":853 - * - * t = type(value) - * if t == str: # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * elif t == unicode: - */ - __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":854 - * t = type(value) - * if t == str: - * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< - * elif t == unicode: - * value_utf8 = value.encode("utf-8") - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((std::string)__pyx_t_6)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":853 - * - * t = type(value) - * if t == str: # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * elif t == unicode: - */ - goto __pyx_L4; - } - - /* "pykeyvi.pyx":855 - * if t == str: - * self.inst.get().SetAttribute( key, value) - * elif t == unicode: # <<<<<<<<<<<<<< - * value_utf8 = value.encode("utf-8") - * self.inst.get().SetAttribute( key, value_utf8) - */ - __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyUnicode_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":856 - * self.inst.get().SetAttribute( key, value) - * elif t == unicode: - * value_utf8 = value.encode("utf-8") # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value_utf8) - * elif t == float: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_value_utf8 = __pyx_t_3; - __pyx_t_3 = 0; - - /* "pykeyvi.pyx":857 - * elif t == unicode: - * value_utf8 = value.encode("utf-8") - * self.inst.get().SetAttribute( key, value_utf8) # <<<<<<<<<<<<<< - * elif t == float: - * self.inst.get().SetAttribute( key, value) - */ - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value_utf8); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_6), ((std::string)__pyx_t_5)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":855 - * if t == str: - * self.inst.get().SetAttribute( key, value) - * elif t == unicode: # <<<<<<<<<<<<<< - * value_utf8 = value.encode("utf-8") - * self.inst.get().SetAttribute( key, value_utf8) - */ - goto __pyx_L4; - } - - /* "pykeyvi.pyx":858 - * value_utf8 = value.encode("utf-8") - * self.inst.get().SetAttribute( key, value_utf8) - * elif t == float: # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * elif t == int: - */ - __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":859 - * self.inst.get().SetAttribute( key, value_utf8) - * elif t == float: - * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< - * elif t == int: - * self.inst.get().SetAttribute( key, value) - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((float)__pyx_t_7)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":858 - * value_utf8 = value.encode("utf-8") - * self.inst.get().SetAttribute( key, value_utf8) - * elif t == float: # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * elif t == int: - */ - goto __pyx_L4; - } - - /* "pykeyvi.pyx":860 - * elif t == float: - * self.inst.get().SetAttribute( key, value) - * elif t == int: # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * # special trick as t == bool does not work due to name collision between cython and C - */ - __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":861 - * self.inst.get().SetAttribute( key, value) - * elif t == int: - * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< - * # special trick as t == bool does not work due to name collision between cython and C - * elif isinstance(value, (int)): - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((int)__pyx_t_8)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":860 - * elif t == float: - * self.inst.get().SetAttribute( key, value) - * elif t == int: # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * # special trick as t == bool does not work due to name collision between cython and C - */ - goto __pyx_L4; - } - - /* "pykeyvi.pyx":863 - * self.inst.get().SetAttribute( key, value) - * # special trick as t == bool does not work due to name collision between cython and C - * elif isinstance(value, (int)): # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * else: - */ - __pyx_t_2 = PyInt_Check(__pyx_v_value); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "pykeyvi.pyx":864 - * # special trick as t == bool does not work due to name collision between cython and C - * elif isinstance(value, (int)): - * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< - * else: - * raise Exception("Unsupported Value Type") - */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_9 == (bool)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((bool)__pyx_t_9)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "pykeyvi.pyx":863 - * self.inst.get().SetAttribute( key, value) - * # special trick as t == bool does not work due to name collision between cython and C - * elif isinstance(value, (int)): # <<<<<<<<<<<<<< - * self.inst.get().SetAttribute( key, value) - * else: - */ - goto __pyx_L4; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_28_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_28_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; } - - /* "pykeyvi.pyx":866 - * self.inst.get().SetAttribute( key, value) - * else: - * raise Exception("Unsupported Value Type") # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *) __pyx_self; + __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_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generator19, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __pyx_L4:; - - /* "pykeyvi.pyx":848 - * - * - * def SetAttribute(self, key, value): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode("utf-8") - */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Match.SetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XDECREF(__pyx_v_value_utf8); - __Pyx_XDECREF(__pyx_v_key); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":869 - * - * - * def GetValue(self): # <<<<<<<<<<<<<< - * """Decodes a keyvi value and returns it.""" - * value = self.inst.get().GetRawValueAsString() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_39GetValue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_7pykeyvi_5Match_38GetValue[] = "Decodes a keyvi value and returns it."; -static PyObject *__pyx_pw_7pykeyvi_5Match_39GetValue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generator19(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("GetValue (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_38GetValue(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + } + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator20(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - PyObject *__pyx_v_value = NULL; +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - std::string __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_29_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_29_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *) __pyx_self; + __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_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator20, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init_2_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator20(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetValue", 0); - - /* "pykeyvi.pyx":871 - * def GetValue(self): - * """Decodes a keyvi value and returns it.""" - * value = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< - * if value is None or len(value) == 0: - * return None - */ - try { - __pyx_t_1 = __pyx_v_self->inst.get()->GetRawValueAsString(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } - __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_value = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pykeyvi.pyx":872 - * """Decodes a keyvi value and returns it.""" - * value = self.inst.get().GetRawValueAsString() - * if value is None or len(value) == 0: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_4 = (__pyx_v_value == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (!__pyx_t_5) { + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params)) { __Pyx_RaiseClosureNameError("value_store_params"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_Values(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((__pyx_t_6 == 0) != 0); - __pyx_t_3 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_3) { - - /* "pykeyvi.pyx":873 - * value = self.inst.get().GetRawValueAsString() - * if value is None or len(value) == 0: - * return None # <<<<<<<<<<<<<< - * - * elif value[0] == '\x00': - */ + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_5 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); + __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + } + /*else*/ { __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - - /* "pykeyvi.pyx":872 - * """Decodes a keyvi value and returns it.""" - * value = self.inst.get().GetRawValueAsString() - * if value is None or len(value) == 0: # <<<<<<<<<<<<<< - * return None - * - */ } - - /* "pykeyvi.pyx":875 - * return None - * - * elif value[0] == '\x00': # <<<<<<<<<<<<<< - * return msgpack.loads(value[1:]) - * - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__14, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - /* "pykeyvi.pyx":876 - * - * elif value[0] == '\x00': - * return msgpack.loads(value[1:]) # <<<<<<<<<<<<<< - * - * elif value[0] == '\x01': - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_loads); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, 0, NULL, NULL, &__pyx_slice__15, 1, 0, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_9) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":875 - * return None - * - * elif value[0] == '\x00': # <<<<<<<<<<<<<< - * return msgpack.loads(value[1:]) +/* "pykeyvi.pyx":723 + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) * + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ - } - /* "pykeyvi.pyx":878 - * return msgpack.loads(value[1:]) - * - * elif value[0] == '\x01': # <<<<<<<<<<<<<< - * value = zlib.decompress(value[1:]) - * - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__16, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *__pyx_cur_scope; + std::map *__pyx_v_v1; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + std::map *__pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + std::string __pyx_t_13; + std::string __pyx_t_14; + size_t __pyx_t_15; + keyvi::dictionary::KeyOnlyDictionaryCompiler *__pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_init_2", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_27__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_27__init_2, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_value_store_params = __pyx_v_value_store_params; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); - /* "pykeyvi.pyx":879 + /* "pykeyvi.pyx":724 * - * elif value[0] == '\x01': - * value = zlib.decompress(value[1:]) # <<<<<<<<<<<<<< + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * - * elif value[0] == '\x02': */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_zlib); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decompress); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, 0, NULL, NULL, &__pyx_slice__17, 1, 0, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (!__pyx_t_7) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "pykeyvi.pyx":878 - * return msgpack.loads(value[1:]) - * - * elif value[0] == '\x01': # <<<<<<<<<<<<<< - * value = zlib.decompress(value[1:]) - * - */ - goto __pyx_L3; } + #endif - /* "pykeyvi.pyx":881 - * value = zlib.decompress(value[1:]) - * - * elif value[0] == '\x02': # <<<<<<<<<<<<<< - * value = snappy.decompress(value[1:]) - * - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__18, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "pykeyvi.pyx":882 - * - * elif value[0] == '\x02': - * value = snappy.decompress(value[1:]) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":725 + * def _init_2(self, memory_limit , dict value_store_params ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' # <<<<<<<<<<<<<< * - * return msgpack.loads(value) + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_snappy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_decompress); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, 0, NULL, NULL, &__pyx_slice__19, 1, 0, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_4 = __pyx_cur_scope->__pyx_v_value_store_params; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = PyDict_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; } - if (!__pyx_t_8) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_t_3; + __pyx_L5_bool_binop_done:; + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_value_store_params_wrong_typ); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":881 - * value = zlib.decompress(value[1:]) - * - * elif value[0] == '\x02': # <<<<<<<<<<<<<< - * value = snappy.decompress(value[1:]) + /* "pykeyvi.pyx":727 + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() # <<<<<<<<<<<<<< + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value */ + try { + __pyx_t_6 = new std::map (); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; + __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":884 - * value = snappy.decompress(value[1:]) - * - * return msgpack.loads(value) # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":728 * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_loads); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + if (unlikely(__pyx_cur_scope->__pyx_v_value_store_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyDict_Items(__pyx_cur_scope->__pyx_v_value_store_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_8(__pyx_t_5); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); + __pyx_t_10 = PyList_GET_ITEM(sequence, 1); + } __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); + __Pyx_INCREF(__pyx_t_10); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; + index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = NULL; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L11_unpacking_done:; } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); + __pyx_t_10 = 0; + + /* "pykeyvi.pyx":729 + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + * del v1 + */ + __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((*__pyx_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); + + /* "pykeyvi.pyx":728 + * + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + */ } - if (!__pyx_t_9) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_value); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":730 + * for key, value in value_store_params.items(): + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) # <<<<<<<<<<<<<< + * del v1 + * + */ + __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_v_memory_limit); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_16 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - /* "pykeyvi.pyx":869 + /* "pykeyvi.pyx":731 + * deref(v1)[ key ] = value + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) + * del v1 # <<<<<<<<<<<<<< * + * def __init__(self, *args): + */ + delete __pyx_v_v1; + + /* "pykeyvi.pyx":723 + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) * - * def GetValue(self): # <<<<<<<<<<<<<< - * """Decodes a keyvi value and returns it.""" - * value = self.inst.get().GetRawValueAsString() + * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(value_store_params, dict) and all(isinstance(k, bytes) for k in value_store_params.keys()) and all(isinstance(v, bytes) for v in value_store_params.values()), 'arg value_store_params wrong type' */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("pykeyvi.Match.GetValue", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); __Pyx_XDECREF(__pyx_v_value); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":887 - * +/* "pykeyvi.pyx":733 + * del v1 * - * def dumps(self): # <<<<<<<<<<<<<< - * m=[] - * do_pack_rest = False + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_41dumps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_41dumps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static int __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dumps (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_40dumps(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_args); /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator21(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { - PyObject *__pyx_v_m = NULL; - int __pyx_v_do_pack_rest; - PyObject *__pyx_v_score = NULL; - size_t __pyx_v_end; - size_t __pyx_v_start; - std::string __pyx_v_matchedstring; - std::string __pyx_v_rawvalue; +/* "pykeyvi.pyx":738 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: + */ + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - std::string __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dumps", 0); + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_31_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *) __pyx_self; + __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_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator21, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } - /* "pykeyvi.pyx":888 - * - * def dumps(self): - * m=[] # <<<<<<<<<<<<<< - * do_pack_rest = False - * score = self.inst.get().GetScore() - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_m = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":889 - * def dumps(self): - * m=[] - * do_pack_rest = False # <<<<<<<<<<<<<< - * score = self.inst.get().GetScore() - * if score != 0: - */ - __pyx_v_do_pack_rest = 0; - - /* "pykeyvi.pyx":890 - * m=[] - * do_pack_rest = False - * score = self.inst.get().GetScore() # <<<<<<<<<<<<<< - * if score != 0: - * m.append(score) - */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->inst.get()->GetScore()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator21(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); - __pyx_v_score = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":891 - * do_pack_rest = False - * score = self.inst.get().GetScore() - * if score != 0: # <<<<<<<<<<<<<< - * m.append(score) - * do_pack_rest = True - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_score, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":892 - * score = self.inst.get().GetScore() - * if score != 0: - * m.append(score) # <<<<<<<<<<<<<< - * do_pack_rest = True - * end = self.inst.get().GetEnd() - */ - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_v_score); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pykeyvi.pyx":893 - * if score != 0: - * m.append(score) - * do_pack_rest = True # <<<<<<<<<<<<<< - * end = self.inst.get().GetEnd() - * if end != 0 or do_pack_rest: - */ - __pyx_v_do_pack_rest = 1; - - /* "pykeyvi.pyx":891 - * do_pack_rest = False - * score = self.inst.get().GetScore() - * if score != 0: # <<<<<<<<<<<<<< - * m.append(score) - * do_pack_rest = True - */ + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } } - - /* "pykeyvi.pyx":894 - * m.append(score) - * do_pack_rest = True - * end = self.inst.get().GetEnd() # <<<<<<<<<<<<<< - * if end != 0 or do_pack_rest: - * m.append(end) - */ - __pyx_v_end = __pyx_v_self->inst.get()->GetEnd(); - - /* "pykeyvi.pyx":895 - * do_pack_rest = True - * end = self.inst.get().GetEnd() - * if end != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(end) - * do_pack_rest = True - */ - __pyx_t_4 = ((__pyx_v_end != 0) != 0); - if (!__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L5_bool_binop_done; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; } - __pyx_t_4 = (__pyx_v_do_pack_rest != 0); - __pyx_t_2 = __pyx_t_4; - __pyx_L5_bool_binop_done:; - if (__pyx_t_2) { - - /* "pykeyvi.pyx":896 - * end = self.inst.get().GetEnd() - * if end != 0 or do_pack_rest: - * m.append(end) # <<<<<<<<<<<<<< - * do_pack_rest = True - * start = self.inst.get().GetStart() - */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pykeyvi.pyx":897 - * if end != 0 or do_pack_rest: - * m.append(end) - * do_pack_rest = True # <<<<<<<<<<<<<< - * start = self.inst.get().GetStart() - * if start != 0 or do_pack_rest: - */ - __pyx_v_do_pack_rest = 1; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator22(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - /* "pykeyvi.pyx":895 - * do_pack_rest = True - * end = self.inst.get().GetEnd() - * if end != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(end) - * do_pack_rest = True - */ +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_32_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_32_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; } - - /* "pykeyvi.pyx":898 - * m.append(end) - * do_pack_rest = True - * start = self.inst.get().GetStart() # <<<<<<<<<<<<<< - * if start != 0 or do_pack_rest: - * m.append(start) - */ - __pyx_v_start = __pyx_v_self->inst.get()->GetStart(); - - /* "pykeyvi.pyx":899 - * do_pack_rest = True - * start = self.inst.get().GetStart() - * if start != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(start) - * do_pack_rest = True - */ - __pyx_t_4 = ((__pyx_v_start != 0) != 0); - if (!__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L8_bool_binop_done; + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *) __pyx_self; + __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_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator22, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __pyx_t_4 = (__pyx_v_do_pack_rest != 0); - __pyx_t_2 = __pyx_t_4; - __pyx_L8_bool_binop_done:; - if (__pyx_t_2) { - /* "pykeyvi.pyx":900 - * start = self.inst.get().GetStart() - * if start != 0 or do_pack_rest: - * m.append(start) # <<<<<<<<<<<<<< - * do_pack_rest = True - * matchedstring = self.inst.get().GetMatchedString() - */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":901 - * if start != 0 or do_pack_rest: - * m.append(start) - * do_pack_rest = True # <<<<<<<<<<<<<< - * matchedstring = self.inst.get().GetMatchedString() - * if len(matchedstring) != 0 or do_pack_rest: - */ - __pyx_v_do_pack_rest = 1; - - /* "pykeyvi.pyx":899 - * do_pack_rest = True - * start = self.inst.get().GetStart() - * if start != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(start) - * do_pack_rest = True - */ +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator22(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args, 1), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - - /* "pykeyvi.pyx":902 - * m.append(start) - * do_pack_rest = True - * matchedstring = self.inst.get().GetMatchedString() # <<<<<<<<<<<<<< - * if len(matchedstring) != 0 or do_pack_rest: - * m.append(matchedstring) - */ - __pyx_v_matchedstring = __pyx_v_self->inst.get()->GetMatchedString(); - - /* "pykeyvi.pyx":903 - * do_pack_rest = True - * matchedstring = self.inst.get().GetMatchedString() - * if len(matchedstring) != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(matchedstring) - * do_pack_rest = True - */ - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_matchedstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = ((__pyx_t_5 != 0) != 0); - if (!__pyx_t_4) { + __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_2 = __pyx_t_4; - goto __pyx_L11_bool_binop_done; + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = (__pyx_v_do_pack_rest != 0); - __pyx_t_2 = __pyx_t_4; - __pyx_L11_bool_binop_done:; - if (__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __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_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + } + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pykeyvi.pyx":904 - * matchedstring = self.inst.get().GetMatchedString() - * if len(matchedstring) != 0 or do_pack_rest: - * m.append(matchedstring) # <<<<<<<<<<<<<< - * do_pack_rest = True - * rawvalue = self.inst.get().GetRawValueAsString() + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":733 + * del v1 + * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_matchedstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":905 - * if len(matchedstring) != 0 or do_pack_rest: - * m.append(matchedstring) - * do_pack_rest = True # <<<<<<<<<<<<<< - * rawvalue = self.inst.get().GetRawValueAsString() - * if len(rawvalue) != 0 or do_pack_rest: +static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *__pyx_cur_scope; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_30___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_30___init__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_args = __pyx_v_args; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); + + /* "pykeyvi.pyx":734 + * + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - __pyx_v_do_pack_rest = 1; + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { - /* "pykeyvi.pyx":903 - * do_pack_rest = True - * matchedstring = self.inst.get().GetMatchedString() - * if len(matchedstring) != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(matchedstring) - * do_pack_rest = True + /* "pykeyvi.pyx":735 + * def __init__(self, *args): + * if not args: + * self._init_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) */ - } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pykeyvi.pyx":906 - * m.append(matchedstring) - * do_pack_rest = True - * rawvalue = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< - * if len(rawvalue) != 0 or do_pack_rest: - * m.append(rawvalue) + /* "pykeyvi.pyx":734 + * + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - try { - __pyx_t_6 = __pyx_v_self->inst.get()->GetRawValueAsString(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_v_rawvalue = __pyx_t_6; - /* "pykeyvi.pyx":907 - * do_pack_rest = True - * rawvalue = self.inst.get().GetRawValueAsString() - * if len(rawvalue) != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(rawvalue) - * m.reverse() + /* "pykeyvi.pyx":736 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): */ - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_rawvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = ((__pyx_t_5 != 0) != 0); - if (!__pyx_t_4) { + __pyx_t_4 = __pyx_cur_scope->__pyx_v_args; + __Pyx_INCREF(__pyx_t_4); + if (unlikely(__pyx_t_4 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); + if (__pyx_t_1) { } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L14_bool_binop_done; + __pyx_t_2 = __pyx_t_1; + goto __pyx_L4_bool_binop_done; } - __pyx_t_4 = (__pyx_v_do_pack_rest != 0); - __pyx_t_2 = __pyx_t_4; - __pyx_L14_bool_binop_done:; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = PyInt_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = (__pyx_t_6 != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_1 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = PyLong_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__pyx_t_7 != 0); + __pyx_t_1 = __pyx_t_6; + __pyx_L6_bool_binop_done:; + __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":908 - * rawvalue = self.inst.get().GetRawValueAsString() - * if len(rawvalue) != 0 or do_pack_rest: - * m.append(rawvalue) # <<<<<<<<<<<<<< - * m.reverse() - * return msgpack.dumps(m) + /* "pykeyvi.pyx":737 + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) # <<<<<<<<<<<<<< + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + * self._init_2(*args) */ - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_rawvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pykeyvi.pyx":907 - * do_pack_rest = True - * rawvalue = self.inst.get().GetRawValueAsString() - * if len(rawvalue) != 0 or do_pack_rest: # <<<<<<<<<<<<<< - * m.append(rawvalue) - * m.reverse() + /* "pykeyvi.pyx":736 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): # <<<<<<<<<<<<<< + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): */ + goto __pyx_L3; } - /* "pykeyvi.pyx":909 - * if len(rawvalue) != 0 or do_pack_rest: - * m.append(rawvalue) - * m.reverse() # <<<<<<<<<<<<<< - * return msgpack.dumps(m) - * - */ - __pyx_t_3 = PyList_Reverse(__pyx_v_m); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pykeyvi.pyx":910 - * m.append(rawvalue) - * m.reverse() - * return msgpack.dumps(m) # <<<<<<<<<<<<<< - * - * def __SetRawValue(self, str): + /* "pykeyvi.pyx":738 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_dumps); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } + __pyx_t_3 = __pyx_cur_scope->__pyx_v_args; + __Pyx_INCREF(__pyx_t_3); + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((__pyx_t_5 == 2) != 0); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyInt_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = (__pyx_t_1 != 0); if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_m); - __Pyx_GIVEREF(__pyx_v_m); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_m); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_6 = __pyx_t_7; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = PyLong_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_t_7 != 0); + __pyx_t_6 = __pyx_t_1; + __pyx_L11_bool_binop_done:; + __pyx_t_1 = (__pyx_t_6 != 0); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 1); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyDict_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_3 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_4 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_6; + __pyx_L8_bool_binop_done:; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":739 + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): + * self._init_2(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_cur_scope->__pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pykeyvi.pyx":738 + * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * self._init_1(*args) + * elif (len(args)==2) and (isinstance(args[0], (int, long))) and (isinstance(args[1], dict) and all(isinstance(k, bytes) for k in args[1].keys()) and all(isinstance(v, bytes) for v in args[1].values())): # <<<<<<<<<<<<<< + * self._init_2(*args) + * else: + */ + goto __pyx_L3; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - /* "pykeyvi.pyx":887 + /* "pykeyvi.pyx":741 + * self._init_2(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * + * def Add(self, bytes in_0 ): + */ + /*else*/ { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_args); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "pykeyvi.pyx":733 + * del v1 * - * def dumps(self): # <<<<<<<<<<<<<< - * m=[] - * do_pack_rest = False + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("pykeyvi.Match.dumps", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_m); - __Pyx_XDECREF(__pyx_v_score); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":912 - * return msgpack.dumps(m) +/* "pykeyvi.pyx":743 + * raise Exception('can not handle type of %s' % (args,)) * - * def __SetRawValue(self, str): # <<<<<<<<<<<<<< - * self.inst.get().SetRawValue( str) + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_43__SetRawValue(PyObject *__pyx_v_self, PyObject *__pyx_v_str); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_5Match_43__SetRawValue(PyObject *__pyx_v_self, PyObject *__pyx_v_str) { +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__SetRawValue (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_5Match_42__SetRawValue(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_str)); + __Pyx_RefNannySetupContext("Add (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_str) { +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - std::string __pyx_t_1; + int __pyx_t_1; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__SetRawValue", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":913 + /* "pykeyvi.pyx":744 * - * def __SetRawValue(self, str): - * self.inst.get().SetRawValue( str) # <<<<<<<<<<<<<< + * def Add(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * @staticmethod + * self.inst.get().Add((in_0)) */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_str); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":746 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * + * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< + * + * def WriteToFile(self, bytes in_0 ): + */ + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_v_self->inst.get()->SetRawValue(((std::string)__pyx_t_1)); + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":912 - * return msgpack.dumps(m) + /* "pykeyvi.pyx":743 + * raise Exception('can not handle type of %s' % (args,)) * - * def __SetRawValue(self, str): # <<<<<<<<<<<<<< - * self.inst.get().SetRawValue( str) + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ @@ -21896,7 +20003,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pyke __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.Match.__SetRawValue", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -21904,32 +20011,184 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pyke return __pyx_r; } -/* "pykeyvi.pyx":916 +/* "pykeyvi.pyx":748 + * self.inst.get().Add((in_0)) * - * @staticmethod - * def loads(serialized_match): # <<<<<<<<<<<<<< - * m=Match() - * unserialized = msgpack.loads(serialized_match) + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7pykeyvi_5Match_45loads = {"loads", (PyCFunction)__pyx_pw_7pykeyvi_5Match_45loads, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_serialized_match = 0; +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile(PyObject *__pyx_v_self, PyObject *__pyx_v_in_0) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("WriteToFile (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_0), (&PyBytes_Type), 1, "in_0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject*)__pyx_v_in_0)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { + const char *__pyx_v_input_in_0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + const char *__pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("WriteToFile", 0); + + /* "pykeyvi.pyx":749 + * + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * cdef const_char * input_in_0 = in_0 + * self.inst.get().WriteToFile(input_in_0) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":750 + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + * self.inst.get().WriteToFile(input_in_0) + * + */ + __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((const char *)__pyx_t_2); + + /* "pykeyvi.pyx":751 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 + * self.inst.get().WriteToFile(input_in_0) # <<<<<<<<<<<<<< + * + * def __enter__(self): + */ + __pyx_v_self->inst.get()->WriteToFile(__pyx_v_input_in_0); + + /* "pykeyvi.pyx":748 + * self.inst.get().Add((in_0)) + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":753 + * self.inst.get().WriteToFile(input_in_0) + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "pykeyvi.pyx":754 + * + * def __enter__(self): + * return self # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pykeyvi.pyx":753 + * self.inst.get().WriteToFile(input_in_0) + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":757 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_type = 0; + CYTHON_UNUSED PyObject *__pyx_v_value = 0; + CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("loads (wrapper)", 0); + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serialized_match,0}; - PyObject* values[1] = {0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; + PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; @@ -21937,74 +20196,330 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_serialized_match)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loads") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_serialized_match = values[0]; + __pyx_v_type = values[0]; + __pyx_v_value = values[1]; + __pyx_v_traceback = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loads", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.Match.loads", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7pykeyvi_5Match_44loads(__pyx_v_serialized_match); + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_match) { - struct __pyx_obj_7pykeyvi_Match *__pyx_v_m = NULL; - PyObject *__pyx_v_unserialized = NULL; - Py_ssize_t __pyx_v_number_of_fields; +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loads", 0); + __Pyx_RefNannySetupContext("__exit__", 0); - /* "pykeyvi.pyx":917 - * @staticmethod - * def loads(serialized_match): - * m=Match() # <<<<<<<<<<<<<< - * unserialized = msgpack.loads(serialized_match) - * number_of_fields = len(unserialized) + /* "pykeyvi.pyx":758 + * + * def __exit__(self, type, value, traceback): + * self.Compile() # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); - __pyx_v_m = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":918 - * def loads(serialized_match): - * m=Match() - * unserialized = msgpack.loads(serialized_match) # <<<<<<<<<<<<<< - * number_of_fields = len(unserialized) - * if number_of_fields > 0: + /* "pykeyvi.pyx":757 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":761 + * + * + * def Compile(self, *args): # <<<<<<<<<<<<<< + * if not args: + * with nogil: + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Compile (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { + void *__pyx_v_callback; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("Compile", 0); + + /* "pykeyvi.pyx":762 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() + */ + __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":763 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "pykeyvi.pyx":764 + * if not args: + * with nogil: + * self.inst.get().Compile() # <<<<<<<<<<<<<< + * return + * + */ + __pyx_v_self->inst.get()->Compile(); + } + + /* "pykeyvi.pyx":763 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "pykeyvi.pyx":765 + * with nogil: + * self.inst.get().Compile() + * return # <<<<<<<<<<<<<< + * + * cdef void* callback = args[0] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pykeyvi.pyx":762 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() + */ + } + + /* "pykeyvi.pyx":767 + * return + * + * cdef void* callback = args[0] # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) + */ + __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); + + /* "pykeyvi.pyx":768 + * + * cdef void* callback = args[0] + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile(callback_wrapper, callback) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "pykeyvi.pyx":769 + * cdef void* callback = args[0] + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); + } + + /* "pykeyvi.pyx":768 + * + * cdef void* callback = args[0] + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile(callback_wrapper, callback) + * + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } + } + + /* "pykeyvi.pyx":761 + * + * + * def Compile(self, *args): # <<<<<<<<<<<<<< + * if not args: + * with nogil: + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":772 + * + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_21SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_21SetManifest(PyObject *__pyx_v_self, PyObject *__pyx_v_manifest) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { + PyObject *__pyx_v_m = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + const char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("SetManifest", 0); + + /* "pykeyvi.pyx":773 + * + * def SetManifest(self, manifest): + * m = json.dumps(manifest) # <<<<<<<<<<<<<< + * self.inst.get().SetManifestFromString(m) + * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_json); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_loads); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -22018,856 +20533,4335 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_serialized_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_manifest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_serialized_match); - __Pyx_GIVEREF(__pyx_v_serialized_match); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_serialized_match); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_manifest); + __Pyx_GIVEREF(__pyx_v_manifest); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __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_v_unserialized = __pyx_t_1; + __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; - /* "pykeyvi.pyx":919 - * m=Match() - * unserialized = msgpack.loads(serialized_match) - * number_of_fields = len(unserialized) # <<<<<<<<<<<<<< - * if number_of_fields > 0: - * m.__SetRawValue(unserialized[0]) + /* "pykeyvi.pyx":774 + * def SetManifest(self, manifest): + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< + * + * cdef class Match: */ - __pyx_t_5 = PyObject_Length(__pyx_v_unserialized); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_number_of_fields = __pyx_t_5; + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_m); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - /* "pykeyvi.pyx":920 - * unserialized = msgpack.loads(serialized_match) - * number_of_fields = len(unserialized) - * if number_of_fields > 0: # <<<<<<<<<<<<<< - * m.__SetRawValue(unserialized[0]) - * if number_of_fields > 1: + /* "pykeyvi.pyx":772 + * + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) */ - __pyx_t_6 = ((__pyx_v_number_of_fields > 0) != 0); - if (__pyx_t_6) { - /* "pykeyvi.pyx":921 - * number_of_fields = len(unserialized) - * if number_of_fields > 0: - * m.__SetRawValue(unserialized[0]) # <<<<<<<<<<<<<< - * if number_of_fields > 1: - * m.SetMatchedString(unserialized[1]) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetRawValue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_unserialized, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":922 - * if number_of_fields > 0: - * m.__SetRawValue(unserialized[0]) - * if number_of_fields > 1: # <<<<<<<<<<<<<< - * m.SetMatchedString(unserialized[1]) - * if number_of_fields > 2: +/* "pykeyvi.pyx":780 + * cdef shared_ptr[_Match] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * */ - __pyx_t_6 = ((__pyx_v_number_of_fields > 1) != 0); - if (__pyx_t_6) { - /* "pykeyvi.pyx":923 - * m.__SetRawValue(unserialized[0]) - * if number_of_fields > 1: - * m.SetMatchedString(unserialized[1]) # <<<<<<<<<<<<<< - * if number_of_fields > 2: - * m.SetStart(unserialized[2]) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetMatchedString); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_unserialized, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +/* Python wrapper */ +static void __pyx_pw_7pykeyvi_5Match_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_7pykeyvi_5Match_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_5Match___dealloc__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); - /* "pykeyvi.pyx":924 - * if number_of_fields > 1: - * m.SetMatchedString(unserialized[1]) - * if number_of_fields > 2: # <<<<<<<<<<<<<< - * m.SetStart(unserialized[2]) - * if number_of_fields > 3: - */ - __pyx_t_6 = ((__pyx_v_number_of_fields > 2) != 0); - if (__pyx_t_6) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} - /* "pykeyvi.pyx":925 - * m.SetMatchedString(unserialized[1]) - * if number_of_fields > 2: - * m.SetStart(unserialized[2]) # <<<<<<<<<<<<<< - * if number_of_fields > 3: - * m.SetEnd(unserialized[3]) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetStart); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_unserialized, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __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; +static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":926 - * if number_of_fields > 2: - * m.SetStart(unserialized[2]) - * if number_of_fields > 3: # <<<<<<<<<<<<<< - * m.SetEnd(unserialized[3]) - * if number_of_fields > 4: + /* "pykeyvi.pyx":781 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< + * + * */ - __pyx_t_6 = ((__pyx_v_number_of_fields > 3) != 0); - if (__pyx_t_6) { + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":927 - * m.SetStart(unserialized[2]) - * if number_of_fields > 3: - * m.SetEnd(unserialized[3]) # <<<<<<<<<<<<<< - * if number_of_fields > 4: - * m.SetScore(unserialized[4]) + /* "pykeyvi.pyx":780 + * cdef shared_ptr[_Match] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetEnd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_unserialized, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":928 - * if number_of_fields > 3: - * m.SetEnd(unserialized[3]) - * if number_of_fields > 4: # <<<<<<<<<<<<<< - * m.SetScore(unserialized[4]) + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":784 + * + * + * def SetEnd(self, end ): # <<<<<<<<<<<<<< + * assert isinstance(end, (int, long)), 'arg end wrong type' * */ - __pyx_t_6 = ((__pyx_v_number_of_fields > 4) != 0); - if (__pyx_t_6) { - /* "pykeyvi.pyx":929 - * m.SetEnd(unserialized[3]) - * if number_of_fields > 4: - * m.SetScore(unserialized[4]) # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_3SetEnd(PyObject *__pyx_v_self, PyObject *__pyx_v_end); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_3SetEnd(PyObject *__pyx_v_self, PyObject *__pyx_v_end) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetEnd (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_2SetEnd(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_end)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_2SetEnd(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_end) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("SetEnd", 0); + + /* "pykeyvi.pyx":785 * - * return m - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetScore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_unserialized, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pykeyvi.pyx":928 - * if number_of_fields > 3: - * m.SetEnd(unserialized[3]) - * if number_of_fields > 4: # <<<<<<<<<<<<<< - * m.SetScore(unserialized[4]) - * - */ - } - - /* "pykeyvi.pyx":926 - * if number_of_fields > 2: - * m.SetStart(unserialized[2]) - * if number_of_fields > 3: # <<<<<<<<<<<<<< - * m.SetEnd(unserialized[3]) - * if number_of_fields > 4: - */ - } - - /* "pykeyvi.pyx":924 - * if number_of_fields > 1: - * m.SetMatchedString(unserialized[1]) - * if number_of_fields > 2: # <<<<<<<<<<<<<< - * m.SetStart(unserialized[2]) - * if number_of_fields > 3: - */ - } - - /* "pykeyvi.pyx":922 - * if number_of_fields > 0: - * m.__SetRawValue(unserialized[0]) - * if number_of_fields > 1: # <<<<<<<<<<<<<< - * m.SetMatchedString(unserialized[1]) - * if number_of_fields > 2: + * def SetEnd(self, end ): + * assert isinstance(end, (int, long)), 'arg end wrong type' # <<<<<<<<<<<<<< + * + * self.inst.get().SetEnd((end)) */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_end); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_end); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_end_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - - /* "pykeyvi.pyx":920 - * unserialized = msgpack.loads(serialized_match) - * number_of_fields = len(unserialized) - * if number_of_fields > 0: # <<<<<<<<<<<<<< - * m.__SetRawValue(unserialized[0]) - * if number_of_fields > 1: - */ } + #endif - /* "pykeyvi.pyx":931 - * m.SetScore(unserialized[4]) - * - * return m # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":787 + * assert isinstance(end, (int, long)), 'arg end wrong type' * + * self.inst.get().SetEnd((end)) # <<<<<<<<<<<<<< * + * def GetStart(self): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_m)); - __pyx_r = ((PyObject *)__pyx_v_m); - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_end); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->SetEnd(((size_t)__pyx_t_4)); - /* "pykeyvi.pyx":916 + /* "pykeyvi.pyx":784 + * + * + * def SetEnd(self, end ): # <<<<<<<<<<<<<< + * assert isinstance(end, (int, long)), 'arg end wrong type' * - * @staticmethod - * def loads(serialized_match): # <<<<<<<<<<<<<< - * m=Match() - * unserialized = msgpack.loads(serialized_match) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.Match.loads", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Match.SetEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_m); - __Pyx_XDECREF(__pyx_v_unserialized); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":959 - * # self.it = it - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self +/* "pykeyvi.pyx":789 + * self.inst.get().SetEnd((end)) * + * def GetStart(self): # <<<<<<<<<<<<<< + * cdef size_t _r = self.inst.get().GetStart() + * py_result = _r */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_1__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7pykeyvi_5Match_5GetStart(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_5GetStart(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_13MatchIterator___iter__(((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_v_self)); + __Pyx_RefNannySetupContext("GetStart (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_4GetStart(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_13MatchIterator___iter__(struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_self) { +static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + size_t __pyx_v__r; + size_t __pyx_v_py_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetStart", 0); - /* "pykeyvi.pyx":960 + /* "pykeyvi.pyx":790 * - * def __iter__(self): - * return self # <<<<<<<<<<<<<< + * def GetStart(self): + * cdef size_t _r = self.inst.get().GetStart() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetStart(); + + /* "pykeyvi.pyx":791 + * def GetStart(self): + * cdef size_t _r = self.inst.get().GetStart() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result * - * #def __dealloc__(self): + */ + __pyx_v_py_result = ((size_t)__pyx_v__r); + + /* "pykeyvi.pyx":792 + * cdef size_t _r = self.inst.get().GetStart() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def GetScore(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "pykeyvi.pyx":959 - * # self.it = it - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self + /* "pykeyvi.pyx":789 + * self.inst.get().SetEnd((end)) * + * def GetStart(self): # <<<<<<<<<<<<<< + * cdef size_t _r = self.inst.get().GetStart() + * py_result = _r */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pykeyvi.Match.GetStart", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":968 - * # del self.end +/* "pykeyvi.pyx":794 + * return py_result * - * def __next__(self): # <<<<<<<<<<<<<< - * # This works correctly by using "*it" and "*end" in the code, - * #if co.dereference( self.it ) == co.dereference( self.end ) : + * def GetScore(self): # <<<<<<<<<<<<<< + * cdef float _r = self.inst.get().GetScore() + * py_result = _r */ /* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_3__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_3__next__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7pykeyvi_5Match_7GetScore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_7GetScore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_13MatchIterator_2__next__(((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_v_self)); + __Pyx_RefNannySetupContext("GetScore (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_6GetScore(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_self) { - keyvi::dictionary::Match *__pyx_v__r; - struct __pyx_obj_7pykeyvi_Match *__pyx_v_py_result = 0; +static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + float __pyx_v__r; + PyObject *__pyx_v_py_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__next__", 0); + __Pyx_RefNannySetupContext("GetScore", 0); - /* "pykeyvi.pyx":971 - * # This works correctly by using "*it" and "*end" in the code, - * #if co.dereference( self.it ) == co.dereference( self.end ) : - * if self.it == self.end: # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":795 * - * raise StopIteration() + * def GetScore(self): + * cdef float _r = self.inst.get().GetScore() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result */ - __pyx_t_1 = ((__pyx_v_self->it == __pyx_v_self->end) != 0); - if (__pyx_t_1) { + __pyx_v__r = __pyx_v_self->inst.get()->GetScore(); - /* "pykeyvi.pyx":973 - * if self.it == self.end: - * - * raise StopIteration() # <<<<<<<<<<<<<< - * cdef _Match * _r = new _Match(co.dereference( self.it )) + /* "pykeyvi.pyx":796 + * def GetScore(self): + * cdef float _r = self.inst.get().GetScore() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result * */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((float)__pyx_v__r)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_py_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "pykeyvi.pyx":971 - * # This works correctly by using "*it" and "*end" in the code, - * #if co.dereference( self.it ) == co.dereference( self.end ) : - * if self.it == self.end: # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":797 + * cdef float _r = self.inst.get().GetScore() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< * - * raise StopIteration() + * def SetMatchedString(self, bytes matched_string ): */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_py_result); + __pyx_r = __pyx_v_py_result; + goto __pyx_L0; - /* "pykeyvi.pyx":974 - * - * raise StopIteration() - * cdef _Match * _r = new _Match(co.dereference( self.it )) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":794 + * return py_result * - * # This also does the expected thing. - */ - __pyx_v__r = new keyvi::dictionary::Match((*__pyx_v_self->it)); - - /* "pykeyvi.pyx":977 - * - * # This also does the expected thing. - * co.preincrement( self.it ) # <<<<<<<<<<<<<< - * - * cdef Match py_result = Match.__new__(Match) + * def GetScore(self): # <<<<<<<<<<<<<< + * cdef float _r = self.inst.get().GetScore() + * py_result = _r */ - (++__pyx_v_self->it); - /* "pykeyvi.pyx":979 - * co.preincrement( self.it ) - * - * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< - * py_result.inst = shared_ptr[_Match](_r) - * - */ - __pyx_t_2 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_2); - __pyx_t_2 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pykeyvi.Match.GetScore", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_py_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":980 - * - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = shared_ptr[_Match](_r) # <<<<<<<<<<<<<< - * +/* "pykeyvi.pyx":799 * return py_result - */ - __pyx_v_py_result->inst = boost::shared_ptr (__pyx_v__r); - - /* "pykeyvi.pyx":982 - * py_result.inst = shared_ptr[_Match](_r) - * - * return py_result # <<<<<<<<<<<<<< * + * def SetMatchedString(self, bytes matched_string ): # <<<<<<<<<<<<<< + * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; - /* "pykeyvi.pyx":968 - * # del self.end - * - * def __next__(self): # <<<<<<<<<<<<<< - * # This works correctly by using "*it" and "*end" in the code, - * #if co.dereference( self.it ) == co.dereference( self.end ) : - */ +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_9SetMatchedString(PyObject *__pyx_v_self, PyObject *__pyx_v_matched_string); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_9SetMatchedString(PyObject *__pyx_v_self, PyObject *__pyx_v_matched_string) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetMatchedString (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_matched_string), (&PyBytes_Type), 1, "matched_string", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_5Match_8SetMatchedString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject*)__pyx_v_matched_string)); /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pykeyvi.MatchIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { - Py_ssize_t __pyx_v_length; - char *__pyx_v_data; - std::string __pyx_r; +static PyObject *__pyx_pf_7pykeyvi_5Match_8SetMatchedString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_matched_string) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - char *__pyx_t_1; + int __pyx_t_1; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); + __Pyx_RefNannySetupContext("SetMatchedString", 0); - /* "string.from_py":15 - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< - * return string(data, length) + /* "pykeyvi.pyx":800 * + * def SetMatchedString(self, bytes matched_string ): + * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' # <<<<<<<<<<<<<< + * + * self.inst.get().SetMatchedString((matched_string)) */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_data = __pyx_t_1; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyBytes_Check(__pyx_v_matched_string); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_matched_string_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "string.from_py":16 - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":802 + * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' * + * self.inst.get().SetMatchedString((matched_string)) # <<<<<<<<<<<<<< * + * def GetValueAsString(self): */ - __pyx_r = std::string(__pyx_v_data, __pyx_v_length); - goto __pyx_L0; + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_matched_string); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->SetMatchedString(((std::string)__pyx_t_2)); - /* "string.from_py":13 + /* "pykeyvi.pyx":799 + * return py_result + * + * def SetMatchedString(self, bytes matched_string ): # <<<<<<<<<<<<<< + * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Match.SetMatchedString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":31 +/* "pykeyvi.pyx":804 + * self.inst.get().SetMatchedString((matched_string)) * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: + * def GetValueAsString(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetValueAsString() + * py_result = _r */ -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_11GetValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_11GetValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetValueAsString (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_10GetValueAsString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + std::string __pyx_v__r; + std::string __pyx_v_py_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("GetValueAsString", 0); - /* "string.to_py":32 - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t) + /* "pykeyvi.pyx":805 + * + * def GetValueAsString(self): + * cdef libcpp_string _r = self.inst.get().GetValueAsString() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + try { + __pyx_t_1 = __pyx_v_self->inst.get()->GetValueAsString(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v__r = __pyx_t_1; + + /* "pykeyvi.pyx":806 + * def GetValueAsString(self): + * cdef libcpp_string _r = self.inst.get().GetValueAsString() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((std::string)__pyx_v__r); + + /* "pykeyvi.pyx":807 + * cdef libcpp_string _r = self.inst.get().GetValueAsString() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def IsEmpty(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "string.to_py":31 + /* "pykeyvi.pyx":804 + * self.inst.get().SetMatchedString((matched_string)) * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: + * def GetValueAsString(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetValueAsString() + * py_result = _r */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pykeyvi.Match.GetValueAsString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":37 +/* "pykeyvi.pyx":809 + * return py_result * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: + * def IsEmpty(self): # <<<<<<<<<<<<<< + * cdef bool _r = self.inst.get().IsEmpty() + * py_result = _r */ -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_13IsEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_13IsEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("IsEmpty (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_12IsEmpty(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + bool __pyx_v__r; + bool __pyx_v_py_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("IsEmpty", 0); - /* "string.to_py":38 - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t) + /* "pykeyvi.pyx":810 + * + * def IsEmpty(self): + * cdef bool _r = self.inst.get().IsEmpty() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + __pyx_v__r = __pyx_v_self->inst.get()->IsEmpty(); + + /* "pykeyvi.pyx":811 + * def IsEmpty(self): + * cdef bool _r = self.inst.get().IsEmpty() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((bool)__pyx_v__r); + + /* "pykeyvi.pyx":812 + * cdef bool _r = self.inst.get().IsEmpty() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def SetScore(self, float score ): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "string.to_py":37 + /* "pykeyvi.pyx":809 + * return py_result * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: + * def IsEmpty(self): # <<<<<<<<<<<<<< + * cdef bool _r = self.inst.get().IsEmpty() + * py_result = _r */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pykeyvi.Match.IsEmpty", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":43 +/* "pykeyvi.pyx":814 + * return py_result + * + * def SetScore(self, float score ): # <<<<<<<<<<<<<< + * assert isinstance(score, float), 'arg score wrong type' * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: */ -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_15SetScore(PyObject *__pyx_v_self, PyObject *__pyx_arg_score); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_15SetScore(PyObject *__pyx_v_self, PyObject *__pyx_arg_score) { + float __pyx_v_score; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetScore (wrapper)", 0); + assert(__pyx_arg_score); { + __pyx_v_score = __pyx_PyFloat_AsFloat(__pyx_arg_score); if (unlikely((__pyx_v_score == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.Match.SetScore", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7pykeyvi_5Match_14SetScore(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((float)__pyx_v_score)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, float __pyx_v_score) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("SetScore", 0); - /* "string.to_py":44 - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t) + /* "pykeyvi.pyx":815 + * + * def SetScore(self, float score ): + * assert isinstance(score, float), 'arg score wrong type' # <<<<<<<<<<<<<< + * + * self.inst.get().SetScore((score)) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_Check(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!(__pyx_t_2 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_score_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "string.to_py":43 + /* "pykeyvi.pyx":817 + * assert isinstance(score, float), 'arg score wrong type' + * + * self.inst.get().SetScore((score)) # <<<<<<<<<<<<<< + * + * def GetRawValueAsString(self): + */ + __pyx_v_self->inst.get()->SetScore(((float)__pyx_v_score)); + + /* "pykeyvi.pyx":814 + * return py_result + * + * def SetScore(self, float score ): # <<<<<<<<<<<<<< + * assert isinstance(score, float), 'arg score wrong type' * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pykeyvi.Match.SetScore", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":49 +/* "pykeyvi.pyx":819 + * self.inst.get().SetScore((score)) * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: + * def GetRawValueAsString(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() + * py_result = _r */ -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_17GetRawValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_17GetRawValueAsString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetRawValueAsString (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + std::string __pyx_v__r; + std::string __pyx_v_py_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + std::string __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("GetRawValueAsString", 0); - /* "string.to_py":50 - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t) + /* "pykeyvi.pyx":820 + * + * def GetRawValueAsString(self): + * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + try { + __pyx_t_1 = __pyx_v_self->inst.get()->GetRawValueAsString(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v__r = __pyx_t_1; + + /* "pykeyvi.pyx":821 + * def GetRawValueAsString(self): + * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((std::string)__pyx_v__r); + + /* "pykeyvi.pyx":822 + * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def SetStart(self, start ): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "string.to_py":49 + /* "pykeyvi.pyx":819 + * self.inst.get().SetScore((score)) * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: + * def GetRawValueAsString(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() + * py_result = _r */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pykeyvi.Match.GetRawValueAsString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":55 +/* "pykeyvi.pyx":824 + * return py_result * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * def SetStart(self, start ): # <<<<<<<<<<<<<< + * assert isinstance(start, (int, long)), 'arg start wrong type' * */ -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_19SetStart(PyObject *__pyx_v_self, PyObject *__pyx_v_start); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_19SetStart(PyObject *__pyx_v_self, PyObject *__pyx_v_start) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetStart (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_18SetStart(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_start)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_start) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("SetStart", 0); - /* "string.to_py":56 - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":825 + * + * def SetStart(self, start ): + * assert isinstance(start, (int, long)), 'arg start wrong type' # <<<<<<<<<<<<<< + * + * self.inst.get().SetStart((start)) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = PyInt_Check(__pyx_v_start); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = PyLong_Check(__pyx_v_start); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_start_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":827 + * assert isinstance(start, (int, long)), 'arg start wrong type' + * + * self.inst.get().SetStart((start)) # <<<<<<<<<<<<<< + * + * def GetEnd(self): + */ + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_start); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->inst.get()->SetStart(((size_t)__pyx_t_4)); + + /* "pykeyvi.pyx":824 + * return py_result + * + * def SetStart(self, start ): # <<<<<<<<<<<<<< + * assert isinstance(start, (int, long)), 'arg start wrong type' + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.Match.SetStart", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":829 + * self.inst.get().SetStart((start)) + * + * def GetEnd(self): # <<<<<<<<<<<<<< + * cdef size_t _r = self.inst.get().GetEnd() + * py_result = _r + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_21GetEnd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_21GetEnd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetEnd (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_20GetEnd(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + size_t __pyx_v__r; + size_t __pyx_v_py_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetEnd", 0); + + /* "pykeyvi.pyx":830 + * + * def GetEnd(self): + * cdef size_t _r = self.inst.get().GetEnd() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetEnd(); + + /* "pykeyvi.pyx":831 + * def GetEnd(self): + * cdef size_t _r = self.inst.get().GetEnd() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((size_t)__pyx_v__r); + + /* "pykeyvi.pyx":832 + * cdef size_t _r = self.inst.get().GetEnd() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< * + * def __copy__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "string.to_py":55 + /* "pykeyvi.pyx":829 + * self.inst.get().SetStart((start)) * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * def GetEnd(self): # <<<<<<<<<<<<<< + * cdef size_t _r = self.inst.get().GetEnd() + * py_result = _r + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pykeyvi.Match.GetEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":834 + * return py_result + * + * def __copy__(self): # <<<<<<<<<<<<<< + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_23__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_23__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_22__copy__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + struct __pyx_obj_7pykeyvi_Match *__pyx_v_rv = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__copy__", 0); + + /* "pykeyvi.pyx":835 + * + * def __copy__(self): + * cdef Match rv = Match.__new__(Match) # <<<<<<<<<<<<<< + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + * return rv + */ + __pyx_t_1 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_rv = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":836 + * def __copy__(self): + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) # <<<<<<<<<<<<<< + * return rv + * + */ + __pyx_v_rv->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_self->inst.get()))); + + /* "pykeyvi.pyx":837 + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + * return rv # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rv)); + __pyx_r = ((PyObject *)__pyx_v_rv); + goto __pyx_L0; + + /* "pykeyvi.pyx":834 + * return py_result * + * def __copy__(self): # <<<<<<<<<<<<<< + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pykeyvi.Match.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_rv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryMerger(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *p; +/* "pykeyvi.pyx":839 + * return rv + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_25__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_25__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_24__deepcopy__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) { + struct __pyx_obj_7pykeyvi_Match *__pyx_v_rv = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "pykeyvi.pyx":840 + * + * def __deepcopy__(self, memo): + * cdef Match rv = Match.__new__(Match) # <<<<<<<<<<<<<< + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + * return rv + */ + __pyx_t_1 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_rv = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":841 + * def __deepcopy__(self, memo): + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) # <<<<<<<<<<<<<< + * return rv + * + */ + __pyx_v_rv->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_self->inst.get()))); + + /* "pykeyvi.pyx":842 + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + * return rv # <<<<<<<<<<<<<< + * + * def _init_0(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rv)); + __pyx_r = ((PyObject *)__pyx_v_rv); + goto __pyx_L0; + + /* "pykeyvi.pyx":839 + * return rv + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * cdef Match rv = Match.__new__(Match) + * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pykeyvi.Match.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_rv); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":844 + * return rv + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_Match](new _Match()) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_27_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_27_init_0(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_0 (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_26_init_0(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_26_init_0(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_0", 0); + + /* "pykeyvi.pyx":845 + * + * def _init_0(self): + * self.inst = shared_ptr[_Match](new _Match()) # <<<<<<<<<<<<<< + * + * def _init_1(self, Match m ): + */ + __pyx_v_self->inst = boost::shared_ptr (new keyvi::dictionary::Match()); + + /* "pykeyvi.pyx":844 + * return rv + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_Match](new _Match()) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":847 + * self.inst = shared_ptr[_Match](new _Match()) + * + * def _init_1(self, Match m ): # <<<<<<<<<<<<<< + * assert isinstance(m, Match), 'arg m wrong type' + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_29_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_m); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_29_init_1(PyObject *__pyx_v_self, PyObject *__pyx_v_m) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_init_1 (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_7pykeyvi_Match, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7pykeyvi_5Match_28_init_1(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_m)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, struct __pyx_obj_7pykeyvi_Match *__pyx_v_m) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_init_1", 0); + + /* "pykeyvi.pyx":848 + * + * def _init_1(self, Match m ): + * assert isinstance(m, Match), 'arg m wrong type' # <<<<<<<<<<<<<< + * + * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_m), __pyx_ptype_7pykeyvi_Match); + if (unlikely(!(__pyx_t_1 != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_m_wrong_type); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":850 + * assert isinstance(m, Match), 'arg m wrong type' + * + * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) # <<<<<<<<<<<<<< + * + * def __init__(self, *args): + */ + __pyx_v_self->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_m->inst.get()))); + + /* "pykeyvi.pyx":847 + * self.inst = shared_ptr[_Match](new _Match()) + * + * def _init_1(self, Match m ): # <<<<<<<<<<<<<< + * assert isinstance(m, Match), 'arg m wrong type' + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.Match._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":852 + * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) + * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) + */ + +/* Python wrapper */ +static int __pyx_pw_7pykeyvi_5Match_31__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7pykeyvi_5Match_31__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_7pykeyvi_5Match_30__init__(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_args) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pykeyvi.pyx":853 + * + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], Match)): + */ + __pyx_t_1 = (__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_v_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":854 + * def __init__(self, *args): + * if not args: + * self._init_0(*args) # <<<<<<<<<<<<<< + * elif (len(args)==1) and (isinstance(args[0], Match)): + * self._init_1(*args) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pykeyvi.pyx":853 + * + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], Match)): + */ + goto __pyx_L3; + } + + /* "pykeyvi.pyx":855 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], Match)): # <<<<<<<<<<<<<< + * self._init_1(*args) + * else: + */ + __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_args, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_ptype_7pykeyvi_Match); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":856 + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], Match)): + * self._init_1(*args) # <<<<<<<<<<<<<< + * else: + * raise Exception('can not handle type of %s' % (args,)) + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_v_args, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pykeyvi.pyx":855 + * if not args: + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], Match)): # <<<<<<<<<<<<<< + * self._init_1(*args) + * else: + */ + goto __pyx_L3; + } + + /* "pykeyvi.pyx":858 + * self._init_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + * + * def GetMatchedString(self): + */ + /*else*/ { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_args); + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "pykeyvi.pyx":852 + * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) + * + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Match.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":860 + * raise Exception('can not handle type of %s' % (args,)) + * + * def GetMatchedString(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetMatchedString() + * py_result = _r + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_33GetMatchedString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_33GetMatchedString(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetMatchedString (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_32GetMatchedString(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + std::string __pyx_v__r; + std::string __pyx_v_py_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetMatchedString", 0); + + /* "pykeyvi.pyx":861 + * + * def GetMatchedString(self): + * cdef libcpp_string _r = self.inst.get().GetMatchedString() # <<<<<<<<<<<<<< + * py_result = _r + * return py_result + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetMatchedString(); + + /* "pykeyvi.pyx":862 + * def GetMatchedString(self): + * cdef libcpp_string _r = self.inst.get().GetMatchedString() + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_v_py_result = ((std::string)__pyx_v__r); + + /* "pykeyvi.pyx":863 + * cdef libcpp_string _r = self.inst.get().GetMatchedString() + * py_result = _r + * return py_result # <<<<<<<<<<<<<< + * + * def GetAttribute(self, key): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_py_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":860 + * raise Exception('can not handle type of %s' % (args,)) + * + * def GetMatchedString(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetMatchedString() + * py_result = _r + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pykeyvi.Match.GetMatchedString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":865 + * return py_result + * + * def GetAttribute(self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode("utf-8") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_35GetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_35GetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetAttribute (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_34GetAttribute(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_py_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + PyObject *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetAttribute", 0); + __Pyx_INCREF(__pyx_v_key); + + /* "pykeyvi.pyx":866 + * + * def GetAttribute(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode("utf-8") + * + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":867 + * def GetAttribute(self, key): + * if isinstance(key, unicode): + * key = key.encode("utf-8") # <<<<<<<<<<<<<< + * + * py_result = self.inst.get().GetAttributePy( key) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + + /* "pykeyvi.pyx":866 + * + * def GetAttribute(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode("utf-8") + * + */ + } + + /* "pykeyvi.pyx":869 + * key = key.encode("utf-8") + * + * py_result = self.inst.get().GetAttributePy( key) # <<<<<<<<<<<<<< + * return py_result + * + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_t_6 = __pyx_v_self->inst.get()->GetAttributePy(((std::string)__pyx_t_5)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_py_result = __pyx_t_6; + + /* "pykeyvi.pyx":870 + * + * py_result = self.inst.get().GetAttributePy( key) + * return py_result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; + + /* "pykeyvi.pyx":865 + * return py_result + * + * def GetAttribute(self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode("utf-8") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Match.GetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":873 + * + * + * def SetAttribute(self, key, value): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode("utf-8") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_value = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetAttribute (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("SetAttribute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SetAttribute") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_key = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("SetAttribute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.Match.SetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7pykeyvi_5Match_36SetAttribute(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), __pyx_v_key, __pyx_v_value); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + PyTypeObject *__pyx_v_t = NULL; + PyObject *__pyx_v_value_utf8 = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + std::string __pyx_t_6; + float __pyx_t_7; + int __pyx_t_8; + bool __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("SetAttribute", 0); + __Pyx_INCREF(__pyx_v_key); + + /* "pykeyvi.pyx":874 + * + * def SetAttribute(self, key, value): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode("utf-8") + * + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":875 + * def SetAttribute(self, key, value): + * if isinstance(key, unicode): + * key = key.encode("utf-8") # <<<<<<<<<<<<<< + * + * t = type(value) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + + /* "pykeyvi.pyx":874 + * + * def SetAttribute(self, key, value): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode("utf-8") + * + */ + } + + /* "pykeyvi.pyx":877 + * key = key.encode("utf-8") + * + * t = type(value) # <<<<<<<<<<<<<< + * if t == str: + * self.inst.get().SetAttribute( key, value) + */ + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_v_t = ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_value))); + + /* "pykeyvi.pyx":878 + * + * t = type(value) + * if t == str: # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * elif t == unicode: + */ + __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":879 + * t = type(value) + * if t == str: + * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< + * elif t == unicode: + * value_utf8 = value.encode("utf-8") + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((std::string)__pyx_t_6)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":878 + * + * t = type(value) + * if t == str: # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * elif t == unicode: + */ + goto __pyx_L4; + } + + /* "pykeyvi.pyx":880 + * if t == str: + * self.inst.get().SetAttribute( key, value) + * elif t == unicode: # <<<<<<<<<<<<<< + * value_utf8 = value.encode("utf-8") + * self.inst.get().SetAttribute( key, value_utf8) + */ + __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyUnicode_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":881 + * self.inst.get().SetAttribute( key, value) + * elif t == unicode: + * value_utf8 = value.encode("utf-8") # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value_utf8) + * elif t == float: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_value_utf8 = __pyx_t_3; + __pyx_t_3 = 0; + + /* "pykeyvi.pyx":882 + * elif t == unicode: + * value_utf8 = value.encode("utf-8") + * self.inst.get().SetAttribute( key, value_utf8) # <<<<<<<<<<<<<< + * elif t == float: + * self.inst.get().SetAttribute( key, value) + */ + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value_utf8); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_6), ((std::string)__pyx_t_5)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":880 + * if t == str: + * self.inst.get().SetAttribute( key, value) + * elif t == unicode: # <<<<<<<<<<<<<< + * value_utf8 = value.encode("utf-8") + * self.inst.get().SetAttribute( key, value_utf8) + */ + goto __pyx_L4; + } + + /* "pykeyvi.pyx":883 + * value_utf8 = value.encode("utf-8") + * self.inst.get().SetAttribute( key, value_utf8) + * elif t == float: # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * elif t == int: + */ + __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":884 + * self.inst.get().SetAttribute( key, value_utf8) + * elif t == float: + * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< + * elif t == int: + * self.inst.get().SetAttribute( key, value) + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((float)__pyx_t_7)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":883 + * value_utf8 = value.encode("utf-8") + * self.inst.get().SetAttribute( key, value_utf8) + * elif t == float: # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * elif t == int: + */ + goto __pyx_L4; + } + + /* "pykeyvi.pyx":885 + * elif t == float: + * self.inst.get().SetAttribute( key, value) + * elif t == int: # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * # special trick as t == bool does not work due to name collision between cython and C + */ + __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_t), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":886 + * self.inst.get().SetAttribute( key, value) + * elif t == int: + * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< + * # special trick as t == bool does not work due to name collision between cython and C + * elif isinstance(value, (int)): + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((int)__pyx_t_8)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":885 + * elif t == float: + * self.inst.get().SetAttribute( key, value) + * elif t == int: # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * # special trick as t == bool does not work due to name collision between cython and C + */ + goto __pyx_L4; + } + + /* "pykeyvi.pyx":888 + * self.inst.get().SetAttribute( key, value) + * # special trick as t == bool does not work due to name collision between cython and C + * elif isinstance(value, (int)): # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * else: + */ + __pyx_t_2 = PyInt_Check(__pyx_v_value); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "pykeyvi.pyx":889 + * # special trick as t == bool does not work due to name collision between cython and C + * elif isinstance(value, (int)): + * self.inst.get().SetAttribute( key, value) # <<<<<<<<<<<<<< + * else: + * raise Exception("Unsupported Value Type") + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_9 == (bool)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetAttribute(((std::string)__pyx_t_5), ((bool)__pyx_t_9)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":888 + * self.inst.get().SetAttribute( key, value) + * # special trick as t == bool does not work due to name collision between cython and C + * elif isinstance(value, (int)): # <<<<<<<<<<<<<< + * self.inst.get().SetAttribute( key, value) + * else: + */ + goto __pyx_L4; + } + + /* "pykeyvi.pyx":891 + * self.inst.get().SetAttribute( key, value) + * else: + * raise Exception("Unsupported Value Type") # <<<<<<<<<<<<<< + * + * + */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "pykeyvi.pyx":873 + * + * + * def SetAttribute(self, key, value): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode("utf-8") + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Match.SetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_value_utf8); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":894 + * + * + * def GetValue(self): # <<<<<<<<<<<<<< + * """Decodes a keyvi value and returns it.""" + * value = self.inst.get().GetRawValueAsString() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_39GetValue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_7pykeyvi_5Match_38GetValue[] = "Decodes a keyvi value and returns it."; +static PyObject *__pyx_pw_7pykeyvi_5Match_39GetValue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("GetValue (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_38GetValue(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("GetValue", 0); + + /* "pykeyvi.pyx":896 + * def GetValue(self): + * """Decodes a keyvi value and returns it.""" + * value = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< + * if value is None or len(value) == 0: + * return None + */ + try { + __pyx_t_1 = __pyx_v_self->inst.get()->GetRawValueAsString(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "pykeyvi.pyx":897 + * """Decodes a keyvi value and returns it.""" + * value = self.inst.get().GetRawValueAsString() + * if value is None or len(value) == 0: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_4 = (__pyx_v_value == Py_None); + __pyx_t_5 = (__pyx_t_4 != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_6 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((__pyx_t_6 == 0) != 0); + __pyx_t_3 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_3) { + + /* "pykeyvi.pyx":898 + * value = self.inst.get().GetRawValueAsString() + * if value is None or len(value) == 0: + * return None # <<<<<<<<<<<<<< + * + * elif value[0] == '\x00': + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + + /* "pykeyvi.pyx":897 + * """Decodes a keyvi value and returns it.""" + * value = self.inst.get().GetRawValueAsString() + * if value is None or len(value) == 0: # <<<<<<<<<<<<<< + * return None + * + */ + } + + /* "pykeyvi.pyx":900 + * return None + * + * elif value[0] == '\x00': # <<<<<<<<<<<<<< + * return msgpack.loads(value[1:]) + * + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__14, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "pykeyvi.pyx":901 + * + * elif value[0] == '\x00': + * return msgpack.loads(value[1:]) # <<<<<<<<<<<<<< + * + * elif value[0] == '\x01': + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_loads); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, 0, NULL, NULL, &__pyx_slice__15, 1, 0, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (!__pyx_t_9) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":900 + * return None + * + * elif value[0] == '\x00': # <<<<<<<<<<<<<< + * return msgpack.loads(value[1:]) + * + */ + } + + /* "pykeyvi.pyx":903 + * return msgpack.loads(value[1:]) + * + * elif value[0] == '\x01': # <<<<<<<<<<<<<< + * value = zlib.decompress(value[1:]) + * + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__16, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "pykeyvi.pyx":904 + * + * elif value[0] == '\x01': + * value = zlib.decompress(value[1:]) # <<<<<<<<<<<<<< + * + * elif value[0] == '\x02': + */ + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_zlib); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decompress); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, 0, NULL, NULL, &__pyx_slice__17, 1, 0, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + } + } + if (!__pyx_t_7) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "pykeyvi.pyx":903 + * return msgpack.loads(value[1:]) + * + * elif value[0] == '\x01': # <<<<<<<<<<<<<< + * value = zlib.decompress(value[1:]) + * + */ + goto __pyx_L3; + } + + /* "pykeyvi.pyx":906 + * value = zlib.decompress(value[1:]) + * + * elif value[0] == '\x02': # <<<<<<<<<<<<<< + * value = snappy.decompress(value[1:]) + * + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__18, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "pykeyvi.pyx":907 + * + * elif value[0] == '\x02': + * value = snappy.decompress(value[1:]) # <<<<<<<<<<<<<< + * + * return msgpack.loads(value) + */ + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_snappy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_decompress); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, 0, NULL, NULL, &__pyx_slice__19, 1, 0, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + if (!__pyx_t_8) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL; + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "pykeyvi.pyx":906 + * value = zlib.decompress(value[1:]) + * + * elif value[0] == '\x02': # <<<<<<<<<<<<<< + * value = snappy.decompress(value[1:]) + * + */ + } + __pyx_L3:; + + /* "pykeyvi.pyx":909 + * value = snappy.decompress(value[1:]) + * + * return msgpack.loads(value) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_loads); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + if (!__pyx_t_9) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_value); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":894 + * + * + * def GetValue(self): # <<<<<<<<<<<<<< + * """Decodes a keyvi value and returns it.""" + * value = self.inst.get().GetRawValueAsString() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pykeyvi.Match.GetValue", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":912 + * + * + * def dumps(self): # <<<<<<<<<<<<<< + * m=[] + * do_pack_rest = False + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_41dumps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_41dumps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dumps (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_40dumps(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self) { + PyObject *__pyx_v_m = NULL; + int __pyx_v_do_pack_rest; + PyObject *__pyx_v_score = NULL; + size_t __pyx_v_end; + size_t __pyx_v_start; + std::string __pyx_v_matchedstring; + std::string __pyx_v_rawvalue; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + std::string __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dumps", 0); + + /* "pykeyvi.pyx":913 + * + * def dumps(self): + * m=[] # <<<<<<<<<<<<<< + * do_pack_rest = False + * score = self.inst.get().GetScore() + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_m = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":914 + * def dumps(self): + * m=[] + * do_pack_rest = False # <<<<<<<<<<<<<< + * score = self.inst.get().GetScore() + * if score != 0: + */ + __pyx_v_do_pack_rest = 0; + + /* "pykeyvi.pyx":915 + * m=[] + * do_pack_rest = False + * score = self.inst.get().GetScore() # <<<<<<<<<<<<<< + * if score != 0: + * m.append(score) + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->inst.get()->GetScore()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_score = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":916 + * do_pack_rest = False + * score = self.inst.get().GetScore() + * if score != 0: # <<<<<<<<<<<<<< + * m.append(score) + * do_pack_rest = True + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_score, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":917 + * score = self.inst.get().GetScore() + * if score != 0: + * m.append(score) # <<<<<<<<<<<<<< + * do_pack_rest = True + * end = self.inst.get().GetEnd() + */ + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_v_score); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":918 + * if score != 0: + * m.append(score) + * do_pack_rest = True # <<<<<<<<<<<<<< + * end = self.inst.get().GetEnd() + * if end != 0 or do_pack_rest: + */ + __pyx_v_do_pack_rest = 1; + + /* "pykeyvi.pyx":916 + * do_pack_rest = False + * score = self.inst.get().GetScore() + * if score != 0: # <<<<<<<<<<<<<< + * m.append(score) + * do_pack_rest = True + */ + } + + /* "pykeyvi.pyx":919 + * m.append(score) + * do_pack_rest = True + * end = self.inst.get().GetEnd() # <<<<<<<<<<<<<< + * if end != 0 or do_pack_rest: + * m.append(end) + */ + __pyx_v_end = __pyx_v_self->inst.get()->GetEnd(); + + /* "pykeyvi.pyx":920 + * do_pack_rest = True + * end = self.inst.get().GetEnd() + * if end != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(end) + * do_pack_rest = True + */ + __pyx_t_4 = ((__pyx_v_end != 0) != 0); + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_do_pack_rest != 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L5_bool_binop_done:; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":921 + * end = self.inst.get().GetEnd() + * if end != 0 or do_pack_rest: + * m.append(end) # <<<<<<<<<<<<<< + * do_pack_rest = True + * start = self.inst.get().GetStart() + */ + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":922 + * if end != 0 or do_pack_rest: + * m.append(end) + * do_pack_rest = True # <<<<<<<<<<<<<< + * start = self.inst.get().GetStart() + * if start != 0 or do_pack_rest: + */ + __pyx_v_do_pack_rest = 1; + + /* "pykeyvi.pyx":920 + * do_pack_rest = True + * end = self.inst.get().GetEnd() + * if end != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(end) + * do_pack_rest = True + */ + } + + /* "pykeyvi.pyx":923 + * m.append(end) + * do_pack_rest = True + * start = self.inst.get().GetStart() # <<<<<<<<<<<<<< + * if start != 0 or do_pack_rest: + * m.append(start) + */ + __pyx_v_start = __pyx_v_self->inst.get()->GetStart(); + + /* "pykeyvi.pyx":924 + * do_pack_rest = True + * start = self.inst.get().GetStart() + * if start != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(start) + * do_pack_rest = True + */ + __pyx_t_4 = ((__pyx_v_start != 0) != 0); + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_do_pack_rest != 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L8_bool_binop_done:; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":925 + * start = self.inst.get().GetStart() + * if start != 0 or do_pack_rest: + * m.append(start) # <<<<<<<<<<<<<< + * do_pack_rest = True + * matchedstring = self.inst.get().GetMatchedString() + */ + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":926 + * if start != 0 or do_pack_rest: + * m.append(start) + * do_pack_rest = True # <<<<<<<<<<<<<< + * matchedstring = self.inst.get().GetMatchedString() + * if len(matchedstring) != 0 or do_pack_rest: + */ + __pyx_v_do_pack_rest = 1; + + /* "pykeyvi.pyx":924 + * do_pack_rest = True + * start = self.inst.get().GetStart() + * if start != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(start) + * do_pack_rest = True + */ + } + + /* "pykeyvi.pyx":927 + * m.append(start) + * do_pack_rest = True + * matchedstring = self.inst.get().GetMatchedString() # <<<<<<<<<<<<<< + * if len(matchedstring) != 0 or do_pack_rest: + * m.append(matchedstring) + */ + __pyx_v_matchedstring = __pyx_v_self->inst.get()->GetMatchedString(); + + /* "pykeyvi.pyx":928 + * do_pack_rest = True + * matchedstring = self.inst.get().GetMatchedString() + * if len(matchedstring) != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(matchedstring) + * do_pack_rest = True + */ + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_matchedstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = ((__pyx_t_5 != 0) != 0); + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_do_pack_rest != 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L11_bool_binop_done:; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":929 + * matchedstring = self.inst.get().GetMatchedString() + * if len(matchedstring) != 0 or do_pack_rest: + * m.append(matchedstring) # <<<<<<<<<<<<<< + * do_pack_rest = True + * rawvalue = self.inst.get().GetRawValueAsString() + */ + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_matchedstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":930 + * if len(matchedstring) != 0 or do_pack_rest: + * m.append(matchedstring) + * do_pack_rest = True # <<<<<<<<<<<<<< + * rawvalue = self.inst.get().GetRawValueAsString() + * if len(rawvalue) != 0 or do_pack_rest: + */ + __pyx_v_do_pack_rest = 1; + + /* "pykeyvi.pyx":928 + * do_pack_rest = True + * matchedstring = self.inst.get().GetMatchedString() + * if len(matchedstring) != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(matchedstring) + * do_pack_rest = True + */ + } + + /* "pykeyvi.pyx":931 + * m.append(matchedstring) + * do_pack_rest = True + * rawvalue = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< + * if len(rawvalue) != 0 or do_pack_rest: + * m.append(rawvalue) + */ + try { + __pyx_t_6 = __pyx_v_self->inst.get()->GetRawValueAsString(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_rawvalue = __pyx_t_6; + + /* "pykeyvi.pyx":932 + * do_pack_rest = True + * rawvalue = self.inst.get().GetRawValueAsString() + * if len(rawvalue) != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(rawvalue) + * m.reverse() + */ + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_rawvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = ((__pyx_t_5 != 0) != 0); + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_do_pack_rest != 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L14_bool_binop_done:; + if (__pyx_t_2) { + + /* "pykeyvi.pyx":933 + * rawvalue = self.inst.get().GetRawValueAsString() + * if len(rawvalue) != 0 or do_pack_rest: + * m.append(rawvalue) # <<<<<<<<<<<<<< + * m.reverse() + * return msgpack.dumps(m) + */ + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_rawvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_m, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":932 + * do_pack_rest = True + * rawvalue = self.inst.get().GetRawValueAsString() + * if len(rawvalue) != 0 or do_pack_rest: # <<<<<<<<<<<<<< + * m.append(rawvalue) + * m.reverse() + */ + } + + /* "pykeyvi.pyx":934 + * if len(rawvalue) != 0 or do_pack_rest: + * m.append(rawvalue) + * m.reverse() # <<<<<<<<<<<<<< + * return msgpack.dumps(m) + * + */ + __pyx_t_3 = PyList_Reverse(__pyx_v_m); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":935 + * m.append(rawvalue) + * m.reverse() + * return msgpack.dumps(m) # <<<<<<<<<<<<<< + * + * def __SetRawValue(self, str): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_dumps); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (!__pyx_t_7) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_m); + __Pyx_GIVEREF(__pyx_v_m); + PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_m); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pykeyvi.pyx":912 + * + * + * def dumps(self): # <<<<<<<<<<<<<< + * m=[] + * do_pack_rest = False + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("pykeyvi.Match.dumps", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XDECREF(__pyx_v_score); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":937 + * return msgpack.dumps(m) + * + * def __SetRawValue(self, str): # <<<<<<<<<<<<<< + * self.inst.get().SetRawValue( str) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_43__SetRawValue(PyObject *__pyx_v_self, PyObject *__pyx_v_str); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_5Match_43__SetRawValue(PyObject *__pyx_v_self, PyObject *__pyx_v_str) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__SetRawValue (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_5Match_42__SetRawValue(((struct __pyx_obj_7pykeyvi_Match *)__pyx_v_self), ((PyObject *)__pyx_v_str)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_str) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__SetRawValue", 0); + + /* "pykeyvi.pyx":938 + * + * def __SetRawValue(self, str): + * self.inst.get().SetRawValue( str) # <<<<<<<<<<<<<< + * + * @staticmethod + */ + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_str); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + try { + __pyx_v_self->inst.get()->SetRawValue(((std::string)__pyx_t_1)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":937 + * return msgpack.dumps(m) + * + * def __SetRawValue(self, str): # <<<<<<<<<<<<<< + * self.inst.get().SetRawValue( str) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.Match.__SetRawValue", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":941 + * + * @staticmethod + * def loads(serialized_match): # <<<<<<<<<<<<<< + * m=Match() + * unserialized = msgpack.loads(serialized_match) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7pykeyvi_5Match_45loads = {"loads", (PyCFunction)__pyx_pw_7pykeyvi_5Match_45loads, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_serialized_match = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loads (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serialized_match,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_serialized_match)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loads") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_serialized_match = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loads", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.Match.loads", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7pykeyvi_5Match_44loads(__pyx_v_serialized_match); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_match) { + struct __pyx_obj_7pykeyvi_Match *__pyx_v_m = NULL; + PyObject *__pyx_v_unserialized = NULL; + Py_ssize_t __pyx_v_number_of_fields; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loads", 0); + + /* "pykeyvi.pyx":942 + * @staticmethod + * def loads(serialized_match): + * m=Match() # <<<<<<<<<<<<<< + * unserialized = msgpack.loads(serialized_match) + * number_of_fields = len(unserialized) + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_m = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":943 + * def loads(serialized_match): + * m=Match() + * unserialized = msgpack.loads(serialized_match) # <<<<<<<<<<<<<< + * number_of_fields = len(unserialized) + * if number_of_fields > 0: + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_msgpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_loads); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_serialized_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_INCREF(__pyx_v_serialized_match); + __Pyx_GIVEREF(__pyx_v_serialized_match); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_serialized_match); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __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_v_unserialized = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":944 + * m=Match() + * unserialized = msgpack.loads(serialized_match) + * number_of_fields = len(unserialized) # <<<<<<<<<<<<<< + * if number_of_fields > 0: + * m.__SetRawValue(unserialized[0]) + */ + __pyx_t_5 = PyObject_Length(__pyx_v_unserialized); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_number_of_fields = __pyx_t_5; + + /* "pykeyvi.pyx":945 + * unserialized = msgpack.loads(serialized_match) + * number_of_fields = len(unserialized) + * if number_of_fields > 0: # <<<<<<<<<<<<<< + * m.__SetRawValue(unserialized[0]) + * if number_of_fields > 1: + */ + __pyx_t_6 = ((__pyx_v_number_of_fields > 0) != 0); + if (__pyx_t_6) { + + /* "pykeyvi.pyx":946 + * number_of_fields = len(unserialized) + * if number_of_fields > 0: + * m.__SetRawValue(unserialized[0]) # <<<<<<<<<<<<<< + * if number_of_fields > 1: + * m.SetMatchedString(unserialized[1]) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetRawValue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_unserialized, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":947 + * if number_of_fields > 0: + * m.__SetRawValue(unserialized[0]) + * if number_of_fields > 1: # <<<<<<<<<<<<<< + * m.SetMatchedString(unserialized[1]) + * if number_of_fields > 2: + */ + __pyx_t_6 = ((__pyx_v_number_of_fields > 1) != 0); + if (__pyx_t_6) { + + /* "pykeyvi.pyx":948 + * m.__SetRawValue(unserialized[0]) + * if number_of_fields > 1: + * m.SetMatchedString(unserialized[1]) # <<<<<<<<<<<<<< + * if number_of_fields > 2: + * m.SetStart(unserialized[2]) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetMatchedString); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_unserialized, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":949 + * if number_of_fields > 1: + * m.SetMatchedString(unserialized[1]) + * if number_of_fields > 2: # <<<<<<<<<<<<<< + * m.SetStart(unserialized[2]) + * if number_of_fields > 3: + */ + __pyx_t_6 = ((__pyx_v_number_of_fields > 2) != 0); + if (__pyx_t_6) { + + /* "pykeyvi.pyx":950 + * m.SetMatchedString(unserialized[1]) + * if number_of_fields > 2: + * m.SetStart(unserialized[2]) # <<<<<<<<<<<<<< + * if number_of_fields > 3: + * m.SetEnd(unserialized[3]) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetStart); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_unserialized, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_7) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __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; + + /* "pykeyvi.pyx":951 + * if number_of_fields > 2: + * m.SetStart(unserialized[2]) + * if number_of_fields > 3: # <<<<<<<<<<<<<< + * m.SetEnd(unserialized[3]) + * if number_of_fields > 4: + */ + __pyx_t_6 = ((__pyx_v_number_of_fields > 3) != 0); + if (__pyx_t_6) { + + /* "pykeyvi.pyx":952 + * m.SetStart(unserialized[2]) + * if number_of_fields > 3: + * m.SetEnd(unserialized[3]) # <<<<<<<<<<<<<< + * if number_of_fields > 4: + * m.SetScore(unserialized[4]) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetEnd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_unserialized, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":953 + * if number_of_fields > 3: + * m.SetEnd(unserialized[3]) + * if number_of_fields > 4: # <<<<<<<<<<<<<< + * m.SetScore(unserialized[4]) + * + */ + __pyx_t_6 = ((__pyx_v_number_of_fields > 4) != 0); + if (__pyx_t_6) { + + /* "pykeyvi.pyx":954 + * m.SetEnd(unserialized[3]) + * if number_of_fields > 4: + * m.SetScore(unserialized[4]) # <<<<<<<<<<<<<< + * + * return m + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_SetScore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_unserialized, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pykeyvi.pyx":953 + * if number_of_fields > 3: + * m.SetEnd(unserialized[3]) + * if number_of_fields > 4: # <<<<<<<<<<<<<< + * m.SetScore(unserialized[4]) + * + */ + } + + /* "pykeyvi.pyx":951 + * if number_of_fields > 2: + * m.SetStart(unserialized[2]) + * if number_of_fields > 3: # <<<<<<<<<<<<<< + * m.SetEnd(unserialized[3]) + * if number_of_fields > 4: + */ + } + + /* "pykeyvi.pyx":949 + * if number_of_fields > 1: + * m.SetMatchedString(unserialized[1]) + * if number_of_fields > 2: # <<<<<<<<<<<<<< + * m.SetStart(unserialized[2]) + * if number_of_fields > 3: + */ + } + + /* "pykeyvi.pyx":947 + * if number_of_fields > 0: + * m.__SetRawValue(unserialized[0]) + * if number_of_fields > 1: # <<<<<<<<<<<<<< + * m.SetMatchedString(unserialized[1]) + * if number_of_fields > 2: + */ + } + + /* "pykeyvi.pyx":945 + * unserialized = msgpack.loads(serialized_match) + * number_of_fields = len(unserialized) + * if number_of_fields > 0: # <<<<<<<<<<<<<< + * m.__SetRawValue(unserialized[0]) + * if number_of_fields > 1: + */ + } + + /* "pykeyvi.pyx":956 + * m.SetScore(unserialized[4]) + * + * return m # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_m)); + __pyx_r = ((PyObject *)__pyx_v_m); + goto __pyx_L0; + + /* "pykeyvi.pyx":941 + * + * @staticmethod + * def loads(serialized_match): # <<<<<<<<<<<<<< + * m=Match() + * unserialized = msgpack.loads(serialized_match) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pykeyvi.Match.loads", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_m); + __Pyx_XDECREF(__pyx_v_unserialized); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":984 + * # self.it = it + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_13MatchIterator___iter__(((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_13MatchIterator___iter__(struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "pykeyvi.pyx":985 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * #def __dealloc__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "pykeyvi.pyx":984 + * # self.it = it + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":993 + * # del self.end + * + * def __next__(self): # <<<<<<<<<<<<<< + * # This works correctly by using "*it" and "*end" in the code, + * #if co.dereference( self.it ) == co.dereference( self.end ) : + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_3__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7pykeyvi_13MatchIterator_3__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_13MatchIterator_2__next__(((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_self) { + keyvi::dictionary::Match *__pyx_v__r; + struct __pyx_obj_7pykeyvi_Match *__pyx_v_py_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "pykeyvi.pyx":996 + * # This works correctly by using "*it" and "*end" in the code, + * #if co.dereference( self.it ) == co.dereference( self.end ) : + * if self.it == self.end: # <<<<<<<<<<<<<< + * + * raise StopIteration() + */ + __pyx_t_1 = ((__pyx_v_self->it == __pyx_v_self->end) != 0); + if (__pyx_t_1) { + + /* "pykeyvi.pyx":998 + * if self.it == self.end: + * + * raise StopIteration() # <<<<<<<<<<<<<< + * cdef _Match * _r = new _Match(co.dereference( self.it )) + * + */ + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "pykeyvi.pyx":996 + * # This works correctly by using "*it" and "*end" in the code, + * #if co.dereference( self.it ) == co.dereference( self.end ) : + * if self.it == self.end: # <<<<<<<<<<<<<< + * + * raise StopIteration() + */ + } + + /* "pykeyvi.pyx":999 + * + * raise StopIteration() + * cdef _Match * _r = new _Match(co.dereference( self.it )) # <<<<<<<<<<<<<< + * + * # This also does the expected thing. + */ + __pyx_v__r = new keyvi::dictionary::Match((*__pyx_v_self->it)); + + /* "pykeyvi.pyx":1002 + * + * # This also does the expected thing. + * co.preincrement( self.it ) # <<<<<<<<<<<<<< + * + * cdef Match py_result = Match.__new__(Match) + */ + (++__pyx_v_self->it); + + /* "pykeyvi.pyx":1004 + * co.preincrement( self.it ) + * + * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< + * py_result.inst = shared_ptr[_Match](_r) + * + */ + __pyx_t_2 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)__pyx_ptype_7pykeyvi_Match), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7pykeyvi_Match)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "pykeyvi.pyx":1005 + * + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = shared_ptr[_Match](_r) # <<<<<<<<<<<<<< + * + * return py_result + */ + __pyx_v_py_result->inst = boost::shared_ptr (__pyx_v__r); + + /* "pykeyvi.pyx":1007 + * py_result.inst = shared_ptr[_Match](_r) + * + * return py_result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; + + /* "pykeyvi.pyx":993 + * # del self.end + * + * def __next__(self): # <<<<<<<<<<<<<< + * # This works correctly by using "*it" and "*end" in the code, + * #if co.dereference( self.it ) == co.dereference( self.end ) : + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pykeyvi.MatchIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { + Py_ssize_t __pyx_v_length; + char *__pyx_v_data; + std::string __pyx_r; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); + + /* "string.from_py":15 + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< + * return string(data, length) + * + */ + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_data = __pyx_t_1; + + /* "string.from_py":16 + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = std::string(__pyx_v_data, __pyx_v_length); + goto __pyx_L0; + + /* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); + + /* "string.to_py":32 + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); + + /* "string.to_py":38 + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); + + /* "string.to_py":44 + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); + + /* "string.to_py":50 + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); + + /* "string.to_py":56 + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryMerger(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger(PyObject *o) { + struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *p = (struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_7pykeyvi_20JsonDictionaryMerger_1__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_7pykeyvi_JsonDictionaryMerger[] = { + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_3_init_0, METH_NOARGS, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5_init_1, METH_O, 0}, + {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7_init_2, METH_VARARGS|METH_KEYWORDS, 0}, + {"Merge", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_11Merge, METH_O, 0}, + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_13Add, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryMerger = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.JsonDictionaryMerger", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7pykeyvi_JsonDictionaryMerger, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7pykeyvi_20JsonDictionaryMerger_9__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7pykeyvi_JsonDictionaryMerger, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_7pykeyvi_StringDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler(PyObject *o) { + struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_7pykeyvi_24StringDictionaryCompiler_1__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_mp_ass_subscript_7pykeyvi_StringDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_7pykeyvi_24StringDictionaryCompiler_13__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyMethodDef __pyx_methods_7pykeyvi_StringDictionaryCompiler[] = { + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_3_init_0, METH_NOARGS, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_5_init_1, METH_O, 0}, + {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2, METH_VARARGS|METH_KEYWORDS, 0}, + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add, METH_VARARGS|METH_KEYWORDS, 0}, + {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_15WriteToFile, METH_O, 0}, + {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_17__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_21Compile, METH_VARARGS|METH_KEYWORDS, 0}, + {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_23SetManifest, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyMappingMethods __pyx_tp_as_mapping_StringDictionaryCompiler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + __pyx_mp_ass_subscript_7pykeyvi_StringDictionaryCompiler, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.StringDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_StringDictionaryCompiler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7pykeyvi_StringDictionaryCompiler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7pykeyvi_StringDictionaryCompiler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler(PyObject *o) { + struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyMethodDef __pyx_methods_7pykeyvi_JsonDictionaryCompiler[] = { + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_5_init_0, METH_NOARGS, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_7_init_1, METH_O, 0}, + {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2, METH_VARARGS|METH_KEYWORDS, 0}, + {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile, METH_O, 0}, + {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_15__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add, METH_VARARGS|METH_KEYWORDS, 0}, + {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile, METH_VARARGS|METH_KEYWORDS, 0}, + {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_23SetManifest, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyMappingMethods __pyx_tp_as_mapping_JsonDictionaryCompiler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.JsonDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_JsonDictionaryCompiler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7pykeyvi_JsonDictionaryCompiler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7pykeyvi_JsonDictionaryCompiler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_7pykeyvi_Dictionary(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_Dictionary *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_Dictionary *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi_Dictionary(PyObject *o) { + struct __pyx_obj_7pykeyvi_Dictionary *p = (struct __pyx_obj_7pykeyvi_Dictionary *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_7pykeyvi_Dictionary(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_7pykeyvi_Dictionary[] = { + {"LookupText", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_3LookupText, METH_O, 0}, + {"Lookup", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_5Lookup, METH_O, 0}, + {"_GetNear_0", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0, METH_VARARGS|METH_KEYWORDS, 0}, + {"_GetNear_1", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1, METH_VARARGS|METH_KEYWORDS, 0}, + {"GetNear", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_11GetNear, METH_VARARGS|METH_KEYWORDS, 0}, + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_13_init_0, METH_O, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_15_init_1, METH_VARARGS|METH_KEYWORDS, 0}, + {"Get", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_19Get, METH_O, 0}, + {"get", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_21get, METH_VARARGS|METH_KEYWORDS, 0}, + {"_key_iterator_wrapper", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_29_key_iterator_wrapper, METH_O, 0}, + {"_value_iterator_wrapper", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_32_value_iterator_wrapper, METH_O, 0}, + {"_item_iterator_wrapper", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_35_item_iterator_wrapper, METH_O, 0}, + {"GetAllKeys", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_38GetAllKeys, METH_NOARGS, 0}, + {"GetAllValues", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_40GetAllValues, METH_NOARGS, 0}, + {"GetAllItems", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_42GetAllItems, METH_NOARGS, 0}, + {"GetManifest", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_44GetManifest, METH_NOARGS, 0}, + {"GetStatistics", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_46GetStatistics, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_Dictionary = { + __pyx_pw_7pykeyvi_10Dictionary_25__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_7pykeyvi_Dictionary, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_7pykeyvi_10Dictionary_23__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Dictionary = { + __pyx_pw_7pykeyvi_10Dictionary_25__len__, /*mp_length*/ + __pyx_pw_7pykeyvi_10Dictionary_27__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_7pykeyvi_Dictionary = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.Dictionary", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_Dictionary), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7pykeyvi_Dictionary, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_Dictionary, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Dictionary, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7pykeyvi_Dictionary, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7pykeyvi_10Dictionary_17__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7pykeyvi_Dictionary, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_7pykeyvi_FsaTransform(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_FsaTransform *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -22875,13 +24869,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryMerger(PyTypeObject *t, CYT o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_FsaTransform *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger(PyObject *o) { - struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *p = (struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)o; +static void __pyx_tp_dealloc_7pykeyvi_FsaTransform(PyObject *o) { + struct __pyx_obj_7pykeyvi_FsaTransform *p = (struct __pyx_obj_7pykeyvi_FsaTransform *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -22891,7 +24885,7 @@ static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_20JsonDictionaryMerger_1__dealloc__(o); + __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -22899,18 +24893,17 @@ static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7pykeyvi_JsonDictionaryMerger[] = { - {"Merge", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5Merge, METH_O, 0}, - {"Add", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7Add, METH_O, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_FsaTransform[] = { + {"Normalize", (PyCFunction)__pyx_pw_7pykeyvi_12FsaTransform_3Normalize, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryMerger = { +static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.JsonDictionaryMerger", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger), /*tp_basicsize*/ + "pykeyvi.FsaTransform", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_FsaTransform), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_FsaTransform, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22938,7 +24931,7 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryMerger = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_JsonDictionaryMerger, /*tp_methods*/ + __pyx_methods_7pykeyvi_FsaTransform, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22946,9 +24939,9 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryMerger = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_20JsonDictionaryMerger_3__init__, /*tp_init*/ + __pyx_pw_7pykeyvi_12FsaTransform_5__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_JsonDictionaryMerger, /*tp_new*/ + __pyx_tp_new_7pykeyvi_FsaTransform, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22963,8 +24956,8 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryMerger = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_StringDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *p; +static PyObject *__pyx_tp_new_7pykeyvi_PrefixCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_PrefixCompletion *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -22972,13 +24965,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_StringDictionaryCompiler(PyTypeObject *t, o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_PrefixCompletion *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler(PyObject *o) { - struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)o; +static void __pyx_tp_dealloc_7pykeyvi_PrefixCompletion(PyObject *o) { + struct __pyx_obj_7pykeyvi_PrefixCompletion *p = (struct __pyx_obj_7pykeyvi_PrefixCompletion *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -22988,7 +24981,7 @@ static void __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_24StringDictionaryCompiler_1__dealloc__(o); + __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -22996,42 +24989,194 @@ static void __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_mp_ass_subscript_7pykeyvi_StringDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_7pykeyvi_24StringDictionaryCompiler_13__setitem__(o, i, v); +static PyMethodDef __pyx_methods_7pykeyvi_PrefixCompletion[] = { + {"GetFuzzyCompletions", (PyCFunction)__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions, METH_VARARGS|METH_KEYWORDS, 0}, + {"GetCompletions", (PyCFunction)__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_7pykeyvi_PrefixCompletion = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.PrefixCompletion", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_PrefixCompletion), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7pykeyvi_PrefixCompletion, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7pykeyvi_PrefixCompletion, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7pykeyvi_PrefixCompletion, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_7pykeyvi_ForwardBackwardCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion(PyObject *o) { + struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *p = (struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); } + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7pykeyvi_StringDictionaryCompiler[] = { - {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_3_init_0, METH_NOARGS, 0}, - {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_5_init_1, METH_O, 0}, - {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2, METH_VARARGS|METH_KEYWORDS, 0}, - {"Add", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add, METH_VARARGS|METH_KEYWORDS, 0}, - {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_15WriteToFile, METH_O, 0}, - {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_17__enter__, METH_NOARGS, 0}, - {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_19__exit__, METH_VARARGS|METH_KEYWORDS, 0}, - {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_21Compile, METH_VARARGS|METH_KEYWORDS, 0}, - {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_24StringDictionaryCompiler_23SetManifest, METH_O, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_ForwardBackwardCompletion[] = { + {"_GetCompletions_0", (PyCFunction)__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_0, METH_O, 0}, + {"_GetCompletions_1", (PyCFunction)__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_1, METH_VARARGS|METH_KEYWORDS, 0}, + {"GetCompletions", (PyCFunction)__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_7GetCompletions, METH_VARARGS|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; -static PyMappingMethods __pyx_tp_as_mapping_StringDictionaryCompiler = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - __pyx_mp_ass_subscript_7pykeyvi_StringDictionaryCompiler, /*mp_ass_subscript*/ +static PyTypeObject __pyx_type_7pykeyvi_ForwardBackwardCompletion = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.ForwardBackwardCompletion", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7pykeyvi_ForwardBackwardCompletion, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7pykeyvi_ForwardBackwardCompletion, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif }; -static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { - PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.StringDictionaryCompiler", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler), /*tp_basicsize*/ +static PyObject *__pyx_tp_new_7pykeyvi_loading_strategy_types(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi_loading_strategy_types(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { + PyVarObject_HEAD_INIT(0, 0) + "pykeyvi.loading_strategy_types", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_loading_strategy_types), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_loading_strategy_types, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23044,7 +25189,7 @@ static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_StringDictionaryCompiler, /*tp_as_mapping*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -23059,7 +25204,7 @@ static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_StringDictionaryCompiler, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23067,9 +25212,9 @@ static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_24StringDictionaryCompiler_9__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_StringDictionaryCompiler, /*tp_new*/ + __pyx_tp_new_7pykeyvi_loading_strategy_types, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23084,8 +25229,8 @@ static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *p; +static PyObject *__pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23093,13 +25238,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryCompiler(PyTypeObject *t, C o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler(PyObject *o) { - struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)o; +static void __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler(PyObject *o) { + struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -23109,7 +25254,7 @@ static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(o); + __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -23117,9 +25262,9 @@ static void __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { +static int __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(o, i, v); + return __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -23128,31 +25273,31 @@ static int __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler(PyObject *o, P } } -static PyMethodDef __pyx_methods_7pykeyvi_JsonDictionaryCompiler[] = { - {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_5_init_0, METH_NOARGS, 0}, - {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_7_init_1, METH_O, 0}, - {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2, METH_VARARGS|METH_KEYWORDS, 0}, - {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile, METH_O, 0}, - {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_15__enter__, METH_NOARGS, 0}, - {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__, METH_VARARGS|METH_KEYWORDS, 0}, - {"Add", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add, METH_VARARGS|METH_KEYWORDS, 0}, - {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile, METH_VARARGS|METH_KEYWORDS, 0}, - {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_23SetManifest, METH_O, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_CompletionDictionaryCompiler[] = { + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_5Add, METH_VARARGS|METH_KEYWORDS, 0}, + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_7_init_0, METH_NOARGS, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_9_init_1, METH_O, 0}, + {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_11_init_2, METH_VARARGS|METH_KEYWORDS, 0}, + {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_15WriteToFile, METH_O, 0}, + {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_17__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_21Compile, METH_VARARGS|METH_KEYWORDS, 0}, + {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_23SetManifest, METH_O, 0}, {0, 0, 0, 0} }; -static PyMappingMethods __pyx_tp_as_mapping_JsonDictionaryCompiler = { +static PyMappingMethods __pyx_tp_as_mapping_CompletionDictionaryCompiler = { 0, /*mp_length*/ 0, /*mp_subscript*/ - __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler, /*mp_ass_subscript*/ + __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler, /*mp_ass_subscript*/ }; -static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { +static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.JsonDictionaryCompiler", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler), /*tp_basicsize*/ + "pykeyvi.CompletionDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23165,7 +25310,7 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_JsonDictionaryCompiler, /*tp_as_mapping*/ + &__pyx_tp_as_mapping_CompletionDictionaryCompiler, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -23180,7 +25325,7 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_JsonDictionaryCompiler, /*tp_methods*/ + __pyx_methods_7pykeyvi_CompletionDictionaryCompiler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23188,9 +25333,9 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__, /*tp_init*/ + __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_JsonDictionaryCompiler, /*tp_new*/ + __pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23205,8 +25350,8 @@ static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_Dictionary(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_Dictionary *p; +static PyObject *__pyx_tp_new_7pykeyvi_MultiWordCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_MultiWordCompletion *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23214,13 +25359,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_Dictionary(PyTypeObject *t, CYTHON_UNUSED o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_Dictionary *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_Dictionary(PyObject *o) { - struct __pyx_obj_7pykeyvi_Dictionary *p = (struct __pyx_obj_7pykeyvi_Dictionary *)o; +static void __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion(PyObject *o) { + struct __pyx_obj_7pykeyvi_MultiWordCompletion *p = (struct __pyx_obj_7pykeyvi_MultiWordCompletion *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -23230,67 +25375,27 @@ static void __pyx_tp_dealloc_7pykeyvi_Dictionary(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(o); + __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } __Pyx_call_destructor(p->inst); (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_sq_item_7pykeyvi_Dictionary(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} -static PyMethodDef __pyx_methods_7pykeyvi_Dictionary[] = { - {"LookupText", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_3LookupText, METH_O, 0}, - {"Lookup", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_5Lookup, METH_O, 0}, - {"_GetNear_0", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0, METH_VARARGS|METH_KEYWORDS, 0}, - {"_GetNear_1", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_9_GetNear_1, METH_VARARGS|METH_KEYWORDS, 0}, - {"GetNear", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_11GetNear, METH_VARARGS|METH_KEYWORDS, 0}, - {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_13_init_0, METH_O, 0}, - {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_15_init_1, METH_VARARGS|METH_KEYWORDS, 0}, - {"Get", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_19Get, METH_O, 0}, - {"get", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_21get, METH_VARARGS|METH_KEYWORDS, 0}, - {"_key_iterator_wrapper", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_29_key_iterator_wrapper, METH_O, 0}, - {"_value_iterator_wrapper", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_32_value_iterator_wrapper, METH_O, 0}, - {"_item_iterator_wrapper", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_35_item_iterator_wrapper, METH_O, 0}, - {"GetAllKeys", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_38GetAllKeys, METH_NOARGS, 0}, - {"GetAllValues", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_40GetAllValues, METH_NOARGS, 0}, - {"GetAllItems", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_42GetAllItems, METH_NOARGS, 0}, - {"GetManifest", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_44GetManifest, METH_NOARGS, 0}, - {"GetStatistics", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_46GetStatistics, METH_NOARGS, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_MultiWordCompletion[] = { + {"_GetCompletions_0", (PyCFunction)__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0, METH_O, 0}, + {"_GetCompletions_1", (PyCFunction)__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1, METH_VARARGS|METH_KEYWORDS, 0}, + {"GetCompletions", (PyCFunction)__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions, METH_VARARGS|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; -static PySequenceMethods __pyx_tp_as_sequence_Dictionary = { - __pyx_pw_7pykeyvi_10Dictionary_25__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_7pykeyvi_Dictionary, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - __pyx_pw_7pykeyvi_10Dictionary_23__contains__, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_Dictionary = { - __pyx_pw_7pykeyvi_10Dictionary_25__len__, /*mp_length*/ - __pyx_pw_7pykeyvi_10Dictionary_27__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_7pykeyvi_Dictionary = { +static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.Dictionary", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_Dictionary), /*tp_basicsize*/ + "pykeyvi.MultiWordCompletion", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_MultiWordCompletion), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_Dictionary, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23302,8 +25407,8 @@ static PyTypeObject __pyx_type_7pykeyvi_Dictionary = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_Dictionary, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Dictionary, /*tp_as_mapping*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -23318,7 +25423,7 @@ static PyTypeObject __pyx_type_7pykeyvi_Dictionary = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_Dictionary, /*tp_methods*/ + __pyx_methods_7pykeyvi_MultiWordCompletion, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23326,9 +25431,9 @@ static PyTypeObject __pyx_type_7pykeyvi_Dictionary = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_10Dictionary_17__init__, /*tp_init*/ + __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_Dictionary, /*tp_new*/ + __pyx_tp_new_7pykeyvi_MultiWordCompletion, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23343,8 +25448,8 @@ static PyTypeObject __pyx_type_7pykeyvi_Dictionary = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_FsaTransform(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_FsaTransform *p; +static PyObject *__pyx_tp_new_7pykeyvi_PredictiveCompression(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_PredictiveCompression *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23352,13 +25457,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_FsaTransform(PyTypeObject *t, CYTHON_UNUS o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_FsaTransform *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_PredictiveCompression *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_FsaTransform(PyObject *o) { - struct __pyx_obj_7pykeyvi_FsaTransform *p = (struct __pyx_obj_7pykeyvi_FsaTransform *)o; +static void __pyx_tp_dealloc_7pykeyvi_PredictiveCompression(PyObject *o) { + struct __pyx_obj_7pykeyvi_PredictiveCompression *p = (struct __pyx_obj_7pykeyvi_PredictiveCompression *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -23368,7 +25473,7 @@ static void __pyx_tp_dealloc_7pykeyvi_FsaTransform(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(o); + __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -23376,17 +25481,18 @@ static void __pyx_tp_dealloc_7pykeyvi_FsaTransform(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7pykeyvi_FsaTransform[] = { - {"Normalize", (PyCFunction)__pyx_pw_7pykeyvi_12FsaTransform_3Normalize, METH_O, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_PredictiveCompression[] = { + {"Compress", (PyCFunction)__pyx_pw_7pykeyvi_21PredictiveCompression_3Compress, METH_O, 0}, + {"Uncompress", (PyCFunction)__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { +static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.FsaTransform", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_FsaTransform), /*tp_basicsize*/ + "pykeyvi.PredictiveCompression", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_PredictiveCompression), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_FsaTransform, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_PredictiveCompression, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23414,7 +25520,7 @@ static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_FsaTransform, /*tp_methods*/ + __pyx_methods_7pykeyvi_PredictiveCompression, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23422,9 +25528,9 @@ static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_12FsaTransform_5__init__, /*tp_init*/ + __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_FsaTransform, /*tp_new*/ + __pyx_tp_new_7pykeyvi_PredictiveCompression, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23439,8 +25545,8 @@ static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_PrefixCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_PrefixCompletion *p; +static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23448,13 +25554,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_PrefixCompletion(PyTypeObject *t, CYTHON_ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_PrefixCompletion *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_PrefixCompletion(PyObject *o) { - struct __pyx_obj_7pykeyvi_PrefixCompletion *p = (struct __pyx_obj_7pykeyvi_PrefixCompletion *)o; +static void __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator(PyObject *o) { + struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *p = (struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -23464,7 +25570,7 @@ static void __pyx_tp_dealloc_7pykeyvi_PrefixCompletion(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(o); + __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -23472,18 +25578,19 @@ static void __pyx_tp_dealloc_7pykeyvi_PrefixCompletion(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7pykeyvi_PrefixCompletion[] = { - {"GetFuzzyCompletions", (PyCFunction)__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions, METH_VARARGS|METH_KEYWORDS, 0}, - {"GetCompletions", (PyCFunction)__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions, METH_O, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_KeyOnlyDictionaryGenerator[] = { + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_5Add, METH_O, 0}, + {"CloseFeeding", (PyCFunction)__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_7CloseFeeding, METH_NOARGS, 0}, + {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7pykeyvi_PrefixCompletion = { +static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.PrefixCompletion", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_PrefixCompletion), /*tp_basicsize*/ + "pykeyvi.KeyOnlyDictionaryGenerator", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_PrefixCompletion, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23511,7 +25618,7 @@ static PyTypeObject __pyx_type_7pykeyvi_PrefixCompletion = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_PrefixCompletion, /*tp_methods*/ + __pyx_methods_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23519,9 +25626,9 @@ static PyTypeObject __pyx_type_7pykeyvi_PrefixCompletion = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__, /*tp_init*/ + __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_PrefixCompletion, /*tp_new*/ + __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23536,8 +25643,8 @@ static PyTypeObject __pyx_type_7pykeyvi_PrefixCompletion = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_ForwardBackwardCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *p; +static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23545,13 +25652,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_ForwardBackwardCompletion(PyTypeObject *t o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion(PyObject *o) { - struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *p = (struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)o; +static void __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler(PyObject *o) { + struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; @@ -23561,7 +25668,7 @@ static void __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(o); + __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -23569,19 +25676,25 @@ static void __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7pykeyvi_ForwardBackwardCompletion[] = { - {"_GetCompletions_0", (PyCFunction)__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_0, METH_O, 0}, - {"_GetCompletions_1", (PyCFunction)__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_1, METH_VARARGS|METH_KEYWORDS, 0}, - {"GetCompletions", (PyCFunction)__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_7GetCompletions, METH_VARARGS|METH_KEYWORDS, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_KeyOnlyDictionaryCompiler[] = { + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_3_init_0, METH_NOARGS, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_5_init_1, METH_O, 0}, + {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2, METH_VARARGS|METH_KEYWORDS, 0}, + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add, METH_O, 0}, + {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile, METH_O, 0}, + {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_15__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile, METH_VARARGS|METH_KEYWORDS, 0}, + {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_21SetManifest, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7pykeyvi_ForwardBackwardCompletion = { +static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.ForwardBackwardCompletion", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion), /*tp_basicsize*/ + "pykeyvi.KeyOnlyDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23609,7 +25722,7 @@ static PyTypeObject __pyx_type_7pykeyvi_ForwardBackwardCompletion = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_ForwardBackwardCompletion, /*tp_methods*/ + __pyx_methods_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23617,9 +25730,9 @@ static PyTypeObject __pyx_type_7pykeyvi_ForwardBackwardCompletion = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__, /*tp_init*/ + __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_ForwardBackwardCompletion, /*tp_new*/ + __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23634,7 +25747,8 @@ static PyTypeObject __pyx_type_7pykeyvi_ForwardBackwardCompletion = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_loading_strategy_types(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi_Match(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_Match *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23642,24 +25756,61 @@ static PyObject *__pyx_tp_new_7pykeyvi_loading_strategy_types(PyTypeObject *t, C o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_Match *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_loading_strategy_types(PyObject *o) { +static void __pyx_tp_dealloc_7pykeyvi_Match(PyObject *o) { + struct __pyx_obj_7pykeyvi_Match *p = (struct __pyx_obj_7pykeyvi_Match *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_7pykeyvi_5Match_1__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->inst); (*Py_TYPE(o)->tp_free)(o); } -static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { +static PyMethodDef __pyx_methods_7pykeyvi_Match[] = { + {"SetEnd", (PyCFunction)__pyx_pw_7pykeyvi_5Match_3SetEnd, METH_O, 0}, + {"GetStart", (PyCFunction)__pyx_pw_7pykeyvi_5Match_5GetStart, METH_NOARGS, 0}, + {"GetScore", (PyCFunction)__pyx_pw_7pykeyvi_5Match_7GetScore, METH_NOARGS, 0}, + {"SetMatchedString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_9SetMatchedString, METH_O, 0}, + {"GetValueAsString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_11GetValueAsString, METH_NOARGS, 0}, + {"IsEmpty", (PyCFunction)__pyx_pw_7pykeyvi_5Match_13IsEmpty, METH_NOARGS, 0}, + {"SetScore", (PyCFunction)__pyx_pw_7pykeyvi_5Match_15SetScore, METH_O, 0}, + {"GetRawValueAsString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_17GetRawValueAsString, METH_NOARGS, 0}, + {"SetStart", (PyCFunction)__pyx_pw_7pykeyvi_5Match_19SetStart, METH_O, 0}, + {"GetEnd", (PyCFunction)__pyx_pw_7pykeyvi_5Match_21GetEnd, METH_NOARGS, 0}, + {"__copy__", (PyCFunction)__pyx_pw_7pykeyvi_5Match_23__copy__, METH_NOARGS, 0}, + {"__deepcopy__", (PyCFunction)__pyx_pw_7pykeyvi_5Match_25__deepcopy__, METH_O, 0}, + {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_5Match_27_init_0, METH_NOARGS, 0}, + {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_5Match_29_init_1, METH_O, 0}, + {"GetMatchedString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_33GetMatchedString, METH_NOARGS, 0}, + {"GetAttribute", (PyCFunction)__pyx_pw_7pykeyvi_5Match_35GetAttribute, METH_O, 0}, + {"SetAttribute", (PyCFunction)__pyx_pw_7pykeyvi_5Match_37SetAttribute, METH_VARARGS|METH_KEYWORDS, 0}, + {"GetValue", (PyCFunction)__pyx_pw_7pykeyvi_5Match_39GetValue, METH_NOARGS, __pyx_doc_7pykeyvi_5Match_38GetValue}, + {"dumps", (PyCFunction)__pyx_pw_7pykeyvi_5Match_41dumps, METH_NOARGS, 0}, + {"__SetRawValue", (PyCFunction)__pyx_pw_7pykeyvi_5Match_43__SetRawValue, METH_O, 0}, + {"loads", (PyCFunction)__pyx_pw_7pykeyvi_5Match_45loads, METH_VARARGS|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_7pykeyvi_Match = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.loading_strategy_types", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_loading_strategy_types), /*tp_basicsize*/ + "pykeyvi.Match", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_Match), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_loading_strategy_types, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_Match, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23687,7 +25838,7 @@ static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_7pykeyvi_Match, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23695,9 +25846,9 @@ static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7pykeyvi_5Match_31__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_loading_strategy_types, /*tp_new*/ + __pyx_tp_new_7pykeyvi_Match, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23712,8 +25863,8 @@ static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *p; +static PyObject *__pyx_tp_new_7pykeyvi_MatchIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_MatchIterator *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); @@ -23721,66 +25872,35 @@ static PyObject *__pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler(PyTypeObject o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_MatchIterator *)o); + new((void*)&(p->it)) keyvi::dictionary::MatchIterator(); + new((void*)&(p->end)) keyvi::dictionary::MatchIterator(); return o; } -static void __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler(PyObject *o) { - struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)o; +static void __pyx_tp_dealloc_7pykeyvi_MatchIterator(PyObject *o) { + struct __pyx_obj_7pykeyvi_MatchIterator *p = (struct __pyx_obj_7pykeyvi_MatchIterator *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - __Pyx_call_destructor(p->inst); + __Pyx_call_destructor(p->it); + __Pyx_call_destructor(p->end); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; - } -} - -static PyMethodDef __pyx_methods_7pykeyvi_CompletionDictionaryCompiler[] = { - {"Add", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_5Add, METH_VARARGS|METH_KEYWORDS, 0}, - {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_7_init_0, METH_NOARGS, 0}, - {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_9_init_1, METH_O, 0}, - {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_11_init_2, METH_VARARGS|METH_KEYWORDS, 0}, - {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_15WriteToFile, METH_O, 0}, - {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_17__enter__, METH_NOARGS, 0}, - {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__, METH_VARARGS|METH_KEYWORDS, 0}, - {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_21Compile, METH_VARARGS|METH_KEYWORDS, 0}, - {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_23SetManifest, METH_O, 0}, +static PyMethodDef __pyx_methods_7pykeyvi_MatchIterator[] = { + {"__next__", (PyCFunction)__pyx_pw_7pykeyvi_13MatchIterator_3__next__, METH_NOARGS|METH_COEXIST, 0}, {0, 0, 0, 0} }; -static PyMappingMethods __pyx_tp_as_mapping_CompletionDictionaryCompiler = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { +static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.CompletionDictionaryCompiler", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler), /*tp_basicsize*/ + "pykeyvi.MatchIterator", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_MatchIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_MatchIterator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23793,7 +25913,7 @@ static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_CompletionDictionaryCompiler, /*tp_as_mapping*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -23806,9 +25926,9 @@ static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_CompletionDictionaryCompiler, /*tp_methods*/ + __pyx_pw_7pykeyvi_13MatchIterator_1__iter__, /*tp_iter*/ + __pyx_pw_7pykeyvi_13MatchIterator_3__next__, /*tp_iternext*/ + __pyx_methods_7pykeyvi_MatchIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23816,9 +25936,9 @@ static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler, /*tp_new*/ + __pyx_tp_new_7pykeyvi_MatchIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23833,52 +25953,58 @@ static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_MultiWordCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_MultiWordCompletion *p; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct___init_2[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct___init_2 = 0; + +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct___init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)o); - new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion(PyObject *o) { - struct __pyx_obj_7pykeyvi_MultiWordCompletion *p = (struct __pyx_obj_7pykeyvi_MultiWordCompletion *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct___init_2(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_value_store_params); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct___init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +} + +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct___init_2(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o; + if (p->__pyx_v_value_store_params) { + e = (*v)(p->__pyx_v_value_store_params, a); if (e) return e; } - __Pyx_call_destructor(p->inst); - (*Py_TYPE(o)->tp_free)(o); + return 0; } -static PyMethodDef __pyx_methods_7pykeyvi_MultiWordCompletion[] = { - {"_GetCompletions_0", (PyCFunction)__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0, METH_O, 0}, - {"_GetCompletions_1", (PyCFunction)__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1, METH_VARARGS|METH_KEYWORDS, 0}, - {"GetCompletions", (PyCFunction)__pyx_pw_7pykeyvi_19MultiWordCompletion_9GetCompletions, METH_VARARGS|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct___init_2(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o; + tmp = ((PyObject*)p->__pyx_v_value_store_params); + p->__pyx_v_value_store_params = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.MultiWordCompletion", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_MultiWordCompletion), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct___init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct___init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23898,15 +26024,15 @@ static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct___init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct___init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_MultiWordCompletion, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23914,9 +26040,9 @@ static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_MultiWordCompletion, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23931,51 +26057,65 @@ static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_PredictiveCompression(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_PredictiveCompression *p; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_1_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr = 0; + +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_1_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_PredictiveCompression *)o); - new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_PredictiveCompression(PyObject *o) { - struct __pyx_obj_7pykeyvi_PredictiveCompression *p = (struct __pyx_obj_7pykeyvi_PredictiveCompression *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_k); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_1_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); + if (p->__pyx_v_k) { + e = (*v)(p->__pyx_v_k, a); if (e) return e; } - __Pyx_call_destructor(p->inst); - (*Py_TYPE(o)->tp_free)(o); + return 0; } -static PyMethodDef __pyx_methods_7pykeyvi_PredictiveCompression[] = { - {"Compress", (PyCFunction)__pyx_pw_7pykeyvi_21PredictiveCompression_3Compress, METH_O, 0}, - {"Uncompress", (PyCFunction)__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress, METH_O, 0}, - {0, 0, 0, 0} -}; +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_k); + p->__pyx_v_k = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.PredictiveCompression", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_PredictiveCompression), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_1_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_PredictiveCompression, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23995,15 +26135,15 @@ static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_PredictiveCompression, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24011,9 +26151,9 @@ static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_PredictiveCompression, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24028,52 +26168,65 @@ static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *p; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_2_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr = 0; + +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_2_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)o); - new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator(PyObject *o) { - struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *p = (struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_v); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_2_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +} + +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - __Pyx_call_destructor(p->inst); - (*Py_TYPE(o)->tp_free)(o); + if (p->__pyx_v_v) { + e = (*v)(p->__pyx_v_v, a); if (e) return e; + } + return 0; } -static PyMethodDef __pyx_methods_7pykeyvi_KeyOnlyDictionaryGenerator[] = { - {"Add", (PyCFunction)__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_5Add, METH_O, 0}, - {"CloseFeeding", (PyCFunction)__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_7CloseFeeding, METH_NOARGS, 0}, - {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_9WriteToFile, METH_O, 0}, - {0, 0, 0, 0} -}; +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_v); + p->__pyx_v_v = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.KeyOnlyDictionaryGenerator", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_2_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24093,15 +26246,15 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24109,9 +26262,9 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24126,58 +26279,58 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *p; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_3___init__[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__ = 0; + +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_3___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)o); - new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler(PyObject *o) { - struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *p = (struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_3___init__(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_args); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_3___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +} + +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_3___init__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o; + if (p->__pyx_v_args) { + e = (*v)(p->__pyx_v_args, a); if (e) return e; } - __Pyx_call_destructor(p->inst); - (*Py_TYPE(o)->tp_free)(o); + return 0; } -static PyMethodDef __pyx_methods_7pykeyvi_KeyOnlyDictionaryCompiler[] = { - {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_3_init_0, METH_NOARGS, 0}, - {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_5_init_1, METH_O, 0}, - {"_init_2", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2, METH_VARARGS|METH_KEYWORDS, 0}, - {"Add", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add, METH_O, 0}, - {"WriteToFile", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile, METH_O, 0}, - {"__enter__", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_15__enter__, METH_NOARGS, 0}, - {"__exit__", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_17__exit__, METH_VARARGS|METH_KEYWORDS, 0}, - {"Compile", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_19Compile, METH_VARARGS|METH_KEYWORDS, 0}, - {"SetManifest", (PyCFunction)__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_21SetManifest, METH_O, 0}, - {0, 0, 0, 0} -}; +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_3___init__(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o; + tmp = ((PyObject*)p->__pyx_v_args); + p->__pyx_v_args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.KeyOnlyDictionaryCompiler", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_3___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_3___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24197,15 +26350,15 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_3___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_3___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24213,9 +26366,9 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24230,70 +26383,65 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_Match(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_Match *p; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_4_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr = 0; + +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_4_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_k); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_4_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o); } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + (*Py_TYPE(o)->tp_free)(o); } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_Match *)o); - new((void*)&(p->inst)) boost::shared_ptr (); - return o; } -static void __pyx_tp_dealloc_7pykeyvi_Match(PyObject *o) { - struct __pyx_obj_7pykeyvi_Match *p = (struct __pyx_obj_7pykeyvi_Match *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_5Match_1__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); + if (p->__pyx_v_k) { + e = (*v)(p->__pyx_v_k, a); if (e) return e; } - __Pyx_call_destructor(p->inst); - (*Py_TYPE(o)->tp_free)(o); + return 0; } -static PyMethodDef __pyx_methods_7pykeyvi_Match[] = { - {"SetEnd", (PyCFunction)__pyx_pw_7pykeyvi_5Match_3SetEnd, METH_O, 0}, - {"GetStart", (PyCFunction)__pyx_pw_7pykeyvi_5Match_5GetStart, METH_NOARGS, 0}, - {"GetScore", (PyCFunction)__pyx_pw_7pykeyvi_5Match_7GetScore, METH_NOARGS, 0}, - {"SetMatchedString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_9SetMatchedString, METH_O, 0}, - {"GetValueAsString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_11GetValueAsString, METH_NOARGS, 0}, - {"IsEmpty", (PyCFunction)__pyx_pw_7pykeyvi_5Match_13IsEmpty, METH_NOARGS, 0}, - {"SetScore", (PyCFunction)__pyx_pw_7pykeyvi_5Match_15SetScore, METH_O, 0}, - {"GetRawValueAsString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_17GetRawValueAsString, METH_NOARGS, 0}, - {"SetStart", (PyCFunction)__pyx_pw_7pykeyvi_5Match_19SetStart, METH_O, 0}, - {"GetEnd", (PyCFunction)__pyx_pw_7pykeyvi_5Match_21GetEnd, METH_NOARGS, 0}, - {"__copy__", (PyCFunction)__pyx_pw_7pykeyvi_5Match_23__copy__, METH_NOARGS, 0}, - {"__deepcopy__", (PyCFunction)__pyx_pw_7pykeyvi_5Match_25__deepcopy__, METH_O, 0}, - {"_init_0", (PyCFunction)__pyx_pw_7pykeyvi_5Match_27_init_0, METH_NOARGS, 0}, - {"_init_1", (PyCFunction)__pyx_pw_7pykeyvi_5Match_29_init_1, METH_O, 0}, - {"GetMatchedString", (PyCFunction)__pyx_pw_7pykeyvi_5Match_33GetMatchedString, METH_NOARGS, 0}, - {"GetAttribute", (PyCFunction)__pyx_pw_7pykeyvi_5Match_35GetAttribute, METH_O, 0}, - {"SetAttribute", (PyCFunction)__pyx_pw_7pykeyvi_5Match_37SetAttribute, METH_VARARGS|METH_KEYWORDS, 0}, - {"GetValue", (PyCFunction)__pyx_pw_7pykeyvi_5Match_39GetValue, METH_NOARGS, __pyx_doc_7pykeyvi_5Match_38GetValue}, - {"dumps", (PyCFunction)__pyx_pw_7pykeyvi_5Match_41dumps, METH_NOARGS, 0}, - {"__SetRawValue", (PyCFunction)__pyx_pw_7pykeyvi_5Match_43__SetRawValue, METH_O, 0}, - {"loads", (PyCFunction)__pyx_pw_7pykeyvi_5Match_45loads, METH_VARARGS|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_k); + p->__pyx_v_k = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyTypeObject __pyx_type_7pykeyvi_Match = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.Match", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_Match), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_4_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_Match, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24313,15 +26461,15 @@ static PyTypeObject __pyx_type_7pykeyvi_Match = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_Match, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24329,9 +26477,9 @@ static PyTypeObject __pyx_type_7pykeyvi_Match = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7pykeyvi_5Match_31__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_Match, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24346,44 +26494,65 @@ static PyTypeObject __pyx_type_7pykeyvi_Match = { #endif }; -static PyObject *__pyx_tp_new_7pykeyvi_MatchIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_MatchIterator *p; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_5_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr = 0; + +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_5_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_MatchIterator *)o); - new((void*)&(p->it)) keyvi::dictionary::MatchIterator(); - new((void*)&(p->end)) keyvi::dictionary::MatchIterator(); return o; } -static void __pyx_tp_dealloc_7pykeyvi_MatchIterator(PyObject *o) { - struct __pyx_obj_7pykeyvi_MatchIterator *p = (struct __pyx_obj_7pykeyvi_MatchIterator *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_v); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_5_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } - #endif - __Pyx_call_destructor(p->it); - __Pyx_call_destructor(p->end); - (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7pykeyvi_MatchIterator[] = { - {"__next__", (PyCFunction)__pyx_pw_7pykeyvi_13MatchIterator_3__next__, METH_NOARGS|METH_COEXIST, 0}, - {0, 0, 0, 0} -}; +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_v) { + e = (*v)(p->__pyx_v_v, a); if (e) return e; + } + return 0; +} -static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_v); + p->__pyx_v_v = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.MatchIterator", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_MatchIterator), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_5_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_MatchIterator, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24403,15 +26572,15 @@ static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_7pykeyvi_13MatchIterator_1__iter__, /*tp_iter*/ - __pyx_pw_7pykeyvi_13MatchIterator_3__next__, /*tp_iternext*/ - __pyx_methods_7pykeyvi_MatchIterator, /*tp_methods*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24421,7 +26590,7 @@ static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_MatchIterator, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24436,14 +26605,14 @@ static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct___init_2[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct___init_2 = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_6__init_2[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2 = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct___init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_6__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24453,41 +26622,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct___init_2(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_6__init_2(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_value_store_params); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct___init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct___init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_6__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct___init_2(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_6__init_2(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o; if (p->__pyx_v_value_store_params) { e = (*v)(p->__pyx_v_value_store_params, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct___init_2(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_6__init_2(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o; tmp = ((PyObject*)p->__pyx_v_value_store_params); p->__pyx_v_value_store_params = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct___init_2", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_6__init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct___init_2, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24509,8 +26678,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct___init_2, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct___init_2, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -24525,7 +26694,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24540,14 +26709,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_1_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_7_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_1_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_7_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24557,21 +26726,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_1_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_7_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -24581,11 +26750,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -24593,12 +26762,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_1_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_7_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24619,9 +26788,9 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_clear*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -24636,7 +26805,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24651,14 +26820,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_2_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_8_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_2_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_8_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24668,21 +26837,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_2_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_8_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -24692,11 +26861,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -24704,12 +26873,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_2_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_8_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24731,8 +26900,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -24747,7 +26916,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24762,14 +26931,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_3___init__[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__ = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_9___init__[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__ = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_3___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_9___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24779,41 +26948,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_3___init__(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_args); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_3___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_3___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_9___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_3___init__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o; if (p->__pyx_v_args) { e = (*v)(p->__pyx_v_args, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_3___init__(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o; tmp = ((PyObject*)p->__pyx_v_args); p->__pyx_v_args = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_9___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_3___init__", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_9___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_3___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_9___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24835,8 +27004,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_3___init__, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_3___init__, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_9___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_9___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -24851,7 +27020,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24866,14 +27035,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_4_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_10_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_4_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_10_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24883,21 +27052,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_4_genexpr(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_4_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_10_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -24907,11 +27076,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -24919,12 +27088,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_4_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_10_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24946,8 +27115,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -24962,7 +27131,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24977,14 +27146,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_5_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_11_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_5_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_11_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -24994,21 +27163,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_5_genexpr(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_5_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_11_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -25018,11 +27187,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -25030,12 +27199,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_5_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_11_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25057,8 +27226,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25073,7 +27242,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25088,14 +27257,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_6__init_2[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2 = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_12__init_2[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_12__init_2 = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_6__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_12__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_12__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_12__init_2]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25105,41 +27274,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_6__init_2(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_12__init_2(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_value_store_params); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_6__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_6__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_12__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_12__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_12__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_6__init_2(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_12__init_2(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)o; if (p->__pyx_v_value_store_params) { e = (*v)(p->__pyx_v_value_store_params, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_6__init_2(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__init_2(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)o; tmp = ((PyObject*)p->__pyx_v_value_store_params); p->__pyx_v_value_store_params = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_6__init_2", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_12__init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_12__init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25161,8 +27330,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2 = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_12__init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25177,7 +27346,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2 = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_12__init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25192,14 +27361,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2 = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_7_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_13_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_13_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_7_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_13_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_13_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_13_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25209,21 +27378,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_13_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_7_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_13_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_13_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_13_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_13_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -25233,11 +27402,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -25245,12 +27414,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_7_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_13_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_13_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25272,8 +27441,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_13_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25288,7 +27457,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_13_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25303,14 +27472,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_8_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_14_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_14_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_8_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_14_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_14_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25320,21 +27489,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(PyTypeObject return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_14_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_8_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_14_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -25344,11 +27513,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -25356,12 +27525,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_8_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_14_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_14_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25383,8 +27552,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_14_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25399,7 +27568,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_14_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25414,14 +27583,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_9___init__[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__ = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_15___init__[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_15___init__ = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_15___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_9___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_15___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_15___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_15___init__]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25431,41 +27600,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_15___init__(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_args); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_9___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_9___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_15___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_15___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_15___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_15___init__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)o; if (p->__pyx_v_args) { e = (*v)(p->__pyx_v_args, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_15___init__(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)o; tmp = ((PyObject*)p->__pyx_v_args); p->__pyx_v_args = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_9___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_9___init__", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_15___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_9___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_15___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25487,8 +27656,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_9___init__ = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_9___init__, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_9___init__, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_15___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_15___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25503,7 +27672,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_9___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_15___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25518,14 +27687,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_9___init__ = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_10_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_16_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_10_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_16_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25535,21 +27704,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_10_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_16_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -25559,11 +27728,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -25571,12 +27740,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_10_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_16_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25598,8 +27767,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25614,7 +27783,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25629,14 +27798,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_11_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_17_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_11_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_17_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25646,21 +27815,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_11_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_11_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_17_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -25670,11 +27839,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -25682,12 +27851,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_11_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_17_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25709,8 +27878,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25725,7 +27894,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25740,14 +27909,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *__pyx_freelist_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *__pyx_freelist_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper[--__pyx_freecount_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper[--__pyx_freecount_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25757,23 +27926,23 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapp return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_iterator); Py_CLEAR(p->__pyx_v_m); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_t_0); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper[__pyx_freecount_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper[__pyx_freecount_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)o; if (p->__pyx_v_iterator) { e = (*v)(p->__pyx_v_iterator, a); if (e) return e; } @@ -25789,9 +27958,9 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_12__key_iterator_wrappe return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)o; tmp = ((PyObject*)p->__pyx_v_iterator); p->__pyx_v_iterator = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -25807,12 +27976,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(P return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_12__key_iterator_wrapper", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_18__key_iterator_wrapper", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25834,8 +28003,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrap 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25850,7 +28019,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrap 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25865,14 +28034,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrap #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *__pyx_freelist_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *__pyx_freelist_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper[--__pyx_freecount_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper[--__pyx_freecount_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -25882,23 +28051,23 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13__value_iterator_wra return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_iterator); Py_CLEAR(p->__pyx_v_m); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_t_0); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper[__pyx_freecount_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper[__pyx_freecount_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)o; if (p->__pyx_v_iterator) { e = (*v)(p->__pyx_v_iterator, a); if (e) return e; } @@ -25914,9 +28083,9 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_13__value_iterator_wrap return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)o; tmp = ((PyObject*)p->__pyx_v_iterator); p->__pyx_v_iterator = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -25932,12 +28101,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_13__value_iterator_wrapper", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_19__value_iterator_wrapper", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25959,8 +28128,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wr 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -25975,7 +28144,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wr 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25990,14 +28159,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wr #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *__pyx_freelist_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *__pyx_freelist_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper[--__pyx_freecount_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper[--__pyx_freecount_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26007,23 +28176,23 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14__item_iterator_wrap return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_iterator); Py_CLEAR(p->__pyx_v_m); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_t_0); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper[__pyx_freecount_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper[__pyx_freecount_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)o; if (p->__pyx_v_iterator) { e = (*v)(p->__pyx_v_iterator, a); if (e) return e; } @@ -26039,9 +28208,9 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapp return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)o; tmp = ((PyObject*)p->__pyx_v_iterator); p->__pyx_v_iterator = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -26057,12 +28226,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper( return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_14__item_iterator_wrapper", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_20__item_iterator_wrapper", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26084,8 +28253,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wra 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26100,7 +28269,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wra 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26115,14 +28284,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wra #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_15__init_2[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_15__init_2 = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_21__init_2[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2 = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_15__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_15__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_15__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_15__init_2]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_21__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26132,41 +28301,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_15__init_2(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_15__init_2(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_21__init_2(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_value_store_params); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_15__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_15__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_15__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_21__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_15__init_2(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_21__init_2(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o; if (p->__pyx_v_value_store_params) { e = (*v)(p->__pyx_v_value_store_params, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_15__init_2(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_21__init_2(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o; tmp = ((PyObject*)p->__pyx_v_value_store_params); p->__pyx_v_value_store_params = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15__init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_15__init_2", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_21__init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_15__init_2, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26188,8 +28357,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15__init_2 = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_15__init_2, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_15__init_2, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26204,7 +28373,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15__init_2 = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_15__init_2, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26219,14 +28388,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15__init_2 = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_16_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_22_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_16_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_22_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26236,21 +28405,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_16_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_16_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_22_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -26260,11 +28429,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -26272,12 +28441,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_16_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_22_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26299,8 +28468,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26315,7 +28484,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26330,14 +28499,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_17_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_23_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_17_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_23_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26347,21 +28516,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_17_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_23_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -26371,11 +28540,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -26383,12 +28552,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_17_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_23_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26410,8 +28579,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26426,7 +28595,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26441,14 +28610,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_18___init__[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_18___init__ = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_24___init__[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__ = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_18___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_18___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_18___init__]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_24___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26458,41 +28627,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18___init__(PyTypeObje return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_18___init__(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_24___init__(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_args); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_18___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_18___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_18___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_24___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_18___init__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_24___init__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o; if (p->__pyx_v_args) { e = (*v)(p->__pyx_v_args, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18___init__(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_24___init__(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o; tmp = ((PyObject*)p->__pyx_v_args); p->__pyx_v_args = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_24___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_18___init__", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_24___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_18___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_24___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26514,8 +28683,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18___init__ = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_18___init__, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18___init__, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_24___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_24___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26530,7 +28699,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_18___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26545,14 +28714,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18___init__ = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_19_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_19_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_25_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_19_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_19_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_19_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_25_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26562,21 +28731,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_19_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_19_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_19_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_19_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_25_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -26586,11 +28755,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -26598,12 +28767,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_19_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_25_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_19_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26625,8 +28794,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26641,7 +28810,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_19_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26656,14 +28825,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_20_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_20_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_26_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_20_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_20_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_20_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_26_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26673,21 +28842,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_20_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_20_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_20_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_20_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_26_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -26697,11 +28866,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -26709,12 +28878,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_20_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_26_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_20_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26736,8 +28905,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26752,7 +28921,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_20_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26767,14 +28936,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_21__init_2[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2 = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *__pyx_freelist_7pykeyvi___pyx_scope_struct_27__init_2[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_27__init_2 = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_27__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_21__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_27__init_2 > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_27__init_2[--__pyx_freecount_7pykeyvi___pyx_scope_struct_27__init_2]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26784,41 +28953,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_21__init_2(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_27__init_2(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_value_store_params); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_21__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_21__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_27__init_2 < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_27__init_2[__pyx_freecount_7pykeyvi___pyx_scope_struct_27__init_2++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_21__init_2(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_27__init_2(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)o; if (p->__pyx_v_value_store_params) { e = (*v)(p->__pyx_v_value_store_params, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_21__init_2(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_27__init_2(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)o; tmp = ((PyObject*)p->__pyx_v_value_store_params); p->__pyx_v_value_store_params = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_27__init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_21__init_2", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_27__init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_27__init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26840,8 +29009,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2 = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_27__init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_27__init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26856,7 +29025,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2 = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_27__init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26871,14 +29040,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2 = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_22_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_28_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_28_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_28_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_22_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_28_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_28_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_28_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26888,21 +29057,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_28_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_22_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_22_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_28_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_28_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_28_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_28_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -26912,11 +29081,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_28_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -26924,12 +29093,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_22_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_22_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_28_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_28_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -26951,8 +29120,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_28_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_28_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26967,7 +29136,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_28_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26982,14 +29151,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_23_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_29_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_29_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_23_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_29_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_29_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_29_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -26999,21 +29168,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_29_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_23_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_23_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_29_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_29_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_29_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_29_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -27023,11 +29192,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_29_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -27035,12 +29204,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_23_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_23_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_29_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_29_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -27062,8 +29231,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_29_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_29_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27078,7 +29247,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_29_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27093,14 +29262,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_24___init__[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__ = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_30___init__[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_30___init__ = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_30___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_24___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_30___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_30___init__[--__pyx_freecount_7pykeyvi___pyx_scope_struct_30___init__]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -27110,41 +29279,41 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__(PyTypeObje return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_24___init__(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_30___init__(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_args); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_24___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_24___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_30___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_30___init__[__pyx_freecount_7pykeyvi___pyx_scope_struct_30___init__++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_24___init__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_30___init__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)o; if (p->__pyx_v_args) { e = (*v)(p->__pyx_v_args, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_24___init__(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_30___init__(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)o; tmp = ((PyObject*)p->__pyx_v_args); p->__pyx_v_args = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_24___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_30___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_24___init__", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_30___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_24___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_30___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -27166,8 +29335,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_24___init__ = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_24___init__, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_24___init__, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_30___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_30___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27182,7 +29351,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_24___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_30___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27197,14 +29366,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_24___init__ = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_25_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_31_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_31_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_25_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_31_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_31_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_31_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -27214,21 +29383,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_31_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_25_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_31_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_31_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_31_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_31_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -27238,11 +29407,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_31_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_k); p->__pyx_v_k = Py_None; Py_INCREF(Py_None); @@ -27250,12 +29419,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_25_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_31_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_31_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -27277,8 +29446,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_31_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_31_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27293,7 +29462,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27308,14 +29477,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { #endif }; -static struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_26_genexpr[8]; -static int __pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr = 0; +static struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_32_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_32_genexpr = 0; -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_32_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr)))) { - o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_26_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr)); + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pykeyvi___pyx_scope_struct_32_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr)))) { + o = (PyObject*)__pyx_freelist_7pykeyvi___pyx_scope_struct_32_genexpr[--__pyx_freecount_7pykeyvi___pyx_scope_struct_32_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -27325,21 +29494,21 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr(PyTypeObjec return o; } -static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o; +static void __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_32_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr)))) { - __pyx_freelist_7pykeyvi___pyx_scope_struct_26_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_26_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pykeyvi___pyx_scope_struct_32_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr)))) { + __pyx_freelist_7pykeyvi___pyx_scope_struct_32_genexpr[__pyx_freecount_7pykeyvi___pyx_scope_struct_32_genexpr++] = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_32_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -27349,11 +29518,11 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o, return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_32_genexpr(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)o; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); @@ -27361,12 +29530,12 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o) { return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_32_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_26_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_32_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_32_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -27388,8 +29557,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_clear*/ + __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_32_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_32_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27404,7 +29573,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_32_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27452,8 +29621,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_GetMatchedString, __pyx_k_GetMatchedString, sizeof(__pyx_k_GetMatchedString), 0, 0, 1, 1}, {&__pyx_n_s_GetNear_0, __pyx_k_GetNear_0, sizeof(__pyx_k_GetNear_0), 0, 0, 1, 1}, {&__pyx_n_s_GetNear_1, __pyx_k_GetNear_1, sizeof(__pyx_k_GetNear_1), 0, 0, 1, 1}, - {&__pyx_n_s_GetRawValueAsString, __pyx_k_GetRawValueAsString, sizeof(__pyx_k_GetRawValueAsString), 0, 0, 1, 1}, {&__pyx_n_s_GetStatistics_locals_lambda, __pyx_k_GetStatistics_locals_lambda, sizeof(__pyx_k_GetStatistics_locals_lambda), 0, 0, 1, 1}, + {&__pyx_n_s_GetValue, __pyx_k_GetValue, sizeof(__pyx_k_GetValue), 0, 0, 1, 1}, {&__pyx_n_s_JumpConsistentHashString, __pyx_k_JumpConsistentHashString, sizeof(__pyx_k_JumpConsistentHashString), 0, 0, 1, 1}, {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, {&__pyx_n_s_SetEnd, __pyx_k_SetEnd, sizeof(__pyx_k_SetEnd), 0, 0, 1, 1}, @@ -27548,11 +29717,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_filter = __Pyx_GetBuiltinName(__pyx_n_s_filter); if (!__pyx_builtin_filter) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_filter = __Pyx_GetBuiltinName(__pyx_n_s_filter); if (!__pyx_builtin_filter) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -27562,149 +29731,149 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "pykeyvi.pyx":203 + /* "pykeyvi.pyx":228 * * if isinstance(key, unicode): * key = key.encode('UTF-8') # <<<<<<<<<<<<<< * cdef libcpp_string input_in_0 = key * */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_UTF_8); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_UTF_8); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "pykeyvi.pyx":207 + /* "pykeyvi.pyx":232 * * if isinstance(value, unicode): * value = value.encode('UTF-8') # <<<<<<<<<<<<<< * cdef libcpp_string input_in_1 = value * */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_UTF_8); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_UTF_8); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "pykeyvi.pyx":317 + /* "pykeyvi.pyx":342 * def get (self, key, default = None): * if isinstance(key, unicode): * key = key.encode('utf-8') # <<<<<<<<<<<<<< * assert isinstance(key, bytes), 'arg in_0 wrong type' * */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "pykeyvi.pyx":330 + /* "pykeyvi.pyx":355 * def __contains__(self, key): * if isinstance(key, unicode): * key = key.encode('utf-8') # <<<<<<<<<<<<<< * * assert isinstance(key, bytes), 'arg in_0 wrong type' */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "pykeyvi.pyx":341 + /* "pykeyvi.pyx":366 * def __getitem__ (self, key): * if isinstance(key, unicode): * key = key.encode('utf-8') # <<<<<<<<<<<<<< * * assert isinstance(key, bytes), 'arg in_0 wrong type' */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "pykeyvi.pyx":398 + /* "pykeyvi.pyx":423 * return {k: json.loads(v) for k, v in filter( * lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1], * [s.rstrip().split("\n") for s in py_result.split("\n\n")] # <<<<<<<<<<<<<< * )} * */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s__8); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s__8); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "pykeyvi.pyx":842 + /* "pykeyvi.pyx":867 * def GetAttribute(self, key): * if isinstance(key, unicode): * key = key.encode("utf-8") # <<<<<<<<<<<<<< * * py_result = self.inst.get().GetAttributePy( key) */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "pykeyvi.pyx":850 + /* "pykeyvi.pyx":875 * def SetAttribute(self, key, value): * if isinstance(key, unicode): * key = key.encode("utf-8") # <<<<<<<<<<<<<< * * t = type(value) */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "pykeyvi.pyx":856 + /* "pykeyvi.pyx":881 * self.inst.get().SetAttribute( key, value) * elif t == unicode: * value_utf8 = value.encode("utf-8") # <<<<<<<<<<<<<< * self.inst.get().SetAttribute( key, value_utf8) * elif t == float: */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "pykeyvi.pyx":866 + /* "pykeyvi.pyx":891 * self.inst.get().SetAttribute( key, value) * else: * raise Exception("Unsupported Value Type") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Unsupported_Value_Type); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Unsupported_Value_Type); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "pykeyvi.pyx":876 + /* "pykeyvi.pyx":901 * * elif value[0] == '\x00': * return msgpack.loads(value[1:]) # <<<<<<<<<<<<<< * * elif value[0] == '\x01': */ - __pyx_slice__15 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_slice__15 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_slice__15); __Pyx_GIVEREF(__pyx_slice__15); - /* "pykeyvi.pyx":879 + /* "pykeyvi.pyx":904 * * elif value[0] == '\x01': * value = zlib.decompress(value[1:]) # <<<<<<<<<<<<<< * * elif value[0] == '\x02': */ - __pyx_slice__17 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_slice__17 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_slice__17); __Pyx_GIVEREF(__pyx_slice__17); - /* "pykeyvi.pyx":882 + /* "pykeyvi.pyx":907 * * elif value[0] == '\x02': * value = snappy.decompress(value[1:]) # <<<<<<<<<<<<<< * * return msgpack.loads(value) */ - __pyx_slice__19 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_slice__19 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_slice__19); __Pyx_GIVEREF(__pyx_slice__19); @@ -27720,17 +29889,17 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_tuple__20); __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_hendrik_dev_git_cliqz_keyv, __pyx_n_s_JumpConsistentHashString, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "pykeyvi.pyx":916 + /* "pykeyvi.pyx":941 * * @staticmethod * def loads(serialized_match): # <<<<<<<<<<<<<< * m=Match() * unserialized = msgpack.loads(serialized_match) */ - __pyx_tuple__22 = PyTuple_Pack(4, __pyx_n_s_serialized_match, __pyx_n_s_m, __pyx_n_s_unserialized, __pyx_n_s_number_of_fields); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__22 = PyTuple_Pack(4, __pyx_n_s_serialized_match, __pyx_n_s_m, __pyx_n_s_unserialized, __pyx_n_s_number_of_fields); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_hendrik_dev_git_cliqz_keyv, __pyx_n_s_loads, 916, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_hendrik_dev_git_cliqz_keyv, __pyx_n_s_loads, 941, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -27847,143 +30016,161 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) __pyx_type_7pykeyvi_JsonDictionaryMerger.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "JsonDictionaryMerger", (PyObject *)&__pyx_type_7pykeyvi_JsonDictionaryMerger) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_JsonDictionaryMerger = &__pyx_type_7pykeyvi_JsonDictionaryMerger; - if (PyType_Ready(&__pyx_type_7pykeyvi_StringDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_StringDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_StringDictionaryCompiler.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "StringDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_StringDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "StringDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_StringDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_StringDictionaryCompiler = &__pyx_type_7pykeyvi_StringDictionaryCompiler; - if (PyType_Ready(&__pyx_type_7pykeyvi_JsonDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_JsonDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_JsonDictionaryCompiler.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "JsonDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_JsonDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "JsonDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_JsonDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_JsonDictionaryCompiler = &__pyx_type_7pykeyvi_JsonDictionaryCompiler; - if (PyType_Ready(&__pyx_type_7pykeyvi_Dictionary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_Dictionary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_Dictionary.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "Dictionary", (PyObject *)&__pyx_type_7pykeyvi_Dictionary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "Dictionary", (PyObject *)&__pyx_type_7pykeyvi_Dictionary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_Dictionary = &__pyx_type_7pykeyvi_Dictionary; - if (PyType_Ready(&__pyx_type_7pykeyvi_FsaTransform) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_FsaTransform) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_FsaTransform.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "FsaTransform", (PyObject *)&__pyx_type_7pykeyvi_FsaTransform) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "FsaTransform", (PyObject *)&__pyx_type_7pykeyvi_FsaTransform) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_FsaTransform = &__pyx_type_7pykeyvi_FsaTransform; - if (PyType_Ready(&__pyx_type_7pykeyvi_PrefixCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_PrefixCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_PrefixCompletion.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "PrefixCompletion", (PyObject *)&__pyx_type_7pykeyvi_PrefixCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "PrefixCompletion", (PyObject *)&__pyx_type_7pykeyvi_PrefixCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_PrefixCompletion = &__pyx_type_7pykeyvi_PrefixCompletion; - if (PyType_Ready(&__pyx_type_7pykeyvi_ForwardBackwardCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_ForwardBackwardCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_ForwardBackwardCompletion.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "ForwardBackwardCompletion", (PyObject *)&__pyx_type_7pykeyvi_ForwardBackwardCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "ForwardBackwardCompletion", (PyObject *)&__pyx_type_7pykeyvi_ForwardBackwardCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_ForwardBackwardCompletion = &__pyx_type_7pykeyvi_ForwardBackwardCompletion; - if (PyType_Ready(&__pyx_type_7pykeyvi_loading_strategy_types) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_loading_strategy_types) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_loading_strategy_types.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "loading_strategy_types", (PyObject *)&__pyx_type_7pykeyvi_loading_strategy_types) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "loading_strategy_types", (PyObject *)&__pyx_type_7pykeyvi_loading_strategy_types) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_loading_strategy_types = &__pyx_type_7pykeyvi_loading_strategy_types; - if (PyType_Ready(&__pyx_type_7pykeyvi_CompletionDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_CompletionDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_CompletionDictionaryCompiler.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "CompletionDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_CompletionDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "CompletionDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_CompletionDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_CompletionDictionaryCompiler = &__pyx_type_7pykeyvi_CompletionDictionaryCompiler; - if (PyType_Ready(&__pyx_type_7pykeyvi_MultiWordCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_MultiWordCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_MultiWordCompletion.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "MultiWordCompletion", (PyObject *)&__pyx_type_7pykeyvi_MultiWordCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "MultiWordCompletion", (PyObject *)&__pyx_type_7pykeyvi_MultiWordCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_MultiWordCompletion = &__pyx_type_7pykeyvi_MultiWordCompletion; - if (PyType_Ready(&__pyx_type_7pykeyvi_PredictiveCompression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_PredictiveCompression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_PredictiveCompression.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "PredictiveCompression", (PyObject *)&__pyx_type_7pykeyvi_PredictiveCompression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "PredictiveCompression", (PyObject *)&__pyx_type_7pykeyvi_PredictiveCompression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_PredictiveCompression = &__pyx_type_7pykeyvi_PredictiveCompression; - if (PyType_Ready(&__pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "KeyOnlyDictionaryGenerator", (PyObject *)&__pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "KeyOnlyDictionaryGenerator", (PyObject *)&__pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_KeyOnlyDictionaryGenerator = &__pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator; - if (PyType_Ready(&__pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "KeyOnlyDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "KeyOnlyDictionaryCompiler", (PyObject *)&__pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_KeyOnlyDictionaryCompiler = &__pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler; - if (PyType_Ready(&__pyx_type_7pykeyvi_Match) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_Match) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_Match.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "Match", (PyObject *)&__pyx_type_7pykeyvi_Match) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "Match", (PyObject *)&__pyx_type_7pykeyvi_Match) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_Match = &__pyx_type_7pykeyvi_Match; - if (PyType_Ready(&__pyx_type_7pykeyvi_MatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_MatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi_MatchIterator.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "MatchIterator", (PyObject *)&__pyx_type_7pykeyvi_MatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "MatchIterator", (PyObject *)&__pyx_type_7pykeyvi_MatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7pykeyvi_MatchIterator = &__pyx_type_7pykeyvi_MatchIterator; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct___init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct___init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct___init_2.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct___init_2 = &__pyx_type_7pykeyvi___pyx_scope_struct___init_2; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_1_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_2_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_3___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_3___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_3___init__.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_3___init__ = &__pyx_type_7pykeyvi___pyx_scope_struct_3___init__; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_4_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_5_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_6__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_6__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_6__init_2 = &__pyx_type_7pykeyvi___pyx_scope_struct_6__init_2; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_7_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_8_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_9___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_9___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_9___init__.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_9___init__ = &__pyx_type_7pykeyvi___pyx_scope_struct_9___init__; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_10_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_11_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper = &__pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper = &__pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper = &__pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_15__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_15__init_2.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_15__init_2 = &__pyx_type_7pykeyvi___pyx_scope_struct_15__init_2; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_12__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_12__init_2.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_12__init_2 = &__pyx_type_7pykeyvi___pyx_scope_struct_12__init_2; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_13_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_14_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_15___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_15___init__.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_15___init__ = &__pyx_type_7pykeyvi___pyx_scope_struct_15___init__; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_16_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_17_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_18___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_18___init__.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_18___init__ = &__pyx_type_7pykeyvi___pyx_scope_struct_18___init__; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_19_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_19_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr.tp_print = 0; - __pyx_ptype_7pykeyvi___pyx_scope_struct_20_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_20_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_21__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper = &__pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper = &__pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper = &__pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_21__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_21__init_2 = &__pyx_type_7pykeyvi___pyx_scope_struct_21__init_2; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_22_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_23_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_24___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_24___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_24___init__.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_24___init__ = &__pyx_type_7pykeyvi___pyx_scope_struct_24___init__; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_25_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr; - if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr.tp_print = 0; __pyx_ptype_7pykeyvi___pyx_scope_struct_26_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_27__init_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_27__init_2.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_27__init_2 = &__pyx_type_7pykeyvi___pyx_scope_struct_27__init_2; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_28_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_29_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_30___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_30___init__.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_30___init__ = &__pyx_type_7pykeyvi___pyx_scope_struct_30___init__; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_31_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr; + if (PyType_Ready(&__pyx_type_7pykeyvi___pyx_scope_struct_32_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7pykeyvi___pyx_scope_struct_32_genexpr.tp_print = 0; + __pyx_ptype_7pykeyvi___pyx_scope_struct_32_genexpr = &__pyx_type_7pykeyvi___pyx_scope_struct_32_genexpr; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY @@ -28011,190 +30198,190 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s_JumpConsistentHashString, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":498 + /* "pykeyvi.pyx":523 * * cdef class loading_strategy_types: * default_os = 0 # <<<<<<<<<<<<<< * lazy = 1 * populate = 2 */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_default_os, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_default_os, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":499 + /* "pykeyvi.pyx":524 * cdef class loading_strategy_types: * default_os = 0 * lazy = 1 # <<<<<<<<<<<<<< * populate = 2 * populate_key_part = 3 */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_lazy, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_lazy, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":500 + /* "pykeyvi.pyx":525 * default_os = 0 * lazy = 1 * populate = 2 # <<<<<<<<<<<<<< * populate_key_part = 3 * populate_lazy = 4 */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":501 + /* "pykeyvi.pyx":526 * lazy = 1 * populate = 2 * populate_key_part = 3 # <<<<<<<<<<<<<< * populate_lazy = 4 * lazy_no_readahead = 5 */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate_key_part, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate_key_part, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":502 + /* "pykeyvi.pyx":527 * populate = 2 * populate_key_part = 3 * populate_lazy = 4 # <<<<<<<<<<<<<< * lazy_no_readahead = 5 * lazy_no_readahead_value_part = 6 */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate_lazy, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate_lazy, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":503 + /* "pykeyvi.pyx":528 * populate_key_part = 3 * populate_lazy = 4 * lazy_no_readahead = 5 # <<<<<<<<<<<<<< * lazy_no_readahead_value_part = 6 * populate_key_part_no_readahead_value_part = 7 */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_lazy_no_readahead, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_lazy_no_readahead, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":504 + /* "pykeyvi.pyx":529 * populate_lazy = 4 * lazy_no_readahead = 5 * lazy_no_readahead_value_part = 6 # <<<<<<<<<<<<<< * populate_key_part_no_readahead_value_part = 7 * */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_lazy_no_readahead_value_part, __pyx_int_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_lazy_no_readahead_value_part, __pyx_int_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":505 + /* "pykeyvi.pyx":530 * lazy_no_readahead = 5 * lazy_no_readahead_value_part = 6 * populate_key_part_no_readahead_value_part = 7 # <<<<<<<<<<<<<< * * cdef class CompletionDictionaryCompiler: */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate_key_part_no_readahead_v, __pyx_int_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_loading_strategy_types->tp_dict, __pyx_n_s_populate_key_part_no_readahead_v, __pyx_int_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":916 + /* "pykeyvi.pyx":941 * * @staticmethod * def loads(serialized_match): # <<<<<<<<<<<<<< * m=Match() * unserialized = msgpack.loads(serialized_match) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7pykeyvi_5Match_45loads, NULL, __pyx_n_s_pykeyvi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7pykeyvi_5Match_45loads, NULL, __pyx_n_s_pykeyvi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "pykeyvi.pyx":915 + /* "pykeyvi.pyx":940 * self.inst.get().SetRawValue( str) * * @staticmethod # <<<<<<<<<<<<<< * def loads(serialized_match): * m=Match() */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_Match->tp_dict, __pyx_n_s_loads, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_Match->tp_dict, __pyx_n_s_loads, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7pykeyvi_Match); - /* "pykeyvi.pyx":916 + /* "pykeyvi.pyx":941 * * @staticmethod * def loads(serialized_match): # <<<<<<<<<<<<<< * m=Match() * unserialized = msgpack.loads(serialized_match) */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7pykeyvi_Match, __pyx_n_s_loads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7pykeyvi_Match, __pyx_n_s_loads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "pykeyvi.pyx":915 + /* "pykeyvi.pyx":940 * self.inst.get().SetRawValue( str) * * @staticmethod # <<<<<<<<<<<<<< * def loads(serialized_match): * m=Match() */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_Match->tp_dict, __pyx_n_s_loads, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7pykeyvi_Match->tp_dict, __pyx_n_s_loads, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7pykeyvi_Match); - /* "pykeyvi.pyx":938 + /* "pykeyvi.pyx":963 * from libc.stdint cimport uint32_t * * import json # <<<<<<<<<<<<<< * import msgpack * import zlib */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_json, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_json, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":939 + /* "pykeyvi.pyx":964 * * import json * import msgpack # <<<<<<<<<<<<<< * import zlib * import snappy */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_msgpack, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_msgpack, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msgpack, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msgpack, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":940 + /* "pykeyvi.pyx":965 * import json * import msgpack * import zlib # <<<<<<<<<<<<<< * import snappy * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_zlib, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_zlib, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_zlib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_zlib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":941 + /* "pykeyvi.pyx":966 * import msgpack * import zlib * import snappy # <<<<<<<<<<<<<< * * # same import style as autowrap */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_snappy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_snappy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_snappy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_snappy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pykeyvi.pyx":1 @@ -28433,45 +30620,6 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in return 0; } -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } @@ -28609,6 +30757,45 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { return 0; } +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result;