From f7c1283ea113c65779a5d52e60ed24ab9b56ff54 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 8 Jul 2016 16:06:14 +0200 Subject: [PATCH 1/8] remove const char* in favor of std::string --- keyvi/src/cpp/dictionary/dictionary.h | 28 +- keyvi/src/cpp/dictionary/fsa/automata.h | 6 +- keyvi/src/cpp/dictionary/fsa/generator.h | 21 +- pykeyvi/src/addons/Dictionary.pyx | 4 +- pykeyvi/src/addons/JsonDictionaryCompiler.pyx | 4 +- pykeyvi/src/pxds/dictionary.pxd | 14 +- pykeyvi/src/pxds/dictionary_compiler.pxd | 22 +- pykeyvi/src/pxds/generator.pxd | 6 +- pykeyvi/src/pykeyvi.cpp | 30357 ++++++++-------- pykeyvi/src/pykeyvi.pyx | 74 +- 10 files changed, 14557 insertions(+), 15979 deletions(-) diff --git a/keyvi/src/cpp/dictionary/dictionary.h b/keyvi/src/cpp/dictionary/dictionary.h index f4923bcd..9698b013 100644 --- a/keyvi/src/cpp/dictionary/dictionary.h +++ b/keyvi/src/cpp/dictionary/dictionary.h @@ -49,7 +49,7 @@ final { * @param filename the filename * @param load_lazy whether to load lazy. */ - Dictionary(const char* filename, bool load_lazy) + Dictionary(const std::string& filename, bool load_lazy) : fsa_(std::make_shared(filename, load_lazy)) { TRACE("Dictionary from file %s", filename); } @@ -60,7 +60,7 @@ final { * @param filename filename to load keyvi file from. * @param loading_strategy optional: Loading strategy to use. */ - explicit Dictionary(const char* filename, loading_strategy_types loading_strategy = loading_strategy_types::lazy) + explicit Dictionary(const std::string& filename, loading_strategy_types loading_strategy = loading_strategy_types::lazy) : fsa_(std::make_shared(filename, loading_strategy)) { TRACE("Dictionary from file %s", filename); } @@ -70,7 +70,7 @@ final { } // temporary implementation - fsa::automata_t GetFsa() { + fsa::automata_t GetFsa() const { return fsa_; } @@ -88,9 +88,9 @@ final { * @param key The key * @return True if key is in the dictionary, False otherwise. */ - bool Contains(const char* key) const { + bool Contains(const std::string& key) const { uint64_t state = fsa_->GetStartState(); - size_t key_length = strlen(key); + size_t key_length = key.size(); TRACE("Contains for %s", key); for (size_t i = 0; i < key_length; ++i) { @@ -111,9 +111,9 @@ final { return false; } - Match operator[](const char* key) const { + Match operator[](const std::string& key) const { uint64_t state = fsa_->GetStartState(); - size_t text_length = strlen(key); + size_t text_length = key.size(); for (size_t i = 0; i < text_length; ++i) { state = fsa_->TryWalkTransition(state, key[i]); @@ -142,9 +142,9 @@ final { * @param key the key to lookup. * @return a match iterator */ - MatchIterator::MatchIteratorPair Get(const char* key) const { + MatchIterator::MatchIteratorPair Get(const std::string& key) const { uint64_t state = fsa_->GetStartState(); - size_t text_length = strlen(key); + size_t text_length = key.size(); for (size_t i = 0; i < text_length; ++i) { state = fsa_->TryWalkTransition(state, key[i]); @@ -256,11 +256,11 @@ final { * @param text the input * @return a match iterator. */ - MatchIterator::MatchIteratorPair Lookup(const char* text, + MatchIterator::MatchIteratorPair Lookup(const std::string& text, size_t offset = 0) { uint64_t state = fsa_->GetStartState(); - size_t text_length = strlen(text); + size_t text_length = text.size(); uint64_t last_final_state = 0; size_t last_final_state_position = 0; @@ -288,7 +288,7 @@ final { offset, last_final_state_position, /*text.substr(0, last_final_state_position),*/ - std::string(text + offset, last_final_state_position - offset), + std::string(text.c_str() + offset, last_final_state_position - offset), 0, fsa_, fsa_->GetStateValue(last_final_state)); @@ -313,9 +313,9 @@ final { * @param text the input * @return a match iterator. */ - MatchIterator::MatchIteratorPair LookupText(const char* text) { + MatchIterator::MatchIteratorPair LookupText(const std::string& text) { - size_t text_length = strlen(text); + size_t text_length = text.size(); std::queue iterators; TRACE("LookupText, 1st lookup for: %s", text); diff --git a/keyvi/src/cpp/dictionary/fsa/automata.h b/keyvi/src/cpp/dictionary/fsa/automata.h index c468bd39..47a1fe60 100644 --- a/keyvi/src/cpp/dictionary/fsa/automata.h +++ b/keyvi/src/cpp/dictionary/fsa/automata.h @@ -52,10 +52,10 @@ class Automata final { public: - Automata(const char * filename, bool load_lazy): + Automata(const std::string& filename, bool load_lazy): Automata(filename, load_lazy ? loading_strategy_types::default_os : loading_strategy_types::populate) {} - explicit Automata(const char * filename, loading_strategy_types loading_strategy = loading_strategy_types::lazy) { + explicit Automata(const std::string& filename, loading_strategy_types loading_strategy = loading_strategy_types::lazy) { std::ifstream in_stream(filename, std::ios::binary); if (!in_stream.good()) { @@ -85,7 +85,7 @@ final { size_t offset = in_stream.tellg(); file_mapping_ = new boost::interprocess::file_mapping( - filename, boost::interprocess::read_only); + filename.c_str(), boost::interprocess::read_only); size_t array_size = boost::lexical_cast(sparse_array_properties_.get("size")); in_stream.seekg(offset + array_size + bucket_size * array_size - 1); diff --git a/keyvi/src/cpp/dictionary/fsa/generator.h b/keyvi/src/cpp/dictionary/fsa/generator.h index 9f2d260a..bd54ae6b 100644 --- a/keyvi/src/cpp/dictionary/fsa/generator.h +++ b/keyvi/src/cpp/dictionary/fsa/generator.h @@ -51,12 +51,11 @@ namespace fsa { * @returns length of the longest common prefix of given strings */ -inline size_t get_common_prefix_length(const char* first, const char* second) { +inline size_t get_common_prefix_length(const std::string& first, const std::string& second) { size_t common_prefix_length = 0; - while (first[common_prefix_length] == second[common_prefix_length] - && first[common_prefix_length] != 0) { + while (first[common_prefix_length] == second[common_prefix_length] && common_prefix_length < first.size()) { ++common_prefix_length; } return common_prefix_length; @@ -190,9 +189,7 @@ final { void Add(const std::string& input_key, typename ValueStoreT::value_t value = ValueStoreT::no_value) { - const char* key = input_key.c_str(); - - size_t commonPrefixLength = get_common_prefix_length(last_key_.c_str(), key); + size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); // keys are equal, just return if (commonPrefixLength == input_key.size() && last_key_.size() == input_key.size()) { @@ -203,7 +200,7 @@ final { ConsumeStack(commonPrefixLength); // put everything that is not common between the two strings (the suffix) into the stack - FeedStack(commonPrefixLength, input_key.size(), key); + FeedStack(commonPrefixLength, input_key.size(), input_key.c_str()); // get value and mark final state bool no_minimization = false; @@ -220,7 +217,7 @@ final { stack_->UpdateWeights(0, input_key.size() + 1, weight); } - last_key_ = key; + last_key_ = std::move(input_key); state_ = generator_state::FEEDING; } @@ -231,9 +228,7 @@ final { */ void Add(const std::string& input_key, const ValueHandle& handle) { - const char* key = input_key.c_str(); - - size_t commonPrefixLength = get_common_prefix_length(last_key_.c_str(), key); + size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); // keys are equal, just return if (commonPrefixLength == input_key.size() && last_key_.size() == input_key.size()) { @@ -244,7 +239,7 @@ final { ConsumeStack(commonPrefixLength); // put everything that is not common between the two strings (the suffix) into the stack - FeedStack(commonPrefixLength, input_key.size(), key); + FeedStack(commonPrefixLength, input_key.size(), input_key.c_str()); stack_->InsertFinalState(input_key.size(), handle.value_idx, handle.no_minimization); @@ -358,7 +353,7 @@ final { internal::SerializationUtils::WriteJsonRecord(stream, pt); } - inline void FeedStack(const size_t start, const size_t end, const char* key) { + inline void FeedStack(const size_t start, const size_t end, const std::string& key) { for (size_t i = start; i < end; ++i) { uint32_t ukey = static_cast(static_cast(key[i])); diff --git a/pykeyvi/src/addons/Dictionary.pyx b/pykeyvi/src/addons/Dictionary.pyx index 17f0749e..f4869a36 100644 --- a/pykeyvi/src/addons/Dictionary.pyx +++ b/pykeyvi/src/addons/Dictionary.pyx @@ -5,7 +5,7 @@ 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)])) + cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) if _r.get().IsEmpty(): return default @@ -30,7 +30,7 @@ assert isinstance(key, bytes), 'arg in_0 wrong type' - cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) + cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) if _r.get().IsEmpty(): raise KeyError(key) diff --git a/pykeyvi/src/addons/JsonDictionaryCompiler.pyx b/pykeyvi/src/addons/JsonDictionaryCompiler.pyx index b70a2627..cd9a99e3 100644 --- a/pykeyvi/src/addons/JsonDictionaryCompiler.pyx +++ b/pykeyvi/src/addons/JsonDictionaryCompiler.pyx @@ -14,11 +14,11 @@ if isinstance(key, unicode): key = key.encode('UTF-8') - cdef const_char * input_in_0 = key + cdef libcpp_string input_in_0 = key if isinstance(value, unicode): value = value.encode('UTF-8') - cdef const_char * input_in_1 = value + cdef libcpp_string input_in_1 = value self.inst.get().Add(input_in_0, input_in_1) diff --git a/pykeyvi/src/pxds/dictionary.pxd b/pykeyvi/src/pxds/dictionary.pxd index 8bc0cd3a..a86ffe90 100644 --- a/pykeyvi/src/pxds/dictionary.pxd +++ b/pykeyvi/src/pxds/dictionary.pxd @@ -17,16 +17,16 @@ cdef extern from "dictionary/dictionary.h" namespace "keyvi::dictionary": populate_key_part_no_readahead_value_part # populate the key part, but disable read ahead value part cdef cppclass Dictionary: - Dictionary (const_char* filename) except + - Dictionary (const_char* filename, loading_strategy_types) except + - bool Contains (const_char*) # wrap-ignore - Match operator[](const_char*) # wrap-ignore - _MatchIteratorPair Get (const_char*) + Dictionary (libcpp_string filename) except + + Dictionary (libcpp_string filename, loading_strategy_types) except + + bool Contains (libcpp_string) # wrap-ignore + Match operator[](libcpp_string) # wrap-ignore + _MatchIteratorPair Get (libcpp_string) _MatchIteratorPair GetNear (libcpp_string, size_t minimum_prefix_length) except + _MatchIteratorPair GetNear (libcpp_string, size_t minimum_prefix_length, bool greedy) except + _MatchIteratorPair GetAllItems () # wrap-ignore - _MatchIteratorPair Lookup(const_char*) - _MatchIteratorPair LookupText(const_char*) + _MatchIteratorPair Lookup(libcpp_string) + _MatchIteratorPair LookupText(libcpp_string) libcpp_string GetManifestAsString() except + # wrap-ignore libcpp_string GetStatistics() # wrap-ignore uint32_t GetSize() # wrap-ignore diff --git a/pykeyvi/src/pxds/dictionary_compiler.pxd b/pykeyvi/src/pxds/dictionary_compiler.pxd index 250eb880..155e35d2 100644 --- a/pykeyvi/src/pxds/dictionary_compiler.pxd +++ b/pykeyvi/src/pxds/dictionary_compiler.pxd @@ -9,8 +9,8 @@ cdef extern from "dictionary/dictionary_types.h" namespace "keyvi::dictionary": CompletionDictionaryCompiler() except + CompletionDictionaryCompiler(size_t memory_limit) except + CompletionDictionaryCompiler(size_t memory_limit, libcpp_map[libcpp_string, libcpp_string] value_store_params) except + - void Add(const_char*, int) except + - void __setitem__ (const_char*, int) except + + void Add(libcpp_string, int) except + + void __setitem__ (libcpp_string, int) except + void Compile() nogil # wrap-ignore void Compile(callback_t, void*) nogil # wrap-ignore void SetManifestFromString(const_char*) # wrap-ignore @@ -20,7 +20,7 @@ cdef extern from "dictionary/dictionary_types.h" namespace "keyvi::dictionary": KeyOnlyDictionaryCompiler() except + KeyOnlyDictionaryCompiler(size_t memory_limit) except + KeyOnlyDictionaryCompiler(size_t memory_limit, libcpp_map[libcpp_string, libcpp_string] value_store_params) except + - void Add(const_char*) except + + void Add(libcpp_string) except + void Compile() nogil # wrap-ignore void Compile(callback_t, void*) nogil # wrap-ignore void SetManifestFromString(const_char*) # wrap-ignore @@ -30,21 +30,21 @@ cdef extern from "dictionary/dictionary_types.h" namespace "keyvi::dictionary": JsonDictionaryCompiler() except + JsonDictionaryCompiler(size_t memory_limit) except + JsonDictionaryCompiler(size_t memory_limit, libcpp_map[libcpp_string, libcpp_string] value_store_params) except + - void Add(const_char*, const_char*) except + # wrap-ignore - void __setitem__(const_char*, const_char*) except + + void Add(libcpp_string, libcpp_string) except + # wrap-ignore + void __setitem__(libcpp_string, libcpp_string) except + void Compile() nogil # wrap-ignore void Compile(callback_t, void*) nogil # wrap-ignore - void SetManifestFromString(const_char*) except + # wrap-ignore - void WriteToFile(const_char*) + void SetManifestFromString(libcpp_string) except + # wrap-ignore + void WriteToFile(libcpp_string) cdef cppclass StringDictionaryCompiler: StringDictionaryCompiler() except + StringDictionaryCompiler(size_t memory_limit) except + StringDictionaryCompiler(size_t memory_limit, libcpp_map[libcpp_string, libcpp_string] value_store_params) except + - void Add(const_char*, const_char*) except + - void __setitem__(const_char*, const_char*) except + + void Add(libcpp_string, libcpp_string) except + + void __setitem__(libcpp_string, libcpp_string) except + void Compile() nogil # wrap-ignore void Compile(callback_t, void*) nogil # wrap-ignore - void SetManifestFromString(const_char*) # wrap-ignore - void WriteToFile(const_char*) + void SetManifestFromString(libcpp_string) # wrap-ignore + void WriteToFile(libcpp_string) diff --git a/pykeyvi/src/pxds/generator.pxd b/pykeyvi/src/pxds/generator.pxd index 28f28b3d..009bf1b3 100644 --- a/pykeyvi/src/pxds/generator.pxd +++ b/pykeyvi/src/pxds/generator.pxd @@ -1,10 +1,10 @@ -from libcpp.string cimport string +from libcpp.string cimport string as libcpp_string from libc.string cimport const_char cdef extern from "dictionary/dictionary_types.h" namespace "keyvi::dictionary": cdef cppclass KeyOnlyDictionaryGenerator: KeyOnlyDictionaryGenerator() except + - void Add(const_char*) except + + void Add(libcpp_string) except + void CloseFeeding() - void WriteToFile(const_char*) \ No newline at end of file + void WriteToFile(libcpp_string) \ No newline at end of file diff --git a/pykeyvi/src/pykeyvi.cpp b/pykeyvi/src/pykeyvi.cpp index 233f2463..821ad013 100644 --- a/pykeyvi/src/pykeyvi.cpp +++ b/pykeyvi/src/pykeyvi.cpp @@ -1,25 +1,13 @@ -/* Generated by Cython 0.21 */ +/* Generated by Cython 0.23.4 */ #define PY_SSIZE_T_CLEAN -#ifndef CYTHON_USE_PYLONG_INTERNALS -#ifdef PYLONG_BITS_IN_DIGIT -#define CYTHON_USE_PYLONG_INTERNALS 0 -#else -#include "pyconfig.h" -#ifdef PYLONG_BITS_IN_DIGIT -#define CYTHON_USE_PYLONG_INTERNALS 1 -#else -#define CYTHON_USE_PYLONG_INTERNALS 0 -#endif -#endif -#endif #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else -#define CYTHON_ABI "0_21" +#define CYTHON_ABI "0_23_4" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -54,35 +42,40 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 +#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 +#define CYTHON_USE_PYLONG_INTERNALS 1 +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif -#if PY_MAJOR_VERSION >= 3 +#ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif -#if PY_MAJOR_VERSION >= 3 +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif -#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE) +#ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) @@ -103,9 +96,12 @@ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) +#endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 @@ -151,6 +147,11 @@ #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -160,18 +161,22 @@ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#else + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif +#if PY_VERSION_HEX >= 0x030500B1 +#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) +#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; +} __Pyx_PyAsyncMethodsStruct; +#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) +#else +#define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) @@ -184,24 +189,42 @@ #define CYTHON_RESTRICT #endif #endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) + +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #define CYTHON_INLINE inline +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + operator T&() { return *ptr; } + private: + T *ptr; +}; + +#if defined(WIN32) || defined(MS_WINDOWS) + #define _USE_MATH_DEFINES +#endif +#include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { - /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and - a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is - a quiet NaN. */ float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif -#ifdef __cplusplus -template -void __Pyx_call_destructor(T* x) { - x->~T(); -} -#endif #if PY_MAJOR_VERSION >= 3 @@ -220,10 +243,6 @@ void __Pyx_call_destructor(T* x) { #endif #endif -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include #define __PYX_HAVE__pykeyvi #define __PYX_HAVE_API__pykeyvi #include "string.h" @@ -239,6 +258,7 @@ void __Pyx_call_destructor(T* x) { #include "boost/smart_ptr/shared_ptr.hpp" #include "autowrap_tools.hpp" #include "stdint.h" +#include "stdio.h" #include "dictionary/match.h" #include "dictionary/match_iterator.h" #include "dictionary/dictionary.h" @@ -270,6 +290,13 @@ void __Pyx_call_destructor(T* x) { # define CYTHON_UNUSED # endif #endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; @@ -278,16 +305,34 @@ typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; #define __PYX_DEFAULT_STRING_ENCODING "ascii # for cython>=0.19" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \ - (sizeof(type) < sizeof(Py_ssize_t)) || \ - (sizeof(type) > sizeof(Py_ssize_t) && \ - likely(v < (type)PY_SSIZE_T_MAX || \ - v == (type)PY_SSIZE_T_MAX) && \ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \ - v == (type)PY_SSIZE_T_MIN))) || \ - (sizeof(type) == sizeof(Py_ssize_t) && \ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \ +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) && defined (_M_X64) + #define __Pyx_sst_abs(value) _abs64(value) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) @@ -304,11 +349,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { @@ -322,8 +367,9 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); @@ -344,7 +390,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); @@ -433,7 +479,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "pykeyvi.pyx", "stringsource", - "stringsource", + "type.pxd", }; /*--- Type declarations ---*/ @@ -464,27 +510,21 @@ 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__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_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_16_genexpr; struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_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_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_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 @@ -494,6 +534,14 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr; * cdef extern from "dictionary/dictionary_types.h" namespace "keyvi::dictionary": */ typedef void (*__pyx_t_19dictionary_compiler_callback_t)(size_t, size_t, void *); + +/* "dictionary_merger.pxd":5 + * from libc.string cimport const_char + * + * ctypedef void (*callback_t)(size_t a, size_t b, void* user_data) # <<<<<<<<<<<<<< + * + * cdef extern from "dictionary/dictionary_types.h" namespace "keyvi::dictionary": + */ typedef void (*__pyx_t_17dictionary_merger_callback_t)(size_t, size_t, void *); /* "pykeyvi.pyx":43 @@ -509,7 +557,7 @@ struct __pyx_obj_7pykeyvi_JsonDictionaryMerger { }; -/* "pykeyvi.pyx":89 +/* "pykeyvi.pyx":64 * self.inst.get().Add((in_0)) * * cdef class StringDictionaryCompiler: # <<<<<<<<<<<<<< @@ -522,7 +570,7 @@ struct __pyx_obj_7pykeyvi_StringDictionaryCompiler { }; -/* "pykeyvi.pyx":167 +/* "pykeyvi.pyx":142 * self.inst.get().SetManifestFromString(m) * * cdef class JsonDictionaryCompiler: # <<<<<<<<<<<<<< @@ -535,7 +583,7 @@ struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler { }; -/* "pykeyvi.pyx":253 +/* "pykeyvi.pyx":228 * self.inst.get().SetManifestFromString(m) * * cdef class Dictionary: # <<<<<<<<<<<<<< @@ -548,7 +596,7 @@ struct __pyx_obj_7pykeyvi_Dictionary { }; -/* "pykeyvi.pyx":426 +/* "pykeyvi.pyx":401 * )} * * cdef class FsaTransform: # <<<<<<<<<<<<<< @@ -561,7 +609,7 @@ struct __pyx_obj_7pykeyvi_FsaTransform { }; -/* "pykeyvi.pyx":446 +/* "pykeyvi.pyx":421 * self.inst = shared_ptr[_FsaTransform](new _FsaTransform(input_in_0)) * * cdef class PrefixCompletion: # <<<<<<<<<<<<<< @@ -574,7 +622,7 @@ struct __pyx_obj_7pykeyvi_PrefixCompletion { }; -/* "pykeyvi.pyx":479 +/* "pykeyvi.pyx":454 * return py_result * * cdef class ForwardBackwardCompletion: # <<<<<<<<<<<<<< @@ -587,7 +635,7 @@ struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion { }; -/* "pykeyvi.pyx":522 +/* "pykeyvi.pyx":497 * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) * * cdef class loading_strategy_types: # <<<<<<<<<<<<<< @@ -599,7 +647,7 @@ struct __pyx_obj_7pykeyvi_loading_strategy_types { }; -/* "pykeyvi.pyx":532 +/* "pykeyvi.pyx":507 * populate_key_part_no_readahead_value_part = 7 * * cdef class CompletionDictionaryCompiler: # <<<<<<<<<<<<<< @@ -612,7 +660,7 @@ struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler { }; -/* "pykeyvi.pyx":615 +/* "pykeyvi.pyx":590 * (py_callback)(a, b) * * cdef class MultiWordCompletion: # <<<<<<<<<<<<<< @@ -625,7 +673,7 @@ struct __pyx_obj_7pykeyvi_MultiWordCompletion { }; -/* "pykeyvi.pyx":656 +/* "pykeyvi.pyx":631 * raise Exception('can not handle type of %s' % (args,)) * * cdef class PredictiveCompression: # <<<<<<<<<<<<<< @@ -638,7 +686,7 @@ struct __pyx_obj_7pykeyvi_PredictiveCompression { }; -/* "pykeyvi.pyx":683 +/* "pykeyvi.pyx":658 * return py_result * * cdef class KeyOnlyDictionaryGenerator: # <<<<<<<<<<<<<< @@ -651,8 +699,8 @@ struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator { }; -/* "pykeyvi.pyx":707 - * self.inst.get().WriteToFile(input_in_0) +/* "pykeyvi.pyx":682 + * self.inst.get().WriteToFile((in_0)) * * cdef class KeyOnlyDictionaryCompiler: # <<<<<<<<<<<<<< * @@ -664,7 +712,7 @@ struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler { }; -/* "pykeyvi.pyx":776 +/* "pykeyvi.pyx":751 * self.inst.get().SetManifestFromString(m) * * cdef class Match: # <<<<<<<<<<<<<< @@ -677,7 +725,7 @@ struct __pyx_obj_7pykeyvi_Match { }; -/* "pykeyvi.pyx":972 +/* "pykeyvi.pyx":947 * from match_iterator cimport MatchIterator as _MatchIterator * * cdef class MatchIterator: # <<<<<<<<<<<<<< @@ -691,8 +739,8 @@ struct __pyx_obj_7pykeyvi_MatchIterator { }; -/* "pykeyvi.pyx":59 - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) +/* "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' @@ -704,7 +752,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 { }; -/* "pykeyvi.pyx":61 +/* "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' # <<<<<<<<<<<<<< @@ -715,22 +763,16 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct___init_2 *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":69 +/* "pykeyvi.pyx":90 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -743,7 +785,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ { }; -/* "pykeyvi.pyx":74 +/* "pykeyvi.pyx":95 * 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())): # <<<<<<<<<<<<<< @@ -754,23 +796,17 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__ *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":105 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) +/* "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' @@ -782,7 +818,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 { }; -/* "pykeyvi.pyx":107 +/* "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' # <<<<<<<<<<<<<< @@ -793,22 +829,16 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; struct __pyx_obj_7pykeyvi___pyx_scope_struct_8_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct_6__init_2 *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":115 +/* "pykeyvi.pyx":175 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -821,7 +851,7 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ { }; -/* "pykeyvi.pyx":120 +/* "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())): # <<<<<<<<<<<<<< @@ -832,107 +862,23 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_10_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; struct __pyx_obj_7pykeyvi___pyx_scope_struct_11_genexpr { PyObject_HEAD struct __pyx_obj_7pykeyvi___pyx_scope_struct_9___init__ *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "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; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - -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; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "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; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - -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; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":378 +/* "pykeyvi.pyx":353 * return py_result * * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< * for m in iterator: * yield m.GetMatchedString() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper { PyObject_HEAD PyObject *__pyx_v_iterator; PyObject *__pyx_v_m; @@ -943,14 +889,14 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper { }; -/* "pykeyvi.pyx":382 +/* "pykeyvi.pyx":357 * yield m.GetMatchedString() * * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< * for m in iterator: - * yield m.GetValue() + * yield m.GetRawValueAsString() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper { PyObject_HEAD PyObject *__pyx_v_iterator; PyObject *__pyx_v_m; @@ -961,14 +907,14 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper { }; -/* "pykeyvi.pyx":386 - * yield m.GetValue() +/* "pykeyvi.pyx":361 + * yield m.GetRawValueAsString() * * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< * for m in iterator: - * yield (m.GetMatchedString(), m.GetValue()) + * yield (m.GetMatchedString(), m.GetRawValueAsString()) */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper { PyObject_HEAD PyObject *__pyx_v_iterator; PyObject *__pyx_v_m; @@ -979,161 +925,139 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper { }; -/* "pykeyvi.pyx":562 +/* "pykeyvi.pyx":537 * 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_21__init_2 { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 { PyObject_HEAD PyObject *__pyx_v_value_store_params; }; -/* "pykeyvi.pyx":564 +/* "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]() */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__init_2 *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":572 +/* "pykeyvi.pyx":547 * 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_18___init__ { PyObject_HEAD PyObject *__pyx_v_args; }; -/* "pykeyvi.pyx":577 +/* "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: */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":723 +/* "pykeyvi.pyx":698 * 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_27__init_2 { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 { PyObject_HEAD PyObject *__pyx_v_value_store_params; }; -/* "pykeyvi.pyx":725 +/* "pykeyvi.pyx":700 * 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_28_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__init_2 *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -/* "pykeyvi.pyx":733 +/* "pykeyvi.pyx":708 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< * if not args: * self._init_0(*args) */ -struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ { PyObject_HEAD PyObject *__pyx_v_args; }; -/* "pykeyvi.pyx":738 +/* "pykeyvi.pyx":713 * 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_31_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; PyObject *__pyx_v_k; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; -struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr { +struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr { PyObject_HEAD - struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___init__ *__pyx_outer_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *__pyx_outer_scope; PyObject *__pyx_v_v; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); }; + +/* --- Runtime support code (head) --- */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1150,19 +1074,19 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr { static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil) \ - if (acquire_gil) { \ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ - PyGILState_Release(__pyx_gilstate_save); \ - } else { \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else - #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif - #define __Pyx_RefNannyFinishContext() \ + #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -1185,13 +1109,13 @@ struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr { #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif -#define __Pyx_XDECREF_SET(r, v) do { \ - PyObject *tmp = (PyObject *) r; \ - r = v; __Pyx_XDECREF(tmp); \ +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ } while (0) -#define __Pyx_DECREF_SET(r, v) do { \ - PyObject *tmp = (PyObject *) r; \ - r = v; __Pyx_DECREF(tmp); \ +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) @@ -1218,31 +1142,45 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); 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); + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif +typedef struct { + PyObject *type; + PyObject **method_name; + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; + +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#define __Pyx_CallUnboundCMethod0(cfunc, self)\ + ((likely((cfunc)->func)) ?\ + (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\ + (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\ + ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) : __Pyx__CallUnboundCMethod0(cfunc, self)))) :\ + __Pyx__CallUnboundCMethod0(cfunc, self)) +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); - -static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); - static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); @@ -1255,7 +1193,11 @@ 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 + +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); @@ -1272,20 +1214,29 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); +#else +#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ + PyObject_RichCompare(op1, op2, Py_EQ) + #endif + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); @@ -1300,13 +1251,13 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f) \ +#define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f) \ +#define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f) \ +#define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { PyCFunctionObject func; @@ -1330,7 +1281,7 @@ typedef struct { PyObject *func_annotations; } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \ +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, int flags, PyObject* qualname, @@ -1346,7 +1297,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __Pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(void); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1370,7 +1321,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, - int full_traceback); + int full_traceback, int nogil); #include @@ -1428,8 +1379,6 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); @@ -1481,13 +1430,12 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_Generator_USED -#include -#include -typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD - __pyx_generator_body_t body; + __pyx_coroutine_body_t body; PyObject *closure; PyObject *exc_type; PyObject *exc_value; @@ -1499,27 +1447,50 @@ typedef struct { PyObject *gi_qualname; int resume_label; char is_running; -} __pyx_GeneratorObject; -static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, - PyObject *closure, PyObject *name, PyObject *qualname); -static int __pyx_Generator_init(void); -static int __Pyx_Generator_clear(PyObject* self); +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject *type, __pyx_coroutine_body_t body, + PyObject *closure, PyObject *name, PyObject *qualname); +static int __Pyx_Coroutine_clear(PyObject *self); #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); #else #define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) #endif -static int __Pyx_check_binary_version(void); - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); +static int __Pyx_patch_abc(void); -/* Module declarations from 'libc.string' */ +#define __Pyx_Generator_USED +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_New(body, closure, name, qualname)\ + __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(void); -/* Module declarations from 'libcpp.string' */ +static int __Pyx_check_binary_version(void); -/* Module declarations from 'libcpp.utility' */ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libcpp.string' */ + +/* Module declarations from 'libcpp.utility' */ /* Module declarations from 'libcpp.set' */ @@ -1537,6 +1508,17 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libc.stdint' */ +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'cpython' */ + +/* Module declarations from 'cpython.object' */ + /* Module declarations from 'cpython.ref' */ /* Module declarations from 'match' */ @@ -1591,237 +1573,37 @@ 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__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_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_16_genexpr = 0; static PyTypeObject *__pyx_ptype_7pykeyvi___pyx_scope_struct_17_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_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_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_(PyObject *); /*proto*/ -static PyObject *__pyx_convert_string_to_py_(std::string const &); /*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*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ #define __Pyx_MODULE_NAME "pykeyvi" int __pyx_module_is_main_pykeyvi = 0; /* Implementation of 'pykeyvi' */ static PyObject *__pyx_builtin_staticmethod; -static PyObject *__pyx_builtin_all; static PyObject *__pyx_builtin_Exception; static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_filter; static PyObject *__pyx_builtin_StopIteration; -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 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 */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self); /* proto */ -static int __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -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); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self); /* 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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest); /* proto */ -static void __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_4_init_0(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self); /* proto */ -static int __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_10__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_14__enter__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_18Add(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest); /* proto */ -static void __pyx_pf_7pykeyvi_10Dictionary___dealloc__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_2LookupText(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -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); /* 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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_10GetNear(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_12_init_0(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ -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); /* proto */ -static int __pyx_pf_7pykeyvi_10Dictionary_16__init__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_18Get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_20get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */ -static int __pyx_pf_7pykeyvi_10Dictionary_22__contains__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ -static Py_ssize_t __pyx_pf_7pykeyvi_10Dictionary_24__len__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_26__getitem__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_28_key_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_31_value_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_34_item_iterator_wrapper(CYTHON_UNUSED struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_iterator); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self); /* proto */ -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_lambda1(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 */ -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); /* proto */ -static void __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self); /* proto */ -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); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -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); /* proto */ -static void __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self); /* proto */ -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); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_6_init_0(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8_init_1(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self); /* proto */ -static int __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_12__init__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest); /* proto */ -static void __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static void __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_2Compress(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static int __pyx_pf_7pykeyvi_21PredictiveCompression_4__init__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self); /* proto */ -static int __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_4Add(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_6CloseFeeding(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static void __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_2_init_0(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_4_init_1(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr(PyObject *__pyx_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self); /* proto */ -static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest); /* proto */ -static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_2SetEnd(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_end); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_8SetMatchedString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_matched_string); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, float __pyx_v_score); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_start); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_26_init_0(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -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); /* proto */ -static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_str); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_match); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_13MatchIterator___iter__(struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryMerger(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_StringDictionaryCompiler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_JsonDictionaryCompiler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_Dictionary(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_FsaTransform(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_PrefixCompletion(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_ForwardBackwardCompletion(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_loading_strategy_types(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_MultiWordCompletion(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_PredictiveCompression(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_Match(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi_MatchIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_6__init_2(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -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__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__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 char __pyx_k_m[] = "m"; static char __pyx_k_r[] = "_r"; static char __pyx_k__6[] = "\n\n"; @@ -1829,7 +1611,6 @@ static char __pyx_k__8[] = "\n"; static char __pyx_k__14[] = "\000"; static char __pyx_k__16[] = "\001"; static char __pyx_k__18[] = "\002"; -static char __pyx_k_all[] = "all"; static char __pyx_k_key[] = "key"; static char __pyx_k_args[] = "args"; static char __pyx_k_in_0[] = "in_0"; @@ -1867,7 +1648,6 @@ 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"; @@ -1899,6 +1679,7 @@ 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"; @@ -1918,8 +1699,8 @@ static char __pyx_k_GetStatistics_locals_lambda[] = "GetStatistics.. 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)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_2_init_0(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_2__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self) { + int __pyx_r; __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", 0); + __Pyx_RefNannySetupContext("__init__", 0); /* "pykeyvi.pyx":52 * - * def _init_0(self): + * def __init__(self): * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) # <<<<<<<<<<<<<< * - * def _init_1(self, memory_limit ): + * def Merge(self, bytes in_0 ): */ try { __pyx_t_1 = new keyvi::dictionary::JsonDictionaryMerger(); @@ -2349,19 +2317,18 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_2_init_0(struct __pyx_ /* "pykeyvi.pyx":51 * * - * def _init_0(self): # <<<<<<<<<<<<<< + * def __init__(self): # <<<<<<<<<<<<<< * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -2369,87 +2336,74 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_2_init_0(struct __pyx_ /* "pykeyvi.pyx":54 * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* Python wrapper */ -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) { +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; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __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)); + __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)); /* 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_4_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_memory_limit) { +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4Merge(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { 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::JsonDictionaryMerger *__pyx_t_5; + 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("Merge", 0); /* "pykeyvi.pyx":55 * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * def Merge(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) + * self.inst.get().Merge((in_0)) */ #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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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:; + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_in_0_wrong_type); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif /* "pykeyvi.pyx":57 - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) # <<<<<<<<<<<<<< + * self.inst.get().Merge((in_0)) # <<<<<<<<<<<<<< * - * def _init_2(self, memory_limit , dict value_store_params ): + * def Add(self, bytes in_0 ): */ - __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); + __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)); /* "pykeyvi.pyx":54 * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger()) * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ @@ -2457,7 +2411,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4_init_1(struct __pyx_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_1", __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); @@ -2466,69 +2420,24 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_4_init_1(struct __pyx_ } /* "pykeyvi.pyx":59 - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) + * self.inst.get().Merge((in_0)) + * + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 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_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; +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; 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 = 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); + __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)); /* function exit code */ goto __pyx_L0; @@ -2538,171 +2447,367 @@ static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7_init_2(PyObject *__p __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_2generator3(__pyx_GeneratorObject *__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_7_init_2_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6Add(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; - __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_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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; + #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;} } + /* "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._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.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_20JsonDictionaryMerger_7_init_2_2generator3(__pyx_GeneratorObject *__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); +/* "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) { 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; + __Pyx_RefNannyDeclarations + keyvi::dictionary::StringDictionaryCompiler *__pyx_t_1; 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_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_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_v_self->inst = boost::shared_ptr (__pyx_t_1); + + /* "pykeyvi.pyx":72 + * + * + * 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":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; + __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":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;} + } } - __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;} + #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_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;} - #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;} - #endif + __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; } - } 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;} + 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;} } - break; } - __Pyx_GOTREF(__pyx_t_1); + 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_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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_memory_limit = values[0]; + __pyx_v_value_store_params = ((PyObject*)values[1]); } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + 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 */ - PyErr_SetNone(PyExc_StopIteration); 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_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_2generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -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; +/* "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_2_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL); + __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; @@ -2712,7 +2817,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(PyOb __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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; @@ -2720,7 +2825,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(PyOb /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -2728,15 +2833,16 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(PyOb return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +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_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); + 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; 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; @@ -2744,27 +2850,26 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(_ __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 = 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_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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} } - __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_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_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_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 = 61; __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -2772,16 +2877,18 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(_ 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;} + __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 = 61; __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 = 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 = 61; __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 = 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 = 61; __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); #endif } } else { @@ -2790,64 +2897,200 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_7_init_2_5generator4(_ 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;} + 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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __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_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __Pyx_XGIVEREF(__pyx_r); + __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_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; + 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_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 from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; + } + + /* 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 */ - PyErr_SetNone(PyExc_StopIteration); 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_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":59 - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) +/* "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_20JsonDictionaryMerger_6_init_2(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_memory_limit, PyObject *__pyx_v_value_store_params) { +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; @@ -2869,7 +3112,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ std::string __pyx_t_13; std::string __pyx_t_14; size_t __pyx_t_15; - keyvi::dictionary::JsonDictionaryMerger *__pyx_t_16; + keyvi::dictionary::StringDictionaryCompiler *__pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2884,7 +3127,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value_store_params); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value_store_params); - /* "pykeyvi.pyx":60 + /* "pykeyvi.pyx":81 * * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< @@ -2896,24 +3139,22 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":61 + /* "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' # <<<<<<<<<<<<<< @@ -2928,53 +3169,39 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - goto __pyx_L6_next_and; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_L6_next_and:; - __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_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_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_3) { - goto __pyx_L7_next_and; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_L7_next_and:; - __pyx_t_4 = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_7_init_2_3genexpr(((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 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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 = 82; __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 = 61; __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 = 82; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":63 + /* "pykeyvi.pyx":84 * 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]() # <<<<<<<<<<<<<< @@ -2985,30 +3212,30 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __pyx_t_6 = new std::map (); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":64 + /* "pykeyvi.pyx":85 * * 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[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) + * 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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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_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_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 = 64; __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 = 85; __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 = 64; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -3016,16 +3243,18 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ 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 = 64; __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 = 85; __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 = 64; __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 = 85; __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 = 64; __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 = 85; __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 = 64; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); #endif } } else { @@ -3034,7 +3263,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ 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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3050,7 +3279,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -3063,15 +3292,15 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __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 = 64; __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 = 85; __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 = 64; __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 = 85; __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 = 64; __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 = 85; __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; @@ -3079,7 +3308,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __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 = 64; __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 = 85; __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; @@ -3087,7 +3316,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L11_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); @@ -3095,54 +3324,54 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); __pyx_t_10 = 0; - /* "pykeyvi.pyx":65 + /* "pykeyvi.pyx":86 * 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[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) * del v1 */ - __pyx_t_13 = __pyx_convert_string_from_py_(__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_(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __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 = 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_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); - /* "pykeyvi.pyx":64 + /* "pykeyvi.pyx":85 * * 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[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pykeyvi.pyx":66 + /* "pykeyvi.pyx":87 * for key, value in value_store_params.items(): * deref(v1)[ key ] = value - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((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 = 66; __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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_16 = new keyvi::dictionary::JsonDictionaryMerger(((size_t)__pyx_t_15), (*__pyx_v_v1)); + __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __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":67 + /* "pykeyvi.pyx":88 * deref(v1)[ key ] = value - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit), deref(v1))) + * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) * del v1 # <<<<<<<<<<<<<< * * def __init__(self, *args): */ delete __pyx_v_v1; - /* "pykeyvi.pyx":59 - * self.inst = shared_ptr[_JsonDictionaryMerger](new _JsonDictionaryMerger((memory_limit))) + /* "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' @@ -3158,7 +3387,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_key); @@ -3169,7 +3398,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ return __pyx_r; } -/* "pykeyvi.pyx":69 +/* "pykeyvi.pyx":90 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -3178,8 +3407,8 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_6_init_2(struct __pyx_ */ /* Python wrapper */ -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) { +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 @@ -3187,16 +3416,16 @@ static int __pyx_pw_7pykeyvi_20JsonDictionaryMerger_9__init__(PyObject *__pyx_v_ 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_20JsonDictionaryMerger_8__init__(((struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *)__pyx_v_self), __pyx_v_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_20JsonDictionaryMerger_8__init___2generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":74 +/* "pykeyvi.pyx":95 * 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())): # <<<<<<<<<<<<<< @@ -3204,7 +3433,7 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( * else: */ -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3222,7 +3451,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(PyOb __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -3230,7 +3459,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(PyOb /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__.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); @@ -3238,7 +3467,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___genexpr(PyOb return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_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; @@ -3248,6 +3477,7 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( 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; @@ -3255,19 +3485,18 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( __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 = 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_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_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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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_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_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3280,10 +3509,10 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( } } 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 = 74; __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 = 95; __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 = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3291,9 +3520,9 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( __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 = 74; __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 = 95; __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 = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -3301,16 +3530,18 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( 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 = 74; __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 = 95; __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 = 74; __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 = 95; __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 = 74; __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 = 95; __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 = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); #endif } } else { @@ -3319,7 +3550,7 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( 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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3330,31 +3561,25 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -3362,15 +3587,15 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___2generator5( __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(PyObject *__pyx_self) { +static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3388,7 +3613,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(PyO __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -3396,7 +3621,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(PyO /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__.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); @@ -3404,7 +3629,7 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(PyO return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_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; @@ -3414,6 +3639,7 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( 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; @@ -3421,19 +3647,18 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( __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 = 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_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_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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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_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_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3446,10 +3671,10 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( } } 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 = 74; __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 = 95; __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 = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3457,9 +3682,9 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( __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 = 74; __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 = 95; __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 = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -3467,16 +3692,18 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( 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 = 74; __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 = 95; __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 = 74; __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 = 95; __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 = 74; __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 = 95; __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 = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); #endif } } else { @@ -3485,7 +3712,7 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( 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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3496,31 +3723,25 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -3528,14 +3749,14 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":69 +/* "pykeyvi.pyx":90 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -3543,7 +3764,7 @@ static PyObject *__pyx_gb_7pykeyvi_20JsonDictionaryMerger_8__init___5generator6( * self._init_0(*args) */ -static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_args) { +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_3___init__ *__pyx_cur_scope; int __pyx_r; __Pyx_RefNannyDeclarations @@ -3551,10 +3772,9 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7 int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3569,7 +3789,7 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - /* "pykeyvi.pyx":70 + /* "pykeyvi.pyx":91 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -3580,92 +3800,98 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7 __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":71 + /* "pykeyvi.pyx":92 * 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 = 71; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":91 + * + * 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":72 + /* "pykeyvi.pyx":93 * 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_5 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_5); - if (unlikely(__pyx_t_5 == Py_None)) { + __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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = ((__pyx_t_6 == 1) != 0); + __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); if (__pyx_t_1) { - goto __pyx_L5_next_and; } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L4_bool_binop_done; } - __pyx_L5_next_and:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_7 = PyInt_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - goto __pyx_L7_next_or; + __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_8; + __pyx_t_1 = __pyx_t_7; goto __pyx_L6_bool_binop_done; } - __pyx_L7_next_or:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_8 = PyLong_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = (__pyx_t_8 != 0); - __pyx_t_1 = __pyx_t_7; + __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_7 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_7; + __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":73 + /* "pykeyvi.pyx":94 * 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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pykeyvi.pyx":93 + * 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":74 + /* "pykeyvi.pyx":95 * 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())): # <<<<<<<<<<<<<< @@ -3676,142 +3902,127 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7 __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = ((__pyx_t_6 == 2) != 0); - if (__pyx_t_7) { - goto __pyx_L9_next_and; + __pyx_t_6 = ((__pyx_t_5 == 2) != 0); + if (__pyx_t_6) { } else { - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_L9_next_and:; __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_8 = (__pyx_t_1 != 0); - if (!__pyx_t_8) { - goto __pyx_L12_next_or; + __pyx_t_7 = (__pyx_t_1 != 0); + if (!__pyx_t_7) { } else { - __pyx_t_7 = __pyx_t_8; + __pyx_t_6 = __pyx_t_7; goto __pyx_L11_bool_binop_done; } - __pyx_L12_next_or:; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); __Pyx_INCREF(__pyx_t_3); - __pyx_t_8 = PyLong_Check(__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_8 != 0); - __pyx_t_7 = __pyx_t_1; - __pyx_L11_bool_binop_done:; __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) { - goto __pyx_L10_next_and; } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L8_bool_binop_done; } - __pyx_L10_next_and:; __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_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - goto __pyx_L13_next_and; + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { } else { - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_L13_next_and:; - __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_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_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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; - if (__pyx_t_7) { - goto __pyx_L14_next_and; + __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { } else { - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_L14_next_and:; - __pyx_t_3 = __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init___3genexpr(((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 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":75 + /* "pykeyvi.pyx":96 * 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 = 75; __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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":95 + * 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; } - /*else*/ { - /* "pykeyvi.pyx":77 + /* "pykeyvi.pyx":98 * self._init_2(*args) * else: * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def Merge(self, bytes in_0 ): + * def Add(self, bytes in_0 , bytes in_1 ): */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + /*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_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_5); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __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_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_L3:; - /* "pykeyvi.pyx":69 + /* "pykeyvi.pyx":90 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -3825,8 +4036,7 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -3834,25 +4044,71 @@ static int __pyx_pf_7pykeyvi_20JsonDictionaryMerger_8__init__(struct __pyx_obj_7 return __pyx_r; } -/* "pykeyvi.pyx":79 +/* "pykeyvi.pyx":100 * raise Exception('can not handle type of %s' % (args,)) * - * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< + * 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 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; +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("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)); + __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; @@ -3863,56 +4119,80 @@ static PyObject *__pyx_pw_7pykeyvi_20JsonDictionaryMerger_11Merge(PyObject *__py return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_10Merge(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { +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("Merge", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":80 + /* "pykeyvi.pyx":101 * - * def Merge(self, bytes in_0 ): + * 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' * - * 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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":82 + /* "pykeyvi.pyx":102 + * 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' # <<<<<<<<<<<<<< * - * self.inst.get().Merge((in_0)) # <<<<<<<<<<<<<< * - * def Add(self, bytes in_0 ): */ - __pyx_t_2 = __pyx_convert_string_from_py_(__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)); + #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)) # <<<<<<<<<<<<<< + * + * 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 = 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;} + } - /* "pykeyvi.pyx":79 + /* "pykeyvi.pyx":100 * raise Exception('can not handle type of %s' % (args,)) * - * def Merge(self, bytes in_0 ): # <<<<<<<<<<<<<< + * 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.JsonDictionaryMerger.Merge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3920,191 +4200,187 @@ static PyObject *__pyx_pf_7pykeyvi_20JsonDictionaryMerger_10Merge(struct __pyx_o return __pyx_r; } -/* "pykeyvi.pyx":84 - * self.inst.get().Merge((in_0)) +/* "pykeyvi.pyx":107 + * self.inst.get().Add((in_0), (in_1)) * - * def Add(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_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) { +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; - 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 = 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)); + __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)); /* 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_20JsonDictionaryMerger_12Add(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger *__pyx_v_self, PyObject *__pyx_v_in_0) { - 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("Add", 0); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "pykeyvi.pyx":85 + /* "pykeyvi.pyx":108 * - * def Add(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' * - * 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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":87 + /* "pykeyvi.pyx":109 + * 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' # <<<<<<<<<<<<<< * - * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< * - * cdef class StringDictionaryCompiler: */ - __pyx_t_2 = __pyx_convert_string_from_py_(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #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().__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 = 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;} try { - __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); + __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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":84 - * self.inst.get().Merge((in_0)) + /* "pykeyvi.pyx":107 + * self.inst.get().Add((in_0), (in_1)) * - * def Add(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 = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryMerger.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":93 - * cdef shared_ptr[_StringDictionaryCompiler] inst +/* "pykeyvi.pyx":114 + * self.inst.get().__setitem__((in_0), (in_1)) * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* 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) { +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("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__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 = 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)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_pf_7pykeyvi_24StringDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self) { +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 - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":94 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":93 - * cdef shared_ptr[_StringDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":97 - * - * - * 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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - keyvi::dictionary::StringDictionaryCompiler *__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("_init_0", 0); + __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":98 + /* "pykeyvi.pyx":115 * - * def _init_0(self): - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) # <<<<<<<<<<<<<< + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * def _init_1(self, memory_limit ): + * 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;} + #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;} + } } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); + #endif - /* "pykeyvi.pyx":97 + /* "pykeyvi.pyx":117 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * + * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) + * 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)); + + /* "pykeyvi.pyx":114 + * self.inst.get().__setitem__((in_0), (in_1)) + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ @@ -4112,7 +4388,7 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(struct __ __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_AddTraceback("pykeyvi.StringDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4120,131 +4396,87 @@ static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_2_init_0(struct __ return __pyx_r; } -/* "pykeyvi.pyx":100 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) +/* "pykeyvi.pyx":119 + * self.inst.get().WriteToFile((in_0)) * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * def __enter__(self): # <<<<<<<<<<<<<< + * return self * */ /* 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) { +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("_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)); + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self)); /* 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) { +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; - 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); + __Pyx_RefNannySetupContext("__enter__", 0); - /* "pykeyvi.pyx":101 - * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":120 * - * 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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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' + * def __enter__(self): + * return self # <<<<<<<<<<<<<< * - * 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); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "pykeyvi.pyx":100 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler()) + /* "pykeyvi.pyx":119 + * self.inst.get().WriteToFile((in_0)) * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit 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.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))) +/* "pykeyvi.pyx":123 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() * - * 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; +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; 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); + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; - PyObject* values[2] = {0,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; @@ -4253,1368 +4485,738 @@ static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_7_init_2(PyObject 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--; + 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_store_params)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __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 = 105; __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } 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_memory_limit = values[0]; - __pyx_v_value_store_params = ((PyObject*)values[1]); + __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("_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_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_L3_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler._init_2", __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:; - 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); + __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 */ - 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_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "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; +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; + 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("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; + __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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; + 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_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* 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_2generator7(__pyx_GeneratorObject *__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; - 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_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 = 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;} - #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;} - #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_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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "pykeyvi.pyx":123 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ /* 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_2); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator8(__pyx_GeneratorObject *__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_8_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +/* "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 - 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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } + __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_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_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_7_init_2_5generator8(__pyx_GeneratorObject *__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); +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; - 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_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 = 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_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;} - #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;} - #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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - 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_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("Compile", 0); -/* "pykeyvi.pyx":105 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) + /* "pykeyvi.pyx":128 * - * 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 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_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; - 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_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":129 + * 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":106 - * - * 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":130 + * if not args: + * with nogil: + * self.inst.get().Compile() # <<<<<<<<<<<<<< + * return * */ - #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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __pyx_v_self->inst.get()->Compile(); + } - /* "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]() + /* "pykeyvi.pyx":129 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return */ - #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) { - goto __pyx_L6_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_L6_next_and:; - __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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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; - if (__pyx_t_3) { - goto __pyx_L7_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_L7_next_and:; - __pyx_t_4 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_7_init_2_3genexpr(((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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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;} + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - } - #endif - /* "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' + /* "pykeyvi.pyx":131 + * with nogil: + * self.inst.get().Compile() + * return # <<<<<<<<<<<<<< * - * 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 + * cdef void* callback = args[0] */ - try { - __pyx_t_6 = new std::map (); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_v1 = __pyx_t_6; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "pykeyvi.pyx":110 + /* "pykeyvi.pyx":128 * - * 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))) + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() */ - 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;} - #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;} - #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; - - /* "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_(__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_(__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":110 + /* "pykeyvi.pyx":133 + * return * - * 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))) + * cdef void* callback = args[0] # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); - /* "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 + /* "pykeyvi.pyx":134 * - */ - __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_16 = new keyvi::dictionary::StringDictionaryCompiler(((size_t)__pyx_t_15), (*__pyx_v_v1)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); + * 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":113 - * deref(v1)[ key ] = value - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit), deref(v1))) - * del v1 # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":135 + * cdef void* callback = args[0] + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< + * * - * def __init__(self, *args): */ - delete __pyx_v_v1; + __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); + } - /* "pykeyvi.pyx":105 - * self.inst = shared_ptr[_StringDictionaryCompiler](new _StringDictionaryCompiler((memory_limit))) + /* "pykeyvi.pyx":134 * - * 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 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: */ /* 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_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":115 - * del v1 +/* "pykeyvi.pyx":138 * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) */ /* 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) { - PyObject *__pyx_v_args = 0; - int __pyx_r; +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("__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); + __Pyx_RefNannySetupContext("SetManifest (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "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; +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 - 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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } - - /* function exit code */ - __pyx_L1_error:; - __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); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___2generator9(__pyx_GeneratorObject *__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; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; 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 = 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_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 = 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 = 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_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 = 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_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_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); } 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 = 120; __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 = 120; __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 = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 120; __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_1 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __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 = 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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) + */ /* 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_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -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; +/* "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 - 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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } + __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 + * + * + * 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_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_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_24StringDictionaryCompiler_8__init___5generator10(__pyx_GeneratorObject *__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; +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; + std::string __pyx_t_3; 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 = 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); + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "pykeyvi.pyx":151 + * + * 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 = 151; __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 = 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_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 = 120; __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 = 120; __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 = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); + #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' # <<<<<<<<<<<<<< + * + * + */ + #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_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_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + #endif + + /* "pykeyvi.pyx":155 + * + * + * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def _init_0(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 = 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)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "pykeyvi.pyx":150 + * + * + * 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 */ - PyErr_SetNone(PyExc_StopIteration); + __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.JsonDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":115 - * del v1 +/* "pykeyvi.pyx":157 + * self.inst.get().__setitem__((in_0), (in_1)) + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) */ -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; +/* 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 - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + __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); - __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("_init_0", 0); - /* "pykeyvi.pyx":116 + /* "pykeyvi.pyx":158 * - * def __init__(self, *args): - * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - */ - __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":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) - */ - __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 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } - - /* "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())): - */ - __pyx_t_5 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_5); - if (unlikely(__pyx_t_5 == 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_6 = PyTuple_GET_SIZE(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = ((__pyx_t_6 == 1) != 0); - if (__pyx_t_1) { - goto __pyx_L5_next_and; - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_L5_next_and:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_7 = PyInt_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - goto __pyx_L7_next_or; - } else { - __pyx_t_1 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_L7_next_or:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_8 = PyLong_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = (__pyx_t_8 != 0); - __pyx_t_1 = __pyx_t_7; - __pyx_L6_bool_binop_done:; - __pyx_t_7 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_7; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_5, __pyx_t_4, 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_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L3; - } - - /* "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_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_t_6 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == -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_7 = ((__pyx_t_6 == 2) != 0); - if (__pyx_t_7) { - goto __pyx_L9_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L9_next_and:; - __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_8 = (__pyx_t_1 != 0); - if (!__pyx_t_8) { - goto __pyx_L12_next_or; - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L11_bool_binop_done; - } - __pyx_L12_next_or:; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_8 = PyLong_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = (__pyx_t_8 != 0); - __pyx_t_7 = __pyx_t_1; - __pyx_L11_bool_binop_done:; - __pyx_t_1 = (__pyx_t_7 != 0); - if (__pyx_t_1) { - goto __pyx_L10_next_and; - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L8_bool_binop_done; - } - __pyx_L10_next_and:; - __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_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - goto __pyx_L13_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L13_next_and:; - __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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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; - if (__pyx_t_7) { - goto __pyx_L14_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L14_next_and:; - __pyx_t_3 = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_8__init___3genexpr(((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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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_7; - __pyx_L8_bool_binop_done:; - if (__pyx_t_2) { - - /* "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 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "pykeyvi.pyx":123 - * self._init_2(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + * def _init_0(self): + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) # <<<<<<<<<<<<<< * - * def Add(self, bytes in_0 , bytes in_1 ): + * def _init_1(self, memory_limit ): */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_5); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 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 = 123; __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 = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":115 - * del v1 + /* "pykeyvi.pyx":157 + * self.inst.get().__setitem__((in_0), (in_1)) + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if not args: - * self._init_0(*args) */ /* function exit code */ - __pyx_r = 0; + __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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_0", __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":125 - * raise Exception('can not handle type of %s' % (args,)) +/* "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' * - * 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 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_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("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); + __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; @@ -5622,16 +5224,16 @@ static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__ 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_in_1)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 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;} + __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, "Add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5639,20 +5241,19 @@ static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__ 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]); + __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("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_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.StringDictionaryCompiler.Add", __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 = 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); + 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; @@ -5662,1124 +5263,1332 @@ static PyObject *__pyx_pw_7pykeyvi_24StringDictionaryCompiler_11Add(PyObject *__ __Pyx_RefNannyFinishContext(); return __pyx_r; } +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -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) { - const char *__pyx_v_input_in_0; - const char *__pyx_v_input_in_1; +/* "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; 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("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' - * cdef const_char * input_in_0 = 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 = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 - */ - #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;} - } + __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; } - #endif - - /* "pykeyvi.pyx":128 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef const_char * input_in_1 = in_1 - * self.inst.get().Add(input_in_0, input_in_1) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":129 - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 # <<<<<<<<<<<<<< - * self.inst.get().Add(input_in_0, input_in_1) - * - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_1 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":130 - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 - * self.inst.get().Add(input_in_0, input_in_1) # <<<<<<<<<<<<<< - * - * def __setitem__(self, bytes in_0 , bytes 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 = 130; __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - /* "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.StringDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._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":132 - * self.inst.get().Add(input_in_0, input_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("__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_r = -1; - __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) { - const char *__pyx_v_input_in_0; - const char *__pyx_v_input_in_1; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - const char *__pyx_t_2; +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_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; + 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("__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' - * cdef const_char * input_in_0 = 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 = 133; __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; } - #endif - - /* "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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 - */ - #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;} + __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;} + } + __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); + 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 = 167; __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_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 = 167; __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_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 = 167; __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_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 = 167; __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; } } - #endif - - /* "pykeyvi.pyx":135 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef const_char * input_in_1 = in_1 - * self.inst.get().__setitem__(input_in_0, input_in_1) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":136 - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 # <<<<<<<<<<<<<< - * self.inst.get().__setitem__(input_in_0, input_in_1) - * - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_1 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":137 - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 - * self.inst.get().__setitem__(input_in_0, input_in_1) # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): - */ - try { - __pyx_v_self->inst.get()->__setitem__(__pyx_v_input_in_0, __pyx_v_input_in_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __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; } - - /* "pykeyvi.pyx":132 - * self.inst.get().Add(input_in_0, input_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' - */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ - __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.StringDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __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_22JsonDictionaryCompiler_7_init_2_5generator8(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":139 - * self.inst.get().__setitem__(input_in_0, input_in_1) - * - * 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_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 PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_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("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)); + 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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._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; } -static PyObject *__pyx_pf_7pykeyvi_24StringDictionaryCompiler_14WriteToFile(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_in_0; +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_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 - int __pyx_t_1; - const char *__pyx_t_2; + 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("WriteToFile", 0); - - /* "pykeyvi.pyx":140 - * - * 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 = 140; __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_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;} + } + __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); + 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 = 167; __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_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 = 167; __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_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 = 167; __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_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 = 167; __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; } } - #endif - - /* "pykeyvi.pyx":141 - * 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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":142 - * 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":139 - * self.inst.get().__setitem__(input_in_0, input_in_1) - * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - */ + /*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.WriteToFile", __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":144 - * self.inst.get().WriteToFile(input_in_0) - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self +/* "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_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("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_24StringDictionaryCompiler_16__enter__(((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_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; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); - - /* "pykeyvi.pyx":145 - * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + 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::JsonDictionaryCompiler *__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_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":144 - * self.inst.get().WriteToFile(input_in_0) + /* "pykeyvi.pyx":166 * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * 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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":148 - * - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + /* "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]() */ - -/* 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; - 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 = 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 = 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 = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; + #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 { - 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_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_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_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;} } - __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("__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.StringDictionaryCompiler.__exit__", __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); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -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; - 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); + #endif - /* "pykeyvi.pyx":149 - * - * def __exit__(self, type, value, traceback): - * self.Compile() # <<<<<<<<<<<<<< - * + /* "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' * + * 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_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))) { - __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 = 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 = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":148 - * - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + /* "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))) */ - - /* 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_r = NULL; + 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_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; + } 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_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; + + /* "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 + */ + __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); + + /* "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))) + */ + } + __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 + * + */ + __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_v_self->inst = boost::shared_ptr (__pyx_t_16); + + /* "pykeyvi.pyx":173 + * 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":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' + */ + + /* 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_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":152 - * +/* "pykeyvi.pyx":175 + * del v1 * - * def Compile(self, *args): # <<<<<<<<<<<<<< + * def __init__(self, *args): # <<<<<<<<<<<<<< * if not args: - * with nogil: + * self._init_0(*args) */ /* 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) { +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; - PyObject *__pyx_r = 0; + int __pyx_r; __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_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_20Compile(((struct __pyx_obj_7pykeyvi_StringDictionaryCompiler *)__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___2generator9(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -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; - __Pyx_RefNannySetupContext("Compile", 0); - - /* "pykeyvi.pyx":153 - * - * 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 - * - */ - __pyx_v_self->inst.get()->Compile(); - } - - /* "pykeyvi.pyx":154 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return +/* "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: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - /* "pykeyvi.pyx":156 - * 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; +static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_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_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_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; } - /* "pykeyvi.pyx":158 - * 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":159 - * - * 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":160 - * 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":159 - * - * 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":152 - * - * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: - */ - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; + __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":163 - * - * - * 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; - __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)); - - /* function exit code */ - __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_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; - __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; + 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_RefNannySetupContext("SetManifest", 0); - - /* "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 = 164; __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_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 = __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; - 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_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_3, function); + __Pyx_DECREF_SET(__pyx_t_2, 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 = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + 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_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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_manifest); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __Pyx_GIVEREF(__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 = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_m = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pykeyvi.pyx":165 - * def SetManifest(self, manifest): - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< - * - * cdef class JsonDictionaryCompiler: - */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_m); if (unlikely((!__pyx_t_5) && 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":163 - * - * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) - */ + __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; /* 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; } +static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator10(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":171 - * 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) { +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; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self)); + 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; + } /* 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 void __pyx_pf_7pykeyvi_22JsonDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":172 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":171 - * cdef shared_ptr[_JsonDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":175 - * - * - * 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_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; +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("__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)); + __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; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = -1; + __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 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) { - const char *__pyx_v_input_in_0; - const char *__pyx_v_input_in_1; +/* "pykeyvi.pyx":175 + * 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_9___init__ *__pyx_cur_scope; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - const char *__pyx_t_2; + 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("__setitem__", 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); /* "pykeyvi.pyx":176 * - * 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 const_char * input_in_0 = 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 = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "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 const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 + * 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_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 + __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":178 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef const_char * input_in_1 = in_1 - * self.inst.get().__setitem__(input_in_0, input_in_1) + /* "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) */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); + __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; - /* "pykeyvi.pyx":179 - * assert isinstance(in_1, bytes), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 # <<<<<<<<<<<<<< - * self.inst.get().__setitem__(input_in_0, input_in_1) + /* "pykeyvi.pyx":176 * + * def __init__(self, *args): + * if not args: # <<<<<<<<<<<<<< + * self._init_0(*args) + * elif (len(args)==1) and (isinstance(args[0], (int, long))): */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_1 = ((const char *)__pyx_t_2); + goto __pyx_L3; + } - /* "pykeyvi.pyx":180 - * cdef const_char * input_in_0 = in_0 - * cdef const_char * input_in_1 = in_1 - * self.inst.get().__setitem__(input_in_0, input_in_1) # <<<<<<<<<<<<<< - * - * def _init_0(self): + /* "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())): */ - try { - __pyx_v_self->inst.get()->__setitem__(__pyx_v_input_in_0, __pyx_v_input_in_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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 = 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":175 - * - * - * 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":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; - /* 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":182 - * self.inst.get().__setitem__(input_in_0, input_in_1) - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) - * + /* "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; + } -/* 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)); + /* "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) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "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; -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":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 _init_0(self): - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) # <<<<<<<<<<<<<< - * - * def _init_1(self, memory_limit ): + * def WriteToFile(self, bytes in_0 ): */ - try { - __pyx_t_1 = new keyvi::dictionary::JsonDictionaryCompiler(); - } catch(...) { - __Pyx_CppExn2PyErr(); + /*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_v_self->inst = boost::shared_ptr (__pyx_t_1); + __pyx_L3:; - /* "pykeyvi.pyx":182 - * self.inst.get().__setitem__(input_in_0, input_in_1) - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) + /* "pykeyvi.pyx":175 + * del v1 * + * 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_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_0", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __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_XGIVEREF(__pyx_r); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "pykeyvi.pyx":185 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) + * raise Exception('can not handle type of %s' % (args,)) * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* 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) { +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("_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("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)); /* 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_6_init_1(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_memory_limit) { +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; - int __pyx_t_3; - size_t __pyx_t_4; - keyvi::dictionary::JsonDictionaryCompiler *__pyx_t_5; + 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("WriteToFile", 0); /* "pykeyvi.pyx":186 * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * def WriteToFile(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) + * self.inst.get().WriteToFile((in_0)) */ #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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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:; + __pyx_t_1 = PyBytes_Check(__pyx_v_in_0); if (unlikely(!(__pyx_t_1 != 0))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_arg_memory_limit_wrong_type); + 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(memory_limit, (int, long)), 'arg memory_limit wrong type' + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< + * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * def _init_2(self, memory_limit , dict value_store_params ): + * def __enter__(self): */ - __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_5 = new keyvi::dictionary::JsonDictionaryCompiler(((size_t)__pyx_t_4)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); + __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)); /* "pykeyvi.pyx":185 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) + * raise Exception('can not handle type of %s' % (args,)) * - * def _init_1(self, memory_limit ): # <<<<<<<<<<<<<< - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ @@ -6787,7 +6596,7 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(struct __py __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_AddTraceback("pykeyvi.JsonDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6796,31 +6605,86 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_6_init_1(struct __py } /* "pykeyvi.pyx":190 - * self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler((memory_limit))) + * self.inst.get().WriteToFile((in_0)) + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self * - * 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; +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("_init_2 (wrapper)", 0); + __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 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ + +/* 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) { + 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("__exit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_memory_limit,&__pyx_n_s_value_store_params,0}; - PyObject* values[2] = {0,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; @@ -6829,359 +6693,183 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_9_init_2(PyObject *_ 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--; + 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_store_params)) != 0)) kw_args--; + 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;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_init_2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __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 = 190; __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 = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } 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_memory_limit = values[0]; - __pyx_v_value_store_params = ((PyObject*)values[1]); + __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("_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_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_L3_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __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 = 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); + __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); /* 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_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "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; +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 - 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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } - - /* 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; -} - -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_2generator11(__pyx_GeneratorObject *__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; + PyObject *__pyx_t_3 = 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 = 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_RefNannySetupContext("__exit__", 0); + + /* "pykeyvi.pyx":195 + * + * 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_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_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; + 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; } 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;} - #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;} - #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_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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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 = 195; __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 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ /* 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_2); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator12(__pyx_GeneratorObject *__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_14_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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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_gb_7pykeyvi_22JsonDictionaryCompiler_7_init_2_5generator12(__pyx_GeneratorObject *__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; - 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; +/* "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' + */ + +/* 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; + PyObject *__pyx_r = 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 = 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_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_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;} - #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;} - #endif + __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; } - } 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;} + 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;} } - break; } - __Pyx_GOTREF(__pyx_t_1); + 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_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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_key = values[0]; + __pyx_v_value = values[1]; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + 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); /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - 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_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "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' - */ - -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; +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_t_1; @@ -7189,294 +6877,178 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8_init_2(struct __py 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; + std::string __pyx_t_6; 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_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); + __Pyx_RefNannySetupContext("Add", 0); + __Pyx_INCREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_value); - /* "pykeyvi.pyx":191 + /* "pykeyvi.pyx":199 * - * 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 Add(self, key , value ): + * assert isinstance(key, (bytes, unicode)), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); + __pyx_t_2 = PyBytes_Check(__pyx_v_key); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; - __pyx_t_3 = PyLong_Check(__pyx_v_memory_limit); + __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_memory_limit_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __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 = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "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' # <<<<<<<<<<<<<< + /* "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' # <<<<<<<<<<<<<< * - * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() + * if isinstance(key, unicode): */ #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_2 = PyBytes_Check(__pyx_v_value); __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - goto __pyx_L6_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_L6_next_and:; - __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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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; - if (__pyx_t_3) { - goto __pyx_L7_next_and; + if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_L7_next_and:; - __pyx_t_4 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_7_init_2_3genexpr(((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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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_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)) { - 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;} + 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":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' + /* "pykeyvi.pyx":202 + * assert isinstance(value, (bytes, unicode)), '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 + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('UTF-8') + * cdef libcpp_string input_in_0 = key */ - try { - __pyx_t_6 = new std::map (); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_v1 = __pyx_t_6; + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "pykeyvi.pyx":195 + /* "pykeyvi.pyx":203 + * + * if isinstance(key, unicode): + * key = key.encode('UTF-8') # <<<<<<<<<<<<<< + * cdef libcpp_string input_in_0 = key * - * 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_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_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;} - #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;} - #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; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 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 + /* "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 */ - __pyx_t_13 = __pyx_convert_string_from_py_(__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_(__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 + /* "pykeyvi.pyx":204 + * if isinstance(key, unicode): + * key = key.encode('UTF-8') + * cdef libcpp_string input_in_0 = key # <<<<<<<<<<<<<< * - * 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 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 */ } - __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 + /* "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) # <<<<<<<<<<<<<< + * * */ - __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)); + __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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __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' + * 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 */ @@ -7485,704 +7057,500 @@ static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8_init_2(struct __py __pyx_L1_error:; __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_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_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":200 - * del v1 +/* "pykeyvi.pyx":213 * - * def __init__(self, *args): # <<<<<<<<<<<<<< + * + * def Compile(self, *args): # <<<<<<<<<<<<<< * if not args: - * self._init_0(*args) + * with nogil: */ /* 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) { +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; - int __pyx_r; + 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_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_10__init__(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_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_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "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; +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("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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("Compile", 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; -} + /* "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) { -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___2generator13(__pyx_GeneratorObject *__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_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 = 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); + /* "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() + */ } - 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;} - #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;} - #endif + + /* "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 + * + * 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":221 + * 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); } - } 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;} + + /* "pykeyvi.pyx":220 + * + * 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; } - break; + __pyx_L9:; } - __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_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pykeyvi.pyx":213 + * + * + * 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_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_22JsonDictionaryCompiler_8__init___5generator14(__pyx_GeneratorObject *__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_17_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +/* "pykeyvi.pyx":224 + * + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) + */ + +/* 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) { + 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__ *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } + __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_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___5generator14(__pyx_GeneratorObject *__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_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; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; 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 = 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_RefNannySetupContext("SetManifest", 0); + + /* "pykeyvi.pyx":225 + * + * 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_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_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_GOTREF(__pyx_t_3); __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;} - #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;} - #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_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_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_1 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __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 = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } 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_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_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_m = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pykeyvi.pyx":226 + * def SetManifest(self, manifest): + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< + * + * 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 = 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;} + } + + /* "pykeyvi.pyx":224 + * + * + * def SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) + */ /* 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_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":200 - * del v1 +/* "pykeyvi.pyx":232 + * cdef shared_ptr[_Dictionary] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * 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; +/* 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) { + __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":233 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->inst.reset(); + + /* "pykeyvi.pyx":232 + * cdef shared_ptr[_Dictionary] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":236 + * + * + * 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("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)); + + /* 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_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 int __pyx_t_1; - int __pyx_t_2; + std::string __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; 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_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_RefNannySetupContext("LookupText", 0); + + /* "pykeyvi.pyx":237 + * + * 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 = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } - __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); + #endif - /* "pykeyvi.pyx":201 + /* "pykeyvi.pyx":239 + * 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))): + * cdef _MatchIteratorPair _r = self.inst.get().LookupText((in_0)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ - __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_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":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) + /* "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_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 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } + __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":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())): + /* "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_t_5 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_5); - if (unlikely(__pyx_t_5 == 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;} - } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = ((__pyx_t_6 == 1) != 0); - if (__pyx_t_1) { - goto __pyx_L5_next_and; - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_L5_next_and:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_7 = PyInt_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - goto __pyx_L7_next_or; - } else { - __pyx_t_1 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_L7_next_or:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_8 = PyLong_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = (__pyx_t_8 != 0); - __pyx_t_1 = __pyx_t_7; - __pyx_L6_bool_binop_done:; - __pyx_t_7 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_7; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "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_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_5, __pyx_t_4, 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_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L3; - } - - /* "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_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_6 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == -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_7 = ((__pyx_t_6 == 2) != 0); - if (__pyx_t_7) { - goto __pyx_L9_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L9_next_and:; - __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_8 = (__pyx_t_1 != 0); - if (!__pyx_t_8) { - goto __pyx_L12_next_or; - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L11_bool_binop_done; - } - __pyx_L12_next_or:; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_8 = PyLong_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = (__pyx_t_8 != 0); - __pyx_t_7 = __pyx_t_1; - __pyx_L11_bool_binop_done:; - __pyx_t_1 = (__pyx_t_7 != 0); - if (__pyx_t_1) { - goto __pyx_L10_next_and; - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L8_bool_binop_done; - } - __pyx_L10_next_and:; - __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_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - goto __pyx_L13_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L13_next_and:; - __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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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; - if (__pyx_t_7) { - goto __pyx_L14_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L14_next_and:; - __pyx_t_3 = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_8__init___3genexpr(((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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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_7; - __pyx_L8_bool_binop_done:; - if (__pyx_t_2) { + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "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,)) + /* "pykeyvi.pyx":242 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result + * */ - __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 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } - /*else*/ { + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":208 - * self._init_2(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":243 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * - * def WriteToFile(self, bytes in_0 ): + * def Lookup(self, bytes in_0 ): */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_5); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 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 = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "pykeyvi.pyx":200 - * del v1 + /* "pykeyvi.pyx":236 + * + * + * def LookupText(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) */ /* function exit code */ - __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_AddTraceback("pykeyvi.JsonDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pykeyvi.Dictionary.LookupText", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":210 - * raise Exception('can not handle type of %s' % (args,)) +/* "pykeyvi.pyx":245 + * return py_result * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Lookup(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_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) { +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("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)); + __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)); /* function exit code */ goto __pyx_L0; @@ -8193,154 +7561,135 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_13WriteToFile(PyObje return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_22JsonDictionaryCompiler_12WriteToFile(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_in_0; +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 int __pyx_t_1; - const char *__pyx_t_2; + 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("WriteToFile", 0); + __Pyx_RefNannySetupContext("Lookup", 0); - /* "pykeyvi.pyx":211 + /* "pykeyvi.pyx":246 * - * def WriteToFile(self, bytes in_0 ): + * def Lookup(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) + * + * 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":212 - * def WriteToFile(self, bytes in_0 ): + /* "pykeyvi.pyx":248 * 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) * + * 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_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Lookup(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":213 - * 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) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":249 * - * def __enter__(self): + * 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_v_self->inst.get()->WriteToFile(__pyx_v_input_in_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 = 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":210 - * raise Exception('can not handle type of %s' % (args,)) + /* "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 * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< + */ + __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; + + /* "pykeyvi.pyx":245 + * return py_result + * + * def Lookup(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.JsonDictionaryCompiler.WriteToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.Dictionary.Lookup", __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":215 - * self.inst.get().WriteToFile(input_in_0) - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self +/* "pykeyvi.pyx":254 + * return py_result * + * 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_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":216 - * - * 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":215 - * 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":219 - * - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() - * - */ - -/* 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) { - 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_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("__exit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("_GetNear_0 (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_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 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; @@ -8349,137 +7698,215 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_17__exit__(PyObject 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_in_0)) != 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--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minimum_prefix_length)) != 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;} + __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, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + 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) != 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_in_0 = ((PyObject*)values[0]); + __pyx_v_minimum_prefix_length = 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 = 219; __pyx_clineno = __LINE__; goto __pyx_L3_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.JsonDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_0", __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); + 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_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_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 - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = 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("__exit__", 0); + __Pyx_RefNannySetupContext("_GetNear_0", 0); - /* "pykeyvi.pyx":220 + /* "pykeyvi.pyx":255 * - * def __exit__(self, type, value, traceback): - * self.Compile() # <<<<<<<<<<<<<< + * 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 + + /* "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' # <<<<<<<<<<<<<< * * */ - __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); + #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 = 256; __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 = 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;} + #endif + + /* "pykeyvi.pyx":259 + * + * + * 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 = 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;} + 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 = 259; __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; + __pyx_v__r = __pyx_t_6; - /* "pykeyvi.pyx":219 + /* "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 * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":263 + * 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":254 + * return py_result * + * 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.__exit__", __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((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":223 - * +/* "pykeyvi.pyx":265 + * return py_result * - * 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 _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_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; +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("Add (wrapper)", 0); + __Pyx_RefNannySetupContext("_GetNear_1 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0}; - PyObject* values[2] = {0,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; @@ -8488,252 +7915,242 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_19Add(PyObject *__py 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_in_0)) != 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_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--; else { - __Pyx_RaiseArgtupleInvalid("Add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_GetNear_1", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __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;} + 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;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } 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_key = values[0]; - __pyx_v_value = values[1]; + __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("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_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_L3_error:; - __Pyx_AddTraceback("pykeyvi.JsonDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_1", __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); + 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); /* 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_18Add(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { - const char *__pyx_v_input_in_0; - const char *__pyx_v_input_in_1; +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 int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - const char *__pyx_t_6; + 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("Add", 0); - __Pyx_INCREF(__pyx_v_key); - __Pyx_INCREF(__pyx_v_value); + __Pyx_RefNannySetupContext("_GetNear_1", 0); - /* "pykeyvi.pyx":224 + /* "pykeyvi.pyx":266 * - * 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 _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;} + } + } + #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 = PyBytes_Check(__pyx_v_key); + __pyx_t_2 = PyInt_Check(__pyx_v_minimum_prefix_length); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; - __pyx_t_3 = PyUnicode_Check(__pyx_v_key); + __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_in_0_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 - /* "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' # <<<<<<<<<<<<<< + /* "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' # <<<<<<<<<<<<<< + * * - * if isinstance(key, unicode): */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyBytes_Check(__pyx_v_value); + __pyx_t_2 = PyInt_Check(__pyx_v_greedy); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L6_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_L6_next_or:; - __pyx_t_3 = PyUnicode_Check(__pyx_v_value); + __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_in_1_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} } } #endif - /* "pykeyvi.pyx":227 - * assert isinstance(value, (bytes, unicode)), 'arg in_1 wrong type' - * - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('UTF-8') - * cdef const_char * 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 + /* "pykeyvi.pyx":272 * - * if isinstance(key, unicode): - * key = key.encode('UTF-8') # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = key * + * 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_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; - goto __pyx_L7; + __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;} } - __pyx_L7:; - - /* "pykeyvi.pyx":229 - * if isinstance(key, unicode): - * key = key.encode('UTF-8') - * cdef const_char * input_in_0 = key # <<<<<<<<<<<<<< - * - * if isinstance(value, unicode): - */ - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_6); + __pyx_v__r = __pyx_t_7; - /* "pykeyvi.pyx":231 - * cdef const_char * input_in_0 = key + /* "pykeyvi.pyx":273 * - * if isinstance(value, unicode): # <<<<<<<<<<<<<< - * value = value.encode('UTF-8') - * cdef const_char * input_in_1 = value + * 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_2 = PyUnicode_Check(__pyx_v_value); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __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":232 - * - * if isinstance(value, unicode): - * value = value.encode('UTF-8') # <<<<<<<<<<<<<< - * cdef const_char * input_in_1 = value - * + /* "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_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; - goto __pyx_L8; - } - __pyx_L8:; + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":233 - * if isinstance(value, unicode): - * value = value.encode('UTF-8') - * cdef const_char * input_in_1 = value # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":275 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result * - * self.inst.get().Add(input_in_0, input_in_1) */ - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_value); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_1 = ((const char *)__pyx_t_6); + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":235 - * cdef const_char * input_in_1 = value - * - * self.inst.get().Add(input_in_0, input_in_1) # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":276 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * + * def GetNear(self, *args): */ - 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_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "pykeyvi.pyx":223 - * + /* "pykeyvi.pyx":265 + * return py_result * - * 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 _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_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_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":238 - * +/* "pykeyvi.pyx":278 + * return py_result * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: + * 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_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) { +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("Compile (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Compile", 0))) return NULL; + __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_22JsonDictionaryCompiler_20Compile(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), __pyx_v_args); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_10GetNear(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); @@ -8741,466 +8158,781 @@ static PyObject *__pyx_pw_7pykeyvi_22JsonDictionaryCompiler_21Compile(PyObject * 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; +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; - int __pyx_t_2; - __Pyx_RefNannySetupContext("Compile", 0); - - /* "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) { - - /* "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:*/ { + 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("GetNear", 0); - /* "pykeyvi.pyx":241 - * if not args: - * with nogil: - * self.inst.get().Compile() # <<<<<<<<<<<<<< - * return + /* "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_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:; - } - } + __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":242 - * with nogil: - * self.inst.get().Compile() - * return # <<<<<<<<<<<<<< - * - * cdef void* callback = args[0] + /* "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_r = Py_None; __Pyx_INCREF(Py_None); + __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":244 - * return + /* "pykeyvi.pyx":279 * - * cdef void* callback = args[0] # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) + * 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_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) - * + /* "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: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { + __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_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":246 - * cdef void* callback = args[0] - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< - * - * + /* "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,)) */ - __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); - } + __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; + goto __pyx_L0; - /* "pykeyvi.pyx":245 - * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) - * + /* "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: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L9; - } - __pyx_L9:; - } } - /* "pykeyvi.pyx":238 + /* "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 Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: + * 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_r = Py_None; __Pyx_INCREF(Py_None); + __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_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":249 +/* "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' * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) */ /* 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_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("SetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_22JsonDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); + __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_22JsonDictionaryCompiler_22SetManifest(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { - PyObject *__pyx_v_m = NULL; +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 - 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_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("SetManifest", 0); + __Pyx_RefNannySetupContext("_init_0", 0); - /* "pykeyvi.pyx":250 + /* "pykeyvi.pyx":287 * - * def SetManifest(self, manifest): - * m = json.dumps(manifest) # <<<<<<<<<<<<<< - * self.inst.get().SetManifestFromString(m) + * def _init_0(self, bytes filename ): + * assert isinstance(filename, bytes), 'arg filename wrong type' # <<<<<<<<<<<<<< * + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) */ - __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 = __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_3, function); + #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;} } } - 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 = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_manifest); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __Pyx_GIVEREF(__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_3); __pyx_t_3 = 0; - __pyx_v_m = __pyx_t_1; - __pyx_t_1 = 0; + #endif - /* "pykeyvi.pyx":251 - * def SetManifest(self, manifest): - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":289 + * assert isinstance(filename, bytes), 'arg filename wrong type' * - * cdef class Dictionary: + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename))) # <<<<<<<<<<<<<< + * + * def _init_1(self, bytes filename , int in_1 ): */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_m); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_v_self->inst.get()->SetManifestFromString(__pyx_t_5); + __pyx_t_3 = new keyvi::dictionary::Dictionary(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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":249 + /* "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' * - * 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.JsonDictionaryCompiler.SetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary._init_0", __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":257 - * cdef shared_ptr[_Dictionary] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() +/* "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 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 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("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_10Dictionary___dealloc__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __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; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 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 = 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 void __pyx_pf_7pykeyvi_10Dictionary___dealloc__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self) { +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 - __Pyx_RefNannySetupContext("__dealloc__", 0); + 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":258 + /* "pykeyvi.pyx":292 * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< + * 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); + 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;} + } + } + #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' # <<<<<<<<<<<<<< * * */ - __pyx_v_self->inst.reset(); + #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; + } + 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;} + } + } + #endif - /* "pykeyvi.pyx":257 - * cdef shared_ptr[_Dictionary] inst + /* "pykeyvi.pyx":296 * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() * + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) # <<<<<<<<<<<<<< + * + * def __init__(self, *args): + */ + __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)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + + /* "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' */ /* 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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "pykeyvi.pyx":261 +/* "pykeyvi.pyx":298 + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) * - * - * def LookupText(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * def __init__(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * self._init_0(*args) */ /* 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; +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("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)); + __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_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 = NULL; - __pyx_L0:; + __Pyx_XDECREF(__pyx_v_args); __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) { - const char *__pyx_v_input_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_10Dictionary_16__init__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - const char *__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; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("LookupText", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":262 + /* "pykeyvi.pyx":299 * - * def LookupText(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().LookupText(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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + * 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); + 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":263 - * def LookupText(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().LookupText(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + /* "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_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__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 = 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":264 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().LookupText(input_in_0) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() + /* "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_v__r = __pyx_v_self->inst.get()->LookupText(__pyx_v_input_in_0); + goto __pyx_L3; + } - /* "pykeyvi.pyx":265 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().LookupText(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() + /* "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_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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; + __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) { + } 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 = 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":266 - * cdef _MatchIteratorPair _r = self.inst.get().LookupText(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() - * return py_result + /* "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_v_py_result->it = __pyx_v__r.begin(); + __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":267 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result - * + /* "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_v_py_result->end = __pyx_v__r.end(); + goto __pyx_L3; + } - /* "pykeyvi.pyx":268 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":304 + * self._init_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * - * def Lookup(self, bytes in_0 ): + * def Get(self, bytes in_0 ): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + /*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_L3:; - /* "pykeyvi.pyx":261 - * + /* "pykeyvi.pyx":298 + * self.inst = shared_ptr[_Dictionary](new _Dictionary((filename), (<_loading_strategy_types>in_1))) * - * def LookupText(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * 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.Dictionary.LookupText", __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":270 - * return py_result +/* "pykeyvi.pyx":306 + * raise Exception('can not handle type of %s' % (args,)) * - * def Lookup(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Get(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_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) { +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("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)); + __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)); /* function exit code */ goto __pyx_L0; @@ -9211,71 +8943,61 @@ static PyObject *__pyx_pw_7pykeyvi_10Dictionary_5Lookup(PyObject *__pyx_v_self, return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_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; __Pyx_RefNannyDeclarations int __pyx_t_1; - const char *__pyx_t_2; + 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("Lookup", 0); + __Pyx_RefNannySetupContext("Get", 0); - /* "pykeyvi.pyx":271 + /* "pykeyvi.pyx":307 * - * def Lookup(self, bytes in_0 ): + * def Get(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().Lookup(input_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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":272 - * def Lookup(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().Lookup(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":273 + /* "pykeyvi.pyx":309 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().Lookup(input_in_0) # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().Get((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->Lookup(__pyx_v_input_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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Get(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":274 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().Lookup(input_in_0) + /* "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 *)((PyObject*)__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_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 = 274; __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 = 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":275 - * cdef _MatchIteratorPair _r = self.inst.get().Lookup(input_in_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() @@ -9283,7 +9005,7 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyv */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":276 + /* "pykeyvi.pyx":312 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< @@ -9292,30 +9014,30 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyv */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":277 + /* "pykeyvi.pyx":313 * py_result.it = _r.begin() * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< * - * def _GetNear_0(self, bytes in_0 , minimum_prefix_length ): + * 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":270 - * return py_result + /* "pykeyvi.pyx":306 + * raise Exception('can not handle type of %s' % (args,)) * - * def Lookup(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Get(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_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.Lookup", __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); @@ -9324,28 +9046,29 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_4Lookup(struct __pyx_obj_7pykeyv return __pyx_r; } -/* "pykeyvi.pyx":279 +/* "pykeyvi.pyx":315 * return py_result * - * 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 get (self, key, default = None): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* 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_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("_GetNear_0 (wrapper)", 0); + __Pyx_RefNannySetupContext("get (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_minimum_prefix_length,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); @@ -9358,2758 +9081,2238 @@ static PyObject *__pyx_pw_7pykeyvi_10Dictionary_7_GetNear_0(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_key)) != 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 (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, "_GetNear_0") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __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 = 315; __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_minimum_prefix_length = values[1]; + __pyx_v_key = values[0]; + __pyx_v_default = 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_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._GetNear_0", __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 = 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); + __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_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; +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; - size_t __pyx_t_5; - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_t_6; - PyObject *__pyx_t_7 = 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("_GetNear_0", 0); + __Pyx_RefNannySetupContext("get", 0); + __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":280 + /* "pykeyvi.pyx":316 * - * 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 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":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' + * + */ + __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_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_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":316 + * + * 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":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)])) */ #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 = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "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' # <<<<<<<<<<<<<< + /* "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(): */ - #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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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;} - } - } - #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 = 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":284 + /* "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); + if (__pyx_t_2) { + + /* "pykeyvi.pyx":323 * - * cdef _MatchIteratorPair _r = self.inst.get().GetNear((in_0), (minimum_prefix_length)) # <<<<<<<<<<<<<< - * 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_(__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_v__r = __pyx_t_6; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_default); + __pyx_r = __pyx_v_default; + goto __pyx_L0; - /* "pykeyvi.pyx":285 + /* "pykeyvi.pyx":322 + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) * - * 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() + * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< + * return default + * cdef Match py_result = Match.__new__(Match) */ - __pyx_t_7 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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() + /* "pykeyvi.pyx":324 + * 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 = 324; __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; - /* "pykeyvi.pyx":287 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":325 + * 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":288 - * py_result.it = _r.begin() - * py_result.end = _r.end() + /* "pykeyvi.pyx":326 + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r * return py_result # <<<<<<<<<<<<<< * - * def _GetNear_1(self, bytes in_0 , minimum_prefix_length , greedy ): + * 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":279 + /* "pykeyvi.pyx":315 * return py_result * - * 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 get (self, key, default = None): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.Dictionary._GetNear_0", __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":290 +/* "pykeyvi.pyx":328 * 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' + * def __contains__(self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* 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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 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("_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 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); + __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 */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -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; +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; 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; + 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("_GetNear_1", 0); + __Pyx_RefNannySetupContext("__contains__", 0); + __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":291 + /* "pykeyvi.pyx":329 + * + * def __contains__(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * - * 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 + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "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' + /* "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' */ - #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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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 + __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":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' # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":329 * + * def __contains__(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * */ - #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) { - goto __pyx_L6_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_L6_next_or:; - __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":297 + /* "pykeyvi.pyx":332 + * key = key.encode('utf-8') * + * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * 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() + * return self.inst.get().Contains(key) */ - __pyx_t_4 = __pyx_convert_string_from_py_(__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;} + #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 = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } - __pyx_v__r = __pyx_t_7; - - /* "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_8 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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":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_v_py_result->it = __pyx_v__r.begin(); + #endif - /* "pykeyvi.pyx":300 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result + /* "pykeyvi.pyx":334 + * assert isinstance(key, bytes), 'arg in_0 wrong type' * - */ - __pyx_v_py_result->end = __pyx_v__r.end(); - - /* "pykeyvi.pyx":301 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< + * return self.inst.get().Contains(key) # <<<<<<<<<<<<<< * - * def GetNear(self, *args): + * def __len__(self): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_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 = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_v_self->inst.get()->Contains(__pyx_t_5); goto __pyx_L0; - /* "pykeyvi.pyx":290 + /* "pykeyvi.pyx":328 * 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' + * def __contains__(self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* function exit code */ __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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pykeyvi.Dictionary.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_key); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":303 - * return py_result +/* "pykeyvi.pyx":336 + * return self.inst.get().Contains(key) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.inst.get().GetSize() * - * 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 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("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); + __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_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_10GetNear(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; +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 - int __pyx_t_1; - 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; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetNear", 0); + __Pyx_RefNannySetupContext("__len__", 0); - /* "pykeyvi.pyx":304 + /* "pykeyvi.pyx":337 * - * 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 = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 2) != 0); - if (__pyx_t_3) { - goto __pyx_L5_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_L5_next_and:; - __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) { - goto __pyx_L6_next_and; - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; - } - __pyx_L6_next_and:; - __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) { - goto __pyx_L8_next_or; - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L7_bool_binop_done; - } - __pyx_L8_next_or:; - __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_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 = PySequence_Tuple(__pyx_v_args); 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_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = __pyx_t_8; - __pyx_t_8 = 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: - */ - __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) { - goto __pyx_L10_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L9_bool_binop_done; - } - __pyx_L10_next_and:; - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_8); - __pyx_t_3 = PyBytes_Check(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_5 = (__pyx_t_3 != 0); - if (__pyx_t_5) { - goto __pyx_L11_next_and; - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L11_next_and:; - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_8); - __pyx_t_3 = PyInt_Check(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = (__pyx_t_3 != 0); - if (!__pyx_t_6) { - goto __pyx_L14_next_or; - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L13_bool_binop_done; - } - __pyx_L14_next_or:; - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_8); - __pyx_t_6 = PyLong_Check(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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) { - goto __pyx_L12_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L9_bool_binop_done; - } - __pyx_L12_next_and:; - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_v_args, 2); - __Pyx_INCREF(__pyx_t_8); - __pyx_t_5 = PyInt_Check(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (!__pyx_t_6) { - goto __pyx_L16_next_or; - } else { - __pyx_t_3 = __pyx_t_6; - goto __pyx_L15_bool_binop_done; - } - __pyx_L16_next_or:; - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_v_args, 2); - __Pyx_INCREF(__pyx_t_8); - __pyx_t_6 = PyLong_Check(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetNear_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PySequence_Tuple(__pyx_v_args); 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_8, __pyx_t_7, 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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "pykeyvi.pyx":309 - * return self._GetNear_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + * def __len__(self): + * return self.inst.get().GetSize() # <<<<<<<<<<<<<< * - * def _init_0(self, bytes filename ): + * def __getitem__ (self, key): */ - __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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __Pyx_GIVEREF(__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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __Pyx_GIVEREF(__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;} - } + __pyx_r = __pyx_v_self->inst.get()->GetSize(); + goto __pyx_L0; - /* "pykeyvi.pyx":303 - * return py_result + /* "pykeyvi.pyx":336 + * return self.inst.get().Contains(key) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.inst.get().GetSize() * - * 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_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetNear", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":311 - * raise Exception('can not handle type of %s' % (args,)) +/* "pykeyvi.pyx":339 + * return self.inst.get().GetSize() * - * def _init_0(self, bytes filename ): # <<<<<<<<<<<<<< - * assert isinstance(filename, bytes), 'arg filename wrong type' - * cdef const_char * input_filename = filename + * def __getitem__ (self, key): # <<<<<<<<<<<<<< + * if isinstance(key, unicode): + * key = key.encode('utf-8') */ /* 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; +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("_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)); + __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 */ - 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) { - const char *__pyx_v_input_filename; +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; - const char *__pyx_t_2; - keyvi::dictionary::Dictionary *__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", 0); + __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":312 + /* "pykeyvi.pyx":340 + * + * def __getitem__ (self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * - * def _init_0(self, bytes filename ): - * assert isinstance(filename, bytes), 'arg filename wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_filename = filename - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_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 = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "pykeyvi.pyx":313 - * def _init_0(self, bytes filename ): - * assert isinstance(filename, bytes), 'arg filename wrong type' - * cdef const_char * input_filename = filename # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename)) + /* "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_2 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_filename = ((const char *)__pyx_t_2); + __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":314 - * assert isinstance(filename, bytes), 'arg filename wrong type' - * cdef const_char * input_filename = filename - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":340 + * + * def __getitem__ (self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode('utf-8') * - * def _init_1(self, bytes filename , int in_1 ): */ - try { - __pyx_t_3 = new keyvi::dictionary::Dictionary(__pyx_v_input_filename); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__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); - /* "pykeyvi.pyx":311 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":343 + * key = key.encode('utf-8') * - * def _init_0(self, bytes filename ): # <<<<<<<<<<<<<< - * assert isinstance(filename, bytes), 'arg filename wrong type' - * cdef const_char * input_filename = filename + * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * + * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) */ - - /* 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":316 - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_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 = 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, "_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; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + #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;} } - __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("_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.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 = 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); + #endif - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "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)]))); -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) { - const char *__pyx_v_input_filename; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - const char *__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":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) { - /* "pykeyvi.pyx":317 + /* "pykeyvi.pyx":348 * - * 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 const_char * input_filename = filename + * if _r.get().IsEmpty(): + * raise KeyError(key) # <<<<<<<<<<<<<< + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r */ - #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 = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif + __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":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' # <<<<<<<<<<<<<< - * cdef const_char * input_filename = filename + /* "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) */ - #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; - } - 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 = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } } - #endif - /* "pykeyvi.pyx":319 - * 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 const_char * input_filename = filename # <<<<<<<<<<<<<< - * - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename, (<_loading_strategy_types>in_1))) + /* "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_2 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_filename = ((const char *)__pyx_t_2); + __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":321 - * cdef const_char * input_filename = filename + /* "pykeyvi.pyx":350 + * raise KeyError(key) + * cdef Match py_result = Match.__new__(Match) + * py_result.inst = _r # <<<<<<<<<<<<<< + * return py_result * - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename, (<_loading_strategy_types>in_1))) # <<<<<<<<<<<<<< + */ + __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 __init__(self, *args): + * def _key_iterator_wrapper(self, iterator): */ - try { - __pyx_t_3 = new keyvi::dictionary::Dictionary(__pyx_v_input_filename, ((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); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "pykeyvi.pyx":316 - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename)) + /* "pykeyvi.pyx":339 + * return self.inst.get().GetSize() * - * 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' + * 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_AddTraceback("pykeyvi.Dictionary._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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":323 - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename, (<_loading_strategy_types>in_1))) +/* "pykeyvi.pyx":353 + * return py_result * - * def __init__(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==1) and (isinstance(args[0], bytes)): - * self._init_0(*args) + * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetMatchedString() */ /* 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) { - PyObject *__pyx_v_args = 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("__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_10Dictionary_16__init__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), __pyx_v_args); + __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 */ - __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_7pykeyvi_10Dictionary_16__init__(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_args) { - 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_12__key_iterator_wrapper *__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; - PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "pykeyvi.pyx":324 - * - * 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 = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 1) != 0); - if (__pyx_t_3) { - goto __pyx_L5_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_L5_next_and:; - __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":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_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 = PySequence_Tuple(__pyx_v_args); 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_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L3; - } - - /* "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) { - goto __pyx_L7_next_and; - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_L7_next_and:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_5 = PyBytes_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { - goto __pyx_L8_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L6_bool_binop_done; - } - __pyx_L8_next_and:; - __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v_args, 1)); - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L16_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L16_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L15_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L15_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L14_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L14_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L13_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L13_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L12_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L12_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L11_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L11_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_5) { - goto __pyx_L10_next_or; - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_L10_next_or:; - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - __pyx_t_3 = __pyx_t_5; - __pyx_L9_bool_binop_done:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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":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_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PySequence_Tuple(__pyx_v_args); 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_7, __pyx_t_6, 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_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L3; + __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; } - /*else*/ { - - /* "pykeyvi.pyx":329 - * self._init_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< - * - * def Get(self, bytes in_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_INCREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __Pyx_GIVEREF(__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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __Pyx_GIVEREF(__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;} + __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; } - __pyx_L3:; - - /* "pykeyvi.pyx":323 - * self.inst = shared_ptr[_Dictionary](new _Dictionary(input_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_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.Dictionary.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pykeyvi.pyx":331 - * 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' - * cdef const_char * input_in_0 = in_0 - */ - -/* 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 = 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; __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.Dictionary._key_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; } -static PyObject *__pyx_pf_7pykeyvi_10Dictionary_18Get(struct __pyx_obj_7pykeyvi_Dictionary *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_in_0; - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +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; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - const char *__pyx_t_2; - PyObject *__pyx_t_3 = 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_RefNannySetupContext("Get", 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;} - /* "pykeyvi.pyx":332 + /* "pykeyvi.pyx":354 + * + * def _key_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetMatchedString() * - * def Get(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().Get(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 = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + 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;} } - #endif - - /* "pykeyvi.pyx":333 - * def Get(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().Get(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":334 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().Get(input_in_0) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_v__r = __pyx_v_self->inst.get()->Get(__pyx_v_input_in_0); - - /* "pykeyvi.pyx":335 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().Get(input_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 *)((PyObject*)__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 = 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":336 - * cdef _MatchIteratorPair _r = self.inst.get().Get(input_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(); + 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 + } + } 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_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":337 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result + /* "pykeyvi.pyx":355 + * def _key_iterator_wrapper(self, iterator): + * for m in iterator: + * yield m.GetMatchedString() # <<<<<<<<<<<<<< * + * def _value_iterator_wrapper(self, iterator): */ - __pyx_v_py_result->end = __pyx_v__r.end(); + __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; + } 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_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;} - /* "pykeyvi.pyx":338 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":354 + * + * def _key_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetMatchedString() * - * 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; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":331 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":353 + * return py_result * - * def Get(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetMatchedString() */ /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.Get", __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("_key_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __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_33generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":340 - * return py_result +/* "pykeyvi.pyx":357 + * yield m.GetMatchedString() * - * def get (self, key, default = None): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') + * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetRawValueAsString() */ /* 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_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)); + + /* 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; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get (wrapper)", 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); { - 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 = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } 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); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_key = values[0]; - __pyx_v_default = values[1]; + __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; } - 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 = 340; __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); /* 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_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; +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; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); PyObject *__pyx_t_4 = NULL; - const char *__pyx_t_5; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get", 0); - __Pyx_INCREF(__pyx_v_key); + __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":341 + /* "pykeyvi.pyx":358 + * + * def _value_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetRawValueAsString() * - * 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; - goto __pyx_L3; + 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;} } - __pyx_L3:; - - /* "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_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;} + 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); } - } - #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":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)])) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":359 + * def _value_iterator_wrapper(self, iterator): + * for m in iterator: + * yield m.GetRawValueAsString() # <<<<<<<<<<<<<< * - * if _r.get().IsEmpty(): + * def _item_iterator_wrapper(self, iterator): */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_5) && 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())[((const char *)__pyx_t_5)]))); + __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;} - /* "pykeyvi.pyx":347 - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) + /* "pykeyvi.pyx":358 * - * 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 + * def _value_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield m.GetRawValueAsString() * - * if _r.get().IsEmpty(): - * return default # <<<<<<<<<<<<<< - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_default); - __pyx_r = __pyx_v_default; - goto __pyx_L0; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":349 - * if _r.get().IsEmpty(): - * return default - * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< - * py_result.inst = _r - * return py_result - */ - __pyx_t_4 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)((PyObject*)__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":350 - * return default - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r # <<<<<<<<<<<<<< - * return py_result - * - */ - __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 __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":340 - * return py_result + /* "pykeyvi.pyx":357 + * yield m.GetMatchedString() * - * def get (self, key, default = None): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') + * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield m.GetRawValueAsString() */ /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pykeyvi.Dictionary.get", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("_value_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_key); - __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":353 - * return py_result +/* "pykeyvi.pyx":361 + * yield m.GetRawValueAsString() * - * def __contains__(self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') + * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield (m.GetMatchedString(), m.GetRawValueAsString()) */ /* 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_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("__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("_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 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_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; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - 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("__contains__", 0); - __Pyx_INCREF(__pyx_v_key); - - /* "pykeyvi.pyx":354 - * - * 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":355 - * 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 = 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L3; + __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; } - __pyx_L3:; - - /* "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":359 - * assert isinstance(key, bytes), 'arg in_0 wrong type' - * - * return self.inst.get().Contains(key) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_5) && 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":353 - * return py_result - * - * 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_AddTraceback("pykeyvi.Dictionary.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); + __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":361 - * return self.inst.get().Contains(key) +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":362 * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.inst.get().GetSize() + * def _item_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield (m.GetMatchedString(), m.GetRawValueAsString()) * */ + 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;} + } + 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; -/* 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; - __Pyx_RefNannyDeclarations - __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":363 + * def _item_iterator_wrapper(self, iterator): + * for m in iterator: + * yield (m.GetMatchedString(), m.GetRawValueAsString()) # <<<<<<<<<<<<<< + * + * 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 = 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); + } + } + 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":362 * - * def __len__(self): - * return self.inst.get().GetSize() # <<<<<<<<<<<<<< + * def _item_iterator_wrapper(self, iterator): + * for m in iterator: # <<<<<<<<<<<<<< + * yield (m.GetMatchedString(), m.GetRawValueAsString()) * - * def __getitem__ (self, key): */ - __pyx_r = __pyx_v_self->inst.get()->GetSize(); - goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pykeyvi.pyx":361 - * return self.inst.get().Contains(key) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.inst.get().GetSize() + * yield m.GetRawValueAsString() * + * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< + * for m in iterator: + * yield (m.GetMatchedString(), m.GetRawValueAsString()) */ /* 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_L0:; + __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":364 - * return self.inst.get().GetSize() +/* "pykeyvi.pyx":365 + * yield (m.GetMatchedString(), m.GetRawValueAsString()) * - * def __getitem__ (self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') + * def GetAllKeys(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* 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) { +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("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_26__getitem__(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + __Pyx_RefNannySetupContext("GetAllKeys (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* 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; +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_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; - const char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - __Pyx_INCREF(__pyx_v_key); + __Pyx_RefNannySetupContext("GetAllKeys", 0); - /* "pykeyvi.pyx":365 - * - * def __getitem__ (self, key): - * if isinstance(key, unicode): # <<<<<<<<<<<<<< - * key = key.encode('utf-8') + /* "pykeyvi.pyx":366 * + * def GetAllKeys(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ - __pyx_t_1 = PyUnicode_Check(__pyx_v_key); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); - /* "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; - goto __pyx_L3; - } - __pyx_L3:; + /* "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 - * key = key.encode('utf-8') + * 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) * - * assert isinstance(key, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + */ + __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) # <<<<<<<<<<<<<< * - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) + * def GetAllValues(self): */ - #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 = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 + 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;} + __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_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_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":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)])) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":365 + * yield (m.GetMatchedString(), m.GetRawValueAsString()) * - * if _r.get().IsEmpty(): + * def GetAllKeys(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_5) && 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())[((const char *)__pyx_t_5)]))); - /* "pykeyvi.pyx":372 - * cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) + /* 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.GetAllKeys", __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":372 + * return self._key_iterator_wrapper(py_result) * - * if _r.get().IsEmpty(): # <<<<<<<<<<<<<< - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) + * def GetAllValues(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ - __pyx_t_2 = (__pyx_v__r.get()->IsEmpty() != 0); - if (__pyx_t_2) { - /* "pykeyvi.pyx":373 +/* 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 + __Pyx_RefNannySetupContext("GetAllValues (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +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; + 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); + + /* "pykeyvi.pyx":373 * - * if _r.get().IsEmpty(): - * raise KeyError(key) # <<<<<<<<<<<<<< - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r + * def GetAllValues(self): + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ - __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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_key); - __Pyx_GIVEREF(__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;} - } + __pyx_v__r = __pyx_v_self->inst.get()->GetAllItems(); /* "pykeyvi.pyx":374 - * if _r.get().IsEmpty(): - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) # <<<<<<<<<<<<<< - * py_result.inst = _r - * return py_result + * 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_3 = __pyx_tp_new_7pykeyvi_Match(((PyTypeObject *)((PyObject*)__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; + __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; /* "pykeyvi.pyx":375 - * raise KeyError(key) - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r # <<<<<<<<<<<<<< - * return py_result - * + * 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->inst = __pyx_v__r; + __pyx_v_py_result->it = __pyx_v__r.begin(); /* "pykeyvi.pyx":376 - * cdef Match py_result = Match.__new__(Match) - * py_result.inst = _r - * return py_result # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return self._value_iterator_wrapper(py_result) * - * def _key_iterator_wrapper(self, iterator): + */ + __pyx_v_py_result->end = __pyx_v__r.end(); + + /* "pykeyvi.pyx":377 + * 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_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); + __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; goto __pyx_L0; - /* "pykeyvi.pyx":364 - * return self.inst.get().GetSize() + /* "pykeyvi.pyx":372 + * return self._key_iterator_wrapper(py_result) * - * def __getitem__ (self, key): # <<<<<<<<<<<<<< - * if isinstance(key, unicode): - * key = key.encode('utf-8') + * 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.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetAllValues", __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_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":378 - * return py_result +/* "pykeyvi.pyx":379 + * return self._value_iterator_wrapper(py_result) * - * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetMatchedString() + * 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_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_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("_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("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_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; +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 + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + 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("_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; - } - __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } + __Pyx_RefNannySetupContext("GetAllItems", 0); - /* 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; -} + /* "pykeyvi.pyx":380 + * + * 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(); -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_30generator(__pyx_GeneratorObject *__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":381 + * 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 = 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; - /* "pykeyvi.pyx":379 - * - * def _key_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetMatchedString() - * + /* "pykeyvi.pyx":382 + * 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) */ - 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;} - #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;} - #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 = 379; __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; + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":380 - * def _key_iterator_wrapper(self, iterator): - * for m in iterator: - * yield m.GetMatchedString() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":383 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return self._item_iterator_wrapper(py_result) * - * 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;} + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":379 - * - * def _key_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetMatchedString() + /* "pykeyvi.pyx":384 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return self._item_iterator_wrapper(py_result) # <<<<<<<<<<<<<< * + * def GetManifest(self): */ + __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); + } } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + 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; + goto __pyx_L0; - /* "pykeyvi.pyx":378 - * return py_result + /* "pykeyvi.pyx":379 + * return self._value_iterator_wrapper(py_result) * - * def _key_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetMatchedString() + * def GetAllItems(self): # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_key_iterator_wrapper", __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_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XDECREF((PyObject *)__pyx_v_py_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_33generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":382 - * yield m.GetMatchedString() +/* "pykeyvi.pyx":386 + * return self._item_iterator_wrapper(py_result) * - * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetValue() + * def GetManifest(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r */ /* 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) { +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("_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)); + __Pyx_RefNannySetupContext("GetManifest (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_43GetManifest(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* 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_19__value_iterator_wrapper *__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 + 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_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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } + __Pyx_RefNannySetupContext("GetManifest", 0); - /* 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_GeneratorObject *__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() + /* "pykeyvi.pyx":387 * + * def GetManifest(self): + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() # <<<<<<<<<<<<<< + * cdef bytes py_result = _r + * import json */ - 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;} + 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;} } - 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;} - #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;} - #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 = 383; __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; + __pyx_v__r = __pyx_t_1; - /* "pykeyvi.pyx":384 - * def _value_iterator_wrapper(self, iterator): - * for m in iterator: - * yield m.GetValue() # <<<<<<<<<<<<<< - * - * def _item_iterator_wrapper(self, iterator): + /* "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_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;} + __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; - /* "pykeyvi.pyx":383 + /* "pykeyvi.pyx":389 + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r + * import json # <<<<<<<<<<<<<< + * return json.loads(py_result) * - * def _value_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield m.GetValue() + */ + __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); + } } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + 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; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "pykeyvi.pyx":382 - * yield m.GetMatchedString() + /* "pykeyvi.pyx":386 + * return self._item_iterator_wrapper(py_result) * - * def _value_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield m.GetValue() + * def GetManifest(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetManifestAsString() + * cdef bytes py_result = _r */ /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_value_iterator_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetManifest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XDECREF(__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_json); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_36generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":386 - * yield m.GetValue() +/* "pykeyvi.pyx":392 + * return json.loads(py_result) * - * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield (m.GetMatchedString(), m.GetValue()) + * def GetStatistics(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r */ /* 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_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 - __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("GetStatistics (wrapper)", 0); + __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); /* function exit code */ __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_20__item_iterator_wrapper *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +/* "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 - 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_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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_RefNannySetupContext("lambda8 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, ((PyObject *)__pyx_v_kv)); /* 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; } -static PyObject *__pyx_gb_7pykeyvi_10Dictionary_36generator2(__pyx_GeneratorObject *__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); +static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations 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_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; 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_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_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":387 - * - * def _item_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield (m.GetMatchedString(), m.GetValue()) - * - */ - 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; + __pyx_t_2 = PyList_Check(__pyx_v_kv); + if (__pyx_t_2) { } 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;} + __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; } - 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;} - #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;} - #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 = 387; __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":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); - } - } - 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); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__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":387 - * - * def _item_iterator_wrapper(self, iterator): - * for m in iterator: # <<<<<<<<<<<<<< - * yield (m.GetMatchedString(), m.GetValue()) - * - */ + __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pykeyvi.pyx":386 - * yield m.GetValue() - * - * def _item_iterator_wrapper(self, iterator): # <<<<<<<<<<<<<< - * for m in iterator: - * yield (m.GetMatchedString(), m.GetValue()) - */ + __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 */ - 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_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":390 - * yield (m.GetMatchedString(), m.GetValue()) +/* "pykeyvi.pyx":392 + * return json.loads(py_result) * - * def GetAllKeys(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * def GetStatistics(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r */ -/* 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) { - 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)); - - /* 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_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("GetAllKeys", 0); + __Pyx_RefNannySetupContext("GetStatistics", 0); - /* "pykeyvi.pyx":391 + /* "pykeyvi.pyx":393 * - * def GetAllKeys(self): - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() + * 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()->GetAllItems(); + __pyx_v__r = __pyx_v_self->inst.get()->GetStatistics(); - /* "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() + /* "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( */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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_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); - 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_v_py_result = ((PyObject*)__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) + /* "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], */ - __pyx_v_py_result->it = __pyx_v__r.begin(); + __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; - /* "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) - * + /* "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_v_py_result->end = __pyx_v__r.end(); + __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); - /* "pykeyvi.pyx":395 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return self._key_iterator_wrapper(py_result) # <<<<<<<<<<<<<< + /* "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")] + * )} + */ + __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); + + /* "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")] # <<<<<<<<<<<<<< + * )} * - * 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); + __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;} } - } - 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_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; + + /* "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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); - __Pyx_GIVEREF(((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_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; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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":390 - * yield (m.GetMatchedString(), m.GetValue()) + /* "pykeyvi.pyx":392 + * return json.loads(py_result) * - * def GetAllKeys(self): # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetAllItems() - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * def GetStatistics(self): # <<<<<<<<<<<<<< + * cdef libcpp_string _r = self.inst.get().GetStatistics() + * cdef bytes py_result = _r */ /* function exit code */ @@ -12118,955 +11321,731 @@ static PyObject *__pyx_pf_7pykeyvi_10Dictionary_37GetAllKeys(struct __pyx_obj_7p __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_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((PyObject *)__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_py_result); + __Pyx_XDECREF(__pyx_v_json); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":397 - * return self._key_iterator_wrapper(py_result) +/* "pykeyvi.pyx":405 + * cdef shared_ptr[_FsaTransform] 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) { - 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("GetAllValues (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_39GetAllValues(((struct __pyx_obj_7pykeyvi_Dictionary *)__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_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; +static void __pyx_pf_7pykeyvi_12FsaTransform___dealloc__(struct __pyx_obj_7pykeyvi_FsaTransform *__pyx_v_self) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - 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("__dealloc__", 0); - /* "pykeyvi.pyx":398 + /* "pykeyvi.pyx":406 * - * 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 *)((PyObject*)__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(__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) + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< * - */ - __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); - } - } - 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); - __Pyx_GIVEREF(((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; + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":397 - * return self._key_iterator_wrapper(py_result) + /* "pykeyvi.pyx":405 + * cdef shared_ptr[_FsaTransform] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * 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_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "pykeyvi.pyx":404 - * return self._value_iterator_wrapper(py_result) +/* "pykeyvi.pyx":409 + * + * + * def Normalize(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_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("GetAllItems (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_41GetAllItems(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __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)); /* 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) { - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +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 - 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("Normalize", 0); - /* "pykeyvi.pyx":405 + /* "pykeyvi.pyx":410 * - * 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() + * 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)) */ - __pyx_t_1 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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; + #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;} + } + } + #endif - /* "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) + /* "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_v_py_result->it = __pyx_v__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 = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Normalize(((std::string)__pyx_t_2)); - /* "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) + /* "pykeyvi.pyx":413 + * + * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + * py_result = _r # <<<<<<<<<<<<<< + * return py_result * */ - __pyx_v_py_result->end = __pyx_v__r.end(); + __pyx_v_py_result = ((std::string)__pyx_v__r); - /* "pykeyvi.pyx":409 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return self._item_iterator_wrapper(py_result) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":414 + * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + * py_result = _r + * return py_result # <<<<<<<<<<<<<< * - * def GetManifest(self): + * def __init__(self, Dictionary in_0 ): */ __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); - } - } - 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_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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_py_result)); - __Pyx_GIVEREF(((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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __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; - /* "pykeyvi.pyx":404 - * return self._value_iterator_wrapper(py_result) + /* "pykeyvi.pyx":409 + * + * + * def Normalize(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.FsaTransform.Normalize", __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":411 - * return self._item_iterator_wrapper(py_result) +/* "pykeyvi.pyx":416 + * return py_result * - * def GetManifest(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r + * 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_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; +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("GetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_43GetManifest(((struct __pyx_obj_7pykeyvi_Dictionary *)__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 = 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); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __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; - 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 - 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; + 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("GetManifest", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":412 + /* "pykeyvi.pyx":417 * - * def GetManifest(self): - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() # <<<<<<<<<<<<<< - * cdef bytes py_result = _r - * import json + * 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)) */ - 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;} + #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 = 417; __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_string_to_py_(__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_v_py_result = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + #endif - /* "pykeyvi.pyx":414 - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r - * import json # <<<<<<<<<<<<<< - * return json.loads(py_result) + /* "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)) * */ - __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; + __pyx_t_2 = __pyx_v_in_0->inst; + __pyx_v_input_in_0 = __pyx_t_2; - /* "pykeyvi.pyx":415 - * cdef bytes py_result = _r - * import json - * return json.loads(py_result) # <<<<<<<<<<<<<< + /* "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)) # <<<<<<<<<<<<<< * - * def GetStatistics(self): + * cdef class PrefixCompletion: */ - __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_3, function); - } - } - 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_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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_py_result); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_py_result); - __Pyx_GIVEREF(__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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + try { + __pyx_t_3 = new keyvi::transform::FsaTransform(__pyx_v_input_in_0); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __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; - goto __pyx_L0; + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":411 - * return self._item_iterator_wrapper(py_result) + /* "pykeyvi.pyx":416 + * return py_result * - * def GetManifest(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetManifestAsString() - * cdef bytes py_result = _r + * 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; + goto __pyx_L0; __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_r = NULL; + __Pyx_AddTraceback("pykeyvi.FsaTransform.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_json); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":417 - * return json.loads(py_result) +/* "pykeyvi.pyx":425 + * cdef shared_ptr[_PrefixCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * 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; +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("GetStatistics (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_10Dictionary_45GetStatistics(((struct __pyx_obj_7pykeyvi_Dictionary *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_PrefixCompletion *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "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")] - * )} +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(); -/* Python wrapper */ -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_7genexpr_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_kv); /*proto*/ -static PyMethodDef __pyx_mdef_7pykeyvi_10Dictionary_13GetStatistics_7genexpr_lambda1 = {"lambda1", (PyCFunction)__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_7genexpr_lambda1, METH_O, 0}; -static PyObject *__pyx_pw_7pykeyvi_10Dictionary_13GetStatistics_7genexpr_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_kv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_kv)); + /* "pykeyvi.pyx":425 + * cdef shared_ptr[_PrefixCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() + * + */ /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; +/* "pykeyvi.pyx":429 + * + * + * 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' + */ + +/* 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; - __Pyx_RefNannySetupContext("lambda1", 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) { - goto __pyx_L4_next_and; - } else { - __Pyx_INCREF(__pyx_v_kv); - __pyx_t_1 = __pyx_v_kv; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_and:; - __pyx_t_2 = PyList_Check(__pyx_v_kv); - if (__pyx_t_2) { - goto __pyx_L5_next_and; - } 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_L5_next_and:; - __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) { - goto __pyx_L6_next_and; - } 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_L6_next_and:; - __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; + 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 = 429; __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;} + } + } 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 = 429; __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 = 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); /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":417 - * return json.loads(py_result) - * - * def GetStatistics(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _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; +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) { + const char *__pyx_v_input_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; - 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_t_1; + int __pyx_t_2; + int __pyx_t_3; + const char *__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("GetStatistics", 0); + __Pyx_RefNannySetupContext("GetFuzzyCompletions", 0); - /* "pykeyvi.pyx":418 + /* "pykeyvi.pyx":430 * - * def GetStatistics(self): - * cdef libcpp_string _r = self.inst.get().GetStatistics() # <<<<<<<<<<<<<< - * cdef bytes py_result = _r - * import json + * 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 const_char * input_in_0 = in_0 */ - __pyx_v__r = __pyx_v_self->inst.get()->GetStatistics(); + #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 = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "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( + /* "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' # <<<<<<<<<<<<<< + * cdef const_char * input_in_0 = in_0 + * */ - __pyx_t_1 = __pyx_convert_string_to_py_(__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; + #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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "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], + /* "pykeyvi.pyx":432 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) */ - __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; + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - /* "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")] + /* "pykeyvi.pyx":434 + * cdef const_char * input_in_0 = in_0 + * + * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __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(__pyx_v_input_in_0, ((int)__pyx_t_5)); + + /* "pykeyvi.pyx":435 + * + * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_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(input_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 # <<<<<<<<<<<<<< + * + * def __init__(self, Dictionary in_0 ): */ __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - PyObject *__pyx_7genexpr__pyx_v_k = NULL; - PyObject *__pyx_7genexpr__pyx_v_v = NULL; - PyObject *__pyx_7genexpr__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); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; - /* "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")] - * )} + /* "pykeyvi.pyx":429 + * + * + * 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' */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7pykeyvi_10Dictionary_13GetStatistics_7genexpr_lambda1, 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":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")] # <<<<<<<<<<<<<< - * )} + /* function exit code */ + __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":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 */ - __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_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_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;} - #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;} - #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_7genexpr__pyx_v_s, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__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":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 = 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__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 = 421; __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 = 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; - 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;} - #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;} - #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:; +/* 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; + 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; } - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_7genexpr__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); - } + 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 (!__pyx_t_2) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_7genexpr__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); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_7genexpr__pyx_v_v); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_7genexpr__pyx_v_v); - __Pyx_GIVEREF(__pyx_7genexpr__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; + 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;} } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_7genexpr__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; + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_s); - goto __pyx_L12_exit_scope; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); - __Pyx_XDECREF(__pyx_7genexpr__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":417 - * return json.loads(py_result) - * - * def GetStatistics(self): # <<<<<<<<<<<<<< - * cdef libcpp_string _r = self.inst.get().GetStatistics() - * cdef bytes py_result = _r - */ + __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); /* 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_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("pykeyvi.Dictionary.GetStatistics", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_result); - __Pyx_XDECREF(__pyx_v_json); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":430 - * cdef shared_ptr[_FsaTransform] inst +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::PrefixCompletion *__pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "pykeyvi.pyx":441 * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() + * 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)) + */ + #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;} + } + } + #endif + + /* "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)) * */ + __pyx_t_2 = __pyx_v_in_0->inst; + __pyx_v_input_in_0 = __pyx_t_2; -/* 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":431 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * + /* "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)) # <<<<<<<<<<<<<< * + * def GetCompletions(self, bytes in_0 ): */ - __pyx_v_self->inst.reset(); + 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;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":430 - * cdef shared_ptr[_FsaTransform] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() + /* "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 */ /* 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":434 - * +/* "pykeyvi.pyx":445 + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) * - * def Normalize(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def GetCompletions(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_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) { +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("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)); + __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)); /* function exit code */ goto __pyx_L0; @@ -13077,291 +12056,326 @@ static PyObject *__pyx_pw_7pykeyvi_12FsaTransform_3Normalize(PyObject *__pyx_v_s 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_16PrefixCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { + const char *__pyx_v_input_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; + const char *__pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Normalize", 0); + __Pyx_RefNannySetupContext("GetCompletions", 0); - /* "pykeyvi.pyx":435 + /* "pykeyvi.pyx":446 * - * def Normalize(self, bytes in_0 ): + * def GetCompletions(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(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 = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":437 + /* "pykeyvi.pyx":447 + * def GetCompletions(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) # <<<<<<<<<<<<<< - * py_result = _r + * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + */ + __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((const char *)__pyx_t_2); + + /* "pykeyvi.pyx":448 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0); + + /* "pykeyvi.pyx":449 + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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(input_in_0) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() * return py_result */ - __pyx_t_2 = __pyx_convert_string_from_py_(__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)); + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":438 - * - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) - * py_result = _r # <<<<<<<<<<<<<< + /* "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 = ((std::string)__pyx_v__r); + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":439 - * cdef libcpp_string _r = self.inst.get().Normalize((in_0)) - * py_result = _r + /* "pykeyvi.pyx":452 + * py_result.it = _r.begin() + * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< * - * def __init__(self, Dictionary in_0 ): + * cdef class ForwardBackwardCompletion: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_string_to_py_(__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; + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":434 - * + /* "pykeyvi.pyx":445 + * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) * - * def Normalize(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def GetCompletions(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_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.FsaTransform.Normalize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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":441 - * return py_result +/* "pykeyvi.pyx":458 + * cdef shared_ptr[_ForwardBackwardCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * 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 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("__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 = 441; __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 = 441; __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 = 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); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __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 void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self) { __Pyx_RefNannyDeclarations - 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("__init__", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":442 + /* "pykeyvi.pyx":459 + * + * def __dealloc__(self): + * self.inst.reset() # <<<<<<<<<<<<<< + * * - * 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)) */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), ((PyObject*)__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;} - } - } - #endif + __pyx_v_self->inst.reset(); - /* "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)) + /* "pykeyvi.pyx":458 + * cdef shared_ptr[_ForwardBackwardCompletion] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ - __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)) # <<<<<<<<<<<<<< + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "pykeyvi.pyx":462 * - * cdef class PrefixCompletion: + * + * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 */ - 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 - */ +/* 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) { + 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)); /* function exit code */ - __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.FsaTransform.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":450 - * cdef shared_ptr[_PrefixCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() +static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { + const char *__pyx_v_input_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; + const char *__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", 0); + + /* "pykeyvi.pyx":463 * + * def _GetCompletions_0(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(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 = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif -/* 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)); + /* "pykeyvi.pyx":464 + * def _GetCompletions_0(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + */ + __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} + /* "pykeyvi.pyx":465 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0); -static void __pyx_pf_7pykeyvi_16PrefixCompletion___dealloc__(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); + /* "pykeyvi.pyx":466 + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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_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;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); + __pyx_t_3 = 0; - /* "pykeyvi.pyx":451 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":467 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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":468 + * 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":469 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * + * def _GetCompletions_1(self, bytes in_0 , in_1 ): */ - __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":450 - * cdef shared_ptr[_PrefixCompletion] inst + /* "pykeyvi.pyx":462 * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() * + * def _GetCompletions_0(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_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_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":454 - * +/* "pykeyvi.pyx":471 + * return py_result * - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): # <<<<<<<<<<<<<< + * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * assert isinstance(in_1, (int, long)), '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) { +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_max_edit_distance = 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("GetFuzzyCompletions (wrapper)", 0); + __Pyx_RefNannySetupContext("_GetCompletions_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_in_0,&__pyx_n_s_in_1,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -13378,13 +12392,13 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObj 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--; + 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 = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_GetCompletions_1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __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;} + 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;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -13393,18 +12407,18 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObj values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_in_0 = ((PyObject*)values[0]); - __pyx_v_max_edit_distance = values[1]; + __pyx_v_in_1 = 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_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_L3_error:; - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetFuzzyCompletions", __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 = 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); + 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); /* function exit code */ goto __pyx_L0; @@ -13415,7 +12429,7 @@ 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) { +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) { const char *__pyx_v_input_in_0; keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; @@ -13430,13 +12444,13 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetFuzzyCompletions", 0); + __Pyx_RefNannySetupContext("_GetCompletions_1", 0); - /* "pykeyvi.pyx":455 + /* "pykeyvi.pyx":472 * - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): + * def _GetCompletions_1(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' * cdef const_char * input_in_0 = in_0 */ #ifndef CYTHON_WITHOUT_ASSERTIONS @@ -13444,75 +12458,73 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":456 - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): + /* "pykeyvi.pyx":473 + * def _GetCompletions_1(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' # <<<<<<<<<<<<<< + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< * cdef const_char * input_in_0 = in_0 * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_max_edit_distance); + __pyx_t_2 = PyInt_Check(__pyx_v_in_1); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; - __pyx_t_3 = PyLong_Check(__pyx_v_max_edit_distance); + __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_max_edit_distance_wrong_type); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __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 = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":457 + /* "pykeyvi.pyx":474 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - /* "pykeyvi.pyx":459 + /* "pykeyvi.pyx":476 * cdef const_char * input_in_0 = in_0 * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __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(__pyx_v_input_in_0, ((int)__pyx_t_5)); + __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(__pyx_v_input_in_0, ((int)__pyx_t_5)); - /* "pykeyvi.pyx":460 + /* "pykeyvi.pyx":477 * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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 *)((PyObject*)__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_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 = 460; __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 = 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":461 - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) + /* "pykeyvi.pyx":478 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() # <<<<<<<<<<<<<< * py_result.end = _r.end() @@ -13520,7 +12532,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc */ __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":462 + /* "pykeyvi.pyx":479 * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() * py_result.end = _r.end() # <<<<<<<<<<<<<< @@ -13529,30 +12541,30 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc */ __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":463 + /* "pykeyvi.pyx":480 * py_result.it = _r.begin() * py_result.end = _r.end() * return py_result # <<<<<<<<<<<<<< * - * def __init__(self, Dictionary in_0 ): + * def GetCompletions(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":454 - * + /* "pykeyvi.pyx":471 + * return py_result * - * def GetFuzzyCompletions(self, bytes in_0 , max_edit_distance ): # <<<<<<<<<<<<<< + * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.GetFuzzyCompletions", __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); @@ -13561,31 +12573,244 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc return __pyx_r; } -/* "pykeyvi.pyx":465 +/* "pykeyvi.pyx":482 * 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 + * def GetCompletions(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_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; +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 + __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); + + /* 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; + __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_t_7; 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}; + __Pyx_RefNannySetupContext("GetCompletions", 0); + + /* "pykeyvi.pyx":483 + * + * 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) { + + /* "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) + */ + __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_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; + + /* "pykeyvi.pyx":483 + * + * 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":488 + * return self._GetCompletions_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + * + * 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 = 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;} + } + + /* "pykeyvi.pyx":482 + * return py_result + * + * def GetCompletions(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) + */ + + /* function exit code */ + __pyx_L1_error:; + __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_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":490 + * 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 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,&__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; @@ -13595,27 +12820,35 @@ static int __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__(PyObject *__pyx_v_self 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 = 465; __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 = 490; __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 = ((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 = 465; __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 = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.PrefixCompletion.__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), __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); + 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); /* function exit code */ goto __pyx_L0; @@ -13626,245 +12859,131 @@ static int __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__(PyObject *__pyx_v_self 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) { +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; boost::shared_ptr __pyx_t_2; - keyvi::dictionary::completion::PrefixCompletion *__pyx_t_3; + 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":466 + /* "pykeyvi.pyx":491 * - * def __init__(self, Dictionary 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 - * 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), ((PyObject*)__pyx_ptype_7pykeyvi_Dictionary)); + __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 = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":467 - * def __init__(self, Dictionary in_0 ): + /* "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 + */ + #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;} + } + } + #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 # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) - * + * 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":468 - * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' + /* "pykeyvi.pyx":494 + * assert isinstance(in_1, Dictionary), 'arg in_1 wrong type' * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) # <<<<<<<<<<<<<< + * cdef shared_ptr[_Dictionary] input_in_1 = in_1.inst # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_ForwardBackwardCompletion](new _ForwardBackwardCompletion(input_in_0, input_in_1)) * - * def GetCompletions(self, bytes in_0 ): + */ + __pyx_t_2 = __pyx_v_in_1->inst; + __pyx_v_input_in_1 = __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)) # <<<<<<<<<<<<<< + * + * cdef class loading_strategy_types: */ try { - __pyx_t_3 = new keyvi::dictionary::completion::PrefixCompletion(__pyx_v_input_in_0); + __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 = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":465 - * return py_result + /* "pykeyvi.pyx":490 + * raise Exception('can not handle type of %s' % (args,)) * - * def __init__(self, Dictionary in_0 ): # <<<<<<<<<<<<<< + * def __init__(self, Dictionary in_0 , Dictionary in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, Dictionary), 'arg in_0 wrong type' - * cdef shared_ptr[_Dictionary] input_in_0 = in_0.inst + * 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.PrefixCompletion.__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":470 - * self.inst = shared_ptr[_PrefixCompletion](new _PrefixCompletion(input_in_0)) +/* "pykeyvi.pyx":511 + * cdef shared_ptr[_CompletionDictionaryCompiler] inst + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def GetCompletions(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_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) { - const char *__pyx_v_input_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; - const char *__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 const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(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 = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":472 - * def GetCompletions(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":473 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0); - - /* "pykeyvi.pyx":474 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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 *)((PyObject*)__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(input_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' - * cdef const_char * input_in_0 = in_0 - */ - - /* 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) { +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_25ForwardBackwardCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)__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_25ForwardBackwardCompletion___dealloc__(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__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":484 + /* "pykeyvi.pyx":512 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -13873,8 +12992,8 @@ static void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __p */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":483 - * cdef shared_ptr[_ForwardBackwardCompletion] inst + /* "pykeyvi.pyx":511 + * cdef shared_ptr[_CompletionDictionaryCompiler] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -13885,159 +13004,138 @@ static void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __p __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":487 +/* "pykeyvi.pyx":515 * * - * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def __setitem__(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * assert isinstance(in_1, (int, long)), 'arg in_1 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 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("_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 = 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)); + __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)); /* 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_25ForwardBackwardCompletion_2_GetCompletions_0(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_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_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; - const char *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; + 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("_GetCompletions_0", 0); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "pykeyvi.pyx":488 + /* "pykeyvi.pyx":516 * - * def _GetCompletions_0(self, bytes in_0 ): + * def __setitem__(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * 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 = 488; __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":489 - * def _GetCompletions_0(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":490 + /* "pykeyvi.pyx":517 + * def __setitem__(self, bytes in_0 , in_1 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' # <<<<<<<<<<<<<< + * + * */ - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0); + #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 = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":491 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() + /* "pykeyvi.pyx":520 + * + * + * self.inst.get().__setitem__((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def Add(self, bytes in_0 , in_1 ): */ - __pyx_t_3 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); - __pyx_t_3 = 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 = 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;} + } - /* "pykeyvi.pyx":492 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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":493 - * 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":494 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< - * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; - - /* "pykeyvi.pyx":487 - * - * - * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + /* "pykeyvi.pyx":515 + * + * + * 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 = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_0", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__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":496 - * return py_result +/* "pykeyvi.pyx":522 + * self.inst.get().__setitem__((in_0), (in_1)) * - * def _GetCompletions_1(self, bytes 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' */ /* 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) { +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; @@ -14045,7 +13143,7 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_ int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_GetCompletions_1 (wrapper)", 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}; @@ -14066,11 +13164,11 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_ 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 = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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, "_GetCompletions_1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + 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; @@ -14083,14 +13181,14 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_ } 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 = 496; __pyx_clineno = __LINE__; goto __pyx_L3_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.ForwardBackwardCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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 = 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); + 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); /* function exit code */ goto __pyx_L0; @@ -14101,45 +13199,41 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_ 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) { - const char *__pyx_v_input_in_0; - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 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; int __pyx_t_2; int __pyx_t_3; - const char *__pyx_t_4; + 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("_GetCompletions_1", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":497 + /* "pykeyvi.pyx":523 * - * def _GetCompletions_1(self, bytes 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' - * cdef const_char * input_in_0 = 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 = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":498 - * def _GetCompletions_1(self, bytes in_0 , in_1 ): + /* "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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 + * * */ #ifndef CYTHON_WITHOUT_ASSERTIONS @@ -14147,310 +13241,212 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_ __pyx_t_2 = PyInt_Check(__pyx_v_in_1); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; __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 = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":499 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":527 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - - /* "pykeyvi.pyx":501 - * cdef const_char * input_in_0 = in_0 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() + * self.inst.get().Add((in_0), (in_1)) # <<<<<<<<<<<<<< + * + * def _init_0(self): */ - __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(__pyx_v_input_in_0, ((int)__pyx_t_5)); + __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;} + } - /* "pykeyvi.pyx":502 + /* "pykeyvi.pyx":522 + * self.inst.get().__setitem__((in_0), (in_1)) * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< - * py_result.it = _r.begin() - * py_result.end = _r.end() + * 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' */ - __pyx_t_6 = __pyx_tp_new_7pykeyvi_MatchIterator(((PyTypeObject *)((PyObject*)__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 = 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":503 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - * 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(); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pykeyvi.pyx":504 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result +/* "pykeyvi.pyx":529 + * self.inst.get().Add((in_0), (in_1)) + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) * */ - __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":505 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< +/* 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) { + 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)); + + /* 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) { + 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 GetCompletions(self, *args): + * def _init_0(self): + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) # <<<<<<<<<<<<<< + * + * def _init_1(self, memory_limit ): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); - goto __pyx_L0; + 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_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":496 - * return py_result + /* "pykeyvi.pyx":529 + * self.inst.get().Add((in_0), (in_1)) + * + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) * - * 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_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._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":507 - * return py_result +/* "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' * - * 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_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; +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("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("_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_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) { +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; - Py_ssize_t __pyx_t_2; + int __pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; + size_t __pyx_t_4; + keyvi::dictionary::CompletionDictionaryCompiler *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("GetCompletions", 0); + __Pyx_RefNannySetupContext("_init_1", 0); - /* "pykeyvi.pyx":508 + /* "pykeyvi.pyx":533 * - * 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))): + * def _init_1(self, memory_limit ): + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< + * + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) */ - __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) { - goto __pyx_L5_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; + #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 = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } - __pyx_L5_next_and:; - __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":509 - * 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_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 = PySequence_Tuple(__pyx_v_args); 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_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - } - - /* "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 = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((__pyx_t_2 == 2) != 0); - if (__pyx_t_5) { - goto __pyx_L7_next_and; - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_L7_next_and:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_5 = PyBytes_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { - goto __pyx_L8_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L6_bool_binop_done; - } - __pyx_L8_next_and:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_5 = PyInt_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = (__pyx_t_5 != 0); - if (!__pyx_t_8) { - goto __pyx_L10_next_or; - } else { - __pyx_t_3 = __pyx_t_8; - goto __pyx_L9_bool_binop_done; - } - __pyx_L10_next_or:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_8 = PyLong_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = (__pyx_t_8 != 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":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) # <<<<<<<<<<<<<< - * 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_GetCompletions_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PySequence_Tuple(__pyx_v_args); 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_7, __pyx_t_6, 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_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /*else*/ { + #endif - /* "pykeyvi.pyx":513 - * return self._GetCompletions_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":535 + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - * def __init__(self, Dictionary in_0 , Dictionary in_1 ): + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< + * + * def _init_2(self, memory_limit , dict value_store_params ): */ - __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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __Pyx_GIVEREF(__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 = 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 = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __Pyx_GIVEREF(__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 = 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 = 513; __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 = 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); - /* "pykeyvi.pyx":507 - * return py_result + /* "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' * - * 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_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.GetCompletions", __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); @@ -14458,27 +13454,27 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_6GetCompletions(s return __pyx_r; } -/* "pykeyvi.pyx":515 - * raise Exception('can not handle type of %s' % (args,)) +/* "pykeyvi.pyx":537 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) * - * 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' + * 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_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; +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; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("_init_2 (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_0,&__pyx_n_s_in_1,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; @@ -14492,16 +13488,16 @@ static int __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__(PyObject *__p 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_in_1)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value_store_params)) != 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;} + __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__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __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 = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -14509,753 +13505,853 @@ static int __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__(PyObject *__p 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]); + __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__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __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 = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.ForwardBackwardCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __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 = 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); + 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); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = -1; + __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 */ -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":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; + 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "pykeyvi.pyx":516 - * - * 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), ((PyObject*)__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 = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "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), ((PyObject*)__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;} - } + __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; } - #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)) - * - */ - __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)) # <<<<<<<<<<<<<< - * - * cdef class loading_strategy_types: - */ - 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 = 520; __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_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; } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - - /* "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.ForwardBackwardCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; + __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; } -/* "pykeyvi.pyx":536 - * cdef shared_ptr[_CompletionDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - -/* 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) { +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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__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 = 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_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; + } + } + /*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_28CompletionDictionaryCompiler_7_init_2_5generator12(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -static void __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { +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; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "pykeyvi.pyx":537 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":536 - * cdef shared_ptr[_CompletionDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ + 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; + } /* 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; } -/* "pykeyvi.pyx":540 - * - * - * 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 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_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); + 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("__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)); + __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_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; + } + } + /*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_r = -1; + __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 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) { - const char *__pyx_v_input_in_0; - int __pyx_r; +/* "pykeyvi.pyx":537 + * 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_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; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - const char *__pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; + 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("__setitem__", 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); - /* "pykeyvi.pyx":541 + /* "pykeyvi.pyx":538 + * + * 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 __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' - * cdef const_char * input_in_0 = in_0 */ #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 = 541; __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 = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 + /* "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]() */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_2 = PyInt_Check(__pyx_v_in_1); + __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) { - goto __pyx_L4_next_or; + if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; + goto __pyx_L5_bool_binop_done; } - __pyx_L4_next_or:; - __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;} + __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;} } } #endif - /* "pykeyvi.pyx":543 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + /* "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' * - * self.inst.get().__setitem__(input_in_0, (in_1)) + * 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_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); + 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":545 - * cdef const_char * input_in_0 = in_0 + /* "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; + } 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 * - * self.inst.get().__setitem__(input_in_0, (in_1)) # <<<<<<<<<<<<<< + * 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 * - * def Add(self, bytes in_0 , in_1 ): */ - __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;} + __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_v_self->inst.get()->__setitem__(__pyx_v_input_in_0, ((int)__pyx_t_5)); + __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 = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - /* "pykeyvi.pyx":540 + /* "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; + + /* "pykeyvi.pyx":537 + * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) * - * 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 _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 = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __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_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":547 - * self.inst.get().__setitem__(input_in_0, (in_1)) + * del v1 * - * 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 __init__(self, *args): # <<<<<<<<<<<<<< + * if not args: + * self._init_0(*args) */ /* 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; +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 + __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); + + /* 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; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("Add (wrapper)", 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); { - 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]; + __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; } - 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; __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.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; } -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) { - const char *__pyx_v_input_in_0; +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; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - const char *__pyx_t_4; - int __pyx_t_5; + 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_RefNannySetupContext("Add", 0); - - /* "pykeyvi.pyx":548 - * - * 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' - * cdef const_char * input_in_0 = 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 = 548; __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_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_keys); 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); } } - #endif - - /* "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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * - */ - #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) { - goto __pyx_L4_next_or; + 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; + } 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_3; - goto __pyx_L3_bool_binop_done; + __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_L4_next_or:; - __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;} + __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; } } - #endif - - /* "pykeyvi.pyx":550 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * - * self.inst.get().Add(input_in_0, (in_1)) - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - - /* "pykeyvi.pyx":552 - * cdef const_char * input_in_0 = in_0 - * - * self.inst.get().Add(input_in_0, (in_1)) # <<<<<<<<<<<<<< - * - * def _init_0(self): - */ - __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(__pyx_v_input_in_0, ((int)__pyx_t_5)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __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; } - - /* "pykeyvi.pyx":547 - * self.inst.get().__setitem__(input_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' - */ + __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.CompletionDictionaryCompiler.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); - __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_28CompletionDictionaryCompiler_8__init___5generator14(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":554 - * self.inst.get().Add(input_in_0, (in_1)) - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) - * - */ - -/* 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) { - 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)); - - /* 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) { - 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":555 - * - * 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 = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - - /* "pykeyvi.pyx":554 - * self.inst.get().Add(input_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_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "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' - * - */ - -/* 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) { - 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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_init_1", 0); - - /* "pykeyvi.pyx":558 - * - * def _init_1(self, memory_limit ): - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< - * - * 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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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 = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "pykeyvi.pyx":560 - * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' - * - * 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 = 560; __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 = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); - - /* "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' - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "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' - */ - -/* 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; - 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 = 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 = 562; __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 = 562; __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 = 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; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "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]() - */ - -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; +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; __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_22_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_22_genexpr, __pyx_empty_tuple, NULL); + __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_21__init_2 *) __pyx_self; + __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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; @@ -15263,7 +14359,7 @@ static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genex /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler._init_2.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); @@ -15271,15 +14367,17 @@ static PyObject *__pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_genex return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +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_22_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_genexpr *)__pyx_generator->closure); + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_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; @@ -15287,199 +14385,72 @@ static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_2gene __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 = 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 = 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 = 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 = 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_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 = 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); + __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); } - __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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - 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_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5generator16(__pyx_GeneratorObject *__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_23_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_23_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_23_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_21__init_2 *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } - - /* 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_5generator16(__pyx_GeneratorObject *__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; - 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_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 = 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 = 564; __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 = 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_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); + __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 = 564; __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 = 552; __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 = 564; __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 = 552; __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 = 564; __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 = 552; __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 = 564; __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 = 552; __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 = 564; __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 = 552; __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 = 564; __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 = 552; __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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -15489,640 +14460,574 @@ static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_5gene __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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); 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_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":562 - * self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit))) +/* "pykeyvi.pyx":547 + * 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_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; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; +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; __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::CompletionDictionaryCompiler *__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_21__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_21__init_2, __pyx_empty_tuple, NULL); + __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 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":563 - * - * 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":548 * + * 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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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 = 563; __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":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]() + /* "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) */ - #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_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_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - goto __pyx_L6_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_L6_next_and:; - __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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_3) { - goto __pyx_L7_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L5_bool_binop_done; - } - __pyx_L7_next_and:; - __pyx_t_4 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_7_init_2_3genexpr(((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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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 = 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - /* "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' + /* "pykeyvi.pyx":548 * - * 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 = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_v_v1 = __pyx_t_6; - /* "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[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) + /* "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())): */ - 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 = 567; __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 = 550; __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; + __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_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 = 567; __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 = 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 = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 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 = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 567; __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 = 567; __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 = 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 = 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 = 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; - 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 = 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; - __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 = 567; __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":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[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) - * del v1 - */ - __pyx_t_13 = __pyx_convert_string_from_py_(__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_(__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":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[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler((memory_limit), deref(v1))) - */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pykeyvi.pyx":569 - * 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 = 569; __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 = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_v_self->inst = boost::shared_ptr (__pyx_t_16); - - /* "pykeyvi.pyx":570 - * 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_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":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' + /* "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) */ + __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; - /* 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_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_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":572 - * del v1 - * - * def __init__(self, *args): # <<<<<<<<<<<<<< + /* "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; + } -/* 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; - __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); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "pykeyvi.pyx":577 + /* "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_25_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_25_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; + __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_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; + __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,)) + */ + __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_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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 ): + */ + /*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_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 = 555; __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 = 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_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __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_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___2generator17(__pyx_GeneratorObject *__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; - 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_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +/* "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("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 = 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 = 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 = 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))) { - __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 = 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 = 577; __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 = 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 = 577; __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 = 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 = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 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 = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 577; __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_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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 */ - PyErr_SetNone(PyExc_StopIteration); 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 = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5generator18(__pyx_GeneratorObject *__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_26_genexpr *__pyx_cur_scope; +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("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_26_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_24___init__ *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; + __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;} + } } + #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); + + /* "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 + */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.WriteToFile", __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_28CompletionDictionaryCompiler_8__init___5generator18(__pyx_GeneratorObject *__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); +/* "pykeyvi.pyx":562 + * self.inst.get().WriteToFile(input_in_0) + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* 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; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __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_28CompletionDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "pykeyvi.pyx":563 + * + * 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":562 + * 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":566 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ + +/* 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; + 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;} + } + } + 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;} + } + } 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]; + } + 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_L3_error:; + __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_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_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; 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_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 = 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 = 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 = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("__exit__", 0); + + /* "pykeyvi.pyx":567 + * + * 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 = 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))) { @@ -16135,572 +15040,482 @@ static PyObject *__pyx_gb_7pykeyvi_28CompletionDictionaryCompiler_8__init___5gen } } 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 = 577; __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 = 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 = 577; __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 = 567; __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 = 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 = 577; __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 = 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 = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 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 = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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 = 577; __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_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pykeyvi.pyx":566 + * + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.Compile() + * + */ /* 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_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":572 - * del v1 +/* "pykeyvi.pyx":570 * - * def __init__(self, *args): # <<<<<<<<<<<<<< + * + * def Compile(self, *args): # <<<<<<<<<<<<<< * if not args: - * self._init_0(*args) + * with nogil: */ -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; +/* 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; + __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); + + /* 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; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - 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_24___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_24___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("Compile", 0); - /* "pykeyvi.pyx":573 + /* "pykeyvi.pyx":571 * - * def __init__(self, *args): + * def Compile(self, *args): * if not args: # <<<<<<<<<<<<<< - * self._init_0(*args) - * elif (len(args)==1) and (isinstance(args[0], (int, long))): + * with nogil: + * self.inst.get().Compile() */ - __pyx_t_1 = (__pyx_cur_scope->__pyx_v_args != Py_None) && (PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_args) != 0); + __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":574 - * def __init__(self, *args): + /* "pykeyvi.pyx":572 + * def Compile(self, *args): * if not args: - * self._init_0(*args) # <<<<<<<<<<<<<< - * elif (len(args)==1) and (isinstance(args[0], (int, long))): - * self._init_1(*args) + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return */ - __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 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { - /* "pykeyvi.pyx":575 + /* "pykeyvi.pyx":573 * 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())): + * with nogil: + * self.inst.get().Compile() # <<<<<<<<<<<<<< + * return + * */ - __pyx_t_5 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_5); - if (unlikely(__pyx_t_5 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = ((__pyx_t_6 == 1) != 0); - if (__pyx_t_1) { - goto __pyx_L5_next_and; - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_L5_next_and:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_7 = PyInt_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - goto __pyx_L7_next_or; - } else { - __pyx_t_1 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_L7_next_or:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_8 = PyLong_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = (__pyx_t_8 != 0); - __pyx_t_1 = __pyx_t_7; - __pyx_L6_bool_binop_done:; - __pyx_t_7 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_7; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + __pyx_v_self->inst.get()->Compile(); + } - /* "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) + /* "pykeyvi.pyx":572 + * def Compile(self, *args): + * if not args: + * with nogil: # <<<<<<<<<<<<<< + * self.inst.get().Compile() + * return */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_5, __pyx_t_4, 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_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L3; - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } - /* "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: + /* "pykeyvi.pyx":574 + * with nogil: + * self.inst.get().Compile() + * return # <<<<<<<<<<<<<< + * + * cdef void* callback = args[0] */ - __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 = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == -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_7 = ((__pyx_t_6 == 2) != 0); - if (__pyx_t_7) { - goto __pyx_L9_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L9_next_and:; - __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_8 = (__pyx_t_1 != 0); - if (!__pyx_t_8) { - goto __pyx_L12_next_or; - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L11_bool_binop_done; - } - __pyx_L12_next_or:; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_8 = PyLong_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = (__pyx_t_8 != 0); - __pyx_t_7 = __pyx_t_1; - __pyx_L11_bool_binop_done:; - __pyx_t_1 = (__pyx_t_7 != 0); - if (__pyx_t_1) { - goto __pyx_L10_next_and; - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L8_bool_binop_done; - } - __pyx_L10_next_and:; - __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_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - goto __pyx_L13_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L13_next_and:; - __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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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; - if (__pyx_t_7) { - goto __pyx_L14_next_and; - } else { - __pyx_t_2 = __pyx_t_7; - goto __pyx_L8_bool_binop_done; - } - __pyx_L14_next_and:; - __pyx_t_3 = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_8__init___3genexpr(((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 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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_7; - __pyx_L8_bool_binop_done:; - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "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,)) + /* "pykeyvi.pyx":571 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() */ - __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 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); 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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; } - /*else*/ { - /* "pykeyvi.pyx":580 - * self._init_2(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":576 + * return * - * def WriteToFile(self, bytes in_0 ): + * cdef void* callback = args[0] # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile(callback_wrapper, callback) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_args); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_5); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 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 = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); + + /* "pykeyvi.pyx":577 + * + * 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":578 + * 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":577 + * + * 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_L3:; - /* "pykeyvi.pyx":572 - * del v1 + /* "pykeyvi.pyx":570 * - * def __init__(self, *args): # <<<<<<<<<<<<<< + * + * def Compile(self, *args): # <<<<<<<<<<<<<< * if not args: - * self._init_0(*args) + * with nogil: */ /* function exit code */ - __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_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":582 - * raise Exception('can not handle type of %s' % (args,)) +/* "pykeyvi.pyx":581 * - * 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 SetManifest(self, manifest): # <<<<<<<<<<<<<< + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) */ /* 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; +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("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 = 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)); + __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 */ - 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; +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 - int __pyx_t_1; - const char *__pyx_t_2; + 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("WriteToFile", 0); + __Pyx_RefNannySetupContext("SetManifest", 0); - /* "pykeyvi.pyx":583 + /* "pykeyvi.pyx":582 + * + * def SetManifest(self, manifest): + * m = json.dumps(manifest) # <<<<<<<<<<<<<< + * self.inst.get().SetManifestFromString(m) * - * 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 = 583; __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 = 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); } } - #endif + 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":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) + /* "pykeyvi.pyx":583 + * def SetManifest(self, manifest): + * m = json.dumps(manifest) + * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< * - */ - __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":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) # <<<<<<<<<<<<<< * - * def __enter__(self): */ - __pyx_v_self->inst.get()->WriteToFile(__pyx_v_input_in_0); + __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":582 - * raise Exception('can not handle type of %s' % (args,)) + /* "pykeyvi.pyx":581 * - * 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 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_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_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 - * self.inst.get().WriteToFile(input_in_0) * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * # definition for all compilers + * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< + * (py_callback)(a, b) * */ -/* 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; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __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_28CompletionDictionaryCompiler_16__enter__(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_f_7pykeyvi_callback_wrapper(size_t __pyx_v_a, size_t __pyx_v_b, void *__pyx_v_py_callback) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); + 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) # <<<<<<<<<<<<<< * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< - * - * + * cdef class MultiWordCompletion: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __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 - * self.inst.get().WriteToFile(input_in_0) * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + * # 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 */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + 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(); - return __pyx_r; + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif } -/* "pykeyvi.pyx":591 +/* "pykeyvi.pyx":594 + * cdef shared_ptr[_MultiWordCompletion] inst * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() + */ + +/* 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 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 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; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (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_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 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; @@ -16708,679 +15523,746 @@ static PyObject *__pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_19__exit__(PyO 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_in_0)) != 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 = 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 = 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 = 591; __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 = 598; __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 = 591; __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 = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.CompletionDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.__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 = 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); /* 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_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 - 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::dictionary::completion::MultiWordCompletion *__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":592 - * - * def __exit__(self, type, value, traceback): - * self.Compile() # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":599 * + * 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)) */ - __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))) { - __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 = 599; __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 = 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 = 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; + #endif + + /* "pykeyvi.pyx":600 + * 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)) + * + */ + __pyx_t_2 = __pyx_v_in_0->inst; + __pyx_v_input_in_0 = __pyx_t_2; - /* "pykeyvi.pyx":591 + /* "pykeyvi.pyx":601 + * 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 = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); + + /* "pykeyvi.pyx":598 * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self.Compile() * + * 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.MultiWordCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":595 - * +/* "pykeyvi.pyx":603 + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: + * def _GetCompletions_0(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_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; +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("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("_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)); /* 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_pf_7pykeyvi_28CompletionDictionaryCompiler_20Compile(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_args) { - void *__pyx_v_callback; +static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { + const char *__pyx_v_input_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; - int __pyx_t_2; - __Pyx_RefNannySetupContext("Compile", 0); + const char *__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", 0); - /* "pykeyvi.pyx":596 + /* "pykeyvi.pyx":604 * - * def Compile(self, *args): - * if not args: # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile() + * def _GetCompletions_0(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) */ - __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) { + #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 = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif - /* "pykeyvi.pyx":597 - * def Compile(self, *args): - * if not args: - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile() - * return + /* "pykeyvi.pyx":605 + * def _GetCompletions_0(self, bytes in_0 ): + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { - - /* "pykeyvi.pyx":598 - * if not args: - * with nogil: - * self.inst.get().Compile() # <<<<<<<<<<<<<< - * return - * - */ - __pyx_v_self->inst.get()->Compile(); - } - - /* "pykeyvi.pyx":597 - * 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:; - } - } + __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - /* "pykeyvi.pyx":599 - * with nogil: - * self.inst.get().Compile() - * return # <<<<<<<<<<<<<< - * - * cdef void* callback = args[0] + /* "pykeyvi.pyx":606 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0); - /* "pykeyvi.pyx":601 - * return - * - * cdef void* callback = args[0] # <<<<<<<<<<<<<< - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) + /* "pykeyvi.pyx":607 + * cdef const_char * input_in_0 = in_0 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) # <<<<<<<<<<<<<< + * py_result.it = _r.begin() + * py_result.end = _r.end() */ - __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 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 = 607; __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;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_3); + __pyx_t_3 = 0; - /* "pykeyvi.pyx":602 - * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) - * + /* "pykeyvi.pyx":608 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() # <<<<<<<<<<<<<< + * py_result.end = _r.end() + * return py_result */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { + __pyx_v_py_result->it = __pyx_v__r.begin(); - /* "pykeyvi.pyx":603 - * cdef void* callback = args[0] - * with nogil: - * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":609 + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + * py_result.end = _r.end() # <<<<<<<<<<<<<< + * return py_result * */ - __pyx_v_self->inst.get()->Compile(__pyx_f_7pykeyvi_callback_wrapper, __pyx_v_callback); - } + __pyx_v_py_result->end = __pyx_v__r.end(); - /* "pykeyvi.pyx":602 - * - * cdef void* callback = args[0] - * with nogil: # <<<<<<<<<<<<<< - * self.inst.get().Compile(callback_wrapper, callback) + /* "pykeyvi.pyx":610 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * + * def _GetCompletions_1(self, bytes in_0 , in_1 ): */ - /*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":595 - * + /* "pykeyvi.pyx":603 + * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) * - * def Compile(self, *args): # <<<<<<<<<<<<<< - * if not args: - * with nogil: + * def _GetCompletions_0(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); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_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":606 - * +/* "pykeyvi.pyx":612 + * return py_result * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) + * 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_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) { +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("SetManifest (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_28CompletionDictionaryCompiler_22SetManifest(((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)__pyx_v_self), ((PyObject *)__pyx_v_manifest)); + __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 = 612; __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;} + } + } 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 = 612; __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 = 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); /* 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_22SetManifest(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *__pyx_v_self, PyObject *__pyx_v_manifest) { - PyObject *__pyx_v_m = NULL; +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) { + const char *__pyx_v_input_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; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - const char *__pyx_t_5; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + const char *__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("SetManifest", 0); + __Pyx_RefNannySetupContext("_GetCompletions_1", 0); - /* "pykeyvi.pyx":607 - * - * def SetManifest(self, manifest): - * m = json.dumps(manifest) # <<<<<<<<<<<<<< - * self.inst.get().SetManifestFromString(m) + /* "pykeyvi.pyx":613 * + * 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' + * cdef const_char * input_in_0 = in_0 */ - __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 = 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; - 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); + #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 = 613; __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 = 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 = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_manifest); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); - __Pyx_GIVEREF(__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 = 607; __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; + #endif - /* "pykeyvi.pyx":608 - * def SetManifest(self, manifest): - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":614 + * 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' # <<<<<<<<<<<<<< + * cdef const_char * input_in_0 = in_0 * + */ + #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 = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "pykeyvi.pyx":615 + * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' + * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) */ - __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); + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - /* "pykeyvi.pyx":606 + /* "pykeyvi.pyx":617 + * cdef const_char * input_in_0 = in_0 * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) # <<<<<<<<<<<<<< + * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) + * py_result.it = _r.begin() + */ + __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_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0, ((int)__pyx_t_5)); + + /* "pykeyvi.pyx":618 * - * def SetManifest(self, manifest): # <<<<<<<<<<<<<< - * m = json.dumps(manifest) - * self.inst.get().SetManifestFromString(m) + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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_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;} + __pyx_v_py_result = ((struct __pyx_obj_7pykeyvi_MatchIterator *)__pyx_t_6); + __pyx_t_6 = 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.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":619 + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + * 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":612 - * - * # definition for all compilers - * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< - * (py_callback)(a, b) + /* "pykeyvi.pyx":620 + * 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(); -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) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":621 + * py_result.it = _r.begin() + * py_result.end = _r.end() + * return py_result # <<<<<<<<<<<<<< * - * cdef class MultiWordCompletion: + * def GetCompletions(self, *args): */ - __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) { - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; - } - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); - __Pyx_GIVEREF(__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; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); + __pyx_r = ((PyObject *)__pyx_v_py_result); + goto __pyx_L0; /* "pykeyvi.pyx":612 + * return py_result * - * # definition for all compilers - * cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: # <<<<<<<<<<<<<< - * (py_callback)(a, b) - * + * 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 */ - 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); + __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(); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif + return __pyx_r; } -/* "pykeyvi.pyx":619 - * cdef shared_ptr[_MultiWordCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() +/* "pykeyvi.pyx":623 + * return py_result * + * def GetCompletions(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) */ /* 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) { +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("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)__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 void __pyx_pf_7pykeyvi_19MultiWordCompletion___dealloc__(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self) { +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 - __Pyx_RefNannySetupContext("__dealloc__", 0); + 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("GetCompletions", 0); - /* "pykeyvi.pyx":620 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * + /* "pykeyvi.pyx":624 * + * 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_self->inst.reset(); + __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_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":619 - * cdef shared_ptr[_MultiWordCompletion] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * + /* "pykeyvi.pyx":625 + * 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_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_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_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; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":623 + /* "pykeyvi.pyx":624 * - * - * 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 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))): */ + } -/* 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) { - 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, "__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]); + /* "pykeyvi.pyx":626 + * 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_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_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); + __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":627 + * 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 = 627; __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_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 + * 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":629 + * return self._GetCompletions_1(*args) + * else: + * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + * + * cdef class PredictiveCompression: + */ + /*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_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_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_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_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;} + } + + /* "pykeyvi.pyx":623 + * return py_result + * + * def GetCompletions(self, *args): # <<<<<<<<<<<<<< + * if (len(args)==1) and (isinstance(args[0], bytes)): + * return self._GetCompletions_0(*args) + */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; - __pyx_r = -1; + __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); __Pyx_RefNannyFinishContext(); 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) { - 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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "pykeyvi.pyx":624 +/* "pykeyvi.pyx":635 + * cdef shared_ptr[_PredictiveCompression] inst * - * 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_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_in_0), ((PyObject*)__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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "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 __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * */ - __pyx_t_2 = __pyx_v_in_0->inst; - __pyx_v_input_in_0 = __pyx_t_2; - /* "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)) # <<<<<<<<<<<<<< +/* 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() # <<<<<<<<<<<<<< + * * - * 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); + __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":623 + /* "pykeyvi.pyx":635 + * cdef shared_ptr[_PredictiveCompression] inst * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.inst.reset() * - * 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; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "pykeyvi.pyx":628 - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) +/* "pykeyvi.pyx":639 * - * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * + * def Compress(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_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_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("_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)); + __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; @@ -17391,146 +16273,113 @@ 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) { - const char *__pyx_v_input_in_0; - keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; - struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; +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; - const char *__pyx_t_2; + 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", 0); + __Pyx_RefNannySetupContext("Compress", 0); - /* "pykeyvi.pyx":629 + /* "pykeyvi.pyx":640 * - * def _GetCompletions_0(self, bytes in_0 ): + * def Compress(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * 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 = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":630 - * def _GetCompletions_0(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":631 + /* "pykeyvi.pyx":642 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0); - - /* "pykeyvi.pyx":632 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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 *)((PyObject*)__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; - - /* "pykeyvi.pyx":633 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() # <<<<<<<<<<<<<< - * py_result.end = _r.end() + * + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) # <<<<<<<<<<<<<< + * py_result = _r * return py_result */ - __pyx_v_py_result->it = __pyx_v__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 = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->Compress(((std::string)__pyx_t_2)); - /* "pykeyvi.pyx":634 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":643 + * + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) + * py_result = _r # <<<<<<<<<<<<<< * return py_result * */ - __pyx_v_py_result->end = __pyx_v__r.end(); + __pyx_v_py_result = ((std::string)__pyx_v__r); - /* "pykeyvi.pyx":635 - * py_result.it = _r.begin() - * py_result.end = _r.end() + /* "pykeyvi.pyx":644 + * cdef libcpp_string _r = self.inst.get().Compress((in_0)) + * py_result = _r * return py_result # <<<<<<<<<<<<<< * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): + * def __init__(self, bytes in_0 ): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_result)); - __pyx_r = ((PyObject *)__pyx_v_py_result); + __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":628 - * self.inst = shared_ptr[_MultiWordCompletion](new _MultiWordCompletion(input_in_0)) + /* "pykeyvi.pyx":639 * - * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< + * + * def Compress(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_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_0", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Compress", __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":637 +/* "pykeyvi.pyx":646 * return py_result * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< + * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< * 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_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 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; - PyObject *__pyx_v_in_1 = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_GetCompletions_1 (wrapper)", 0); + __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}; + 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 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; @@ -17540,394 +16389,204 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyOb 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;} + 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;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } 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); } __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_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_L3_error:; - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.PredictiveCompression.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + 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 = 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); + 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); /* 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_19MultiWordCompletion_6_GetCompletions_1(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0, PyObject *__pyx_v_in_1) { - const char *__pyx_v_input_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_21PredictiveCompression_4__init__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - const char *__pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + 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("_GetCompletions_1", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":638 + /* "pykeyvi.pyx":647 * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): + * def __init__(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 + * + * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((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 = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - - /* "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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * - */ - #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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":640 + /* "pykeyvi.pyx":649 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - - /* "pykeyvi.pyx":642 - * cdef const_char * input_in_0 = in_0 - * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) # <<<<<<<<<<<<<< - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - */ - __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(__pyx_v_input_in_0, ((int)__pyx_t_5)); - - /* "pykeyvi.pyx":643 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_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 *)((PyObject*)__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; - - /* "pykeyvi.pyx":644 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - * 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":645 - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - * py_result.it = _r.begin() - * py_result.end = _r.end() # <<<<<<<<<<<<<< - * return py_result + * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) # <<<<<<<<<<<<<< * + * def Uncompress(self, bytes in_0 ): */ - __pyx_v_py_result->end = __pyx_v__r.end(); + __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)); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); /* "pykeyvi.pyx":646 - * py_result.it = _r.begin() - * py_result.end = _r.end() - * return py_result # <<<<<<<<<<<<<< - * - * def GetCompletions(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":637 * return py_result * - * def _GetCompletions_1(self, bytes in_0 , in_1 ): # <<<<<<<<<<<<<< + * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< * 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 = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion._GetCompletions_1", __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_XDECREF((PyObject *)__pyx_v_py_result); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":648 - * return py_result +/* "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' * - * 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_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; +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("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); + __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 */ - __Pyx_XDECREF(__pyx_v_args); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -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 +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; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; + 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); + __Pyx_RefNannySetupContext("Uncompress", 0); - /* "pykeyvi.pyx":649 + /* "pykeyvi.pyx":652 * - * 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 = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((__pyx_t_2 == 1) != 0); - if (__pyx_t_3) { - goto __pyx_L5_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_L5_next_and:; - __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":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) + * 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_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 = PySequence_Tuple(__pyx_v_args); 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_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 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 = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif - /* "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: + /* "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 = 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) { - goto __pyx_L7_next_and; - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_L7_next_and:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_5 = PyBytes_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { - goto __pyx_L8_next_and; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L6_bool_binop_done; - } - __pyx_L8_next_and:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_5 = PyInt_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = (__pyx_t_5 != 0); - if (!__pyx_t_8) { - goto __pyx_L10_next_or; - } else { - __pyx_t_3 = __pyx_t_8; - goto __pyx_L9_bool_binop_done; - } - __pyx_L10_next_or:; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_v_args, 1); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_8 = PyLong_Check(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = (__pyx_t_8 != 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) { + __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":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,)) + /* "pykeyvi.pyx":655 + * + * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) + * py_result = _r # <<<<<<<<<<<<<< + * return py_result + * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetCompletions_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PySequence_Tuple(__pyx_v_args); 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_7, __pyx_t_6, 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_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /*else*/ { + __pyx_v_py_result = ((std::string)__pyx_v__r); - /* "pykeyvi.pyx":654 - * return self._GetCompletions_1(*args) - * else: - * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< + /* "pykeyvi.pyx":656 + * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) + * py_result = _r + * return py_result # <<<<<<<<<<<<<< * - * cdef class PredictiveCompression: + * cdef class KeyOnlyDictionaryGenerator: */ - __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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args); - __Pyx_GIVEREF(__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); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __Pyx_GIVEREF(__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;} - } + __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":648 - * return py_result + /* "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' * - * def GetCompletions(self, *args): # <<<<<<<<<<<<<< - * if (len(args)==1) and (isinstance(args[0], bytes)): - * return self._GetCompletions_0(*args) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pykeyvi.MultiWordCompletion.GetCompletions", __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_XGIVEREF(__pyx_r); @@ -17935,8 +16594,8 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct return __pyx_r; } -/* "pykeyvi.pyx":660 - * cdef shared_ptr[_PredictiveCompression] inst +/* "pykeyvi.pyx":662 + * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -17944,21 +16603,21 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_8GetCompletions(struct */ /* 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) { +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("__dealloc__ (wrapper)", 0); - __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(((struct __pyx_obj_7pykeyvi_PredictiveCompression *)__pyx_v_self)); + __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } -static void __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self) { +static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":661 + /* "pykeyvi.pyx":663 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -17967,8 +16626,8 @@ static void __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(struct __pyx_o */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":660 - * cdef shared_ptr[_PredictiveCompression] inst + /* "pykeyvi.pyx":662 + * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -17979,264 +16638,233 @@ static void __pyx_pf_7pykeyvi_21PredictiveCompression___dealloc__(struct __pyx_o __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":664 +/* "pykeyvi.pyx":666 * * - * def Compress(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + * def __init__(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * */ /* 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; +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("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)); + __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 */ - 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; +static int __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + keyvi::dictionary::KeyOnlyDictionaryGenerator *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("Compress", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "pykeyvi.pyx":665 + /* "pykeyvi.pyx":667 * - * def Compress(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< + * def __init__(self): + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) # <<<<<<<<<<<<<< * - * cdef libcpp_string _r = self.inst.get().Compress((in_0)) + * def Add(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 = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + 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;} } - #endif + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - /* "pykeyvi.pyx":667 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' + /* "pykeyvi.pyx":666 * - * cdef libcpp_string _r = self.inst.get().Compress((in_0)) # <<<<<<<<<<<<<< - * py_result = _r - * return py_result - */ - __pyx_t_2 = __pyx_convert_string_from_py_(__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":668 * - * 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":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_string_to_py_(__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' + * def __init__(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Compress", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pykeyvi.pyx":671 - * return py_result +/* "pykeyvi.pyx":669 + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * - * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Add(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 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__ (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); + __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)); /* 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_21PredictiveCompression_4__init__(struct __pyx_obj_7pykeyvi_PredictiveCompression *__pyx_v_self, PyObject *__pyx_v_in_0) { - int __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; __Pyx_RefNannyDeclarations 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("__init__", 0); + __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":672 + /* "pykeyvi.pyx":670 * - * def __init__(self, bytes in_0 ): + * def Add(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) + * 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 = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":674 + /* "pykeyvi.pyx":672 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) # <<<<<<<<<<<<<< + * self.inst.get().Add((in_0)) # <<<<<<<<<<<<<< * - * def Uncompress(self, bytes in_0 ): + * def CloseFeeding(self): */ - __pyx_t_2 = __pyx_convert_string_from_py_(__pyx_v_in_0); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __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 = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} try { - __pyx_t_3 = new keyvi::compression::PredictiveCompression(((std::string)__pyx_t_2)); + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_3); - /* "pykeyvi.pyx":671 - * return py_result + /* "pykeyvi.pyx":669 + * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) * - * def __init__(self, bytes in_0 ): # <<<<<<<<<<<<<< + * def Add(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 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.PredictiveCompression.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __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":676 - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) +/* "pykeyvi.pyx":674 + * self.inst.get().Add((in_0)) * - * def Uncompress(self, bytes 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_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pykeyvi.pyx":677 + * self.inst.get().CloseFeeding() + * + * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' * */ /* 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) { +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("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)); + __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)); /* function exit code */ goto __pyx_L0; @@ -18247,81 +16875,56 @@ static PyObject *__pyx_pw_7pykeyvi_21PredictiveCompression_7Uncompress(PyObject 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; +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 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); + __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":677 + /* "pykeyvi.pyx":678 * - * def Uncompress(self, bytes in_0 ): + * def WriteToFile(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< * - * cdef libcpp_string _r = self.inst.get().Uncompress((in_0)) + * 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 = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":679 - * 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_(__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 + * 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_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 # <<<<<<<<<<<<<< + * self.inst.get().WriteToFile((in_0)) # <<<<<<<<<<<<<< * - * cdef class KeyOnlyDictionaryGenerator: + * cdef class KeyOnlyDictionaryCompiler: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_string_to_py_(__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; + __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)); - /* "pykeyvi.pyx":676 - * self.inst = shared_ptr[_PredictiveCompression](new _PredictiveCompression((in_0))) + /* "pykeyvi.pyx":677 + * self.inst.get().CloseFeeding() * - * def Uncompress(self, bytes in_0 ): # <<<<<<<<<<<<<< + * 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_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pykeyvi.PredictiveCompression.Uncompress", __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); @@ -18329,8 +16932,8 @@ static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(struct __ return __pyx_r; } -/* "pykeyvi.pyx":687 - * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst +/* "pykeyvi.pyx":686 + * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -18338,21 +16941,21 @@ static PyObject *__pyx_pf_7pykeyvi_21PredictiveCompression_6Uncompress(struct __ */ /* 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_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_26KeyOnlyDictionaryGenerator___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); + __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler___dealloc__(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)__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_25KeyOnlyDictionaryCompiler___dealloc__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":688 + /* "pykeyvi.pyx":687 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -18361,8 +16964,8 @@ static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __ */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":687 - * cdef shared_ptr[_KeyOnlyDictionaryGenerator] inst + /* "pykeyvi.pyx":686 + * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< * self.inst.reset() @@ -18373,167 +16976,161 @@ static void __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator___dealloc__(struct __ __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":691 +/* "pykeyvi.pyx":690 * * - * def __init__(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) * */ /* 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; +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__ (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)); + __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 int __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_2__init__(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self) { - int __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::KeyOnlyDictionaryGenerator *__pyx_t_1; + keyvi::dictionary::KeyOnlyDictionaryCompiler *__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":692 + /* "pykeyvi.pyx":691 * - * def __init__(self): - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) # <<<<<<<<<<<<<< + * def _init_0(self): + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) # <<<<<<<<<<<<<< * - * def Add(self, bytes in_0 ): + * def _init_1(self, memory_limit ): */ try { - __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryGenerator(); + __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __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":691 + /* "pykeyvi.pyx":690 * * - * def __init__(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) + * def _init_0(self): # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) * */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryGenerator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __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":694 - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) +/* "pykeyvi.pyx":693 + * 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 Add(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_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; +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("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)); + __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 */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __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) { - const char *__pyx_v_input_in_0; +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; - const char *__pyx_t_2; + 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("Add", 0); + __Pyx_RefNannySetupContext("_init_1", 0); - /* "pykeyvi.pyx":695 + /* "pykeyvi.pyx":694 * - * def Add(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().Add(input_in_0) + * 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_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 = 695; __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 = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif /* "pykeyvi.pyx":696 - * def Add(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().Add(input_in_0) + * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' * - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":697 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * self.inst.get().Add(input_in_0) # <<<<<<<<<<<<<< + * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) # <<<<<<<<<<<<<< * - * def CloseFeeding(self): + * 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;} try { - __pyx_v_self->inst.get()->Add(__pyx_v_input_in_0); + __pyx_t_5 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(((size_t)__pyx_t_4)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_v_self->inst = boost::shared_ptr (__pyx_t_5); - /* "pykeyvi.pyx":694 - * self.inst = shared_ptr[_KeyOnlyDictionaryGenerator](new _KeyOnlyDictionaryGenerator()) + /* "pykeyvi.pyx":693 + * 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 Add(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.KeyOnlyDictionaryGenerator.Add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18541,486 +17138,275 @@ static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_4Add(struct __py return __pyx_r; } -/* "pykeyvi.pyx":699 - * self.inst.get().Add(input_in_0) - * - * def CloseFeeding(self): # <<<<<<<<<<<<<< - * self.inst.get().CloseFeeding() +/* "pykeyvi.pyx":698 + * 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' */ /* 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) { +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("CloseFeeding (wrapper)", 0); - __pyx_r = __pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_6CloseFeeding(((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)__pyx_v_self)); - - /* function exit code */ + __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 = 698; __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;} + } + } 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 = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._init_2", __pyx_clineno, __pyx_lineno, __pyx_filename); __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":700 - * - * def CloseFeeding(self): - * self.inst.get().CloseFeeding() # <<<<<<<<<<<<<< - * - * def WriteToFile(self, bytes in_0 ): - */ - __pyx_v_self->inst.get()->CloseFeeding(); - - /* "pykeyvi.pyx":699 - * self.inst.get().Add(input_in_0) - * - * def CloseFeeding(self): # <<<<<<<<<<<<<< - * self.inst.get().CloseFeeding() - * - */ + 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); /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); + 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_2generator15(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":702 - * self.inst.get().CloseFeeding() +/* "pykeyvi.pyx":700 + * 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 WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() */ -/* 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; - PyObject *__pyx_r = 0; +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_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 - __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)); + 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_22_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_22_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_21__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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._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; } -static PyObject *__pyx_pf_7pykeyvi_26KeyOnlyDictionaryGenerator_8WriteToFile(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_in_0; +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_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; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - const char *__pyx_t_2; + 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("WriteToFile", 0); - - /* "pykeyvi.pyx":703 - * - * 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 = 703; __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_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_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_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_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_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_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 = 700; __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_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;} + #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_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 = 700; __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; } } - #endif - - /* "pykeyvi.pyx":704 - * 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 = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":705 - * 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) # <<<<<<<<<<<<<< - * - * cdef class KeyOnlyDictionaryCompiler: - */ - __pyx_v_self->inst.get()->WriteToFile(__pyx_v_input_in_0); - - /* "pykeyvi.pyx":702 - * self.inst.get().CloseFeeding() - * - * def WriteToFile(self, bytes in_0 ): # <<<<<<<<<<<<<< - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - */ + /*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.KeyOnlyDictionaryGenerator.WriteToFile", __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_25KeyOnlyDictionaryCompiler_7_init_2_5generator16(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":711 - * 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":712 - * - * def __dealloc__(self): - * self.inst.reset() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->inst.reset(); - - /* "pykeyvi.pyx":711 - * cdef shared_ptr[_KeyOnlyDictionaryCompiler] inst - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * self.inst.reset() - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "pykeyvi.pyx":715 - * - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) - * - */ - -/* 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) { +static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_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 - 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 - * - * def _init_0(self): - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) # <<<<<<<<<<<<<< - * - * def _init_1(self, memory_limit ): - */ - try { - __pyx_t_1 = new keyvi::dictionary::KeyOnlyDictionaryCompiler(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_23_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_21__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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; } - __pyx_v_self->inst = boost::shared_ptr (__pyx_t_1); - - /* "pykeyvi.pyx":715 - * - * - * def _init_0(self): # <<<<<<<<<<<<<< - * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler()) - * - */ /* 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_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._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":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) { +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_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; - __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) { - goto __pyx_L4_next_or; - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L3_bool_binop_done; - } - __pyx_L4_next_or:; - __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' - * - */ - - /* function exit code */ - __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_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "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' - */ - -/* 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) { - 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 = 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, "_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; - } 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 = 723; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler._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 = 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_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "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_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_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; - } - __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; - } - - /* 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_2generator19(__pyx_GeneratorObject *__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; + 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; @@ -19028,27 +17414,26 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_2generat __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 = 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_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_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;} + 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_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_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_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_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_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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -19056,16 +17441,18 @@ 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 = 725; __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 = 700; __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_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_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;} + __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;} #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_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_GOTREF(__pyx_t_1); #endif } } else { @@ -19074,247 +17461,95 @@ 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 = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 */ - PyErr_SetNone(PyExc_StopIteration); 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_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -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; +/* "pykeyvi.pyx":698 + * 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' + */ + +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_21__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("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); + __Pyx_RefNannySetupContext("_init_2", 0); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_21__init_2 *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_21__init_2(__pyx_ptype_7pykeyvi___pyx_scope_struct_21__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_27__init_2 *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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; -} + __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); -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_5generator20(__pyx_GeneratorObject *__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; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - int __pyx_t_5; - 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 = 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 = -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;} - #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;} - #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_1 = __Pyx_PyBool_FromLong(__pyx_t_5); 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); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - 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_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* "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' - */ - -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":724 + /* "pykeyvi.pyx":699 * * def _init_2(self, memory_limit , dict value_store_params ): * assert isinstance(memory_limit, (int, long)), 'arg memory_limit wrong type' # <<<<<<<<<<<<<< @@ -19326,24 +17561,22 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __pyx_t_2 = PyInt_Check(__pyx_v_memory_limit); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; __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_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":725 + /* "pykeyvi.pyx":700 * 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' # <<<<<<<<<<<<<< @@ -19358,53 +17591,39 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - goto __pyx_L6_next_and; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_L6_next_and:; - __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_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_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __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 = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); 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_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_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_3) { - goto __pyx_L7_next_and; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_L7_next_and:; - __pyx_t_4 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_7_init_2_3genexpr(((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 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __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 = 700; __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_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_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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":727 + /* "pykeyvi.pyx":702 * 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]() # <<<<<<<<<<<<<< @@ -19415,11 +17634,11 @@ 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 = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_v1 = __pyx_t_6; - /* "pykeyvi.pyx":728 + /* "pykeyvi.pyx":703 * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< @@ -19428,17 +17647,17 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ */ 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_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 = 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 = 703; __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_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_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_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_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -19446,16 +17665,18 @@ 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 = 728; __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 = 703; __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_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_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;} + __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;} #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_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_GOTREF(__pyx_t_4); #endif } } else { @@ -19464,7 +17685,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 = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -19480,7 +17701,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 = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -19493,15 +17714,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 = 728; __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 = 703; __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_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_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_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_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -19509,7 +17730,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 = 728; __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 = 703; __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; @@ -19517,7 +17738,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 = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L11_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); @@ -19525,18 +17746,18 @@ 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":729 + /* "pykeyvi.pyx":704 * 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_(__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_(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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 = 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_v_v1)[((std::string)__pyx_t_14)]) = ((std::string)__pyx_t_13); - /* "pykeyvi.pyx":728 + /* "pykeyvi.pyx":703 * * cdef libcpp_map[libcpp_string, libcpp_string] * v1 = new libcpp_map[libcpp_string, libcpp_string]() * for key, value in value_store_params.items(): # <<<<<<<<<<<<<< @@ -19546,23 +17767,23 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pykeyvi.pyx":730 + /* "pykeyvi.pyx":705 * 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;} + __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;} 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_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_self->inst = boost::shared_ptr (__pyx_t_16); - /* "pykeyvi.pyx":731 + /* "pykeyvi.pyx":706 * deref(v1)[ key ] = value * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit), deref(v1))) * del v1 # <<<<<<<<<<<<<< @@ -19571,7 +17792,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ */ delete __pyx_v_v1; - /* "pykeyvi.pyx":723 + /* "pykeyvi.pyx":698 * self.inst = shared_ptr[_KeyOnlyDictionaryCompiler](new _KeyOnlyDictionaryCompiler((memory_limit))) * * def _init_2(self, memory_limit , dict value_store_params ): # <<<<<<<<<<<<<< @@ -19599,7 +17820,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_6_init_2(struct _ return __pyx_r; } -/* "pykeyvi.pyx":733 +/* "pykeyvi.pyx":708 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -19624,9 +17845,9 @@ static int __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__(PyObject *__p __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator17(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pykeyvi.pyx":738 +/* "pykeyvi.pyx":713 * 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())): # <<<<<<<<<<<<<< @@ -19635,24 +17856,24 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera */ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_genexpr *__pyx_cur_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_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_31_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_31_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_25_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_25_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_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -19668,9 +17889,9 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___genexpr return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2generator17(__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); + 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; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -19678,6 +17899,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera 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; @@ -19685,19 +17907,18 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera __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 = 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_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_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_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 = 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 = 713; __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))) { @@ -19710,10 +17931,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 = 738; __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 = 713; __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_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_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -19721,9 +17942,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 = 738; __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 = 713; __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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -19731,16 +17952,18 @@ 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 = 738; __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 = 713; __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_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_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;} + __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;} #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_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_GOTREF(__pyx_t_1); #endif } } else { @@ -19749,7 +17972,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 = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -19760,31 +17983,25 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_k); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -19792,33 +18009,33 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___2genera __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator18(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_genexpr *__pyx_cur_scope; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_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); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_26_genexpr *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr(__pyx_ptype_7pykeyvi___pyx_scope_struct_26_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_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_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_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_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -19834,9 +18051,9 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexp return __pyx_r; } -static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5generator18(__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); + 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; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -19844,6 +18061,7 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera 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; @@ -19851,19 +18069,18 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera __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 = 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_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_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_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 = 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 = 713; __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))) { @@ -19876,10 +18093,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 = 738; __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 = 713; __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_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_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -19887,9 +18104,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 = 738; __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 = 713; __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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -19897,16 +18114,18 @@ 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 = 738; __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 = 713; __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_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_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;} + __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;} #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_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_GOTREF(__pyx_t_1); #endif } } else { @@ -19915,7 +18134,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 = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -19926,31 +18145,25 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = PyBytes_Check(__pyx_cur_scope->__pyx_v_v); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_6); 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_r = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; - __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_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -19958,14 +18171,14 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XDECREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return NULL; + return __pyx_r; } -/* "pykeyvi.pyx":733 +/* "pykeyvi.pyx":708 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -19974,22 +18187,21 @@ static PyObject *__pyx_gb_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___5genera */ 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; + struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___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; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; 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); + __pyx_cur_scope = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_24___init__ *)__pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__(__pyx_ptype_7pykeyvi___pyx_scope_struct_24___init__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return -1; @@ -19999,7 +18211,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":734 + /* "pykeyvi.pyx":709 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -20010,92 +18222,98 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":735 + /* "pykeyvi.pyx":710 * 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_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_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __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 = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":709 + * + * 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":736 + /* "pykeyvi.pyx":711 * 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_5 = __pyx_cur_scope->__pyx_v_args; - __Pyx_INCREF(__pyx_t_5); - if (unlikely(__pyx_t_5 == Py_None)) { + __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_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = ((__pyx_t_6 == 1) != 0); + __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); if (__pyx_t_1) { - goto __pyx_L5_next_and; } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L4_bool_binop_done; } - __pyx_L5_next_and:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_7 = PyInt_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - goto __pyx_L7_next_or; + __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_8; + __pyx_t_1 = __pyx_t_7; goto __pyx_L6_bool_binop_done; } - __pyx_L7_next_or:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_8 = PyLong_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = (__pyx_t_8 != 0); - __pyx_t_1 = __pyx_t_7; + __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_7 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_7; + __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":737 + /* "pykeyvi.pyx":712 * 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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __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 = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __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 = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pykeyvi.pyx":711 + * 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":738 + /* "pykeyvi.pyx":713 * 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())): # <<<<<<<<<<<<<< @@ -20106,142 +18324,127 @@ 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 = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = ((__pyx_t_6 == 2) != 0); - if (__pyx_t_7) { - goto __pyx_L9_next_and; + __pyx_t_6 = ((__pyx_t_5 == 2) != 0); + if (__pyx_t_6) { } else { - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_L9_next_and:; __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_8 = (__pyx_t_1 != 0); - if (!__pyx_t_8) { - goto __pyx_L12_next_or; + __pyx_t_7 = (__pyx_t_1 != 0); + if (!__pyx_t_7) { } else { - __pyx_t_7 = __pyx_t_8; + __pyx_t_6 = __pyx_t_7; goto __pyx_L11_bool_binop_done; } - __pyx_L12_next_or:; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_args, 0); __Pyx_INCREF(__pyx_t_3); - __pyx_t_8 = PyLong_Check(__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_8 != 0); - __pyx_t_7 = __pyx_t_1; - __pyx_L11_bool_binop_done:; __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) { - goto __pyx_L10_next_and; } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L8_bool_binop_done; } - __pyx_L10_next_and:; __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_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - goto __pyx_L13_next_and; + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { } else { - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_L13_next_and:; - __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_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_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); 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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 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; - if (__pyx_t_7) { - goto __pyx_L14_next_and; + __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { } else { - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } - __pyx_L14_next_and:; - __pyx_t_3 = __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init___3genexpr(((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 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __pyx_t_7; + __pyx_t_2 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (__pyx_t_2) { - /* "pykeyvi.pyx":739 + /* "pykeyvi.pyx":714 * 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_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_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __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 = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":713 + * 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; } - /*else*/ { - /* "pykeyvi.pyx":741 + /* "pykeyvi.pyx":716 * self._init_2(*args) * else: * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * * def Add(self, bytes in_0 ): */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + /*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_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_args); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_not_handle_type_of_s, __pyx_t_5); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __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_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_L3:; - /* "pykeyvi.pyx":733 + /* "pykeyvi.pyx":708 * del v1 * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -20255,7 +18458,6 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -20264,12 +18466,12 @@ static int __pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_8__init__(struct __pyx_ return __pyx_r; } -/* "pykeyvi.pyx":743 +/* "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' - * cdef const_char * input_in_0 = in_0 + * */ /* Python wrapper */ @@ -20281,7 +18483,7 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add(PyObject *_ 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 = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 */ @@ -20294,63 +18496,53 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_11Add(PyObject *_ } static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(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; + std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("Add", 0); - /* "pykeyvi.pyx":744 + /* "pykeyvi.pyx":719 * * def Add(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().Add(input_in_0) + * + * 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 = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":745 - * def Add(self, bytes in_0 ): + /* "pykeyvi.pyx":721 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * self.inst.get().Add(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 = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - - /* "pykeyvi.pyx":746 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * self.inst.get().Add(input_in_0) # <<<<<<<<<<<<<< + * 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(__pyx_v_input_in_0); + __pyx_v_self->inst.get()->Add(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":743 + /* "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' - * cdef const_char * input_in_0 = in_0 + * */ /* function exit code */ @@ -20365,8 +18557,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_10Add(struct __py return __pyx_r; } -/* "pykeyvi.pyx":748 - * self.inst.get().Add(input_in_0) +/* "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' @@ -20382,7 +18574,7 @@ static PyObject *__pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_13WriteToFile(PyO 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;} + 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)); /* function exit code */ @@ -20405,7 +18597,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("WriteToFile", 0); - /* "pykeyvi.pyx":749 + /* "pykeyvi.pyx":724 * * def WriteToFile(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< @@ -20417,22 +18609,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 = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":750 + /* "pykeyvi.pyx":725 * 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_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_v_input_in_0 = ((const char *)__pyx_t_2); - /* "pykeyvi.pyx":751 + /* "pykeyvi.pyx":726 * 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) # <<<<<<<<<<<<<< @@ -20441,8 +18633,8 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str */ __pyx_v_self->inst.get()->WriteToFile(__pyx_v_input_in_0); - /* "pykeyvi.pyx":748 - * self.inst.get().Add(input_in_0) + /* "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' @@ -20461,7 +18653,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_12WriteToFile(str return __pyx_r; } -/* "pykeyvi.pyx":753 +/* "pykeyvi.pyx":728 * self.inst.get().WriteToFile(input_in_0) * * def __enter__(self): # <<<<<<<<<<<<<< @@ -20487,7 +18679,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__", 0); - /* "pykeyvi.pyx":754 + /* "pykeyvi.pyx":729 * * def __enter__(self): * return self # <<<<<<<<<<<<<< @@ -20499,7 +18691,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struc __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "pykeyvi.pyx":753 + /* "pykeyvi.pyx":728 * self.inst.get().WriteToFile(input_in_0) * * def __enter__(self): # <<<<<<<<<<<<<< @@ -20514,7 +18706,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_14__enter__(struc return __pyx_r; } -/* "pykeyvi.pyx":757 +/* "pykeyvi.pyx":732 * * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -20555,16 +18747,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 = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __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;} + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __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 = 757; __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 = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -20579,7 +18771,7 @@ 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 = 757; __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 = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pykeyvi.KeyOnlyDictionaryCompiler.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -20603,14 +18795,14 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__exit__", 0); - /* "pykeyvi.pyx":758 + /* "pykeyvi.pyx":733 * * 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 = 758; __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 = 733; __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))) { @@ -20623,16 +18815,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 = 758; __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 = 733; __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_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_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":757 + /* "pykeyvi.pyx":732 * * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -20655,7 +18847,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_16__exit__(struct return __pyx_r; } -/* "pykeyvi.pyx":761 +/* "pykeyvi.pyx":736 * * * def Compile(self, *args): # <<<<<<<<<<<<<< @@ -20689,7 +18881,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct int __pyx_t_2; __Pyx_RefNannySetupContext("Compile", 0); - /* "pykeyvi.pyx":762 + /* "pykeyvi.pyx":737 * * def Compile(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -20700,7 +18892,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":763 + /* "pykeyvi.pyx":738 * def Compile(self, *args): * if not args: * with nogil: # <<<<<<<<<<<<<< @@ -20714,7 +18906,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct #endif /*try:*/ { - /* "pykeyvi.pyx":764 + /* "pykeyvi.pyx":739 * if not args: * with nogil: * self.inst.get().Compile() # <<<<<<<<<<<<<< @@ -20724,7 +18916,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __pyx_v_self->inst.get()->Compile(); } - /* "pykeyvi.pyx":763 + /* "pykeyvi.pyx":738 * def Compile(self, *args): * if not args: * with nogil: # <<<<<<<<<<<<<< @@ -20742,7 +18934,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct } } - /* "pykeyvi.pyx":765 + /* "pykeyvi.pyx":740 * with nogil: * self.inst.get().Compile() * return # <<<<<<<<<<<<<< @@ -20752,9 +18944,17 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; + + /* "pykeyvi.pyx":737 + * + * def Compile(self, *args): + * if not args: # <<<<<<<<<<<<<< + * with nogil: + * self.inst.get().Compile() + */ } - /* "pykeyvi.pyx":767 + /* "pykeyvi.pyx":742 * return * * cdef void* callback = args[0] # <<<<<<<<<<<<<< @@ -20763,7 +18963,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct */ __pyx_v_callback = ((void *)PyTuple_GET_ITEM(__pyx_v_args, 0)); - /* "pykeyvi.pyx":768 + /* "pykeyvi.pyx":743 * * cdef void* callback = args[0] * with nogil: # <<<<<<<<<<<<<< @@ -20777,7 +18977,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct #endif /*try:*/ { - /* "pykeyvi.pyx":769 + /* "pykeyvi.pyx":744 * cdef void* callback = args[0] * with nogil: * self.inst.get().Compile(callback_wrapper, callback) # <<<<<<<<<<<<<< @@ -20787,7 +18987,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":768 + /* "pykeyvi.pyx":743 * * cdef void* callback = args[0] * with nogil: # <<<<<<<<<<<<<< @@ -20805,7 +19005,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct } } - /* "pykeyvi.pyx":761 + /* "pykeyvi.pyx":736 * * * def Compile(self, *args): # <<<<<<<<<<<<<< @@ -20821,7 +19021,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_18Compile(struct return __pyx_r; } -/* "pykeyvi.pyx":772 +/* "pykeyvi.pyx":747 * * * def SetManifest(self, manifest): # <<<<<<<<<<<<<< @@ -20856,16 +19056,16 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetManifest", 0); - /* "pykeyvi.pyx":773 + /* "pykeyvi.pyx":748 * * 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 = 773; __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 = 748; __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 = 773; __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 = 748; __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; @@ -20879,16 +19079,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 = 773; __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 = 748; __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 = 773; __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 = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_manifest); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_manifest); __Pyx_GIVEREF(__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;} + 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_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -20896,17 +19096,17 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; - /* "pykeyvi.pyx":774 + /* "pykeyvi.pyx":749 * 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 = 774; __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 = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->inst.get()->SetManifestFromString(__pyx_t_5); - /* "pykeyvi.pyx":772 + /* "pykeyvi.pyx":747 * * * def SetManifest(self, manifest): # <<<<<<<<<<<<<< @@ -20931,7 +19131,7 @@ static PyObject *__pyx_pf_7pykeyvi_25KeyOnlyDictionaryCompiler_20SetManifest(str return __pyx_r; } -/* "pykeyvi.pyx":780 +/* "pykeyvi.pyx":755 * cdef shared_ptr[_Match] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -20954,7 +19154,7 @@ static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "pykeyvi.pyx":781 + /* "pykeyvi.pyx":756 * * def __dealloc__(self): * self.inst.reset() # <<<<<<<<<<<<<< @@ -20963,7 +19163,7 @@ static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match */ __pyx_v_self->inst.reset(); - /* "pykeyvi.pyx":780 + /* "pykeyvi.pyx":755 * cdef shared_ptr[_Match] inst * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -20975,7 +19175,7 @@ static void __pyx_pf_7pykeyvi_5Match___dealloc__(struct __pyx_obj_7pykeyvi_Match __Pyx_RefNannyFinishContext(); } -/* "pykeyvi.pyx":784 +/* "pykeyvi.pyx":759 * * * def SetEnd(self, end ): # <<<<<<<<<<<<<< @@ -21008,7 +19208,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_2SetEnd(struct __pyx_obj_7pykeyvi_Matc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetEnd", 0); - /* "pykeyvi.pyx":785 + /* "pykeyvi.pyx":760 * * def SetEnd(self, end ): * assert isinstance(end, (int, long)), 'arg end wrong type' # <<<<<<<<<<<<<< @@ -21020,34 +19220,32 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_2SetEnd(struct __pyx_obj_7pykeyvi_Matc __pyx_t_2 = PyInt_Check(__pyx_v_end); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":787 + /* "pykeyvi.pyx":762 * assert isinstance(end, (int, long)), 'arg end wrong type' * * self.inst.get().SetEnd((end)) # <<<<<<<<<<<<<< * * 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 = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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)); - /* "pykeyvi.pyx":784 + /* "pykeyvi.pyx":759 * * * def SetEnd(self, end ): # <<<<<<<<<<<<<< @@ -21067,7 +19265,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_2SetEnd(struct __pyx_obj_7pykeyvi_Matc return __pyx_r; } -/* "pykeyvi.pyx":789 +/* "pykeyvi.pyx":764 * self.inst.get().SetEnd((end)) * * def GetStart(self): # <<<<<<<<<<<<<< @@ -21099,7 +19297,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Ma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetStart", 0); - /* "pykeyvi.pyx":790 + /* "pykeyvi.pyx":765 * * def GetStart(self): * cdef size_t _r = self.inst.get().GetStart() # <<<<<<<<<<<<<< @@ -21108,7 +19306,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v__r = __pyx_v_self->inst.get()->GetStart(); - /* "pykeyvi.pyx":791 + /* "pykeyvi.pyx":766 * def GetStart(self): * cdef size_t _r = self.inst.get().GetStart() * py_result = _r # <<<<<<<<<<<<<< @@ -21117,7 +19315,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v_py_result = ((size_t)__pyx_v__r); - /* "pykeyvi.pyx":792 + /* "pykeyvi.pyx":767 * cdef size_t _r = self.inst.get().GetStart() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -21125,13 +19323,13 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Ma * def GetScore(self): */ __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 = 792; __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 = 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; - /* "pykeyvi.pyx":789 + /* "pykeyvi.pyx":764 * self.inst.get().SetEnd((end)) * * def GetStart(self): # <<<<<<<<<<<<<< @@ -21150,7 +19348,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_4GetStart(struct __pyx_obj_7pykeyvi_Ma return __pyx_r; } -/* "pykeyvi.pyx":794 +/* "pykeyvi.pyx":769 * return py_result * * def GetScore(self): # <<<<<<<<<<<<<< @@ -21182,7 +19380,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Ma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetScore", 0); - /* "pykeyvi.pyx":795 + /* "pykeyvi.pyx":770 * * def GetScore(self): * cdef float _r = self.inst.get().GetScore() # <<<<<<<<<<<<<< @@ -21191,19 +19389,19 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v__r = __pyx_v_self->inst.get()->GetScore(); - /* "pykeyvi.pyx":796 + /* "pykeyvi.pyx":771 * def GetScore(self): * cdef float _r = self.inst.get().GetScore() * py_result = _r # <<<<<<<<<<<<<< * return py_result * */ - __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_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; - /* "pykeyvi.pyx":797 + /* "pykeyvi.pyx":772 * cdef float _r = self.inst.get().GetScore() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -21215,7 +19413,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Ma __pyx_r = __pyx_v_py_result; goto __pyx_L0; - /* "pykeyvi.pyx":794 + /* "pykeyvi.pyx":769 * return py_result * * def GetScore(self): # <<<<<<<<<<<<<< @@ -21235,7 +19433,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_6GetScore(struct __pyx_obj_7pykeyvi_Ma return __pyx_r; } -/* "pykeyvi.pyx":799 +/* "pykeyvi.pyx":774 * return py_result * * def SetMatchedString(self, bytes matched_string ): # <<<<<<<<<<<<<< @@ -21252,7 +19450,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_9SetMatchedString(PyObject *__pyx_v_se 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;} + 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)); /* function exit code */ @@ -21274,7 +19472,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_8SetMatchedString(struct __pyx_obj_7py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetMatchedString", 0); - /* "pykeyvi.pyx":800 + /* "pykeyvi.pyx":775 * * def SetMatchedString(self, bytes matched_string ): * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' # <<<<<<<<<<<<<< @@ -21286,22 +19484,22 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_8SetMatchedString(struct __pyx_obj_7py __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":802 + /* "pykeyvi.pyx":777 * assert isinstance(matched_string, bytes), 'arg matched_string wrong type' * * self.inst.get().SetMatchedString((matched_string)) # <<<<<<<<<<<<<< * * def GetValueAsString(self): */ - __pyx_t_2 = __pyx_convert_string_from_py_(__pyx_v_matched_string); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":799 + /* "pykeyvi.pyx":774 * return py_result * * def SetMatchedString(self, bytes matched_string ): # <<<<<<<<<<<<<< @@ -21321,7 +19519,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_8SetMatchedString(struct __pyx_obj_7py return __pyx_r; } -/* "pykeyvi.pyx":804 +/* "pykeyvi.pyx":779 * self.inst.get().SetMatchedString((matched_string)) * * def GetValueAsString(self): # <<<<<<<<<<<<<< @@ -21354,7 +19552,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetValueAsString", 0); - /* "pykeyvi.pyx":805 + /* "pykeyvi.pyx":780 * * def GetValueAsString(self): * cdef libcpp_string _r = self.inst.get().GetValueAsString() # <<<<<<<<<<<<<< @@ -21365,11 +19563,11 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7p __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_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v__r = __pyx_t_1; - /* "pykeyvi.pyx":806 + /* "pykeyvi.pyx":781 * def GetValueAsString(self): * cdef libcpp_string _r = self.inst.get().GetValueAsString() * py_result = _r # <<<<<<<<<<<<<< @@ -21378,7 +19576,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7p */ __pyx_v_py_result = ((std::string)__pyx_v__r); - /* "pykeyvi.pyx":807 + /* "pykeyvi.pyx":782 * cdef libcpp_string _r = self.inst.get().GetValueAsString() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -21386,13 +19584,13 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7p * def IsEmpty(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_convert_string_to_py_(__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_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; goto __pyx_L0; - /* "pykeyvi.pyx":804 + /* "pykeyvi.pyx":779 * self.inst.get().SetMatchedString((matched_string)) * * def GetValueAsString(self): # <<<<<<<<<<<<<< @@ -21411,7 +19609,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_10GetValueAsString(struct __pyx_obj_7p return __pyx_r; } -/* "pykeyvi.pyx":809 +/* "pykeyvi.pyx":784 * return py_result * * def IsEmpty(self): # <<<<<<<<<<<<<< @@ -21443,7 +19641,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Ma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("IsEmpty", 0); - /* "pykeyvi.pyx":810 + /* "pykeyvi.pyx":785 * * def IsEmpty(self): * cdef bool _r = self.inst.get().IsEmpty() # <<<<<<<<<<<<<< @@ -21452,7 +19650,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v__r = __pyx_v_self->inst.get()->IsEmpty(); - /* "pykeyvi.pyx":811 + /* "pykeyvi.pyx":786 * def IsEmpty(self): * cdef bool _r = self.inst.get().IsEmpty() * py_result = _r # <<<<<<<<<<<<<< @@ -21461,7 +19659,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v_py_result = ((bool)__pyx_v__r); - /* "pykeyvi.pyx":812 + /* "pykeyvi.pyx":787 * cdef bool _r = self.inst.get().IsEmpty() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -21469,13 +19667,13 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Ma * def SetScore(self, float score ): */ __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 = 812; __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 = 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; - /* "pykeyvi.pyx":809 + /* "pykeyvi.pyx":784 * return py_result * * def IsEmpty(self): # <<<<<<<<<<<<<< @@ -21494,7 +19692,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_12IsEmpty(struct __pyx_obj_7pykeyvi_Ma return __pyx_r; } -/* "pykeyvi.pyx":814 +/* "pykeyvi.pyx":789 * return py_result * * def SetScore(self, float score ): # <<<<<<<<<<<<<< @@ -21513,7 +19711,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_15SetScore(PyObject *__pyx_v_self, PyO __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;} + __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;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -21538,7 +19736,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_M int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetScore", 0); - /* "pykeyvi.pyx":815 + /* "pykeyvi.pyx":790 * * def SetScore(self, float score ): * assert isinstance(score, float), 'arg score wrong type' # <<<<<<<<<<<<<< @@ -21547,18 +19745,18 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_M */ #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_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 = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":817 + /* "pykeyvi.pyx":792 * assert isinstance(score, float), 'arg score wrong type' * * self.inst.get().SetScore((score)) # <<<<<<<<<<<<<< @@ -21567,7 +19765,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_M */ __pyx_v_self->inst.get()->SetScore(((float)__pyx_v_score)); - /* "pykeyvi.pyx":814 + /* "pykeyvi.pyx":789 * return py_result * * def SetScore(self, float score ): # <<<<<<<<<<<<<< @@ -21588,7 +19786,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_14SetScore(struct __pyx_obj_7pykeyvi_M return __pyx_r; } -/* "pykeyvi.pyx":819 +/* "pykeyvi.pyx":794 * self.inst.get().SetScore((score)) * * def GetRawValueAsString(self): # <<<<<<<<<<<<<< @@ -21621,7 +19819,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetRawValueAsString", 0); - /* "pykeyvi.pyx":820 + /* "pykeyvi.pyx":795 * * def GetRawValueAsString(self): * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< @@ -21632,11 +19830,11 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj __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_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v__r = __pyx_t_1; - /* "pykeyvi.pyx":821 + /* "pykeyvi.pyx":796 * def GetRawValueAsString(self): * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() * py_result = _r # <<<<<<<<<<<<<< @@ -21645,7 +19843,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj */ __pyx_v_py_result = ((std::string)__pyx_v__r); - /* "pykeyvi.pyx":822 + /* "pykeyvi.pyx":797 * cdef libcpp_string _r = self.inst.get().GetRawValueAsString() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -21653,13 +19851,13 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj * def SetStart(self, start ): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_convert_string_to_py_(__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_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; - /* "pykeyvi.pyx":819 + /* "pykeyvi.pyx":794 * self.inst.get().SetScore((score)) * * def GetRawValueAsString(self): # <<<<<<<<<<<<<< @@ -21678,7 +19876,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_16GetRawValueAsString(struct __pyx_obj return __pyx_r; } -/* "pykeyvi.pyx":824 +/* "pykeyvi.pyx":799 * return py_result * * def SetStart(self, start ): # <<<<<<<<<<<<<< @@ -21711,7 +19909,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_M int __pyx_clineno = 0; __Pyx_RefNannySetupContext("SetStart", 0); - /* "pykeyvi.pyx":825 + /* "pykeyvi.pyx":800 * * def SetStart(self, start ): * assert isinstance(start, (int, long)), 'arg start wrong type' # <<<<<<<<<<<<<< @@ -21723,34 +19921,32 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_M __pyx_t_2 = PyInt_Check(__pyx_v_start); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { - goto __pyx_L4_next_or; } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } - __pyx_L4_next_or:; __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":827 + /* "pykeyvi.pyx":802 * 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_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)); - /* "pykeyvi.pyx":824 + /* "pykeyvi.pyx":799 * return py_result * * def SetStart(self, start ): # <<<<<<<<<<<<<< @@ -21770,7 +19966,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_18SetStart(struct __pyx_obj_7pykeyvi_M return __pyx_r; } -/* "pykeyvi.pyx":829 +/* "pykeyvi.pyx":804 * self.inst.get().SetStart((start)) * * def GetEnd(self): # <<<<<<<<<<<<<< @@ -21802,7 +19998,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Mat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetEnd", 0); - /* "pykeyvi.pyx":830 + /* "pykeyvi.pyx":805 * * def GetEnd(self): * cdef size_t _r = self.inst.get().GetEnd() # <<<<<<<<<<<<<< @@ -21811,7 +20007,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Mat */ __pyx_v__r = __pyx_v_self->inst.get()->GetEnd(); - /* "pykeyvi.pyx":831 + /* "pykeyvi.pyx":806 * def GetEnd(self): * cdef size_t _r = self.inst.get().GetEnd() * py_result = _r # <<<<<<<<<<<<<< @@ -21820,7 +20016,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Mat */ __pyx_v_py_result = ((size_t)__pyx_v__r); - /* "pykeyvi.pyx":832 + /* "pykeyvi.pyx":807 * cdef size_t _r = self.inst.get().GetEnd() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -21828,13 +20024,13 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Mat * def __copy__(self): */ __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 = 832; __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 = 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; - /* "pykeyvi.pyx":829 + /* "pykeyvi.pyx":804 * self.inst.get().SetStart((start)) * * def GetEnd(self): # <<<<<<<<<<<<<< @@ -21853,7 +20049,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_20GetEnd(struct __pyx_obj_7pykeyvi_Mat return __pyx_r; } -/* "pykeyvi.pyx":834 +/* "pykeyvi.pyx":809 * return py_result * * def __copy__(self): # <<<<<<<<<<<<<< @@ -21884,20 +20080,20 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_M int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__copy__", 0); - /* "pykeyvi.pyx":835 + /* "pykeyvi.pyx":810 * * 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 *)((PyObject*)__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_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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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":836 + /* "pykeyvi.pyx":811 * def __copy__(self): * cdef Match rv = Match.__new__(Match) * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) # <<<<<<<<<<<<<< @@ -21906,7 +20102,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_M */ __pyx_v_rv->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_self->inst.get()))); - /* "pykeyvi.pyx":837 + /* "pykeyvi.pyx":812 * cdef Match rv = Match.__new__(Match) * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) * return rv # <<<<<<<<<<<<<< @@ -21918,7 +20114,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_M __pyx_r = ((PyObject *)__pyx_v_rv); goto __pyx_L0; - /* "pykeyvi.pyx":834 + /* "pykeyvi.pyx":809 * return py_result * * def __copy__(self): # <<<<<<<<<<<<<< @@ -21938,7 +20134,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_22__copy__(struct __pyx_obj_7pykeyvi_M return __pyx_r; } -/* "pykeyvi.pyx":839 +/* "pykeyvi.pyx":814 * return rv * * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< @@ -21969,20 +20165,20 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykey int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__deepcopy__", 0); - /* "pykeyvi.pyx":840 + /* "pykeyvi.pyx":815 * * 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 *)((PyObject*)__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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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":841 + /* "pykeyvi.pyx":816 * def __deepcopy__(self, memo): * cdef Match rv = Match.__new__(Match) * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) # <<<<<<<<<<<<<< @@ -21991,7 +20187,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykey */ __pyx_v_rv->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_self->inst.get()))); - /* "pykeyvi.pyx":842 + /* "pykeyvi.pyx":817 * cdef Match rv = Match.__new__(Match) * rv.inst = shared_ptr[_Match](new _Match(deref(self.inst.get()))) * return rv # <<<<<<<<<<<<<< @@ -22003,7 +20199,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykey __pyx_r = ((PyObject *)__pyx_v_rv); goto __pyx_L0; - /* "pykeyvi.pyx":839 + /* "pykeyvi.pyx":814 * return rv * * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< @@ -22023,7 +20219,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_24__deepcopy__(struct __pyx_obj_7pykey return __pyx_r; } -/* "pykeyvi.pyx":844 +/* "pykeyvi.pyx":819 * return rv * * def _init_0(self): # <<<<<<<<<<<<<< @@ -22049,7 +20245,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_26_init_0(struct __pyx_obj_7pykeyvi_Ma __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init_0", 0); - /* "pykeyvi.pyx":845 + /* "pykeyvi.pyx":820 * * def _init_0(self): * self.inst = shared_ptr[_Match](new _Match()) # <<<<<<<<<<<<<< @@ -22058,7 +20254,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_26_init_0(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v_self->inst = boost::shared_ptr (new keyvi::dictionary::Match()); - /* "pykeyvi.pyx":844 + /* "pykeyvi.pyx":819 * return rv * * def _init_0(self): # <<<<<<<<<<<<<< @@ -22073,7 +20269,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_26_init_0(struct __pyx_obj_7pykeyvi_Ma return __pyx_r; } -/* "pykeyvi.pyx":847 +/* "pykeyvi.pyx":822 * self.inst = shared_ptr[_Match](new _Match()) * * def _init_1(self, Match m ): # <<<<<<<<<<<<<< @@ -22090,7 +20286,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_29_init_1(PyObject *__pyx_v_self, PyOb 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;} + 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)); /* function exit code */ @@ -22111,7 +20307,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Ma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_init_1", 0); - /* "pykeyvi.pyx":848 + /* "pykeyvi.pyx":823 * * def _init_1(self, Match m ): * assert isinstance(m, Match), 'arg m wrong type' # <<<<<<<<<<<<<< @@ -22120,15 +20316,15 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Ma */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_m), ((PyObject*)__pyx_ptype_7pykeyvi_Match)); + __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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif - /* "pykeyvi.pyx":850 + /* "pykeyvi.pyx":825 * assert isinstance(m, Match), 'arg m wrong type' * * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) # <<<<<<<<<<<<<< @@ -22137,7 +20333,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Ma */ __pyx_v_self->inst = boost::shared_ptr (new keyvi::dictionary::Match((*__pyx_v_m->inst.get()))); - /* "pykeyvi.pyx":847 + /* "pykeyvi.pyx":822 * self.inst = shared_ptr[_Match](new _Match()) * * def _init_1(self, Match m ): # <<<<<<<<<<<<<< @@ -22157,7 +20353,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_28_init_1(struct __pyx_obj_7pykeyvi_Ma return __pyx_r; } -/* "pykeyvi.pyx":852 +/* "pykeyvi.pyx":827 * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -22190,15 +20386,14 @@ static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match * int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; + 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 + /* "pykeyvi.pyx":828 * * def __init__(self, *args): * if not args: # <<<<<<<<<<<<<< @@ -22209,100 +20404,108 @@ static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match * __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":854 + /* "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 = 854; __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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pykeyvi.pyx":828 + * + * 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 + /* "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_6 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((__pyx_t_6 == 1) != 0); + __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) { - goto __pyx_L5_next_and; } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L4_bool_binop_done; } - __pyx_L5_next_and:; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_args, 0); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_5, ((PyObject*)__pyx_ptype_7pykeyvi_Match)); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_7; + __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 + /* "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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_5); __pyx_t_5 = 0; __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: + */ goto __pyx_L3; } - /*else*/ { - /* "pykeyvi.pyx":858 + /* "pykeyvi.pyx":833 * self._init_1(*args) * else: * raise Exception('can not handle type of %s' % (args,)) # <<<<<<<<<<<<<< * * def GetMatchedString(self): */ - __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;} + /*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); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_args); __Pyx_GIVEREF(__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;} + 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 = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __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_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 = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; - /* "pykeyvi.pyx":852 + /* "pykeyvi.pyx":827 * self.inst = shared_ptr[_Match](new _Match((deref(m.inst.get())))) * * def __init__(self, *args): # <<<<<<<<<<<<<< @@ -22316,7 +20519,6 @@ static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match * __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("pykeyvi.Match.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -22324,7 +20526,7 @@ static int __pyx_pf_7pykeyvi_5Match_30__init__(struct __pyx_obj_7pykeyvi_Match * return __pyx_r; } -/* "pykeyvi.pyx":860 +/* "pykeyvi.pyx":835 * raise Exception('can not handle type of %s' % (args,)) * * def GetMatchedString(self): # <<<<<<<<<<<<<< @@ -22356,7 +20558,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetMatchedString", 0); - /* "pykeyvi.pyx":861 + /* "pykeyvi.pyx":836 * * def GetMatchedString(self): * cdef libcpp_string _r = self.inst.get().GetMatchedString() # <<<<<<<<<<<<<< @@ -22365,7 +20567,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7p */ __pyx_v__r = __pyx_v_self->inst.get()->GetMatchedString(); - /* "pykeyvi.pyx":862 + /* "pykeyvi.pyx":837 * def GetMatchedString(self): * cdef libcpp_string _r = self.inst.get().GetMatchedString() * py_result = _r # <<<<<<<<<<<<<< @@ -22374,7 +20576,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7p */ __pyx_v_py_result = ((std::string)__pyx_v__r); - /* "pykeyvi.pyx":863 + /* "pykeyvi.pyx":838 * cdef libcpp_string _r = self.inst.get().GetMatchedString() * py_result = _r * return py_result # <<<<<<<<<<<<<< @@ -22382,13 +20584,13 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7p * def GetAttribute(self, key): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_string_to_py_(__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_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; - /* "pykeyvi.pyx":860 + /* "pykeyvi.pyx":835 * raise Exception('can not handle type of %s' % (args,)) * * def GetMatchedString(self): # <<<<<<<<<<<<<< @@ -22407,7 +20609,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_32GetMatchedString(struct __pyx_obj_7p return __pyx_r; } -/* "pykeyvi.pyx":865 +/* "pykeyvi.pyx":840 * return py_result * * def GetAttribute(self, key): # <<<<<<<<<<<<<< @@ -22444,7 +20646,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykey __Pyx_RefNannySetupContext("GetAttribute", 0); __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":866 + /* "pykeyvi.pyx":841 * * def GetAttribute(self, key): * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -22455,41 +20657,47 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykey __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":867 + /* "pykeyvi.pyx":842 * 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_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 = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; - goto __pyx_L3; + + /* "pykeyvi.pyx":841 + * + * def GetAttribute(self, key): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< + * key = key.encode("utf-8") + * + */ } - __pyx_L3:; - /* "pykeyvi.pyx":869 + /* "pykeyvi.pyx":844 * key = key.encode("utf-8") * * py_result = self.inst.get().GetAttributePy( key) # <<<<<<<<<<<<<< * return py_result * */ - __pyx_t_5 = __pyx_convert_string_from_py_(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __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 = 844; __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_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_py_result = __pyx_t_6; - /* "pykeyvi.pyx":870 + /* "pykeyvi.pyx":845 * * py_result = self.inst.get().GetAttributePy( key) * return py_result # <<<<<<<<<<<<<< @@ -22501,7 +20709,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykey __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":865 + /* "pykeyvi.pyx":840 * return py_result * * def GetAttribute(self, key): # <<<<<<<<<<<<<< @@ -22522,7 +20730,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_34GetAttribute(struct __pyx_obj_7pykey return __pyx_r; } -/* "pykeyvi.pyx":873 +/* "pykeyvi.pyx":848 * * * def SetAttribute(self, key, value): # <<<<<<<<<<<<<< @@ -22561,11 +20769,11 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, 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;} + __Pyx_RaiseArgtupleInvalid("SetAttribute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __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;} + 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;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -22578,7 +20786,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, } 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_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_L3_error:; __Pyx_AddTraceback("pykeyvi.Match.SetAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -22592,7 +20800,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_37SetAttribute(PyObject *__pyx_v_self, } static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykeyvi_Match *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { - PyObject *__pyx_v_t = NULL; + PyTypeObject *__pyx_v_t = NULL; PyObject *__pyx_v_value_utf8 = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -22611,7 +20819,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykey __Pyx_RefNannySetupContext("SetAttribute", 0); __Pyx_INCREF(__pyx_v_key); - /* "pykeyvi.pyx":874 + /* "pykeyvi.pyx":849 * * def SetAttribute(self, key, value): * if isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -22622,170 +20830,208 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykey __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pykeyvi.pyx":875 + /* "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 = 875; __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 = 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 = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; - goto __pyx_L3; - } - __pyx_L3:; - /* "pykeyvi.pyx":877 + /* "pykeyvi.pyx":849 + * + * def SetAttribute(self, key, value): + * if isinstance(key, unicode): # <<<<<<<<<<<<<< * key = key.encode("utf-8") * - * t = type(value) # <<<<<<<<<<<<<< - * if t == str: - * self.inst.get().SetAttribute( key, value) + */ + } + + /* "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 = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_v_t = ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_value))); - /* "pykeyvi.pyx":878 + /* "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 *)((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_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":879 + /* "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_(__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_(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __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 = 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 = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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":880 + /* "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 *)((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_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":881 + /* "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 = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":882 + /* "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_(__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_(__pyx_v_value_utf8); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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":883 + /* "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 *)((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_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":884 + /* "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_(__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;} + __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 = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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":885 + /* "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 *)((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_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":886 + /* "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_(__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;} + __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 = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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":888 + /* "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)): # <<<<<<<<<<<<<< @@ -22796,41 +21042,49 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykey __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "pykeyvi.pyx":889 + /* "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_(__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;} + __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 = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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; } - /*else*/ { - /* "pykeyvi.pyx":891 + /* "pykeyvi.pyx":866 * self.inst.get().SetAttribute( key, value) * else: * raise Exception("Unsupported Value Type") # <<<<<<<<<<<<<< * * */ - __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;} + /*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 = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L4:; - /* "pykeyvi.pyx":873 + /* "pykeyvi.pyx":848 * * * def SetAttribute(self, key, value): # <<<<<<<<<<<<<< @@ -22855,7 +21109,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_36SetAttribute(struct __pyx_obj_7pykey return __pyx_r; } -/* "pykeyvi.pyx":894 +/* "pykeyvi.pyx":869 * * * def GetValue(self): # <<<<<<<<<<<<<< @@ -22896,7 +21150,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M int __pyx_clineno = 0; __Pyx_RefNannySetupContext("GetValue", 0); - /* "pykeyvi.pyx":896 + /* "pykeyvi.pyx":871 * def GetValue(self): * """Decodes a keyvi value and returns it.""" * value = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< @@ -22907,14 +21161,14 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M __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_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __pyx_convert_string_to_py_(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__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 = 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":897 + /* "pykeyvi.pyx":872 * """Decodes a keyvi value and returns it.""" * value = self.inst.get().GetRawValueAsString() * if value is None or len(value) == 0: # <<<<<<<<<<<<<< @@ -22924,19 +21178,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M __pyx_t_4 = (__pyx_v_value == Py_None); __pyx_t_5 = (__pyx_t_4 != 0); if (!__pyx_t_5) { - goto __pyx_L5_next_or; } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } - __pyx_L5_next_or:; - __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_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":898 + /* "pykeyvi.pyx":873 * value = self.inst.get().GetRawValueAsString() * if value is None or len(value) == 0: * return None # <<<<<<<<<<<<<< @@ -22947,22 +21199,30 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M __Pyx_INCREF(Py_None); __pyx_r = Py_None; 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":900 + /* "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 = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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 = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":901 + /* "pykeyvi.pyx":876 * * elif value[0] == '\x00': * return msgpack.loads(value[1:]) # <<<<<<<<<<<<<< @@ -22970,12 +21230,12 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M * 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_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 = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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))) { @@ -22988,17 +21248,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M } } 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_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 = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL; - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7); + __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_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; } @@ -23006,34 +21266,42 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; + + /* "pykeyvi.pyx":875 + * return None + * + * elif value[0] == '\x00': # <<<<<<<<<<<<<< + * return msgpack.loads(value[1:]) + * + */ } - /* "pykeyvi.pyx":903 + /* "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 = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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 = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { - /* "pykeyvi.pyx":904 + /* "pykeyvi.pyx":879 * * 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_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 = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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))) { @@ -23046,52 +21314,60 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M } } 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_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); } 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_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); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8); + __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_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_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; } - /* "pykeyvi.pyx":906 + /* "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 = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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 = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":907 + /* "pykeyvi.pyx":882 * * 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_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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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))) { @@ -23104,28 +21380,35 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M } } 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_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); } 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_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); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL; - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_10); + __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_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_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L3; + + /* "pykeyvi.pyx":881 + * value = zlib.decompress(value[1:]) + * + * elif value[0] == '\x02': # <<<<<<<<<<<<<< + * value = snappy.decompress(value[1:]) + * + */ } __pyx_L3:; - /* "pykeyvi.pyx":909 + /* "pykeyvi.pyx":884 * value = snappy.decompress(value[1:]) * * return msgpack.loads(value) # <<<<<<<<<<<<<< @@ -23133,9 +21416,9 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M * */ __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_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 = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; @@ -23149,16 +21432,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M } } 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_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 = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL; + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_value); __Pyx_GIVEREF(__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;} + 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; } @@ -23167,7 +21450,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M __pyx_t_2 = 0; goto __pyx_L0; - /* "pykeyvi.pyx":894 + /* "pykeyvi.pyx":869 * * * def GetValue(self): # <<<<<<<<<<<<<< @@ -23191,7 +21474,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_38GetValue(struct __pyx_obj_7pykeyvi_M return __pyx_r; } -/* "pykeyvi.pyx":912 +/* "pykeyvi.pyx":887 * * * def dumps(self): # <<<<<<<<<<<<<< @@ -23236,19 +21519,19 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dumps", 0); - /* "pykeyvi.pyx":913 + /* "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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; - /* "pykeyvi.pyx":914 + /* "pykeyvi.pyx":889 * def dumps(self): * m=[] * do_pack_rest = False # <<<<<<<<<<<<<< @@ -23257,40 +21540,40 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc */ __pyx_v_do_pack_rest = 0; - /* "pykeyvi.pyx":915 + /* "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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_score = __pyx_t_1; __pyx_t_1 = 0; - /* "pykeyvi.pyx":916 + /* "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 = 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_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_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "pykeyvi.pyx":917 + /* "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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":918 + /* "pykeyvi.pyx":893 * if score != 0: * m.append(score) * do_pack_rest = True # <<<<<<<<<<<<<< @@ -23298,11 +21581,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc * if end != 0 or do_pack_rest: */ __pyx_v_do_pack_rest = 1; - goto __pyx_L3; + + /* "pykeyvi.pyx":891 + * do_pack_rest = False + * score = self.inst.get().GetScore() + * if score != 0: # <<<<<<<<<<<<<< + * m.append(score) + * do_pack_rest = True + */ } - __pyx_L3:; - /* "pykeyvi.pyx":919 + /* "pykeyvi.pyx":894 * m.append(score) * do_pack_rest = True * end = self.inst.get().GetEnd() # <<<<<<<<<<<<<< @@ -23311,7 +21600,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc */ __pyx_v_end = __pyx_v_self->inst.get()->GetEnd(); - /* "pykeyvi.pyx":920 + /* "pykeyvi.pyx":895 * do_pack_rest = True * end = self.inst.get().GetEnd() * if end != 0 or do_pack_rest: # <<<<<<<<<<<<<< @@ -23320,30 +21609,28 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc */ __pyx_t_4 = ((__pyx_v_end != 0) != 0); if (!__pyx_t_4) { - goto __pyx_L6_next_or; } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } - __pyx_L6_next_or:; __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 + /* "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 = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; - /* "pykeyvi.pyx":922 + /* "pykeyvi.pyx":897 * if end != 0 or do_pack_rest: * m.append(end) * do_pack_rest = True # <<<<<<<<<<<<<< @@ -23351,11 +21638,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc * if start != 0 or do_pack_rest: */ __pyx_v_do_pack_rest = 1; - goto __pyx_L4; + + /* "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_L4:; - /* "pykeyvi.pyx":923 + /* "pykeyvi.pyx":898 * m.append(end) * do_pack_rest = True * start = self.inst.get().GetStart() # <<<<<<<<<<<<<< @@ -23364,7 +21657,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc */ __pyx_v_start = __pyx_v_self->inst.get()->GetStart(); - /* "pykeyvi.pyx":924 + /* "pykeyvi.pyx":899 * do_pack_rest = True * start = self.inst.get().GetStart() * if start != 0 or do_pack_rest: # <<<<<<<<<<<<<< @@ -23373,30 +21666,28 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc */ __pyx_t_4 = ((__pyx_v_start != 0) != 0); if (!__pyx_t_4) { - goto __pyx_L9_next_or; } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L8_bool_binop_done; } - __pyx_L9_next_or:; __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 + /* "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 = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; - /* "pykeyvi.pyx":926 + /* "pykeyvi.pyx":901 * if start != 0 or do_pack_rest: * m.append(start) * do_pack_rest = True # <<<<<<<<<<<<<< @@ -23404,11 +21695,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc * if len(matchedstring) != 0 or do_pack_rest: */ __pyx_v_do_pack_rest = 1; - goto __pyx_L7; + + /* "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_L7:; - /* "pykeyvi.pyx":927 + /* "pykeyvi.pyx":902 * m.append(start) * do_pack_rest = True * matchedstring = self.inst.get().GetMatchedString() # <<<<<<<<<<<<<< @@ -23417,43 +21714,41 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc */ __pyx_v_matchedstring = __pyx_v_self->inst.get()->GetMatchedString(); - /* "pykeyvi.pyx":928 + /* "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_string_to_py_(__pyx_v_matchedstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { - goto __pyx_L12_next_or; } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L11_bool_binop_done; } - __pyx_L12_next_or:; __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 + /* "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() */ - __pyx_t_1 = __pyx_convert_string_to_py_(__pyx_v_matchedstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":930 + /* "pykeyvi.pyx":905 * if len(matchedstring) != 0 or do_pack_rest: * m.append(matchedstring) * do_pack_rest = True # <<<<<<<<<<<<<< @@ -23461,11 +21756,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc * if len(rawvalue) != 0 or do_pack_rest: */ __pyx_v_do_pack_rest = 1; - goto __pyx_L10; + + /* "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_L10:; - /* "pykeyvi.pyx":931 + /* "pykeyvi.pyx":906 * m.append(matchedstring) * do_pack_rest = True * rawvalue = self.inst.get().GetRawValueAsString() # <<<<<<<<<<<<<< @@ -23476,59 +21777,63 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc __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_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_rawvalue = __pyx_t_6; - /* "pykeyvi.pyx":932 + /* "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() */ - __pyx_t_1 = __pyx_convert_string_to_py_(__pyx_v_rawvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { - goto __pyx_L15_next_or; } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L14_bool_binop_done; } - __pyx_L15_next_or:; __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 + /* "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) */ - __pyx_t_1 = __pyx_convert_string_to_py_(__pyx_v_rawvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; - goto __pyx_L13; + + /* "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() + */ } - __pyx_L13:; - /* "pykeyvi.pyx":934 + /* "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 = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":935 + /* "pykeyvi.pyx":910 * m.append(rawvalue) * m.reverse() * return msgpack.dumps(m) # <<<<<<<<<<<<<< @@ -23536,9 +21841,9 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc * 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_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 = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; @@ -23552,16 +21857,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc } } 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_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 = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_INCREF(__pyx_v_m); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_m); __Pyx_GIVEREF(__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;} + 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; } @@ -23570,7 +21875,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc __pyx_t_1 = 0; goto __pyx_L0; - /* "pykeyvi.pyx":912 + /* "pykeyvi.pyx":887 * * * def dumps(self): # <<<<<<<<<<<<<< @@ -23594,7 +21899,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_40dumps(struct __pyx_obj_7pykeyvi_Matc return __pyx_r; } -/* "pykeyvi.pyx":937 +/* "pykeyvi.pyx":912 * return msgpack.dumps(m) * * def __SetRawValue(self, str): # <<<<<<<<<<<<<< @@ -23624,22 +21929,22 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pyke int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__SetRawValue", 0); - /* "pykeyvi.pyx":938 + /* "pykeyvi.pyx":913 * * def __SetRawValue(self, str): * self.inst.get().SetRawValue( str) # <<<<<<<<<<<<<< * * @staticmethod */ - __pyx_t_1 = __pyx_convert_string_from_py_(__pyx_v_str); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} 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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pykeyvi.pyx":937 + /* "pykeyvi.pyx":912 * return msgpack.dumps(m) * * def __SetRawValue(self, str): # <<<<<<<<<<<<<< @@ -23659,7 +21964,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_42__SetRawValue(struct __pyx_obj_7pyke return __pyx_r; } -/* "pykeyvi.pyx":941 +/* "pykeyvi.pyx":916 * * @staticmethod * def loads(serialized_match): # <<<<<<<<<<<<<< @@ -23696,7 +22001,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_ 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;} + 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;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -23707,7 +22012,7 @@ static PyObject *__pyx_pw_7pykeyvi_5Match_45loads(CYTHON_UNUSED PyObject *__pyx_ } 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_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_L3_error:; __Pyx_AddTraceback("pykeyvi.Match.loads", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -23738,28 +22043,28 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m int __pyx_clineno = 0; __Pyx_RefNannySetupContext("loads", 0); - /* "pykeyvi.pyx":942 + /* "pykeyvi.pyx":917 * @staticmethod * def loads(serialized_match): * m=Match() # <<<<<<<<<<<<<< * unserialized = msgpack.loads(serialized_match) * number_of_fields = len(unserialized) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((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_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_GOTREF(__pyx_t_1); __pyx_v_m = ((struct __pyx_obj_7pykeyvi_Match *)__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":943 + /* "pykeyvi.pyx":918 * 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_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_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_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_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -23773,16 +22078,16 @@ 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 = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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_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_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + __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); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_serialized_match); __Pyx_GIVEREF(__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;} + 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_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -23790,17 +22095,17 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_v_unserialized = __pyx_t_1; __pyx_t_1 = 0; - /* "pykeyvi.pyx":944 + /* "pykeyvi.pyx":919 * 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_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; - /* "pykeyvi.pyx":945 + /* "pykeyvi.pyx":920 * unserialized = msgpack.loads(serialized_match) * number_of_fields = len(unserialized) * if number_of_fields > 0: # <<<<<<<<<<<<<< @@ -23810,16 +22115,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_t_6 = ((__pyx_v_number_of_fields > 0) != 0); if (__pyx_t_6) { - /* "pykeyvi.pyx":946 + /* "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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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))) { @@ -23832,24 +22137,24 @@ 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_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); + __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_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; - /* "pykeyvi.pyx":947 + /* "pykeyvi.pyx":922 * if number_of_fields > 0: * m.__SetRawValue(unserialized[0]) * if number_of_fields > 1: # <<<<<<<<<<<<<< @@ -23859,16 +22164,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_t_6 = ((__pyx_v_number_of_fields > 1) != 0); if (__pyx_t_6) { - /* "pykeyvi.pyx":948 + /* "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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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))) { @@ -23881,24 +22186,24 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m } } 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_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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); + __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_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; - /* "pykeyvi.pyx":949 + /* "pykeyvi.pyx":924 * if number_of_fields > 1: * m.SetMatchedString(unserialized[1]) * if number_of_fields > 2: # <<<<<<<<<<<<<< @@ -23908,16 +22213,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_t_6 = ((__pyx_v_number_of_fields > 2) != 0); if (__pyx_t_6) { - /* "pykeyvi.pyx":950 + /* "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 = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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))) { @@ -23930,24 +22235,24 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m } } 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_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 = 950; __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 = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2); + __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_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; - /* "pykeyvi.pyx":951 + /* "pykeyvi.pyx":926 * if number_of_fields > 2: * m.SetStart(unserialized[2]) * if number_of_fields > 3: # <<<<<<<<<<<<<< @@ -23957,16 +22262,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_t_6 = ((__pyx_v_number_of_fields > 3) != 0); if (__pyx_t_6) { - /* "pykeyvi.pyx":952 + /* "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]) */ - __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_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 = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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))) { @@ -23979,24 +22284,24 @@ 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_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); + __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_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":953 + /* "pykeyvi.pyx":928 * if number_of_fields > 3: * m.SetEnd(unserialized[3]) * if number_of_fields > 4: # <<<<<<<<<<<<<< @@ -24006,16 +22311,16 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_t_6 = ((__pyx_v_number_of_fields > 4) != 0); if (__pyx_t_6) { - /* "pykeyvi.pyx":954 + /* "pykeyvi.pyx":929 * 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_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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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))) { @@ -24028,39 +22333,69 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m } } 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_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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); + __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_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; - goto __pyx_L7; + + /* "pykeyvi.pyx":928 + * if number_of_fields > 3: + * m.SetEnd(unserialized[3]) + * if number_of_fields > 4: # <<<<<<<<<<<<<< + * m.SetScore(unserialized[4]) + * + */ } - __pyx_L7:; - goto __pyx_L6; + + /* "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: + */ } - __pyx_L6:; - goto __pyx_L5; + + /* "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_L5:; - goto __pyx_L4; + + /* "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: + */ } - __pyx_L4:; - goto __pyx_L3; + + /* "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: + */ } - __pyx_L3:; - /* "pykeyvi.pyx":956 + /* "pykeyvi.pyx":931 * m.SetScore(unserialized[4]) * * return m # <<<<<<<<<<<<<< @@ -24072,7 +22407,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m __pyx_r = ((PyObject *)__pyx_v_m); goto __pyx_L0; - /* "pykeyvi.pyx":941 + /* "pykeyvi.pyx":916 * * @staticmethod * def loads(serialized_match): # <<<<<<<<<<<<<< @@ -24097,7 +22432,7 @@ static PyObject *__pyx_pf_7pykeyvi_5Match_44loads(PyObject *__pyx_v_serialized_m return __pyx_r; } -/* "pykeyvi.pyx":984 +/* "pykeyvi.pyx":959 * # self.it = it * * def __iter__(self): # <<<<<<<<<<<<<< @@ -24123,7 +22458,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator___iter__(struct __pyx_obj_7py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); - /* "pykeyvi.pyx":985 + /* "pykeyvi.pyx":960 * * def __iter__(self): * return self # <<<<<<<<<<<<<< @@ -24135,7 +22470,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator___iter__(struct __pyx_obj_7py __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "pykeyvi.pyx":984 + /* "pykeyvi.pyx":959 * # self.it = it * * def __iter__(self): # <<<<<<<<<<<<<< @@ -24150,7 +22485,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator___iter__(struct __pyx_obj_7py return __pyx_r; } -/* "pykeyvi.pyx":993 +/* "pykeyvi.pyx":968 * # del self.end * * def __next__(self): # <<<<<<<<<<<<<< @@ -24183,7 +22518,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__", 0); - /* "pykeyvi.pyx":996 + /* "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: # <<<<<<<<<<<<<< @@ -24193,21 +22528,29 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p __pyx_t_1 = ((__pyx_v_self->it == __pyx_v_self->end) != 0); if (__pyx_t_1) { - /* "pykeyvi.pyx":998 + /* "pykeyvi.pyx":973 * 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_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 = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "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: # <<<<<<<<<<<<<< + * + * raise StopIteration() + */ } - /* "pykeyvi.pyx":999 + /* "pykeyvi.pyx":974 * * raise StopIteration() * cdef _Match * _r = new _Match(co.dereference( self.it )) # <<<<<<<<<<<<<< @@ -24216,7 +22559,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p */ __pyx_v__r = new keyvi::dictionary::Match((*__pyx_v_self->it)); - /* "pykeyvi.pyx":1002 + /* "pykeyvi.pyx":977 * * # This also does the expected thing. * co.preincrement( self.it ) # <<<<<<<<<<<<<< @@ -24225,20 +22568,20 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p */ (++__pyx_v_self->it); - /* "pykeyvi.pyx":1004 + /* "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 *)((PyObject*)__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_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 = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; - /* "pykeyvi.pyx":1005 + /* "pykeyvi.pyx":980 * * cdef Match py_result = Match.__new__(Match) * py_result.inst = shared_ptr[_Match](_r) # <<<<<<<<<<<<<< @@ -24247,7 +22590,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p */ __pyx_v_py_result->inst = boost::shared_ptr (__pyx_v__r); - /* "pykeyvi.pyx":1007 + /* "pykeyvi.pyx":982 * py_result.inst = shared_ptr[_Match](_r) * * return py_result # <<<<<<<<<<<<<< @@ -24259,7 +22602,7 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p __pyx_r = ((PyObject *)__pyx_v_py_result); goto __pyx_L0; - /* "pykeyvi.pyx":993 + /* "pykeyvi.pyx":968 * # del self.end * * def __next__(self): # <<<<<<<<<<<<<< @@ -24281,13 +22624,13 @@ static PyObject *__pyx_pf_7pykeyvi_13MatchIterator_2__next__(struct __pyx_obj_7p /* "string.from_py":13 * - * @cname("__pyx_convert_string_from_py_") - * cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<< + * @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_(PyObject *__pyx_v_o) { +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; @@ -24296,10 +22639,10 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_", 0); + __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); /* "string.from_py":15 - * cdef string __pyx_convert_string_from_py_(object o) except *: + * 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) @@ -24320,63 +22663,63 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) { /* "string.from_py":13 * - * @cname("__pyx_convert_string_from_py_") - * cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<< + * @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_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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":30 +/* "string.to_py":31 * - * @cname("__pyx_convert_string_to_py_") - * cdef object __pyx_convert_string_to_py_(const string& s): # <<<<<<<<<<<<<< + * @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 PyObject *__pyx_convert_string_to_py_(std::string const &__pyx_v_s) { +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_string_to_py_", 0); + __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); - /* "string.to_py":31 - * @cname("__pyx_convert_string_to_py_") - * cdef object __pyx_convert_string_to_py_(const string& s): + /* "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[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":30 + /* "string.to_py":31 * - * @cname("__pyx_convert_string_to_py_") - * cdef object __pyx_convert_string_to_py_(const string& s): # <<<<<<<<<<<<<< + * @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_string_to_py_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -24384,484 +22727,207 @@ static PyObject *__pyx_convert_string_to_py_(std::string const &__pyx_v_s) { 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); -} +/* "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 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 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); -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*/ - #else - 0, /*reserved*/ - #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 -}; + /* "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; -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; -} + /* "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 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); + /* 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; } -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; - } -} +/* "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 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 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); -static PyMappingMethods __pyx_tp_as_mapping_StringDictionaryCompiler = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - __pyx_mp_ass_subscript_7pykeyvi_StringDictionaryCompiler, /*mp_ass_subscript*/ -}; + /* "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; -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*/ - #else - 0, /*reserved*/ - #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 -}; + /* "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 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; + /* 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; } -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} -}; +/* "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 PyMappingMethods __pyx_tp_as_mapping_JsonDictionaryCompiler = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler, /*mp_ass_subscript*/ -}; +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); -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*/ - #else - 0, /*reserved*/ - #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 -}; + /* "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; -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; -} + /* "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 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; + /* 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; } -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} -}; +/* "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 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 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); -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*/ -}; + /* "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; -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*/ - #else - 0, /*reserved*/ - #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 -}; + /* "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 PyObject *__pyx_tp_new_7pykeyvi_FsaTransform(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7pykeyvi_FsaTransform *p; + /* 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); @@ -24869,13 +22935,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_JsonDictionaryMerger *)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_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; @@ -24885,32 +22951,34 @@ 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_20JsonDictionaryMerger_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __Pyx_call_destructor(p->inst); (*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_JsonDictionaryMerger[] = { + {"Merge", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_5Merge, METH_O, 0}, + {"Add", (PyCFunction)__pyx_pw_7pykeyvi_20JsonDictionaryMerger_7Add, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { +static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryMerger = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.FsaTransform", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_FsaTransform), /*tp_basicsize*/ + "pykeyvi.JsonDictionaryMerger", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_JsonDictionaryMerger), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_FsaTransform, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_JsonDictionaryMerger, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -24930,7 +22998,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_JsonDictionaryMerger, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24938,9 +23006,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_20JsonDictionaryMerger_3__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_FsaTransform, /*tp_new*/ + __pyx_tp_new_7pykeyvi_JsonDictionaryMerger, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24955,8 +23023,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_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); @@ -24964,13 +23032,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_StringDictionaryCompiler *)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_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; @@ -24980,212 +23048,63 @@ 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_24StringDictionaryCompiler_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __Pyx_call_destructor(p->inst); (*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}, - {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*/ - #else - 0, /*reserved*/ - #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); - } - 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; +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); } - #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); + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; } - __Pyx_call_destructor(&p->inst); - (*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_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 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*/ - #else - 0, /*reserved*/ - #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 PyMappingMethods __pyx_tp_as_mapping_StringDictionaryCompiler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + __pyx_mp_ass_subscript_7pykeyvi_StringDictionaryCompiler, /*mp_ass_subscript*/ }; -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 = { +static PyTypeObject __pyx_type_7pykeyvi_StringDictionaryCompiler = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.loading_strategy_types", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_loading_strategy_types), /*tp_basicsize*/ + "pykeyvi.StringDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_StringDictionaryCompiler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_loading_strategy_types, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_StringDictionaryCompiler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #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*/ + &__pyx_tp_as_mapping_StringDictionaryCompiler, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -25200,7 +23119,7 @@ static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_7pykeyvi_StringDictionaryCompiler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25208,9 +23127,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_24StringDictionaryCompiler_9__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_loading_strategy_types, /*tp_new*/ + __pyx_tp_new_7pykeyvi_StringDictionaryCompiler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25225,8 +23144,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_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); @@ -25234,13 +23153,13 @@ 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_JsonDictionaryCompiler *)o); + new((void*)&(p->inst)) boost::shared_ptr (); 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_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; @@ -25250,17 +23169,17 @@ static void __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler(PyObject *o) PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_1__dealloc__(o); + __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __Pyx_call_destructor(p->inst); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { +static int __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_3__setitem__(o, i, v); + return __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_3__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -25269,43 +23188,44 @@ static int __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler(PyObject } } -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_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_CompletionDictionaryCompiler = { +static PyMappingMethods __pyx_tp_as_mapping_JsonDictionaryCompiler = { 0, /*mp_length*/ 0, /*mp_subscript*/ - __pyx_mp_ass_subscript_7pykeyvi_CompletionDictionaryCompiler, /*mp_ass_subscript*/ + __pyx_mp_ass_subscript_7pykeyvi_JsonDictionaryCompiler, /*mp_ass_subscript*/ }; -static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { +static PyTypeObject __pyx_type_7pykeyvi_JsonDictionaryCompiler = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.CompletionDictionaryCompiler", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler), /*tp_basicsize*/ + "pykeyvi.JsonDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_JsonDictionaryCompiler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_JsonDictionaryCompiler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #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_CompletionDictionaryCompiler, /*tp_as_mapping*/ + &__pyx_tp_as_mapping_JsonDictionaryCompiler, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -25320,7 +23240,7 @@ static PyTypeObject __pyx_type_7pykeyvi_CompletionDictionaryCompiler = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_CompletionDictionaryCompiler, /*tp_methods*/ + __pyx_methods_7pykeyvi_JsonDictionaryCompiler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25328,9 +23248,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*/ + __pyx_pw_7pykeyvi_22JsonDictionaryCompiler_11__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler, /*tp_new*/ + __pyx_tp_new_7pykeyvi_JsonDictionaryCompiler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25345,8 +23265,8 @@ 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 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); @@ -25354,13 +23274,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_MultiWordCompletion(PyTypeObject *t, CYTH o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_MultiWordCompletion *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_Dictionary *)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; +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; @@ -25370,39 +23290,80 @@ static void __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_19MultiWordCompletion_1__dealloc__(o); + __pyx_pw_7pykeyvi_10Dictionary_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __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_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}, +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 PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { +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.MultiWordCompletion", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_MultiWordCompletion), /*tp_basicsize*/ + "pykeyvi.Dictionary", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_Dictionary), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_Dictionary, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #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*/ + &__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*/ @@ -25417,7 +23378,7 @@ static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_MultiWordCompletion, /*tp_methods*/ + __pyx_methods_7pykeyvi_Dictionary, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25425,9 +23386,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*/ + __pyx_pw_7pykeyvi_10Dictionary_17__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_MultiWordCompletion, /*tp_new*/ + __pyx_tp_new_7pykeyvi_Dictionary, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25442,8 +23403,8 @@ 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 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); @@ -25451,13 +23412,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_PredictiveCompression(PyTypeObject *t, CY o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_PredictiveCompression *)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_PredictiveCompression(PyObject *o) { - struct __pyx_obj_7pykeyvi_PredictiveCompression *p = (struct __pyx_obj_7pykeyvi_PredictiveCompression *)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; @@ -25467,33 +23428,33 @@ static void __pyx_tp_dealloc_7pykeyvi_PredictiveCompression(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_21PredictiveCompression_1__dealloc__(o); + __pyx_pw_7pykeyvi_12FsaTransform_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __Pyx_call_destructor(p->inst); (*Py_TYPE(o)->tp_free)(o); } -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}, +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_PredictiveCompression = { +static PyTypeObject __pyx_type_7pykeyvi_FsaTransform = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.PredictiveCompression", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_PredictiveCompression), /*tp_basicsize*/ + "pykeyvi.FsaTransform", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_FsaTransform), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_PredictiveCompression, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_FsaTransform, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -25513,7 +23474,7 @@ static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_PredictiveCompression, /*tp_methods*/ + __pyx_methods_7pykeyvi_FsaTransform, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25521,9 +23482,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*/ + __pyx_pw_7pykeyvi_12FsaTransform_5__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_PredictiveCompression, /*tp_new*/ + __pyx_tp_new_7pykeyvi_FsaTransform, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25538,8 +23499,8 @@ 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 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); @@ -25547,13 +23508,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator(PyTypeObject * o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)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_KeyOnlyDictionaryGenerator(PyObject *o) { - struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *p = (struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)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; @@ -25563,34 +23524,34 @@ static void __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_1__dealloc__(o); + __pyx_pw_7pykeyvi_16PrefixCompletion_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __Pyx_call_destructor(p->inst); (*Py_TYPE(o)->tp_free)(o); } -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}, +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_KeyOnlyDictionaryGenerator = { +static PyTypeObject __pyx_type_7pykeyvi_PrefixCompletion = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.KeyOnlyDictionaryGenerator", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator), /*tp_basicsize*/ + "pykeyvi.PrefixCompletion", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_PrefixCompletion), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_PrefixCompletion, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -25610,7 +23571,7 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_methods*/ + __pyx_methods_7pykeyvi_PrefixCompletion, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25618,9 +23579,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*/ + __pyx_pw_7pykeyvi_16PrefixCompletion_5__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_new*/ + __pyx_tp_new_7pykeyvi_PrefixCompletion, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25635,8 +23596,8 @@ 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 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); @@ -25644,13 +23605,13 @@ static PyObject *__pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler(PyTypeObject *t o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *)o); - new((void*)&(p->inst)) boost::shared_ptr (); + p = ((struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *)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; +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; @@ -25660,40 +23621,35 @@ static void __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_1__dealloc__(o); + __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_1__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - __Pyx_call_destructor(&p->inst); + __Pyx_call_destructor(p->inst); (*Py_TYPE(o)->tp_free)(o); } -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}, +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 PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { +static PyTypeObject __pyx_type_7pykeyvi_ForwardBackwardCompletion = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.KeyOnlyDictionaryCompiler", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler), /*tp_basicsize*/ + "pykeyvi.ForwardBackwardCompletion", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_ForwardBackwardCompletion, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -25713,7 +23669,7 @@ static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_methods*/ + __pyx_methods_7pykeyvi_ForwardBackwardCompletion, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25721,9 +23677,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*/ + __pyx_pw_7pykeyvi_25ForwardBackwardCompletion_9__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_new*/ + __pyx_tp_new_7pykeyvi_ForwardBackwardCompletion, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25738,8 +23694,7 @@ 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 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); @@ -25747,68 +23702,32 @@ static PyObject *__pyx_tp_new_7pykeyvi_Match(PyTypeObject *t, CYTHON_UNUSED PyOb 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_Match(PyObject *o) { - struct __pyx_obj_7pykeyvi_Match *p = (struct __pyx_obj_7pykeyvi_Match *)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 - { - 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 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 = { +static PyTypeObject __pyx_type_7pykeyvi_loading_strategy_types = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.Match", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_Match), /*tp_basicsize*/ + "pykeyvi.loading_strategy_types", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_loading_strategy_types), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_Match, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_loading_strategy_types, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -25828,7 +23747,7 @@ static PyTypeObject __pyx_type_7pykeyvi_Match = { 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*/ @@ -25836,9 +23755,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_loading_strategy_types, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25853,8 +23772,8 @@ 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 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); @@ -25862,47 +23781,79 @@ static PyObject *__pyx_tp_new_7pykeyvi_MatchIterator(PyTypeObject *t, CYTHON_UNU o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 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(); + p = ((struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler *)o); + new((void*)&(p->inst)) boost::shared_ptr (); return o; } -static void __pyx_tp_dealloc_7pykeyvi_MatchIterator(PyObject *o) { - struct __pyx_obj_7pykeyvi_MatchIterator *p = (struct __pyx_obj_7pykeyvi_MatchIterator *)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; } #endif - __Pyx_call_destructor(&p->it); - __Pyx_call_destructor(&p->end); + { + 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); (*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}, +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}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { +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 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.MatchIterator", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi_MatchIterator), /*tp_basicsize*/ + "pykeyvi.CompletionDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_CompletionDictionaryCompiler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi_MatchIterator, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_CompletionDictionaryCompiler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #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*/ + &__pyx_tp_as_mapping_CompletionDictionaryCompiler, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -25915,9 +23866,9 @@ static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { 0, /*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*/ + __pyx_methods_7pykeyvi_CompletionDictionaryCompiler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25925,9 +23876,9 @@ static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7pykeyvi_28CompletionDictionaryCompiler_13__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi_MatchIterator, /*tp_new*/ + __pyx_tp_new_7pykeyvi_CompletionDictionaryCompiler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25942,65 +23893,60 @@ 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 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_MultiWordCompletion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_MultiWordCompletion *p; 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)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 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___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); +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 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; + #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); } - return 0; + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); } -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 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 PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { +static PyTypeObject __pyx_type_7pykeyvi_MultiWordCompletion = { 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.MultiWordCompletion", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_MultiWordCompletion), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct___init_2, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_MultiWordCompletion, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26012,15 +23958,15 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { 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_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_7pykeyvi_MultiWordCompletion, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -26028,9 +23974,9 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7pykeyvi_19MultiWordCompletion_3__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct___init_2, /*tp_new*/ + __pyx_tp_new_7pykeyvi_MultiWordCompletion, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26038,86 +23984,66 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___init_2 = { 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 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 (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 = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; -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); - Py_CLEAR(p->__pyx_t_0); - 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); +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); } else { - (*Py_TYPE(o)->tp_free)(o); + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_PredictiveCompression *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return 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; - } - if (p->__pyx_v_k) { - e = (*v)(p->__pyx_v_k, a); if (e) return e; +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; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, 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); } - return 0; + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); } -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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - 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 PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi_PredictiveCompression = { 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.PredictiveCompression", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_PredictiveCompression), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_PredictiveCompression, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26129,15 +24055,15 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { 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_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_7pykeyvi_PredictiveCompression, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -26145,9 +24071,9 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_genexpr = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7pykeyvi_21PredictiveCompression_5__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi_PredictiveCompression, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26162,79 +24088,60 @@ 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 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_KeyOnlyDictionaryGenerator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *p; 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)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - 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; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_v); - Py_CLEAR(p->__pyx_t_0); - 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); + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator *)o); + new((void*)&(p->inst)) boost::shared_ptr (); + return o; } -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; - } - if (p->__pyx_v_v) { - e = (*v)(p->__pyx_v_v, a); if (e) return e; +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; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + #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); } - return 0; + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); } -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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - 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 PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator = { 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.KeyOnlyDictionaryGenerator", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryGenerator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26246,15 +24153,15 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { 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_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -26262,9 +24169,9 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_genexpr = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7pykeyvi_26KeyOnlyDictionaryGenerator_3__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryGenerator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26279,65 +24186,66 @@ 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 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_KeyOnlyDictionaryCompiler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler *p; 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__)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 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___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); +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 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; + #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); } - return 0; + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); } -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 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___pyx_scope_struct_3___init__ = { +static PyTypeObject __pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler = { 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.KeyOnlyDictionaryCompiler", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_KeyOnlyDictionaryCompiler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_3___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26349,15 +24257,15 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { 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_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -26365,9 +24273,9 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___init__ = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7pykeyvi_25KeyOnlyDictionaryCompiler_9__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_3___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi_KeyOnlyDictionaryCompiler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26382,79 +24290,78 @@ 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 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_Match(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_Match *p; 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)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { 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); - Py_CLEAR(p->__pyx_t_0); - 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 { - (*Py_TYPE(o)->tp_free)(o); + 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 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; - } - if (p->__pyx_v_k) { - e = (*v)(p->__pyx_v_k, a); if (e) return e; +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; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, 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); } - return 0; + __Pyx_call_destructor(p->inst); + (*Py_TYPE(o)->tp_free)(o); } -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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - 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 PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi_Match = { 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.Match", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_Match), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_Match, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26466,15 +24373,15 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { 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_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 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*/ @@ -26482,9 +24389,9 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_genexpr = { 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___pyx_scope_struct_4_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi_Match, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26499,79 +24406,52 @@ 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 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_MatchIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7pykeyvi_MatchIterator *p; 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)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - 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; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_v); - Py_CLEAR(p->__pyx_t_0); - 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); + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 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 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; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; +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; } - return 0; + #endif + __Pyx_call_destructor(p->it); + __Pyx_call_destructor(p->end); + (*Py_TYPE(o)->tp_free)(o); } -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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 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 PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi_MatchIterator = { 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.MatchIterator", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi_MatchIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi_MatchIterator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26583,15 +24463,15 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_genexpr = { 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_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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*/ @@ -26601,7 +24481,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_MatchIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26616,14 +24496,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___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_6__init_2(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct___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___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 { @@ -26633,48 +24513,49 @@ 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___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_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___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); } } -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___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___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; } 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___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___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___pyx_scope_struct_6__init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct___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___init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct___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___init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26688,8 +24569,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___init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct___init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26704,7 +24585,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___init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26719,14 +24600,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_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_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_1_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_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 { @@ -26736,62 +24617,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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_7_genexpr(PyObject *o, visitproc v, void *a) { +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_7_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_7_genexpr *)o; + 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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_7_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_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_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_6__init_2 *)Py_None); Py_INCREF(Py_None); + 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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_1_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_1_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26805,8 +24680,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_1_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_1_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26821,7 +24696,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_1_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26836,14 +24711,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_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_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_2_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_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 { @@ -26853,62 +24728,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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); } } -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_2_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_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; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_8_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_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_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_6__init_2 *)Py_None); Py_INCREF(Py_None); + 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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_2_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_2_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -26922,8 +24791,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_2_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_2_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -26938,7 +24807,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_2_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -26953,14 +24822,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_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_9___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_3___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_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 { @@ -26970,48 +24839,49 @@ 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_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_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_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); } } -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_3___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_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; } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_9___init__(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_3___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_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___pyx_scope_struct_9___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_3___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_3___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_3___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_9___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_3___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27025,8 +24895,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_3___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_3___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27041,7 +24911,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_3___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27056,14 +24926,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_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_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_4_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_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 { @@ -27073,62 +24943,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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 { (*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_4_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_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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_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_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_9___init__ *)Py_None); Py_INCREF(Py_None); + 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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_4_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_4_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_4_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27142,8 +25006,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_4_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_4_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27158,7 +25022,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_4_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27173,14 +25037,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_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_11_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_5_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_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 { @@ -27190,62 +25054,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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); } } -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_5_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_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; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_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_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_9___init__ *)Py_None); Py_INCREF(Py_None); + 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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_5_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_5_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27259,8 +25117,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_5_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_5_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27275,7 +25133,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_5_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27290,14 +25148,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_genexpr = { #endif }; -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 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_12__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_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)); + 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 { @@ -27307,48 +25165,49 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__init_2(PyTypeObjec return 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; +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_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); + 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_12__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_12__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__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_12__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_12__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__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_12__init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_6__init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_12__init_2", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__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_12__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*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27362,8 +25221,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__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_12__init_2, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__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*/ @@ -27378,7 +25237,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__init_2 = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_12__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*/ @@ -27393,14 +25252,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__init_2 = { #endif }; -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 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_13_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_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)); + 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 { @@ -27410,62 +25269,56 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13_genexpr(PyTypeObjec return 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; +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); - Py_CLEAR(p->__pyx_t_0); - 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); + 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_13_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_13_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13_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_13_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_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_12__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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_7_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_13_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13_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_13_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27479,8 +25332,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13_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_13_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13_genexpr, /*tp_clear*/ + __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*/ @@ -27495,7 +25348,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_13_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_7_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27510,14 +25363,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13_genexpr = { #endif }; -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 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_14_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_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)); + 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 { @@ -27527,62 +25380,56 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14_genexpr(PyTypeObjec return 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; +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); - Py_CLEAR(p->__pyx_t_0); - 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); + 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_14_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_14_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_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; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14_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_14_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_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_12__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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_8_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_14_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14_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_14_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27596,8 +25443,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14_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_14_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14_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*/ @@ -27612,7 +25459,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_14_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_8_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27627,14 +25474,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14_genexpr = { #endif }; -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 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_15___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_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__)); + 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 { @@ -27644,48 +25491,49 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_15___init__(PyTypeObje return 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; +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_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); + 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_15___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_15___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___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_15___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_15___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___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_15___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_9___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_15___init__", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15___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_15___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_9___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27699,8 +25547,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15___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_15___init__, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_15___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*/ @@ -27715,7 +25563,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_15___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_9___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27730,14 +25578,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_15___init__ = { #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_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_16_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_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_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 { @@ -27747,62 +25595,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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_16_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_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_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_16_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_16_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_15___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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_10_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_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_16_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27816,8 +25658,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_10_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_10_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27832,7 +25674,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_10_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27847,14 +25689,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_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_17_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_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_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 { @@ -27864,62 +25706,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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_17_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_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_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; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_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_17_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_17_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_15___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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_11_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_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_17_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -27933,8 +25769,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_11_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_11_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -27949,7 +25785,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_11_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -27964,14 +25800,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_genexpr = { #endif }; -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 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 PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_12__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_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)); + 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)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -27981,23 +25817,23 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapp return 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; +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; 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_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); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)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; if (p->__pyx_v_iterator) { e = (*v)(p->__pyx_v_iterator, a); if (e) return e; } @@ -28013,9 +25849,9 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_18__key_iterator_wrappe return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper *)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; tmp = ((PyObject*)p->__pyx_v_iterator); p->__pyx_v_iterator = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -28031,19 +25867,20 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper(P return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_18__key_iterator_wrapper", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_12__key_iterator_wrapper", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28057,8 +25894,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18__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_18__key_iterator_wrapper, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28073,7 +25910,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrap 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_18__key_iterator_wrapper, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_12__key_iterator_wrapper, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28088,14 +25925,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_18__key_iterator_wrap #endif }; -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 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 PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_13__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_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)); + 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)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -28105,23 +25942,23 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wra return 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; +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; 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_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); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)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; if (p->__pyx_v_iterator) { e = (*v)(p->__pyx_v_iterator, a); if (e) return e; } @@ -28137,9 +25974,9 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_19__value_iterator_wrap return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper *)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; tmp = ((PyObject*)p->__pyx_v_iterator); p->__pyx_v_iterator = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -28155,19 +25992,20 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_19__value_iterator_wrapper", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_13__value_iterator_wrapper", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28181,8 +26019,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19__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_19__value_iterator_wrapper, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28197,7 +26035,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wr 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_19__value_iterator_wrapper, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_13__value_iterator_wrapper, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28212,14 +26050,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19__value_iterator_wr #endif }; -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 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 PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_14__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_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)); + 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)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -28229,23 +26067,23 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrap return 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; +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; 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_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); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)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; if (p->__pyx_v_iterator) { e = (*v)(p->__pyx_v_iterator, a); if (e) return e; } @@ -28261,9 +26099,9 @@ static int __pyx_tp_traverse_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapp return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper(PyObject *o) { PyObject* tmp; - struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper *)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; tmp = ((PyObject*)p->__pyx_v_iterator); p->__pyx_v_iterator = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -28279,19 +26117,20 @@ static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper( return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_20__item_iterator_wrapper", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper), /*tp_basicsize*/ + "pykeyvi.__pyx_scope_struct_14__item_iterator_wrapper", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28305,8 +26144,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20__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_20__item_iterator_wrapper, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28321,7 +26160,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wra 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_20__item_iterator_wrapper, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_14__item_iterator_wrapper, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28336,14 +26175,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20__item_iterator_wra #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_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 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_15__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_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)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -28353,48 +26192,49 @@ 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_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; 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_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); } 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_15__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_15__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__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_15__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_15__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__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_15__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_15__init_2", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__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_15__init_2, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28408,8 +26248,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_15__init_2, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_15__init_2, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28424,7 +26264,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_15__init_2, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28439,14 +26279,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_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_22_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_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_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 { @@ -28456,62 +26296,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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_22_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_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_22_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_22_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_22_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_21__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_16_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_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_22_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28525,8 +26359,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_16_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_16_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28541,7 +26375,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_16_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28556,14 +26390,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_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_23_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_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_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 { @@ -28573,62 +26407,56 @@ 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_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); - Py_CLEAR(p->__pyx_t_0); - 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_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_23_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_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_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; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_23_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_23_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_23_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_21__init_2 *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_7pykeyvi___pyx_scope_struct_15__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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_17_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_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_23_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28642,8 +26470,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_17_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_17_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28658,7 +26486,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_17_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28673,14 +26501,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_18___init__ *__pyx_freelist_7pykeyvi___pyx_scope_struct_18___init__[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_18___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_18___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_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__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -28690,48 +26518,49 @@ 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_18___init__(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___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_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); } 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_18___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_18___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___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_18___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_18___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___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_18___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_18___init__", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_18___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_24___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_18___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28745,8 +26574,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_18___init__, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_18___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28761,7 +26590,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_18___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28776,14 +26605,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_19_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_19_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_19_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_19_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_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)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -28793,62 +26622,56 @@ 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_19_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_k); - Py_CLEAR(p->__pyx_t_0); - 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_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); } 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_19_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_19_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_25_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19_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_19_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_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_18___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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_19_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_19_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_19_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_19_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28862,8 +26685,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_19_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_19_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28878,7 +26701,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_19_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -28893,14 +26716,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_20_genexpr *__pyx_freelist_7pykeyvi___pyx_scope_struct_20_genexpr[8]; +static int __pyx_freecount_7pykeyvi___pyx_scope_struct_20_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_20_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_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)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { @@ -28910,62 +26733,56 @@ 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_20_genexpr(PyObject *o) { + struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); - Py_CLEAR(p->__pyx_t_0); - 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_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); } 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_20_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_20_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_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; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_26_genexpr(PyObject *o) { +static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20_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_20_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_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_18___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); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_20_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_20_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_20_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_20_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -28979,8 +26796,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_20_genexpr, /*tp_traverse*/ + __pyx_tp_clear_7pykeyvi___pyx_scope_struct_20_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -28995,7 +26812,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_20_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -29010,14 +26827,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { #endif }; -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 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_27__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_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)); + 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 { @@ -29027,48 +26844,49 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_27__init_2(PyTypeObjec return 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; +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_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); + 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_27__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_27__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__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_27__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_27__init_2 *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__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_27__init_2 = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_21__init_2 = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_27__init_2", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_27__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_27__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*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -29082,8 +26900,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_27__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_27__init_2, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_27__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*/ @@ -29098,7 +26916,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_27__init_2 = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_27__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*/ @@ -29113,14 +26931,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_27__init_2 = { #endif }; -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 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_28_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_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)); + 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 { @@ -29130,62 +26948,56 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_28_genexpr(PyTypeObjec return 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; +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); - Py_CLEAR(p->__pyx_t_0); - 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); + 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_28_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_28_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_28_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_28_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_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_27__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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_22_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_28_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_28_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_28_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -29199,8 +27011,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_28_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_28_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_28_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*/ @@ -29215,7 +27027,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_28_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_22_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -29230,14 +27042,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_28_genexpr = { #endif }; -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 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_29_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_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)); + 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 { @@ -29247,62 +27059,56 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_29_genexpr(PyTypeObjec return 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; +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); - Py_CLEAR(p->__pyx_t_0); - 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); + 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_29_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_29_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_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; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_29_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_29_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_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_27__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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_23_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_29_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_29_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_29_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -29316,8 +27122,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_29_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_29_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_29_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*/ @@ -29332,7 +27138,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_29_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_23_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -29347,14 +27153,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_29_genexpr = { #endif }; -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 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_30___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_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__)); + 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 { @@ -29364,48 +27170,49 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_30___init__(PyTypeObje return 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; +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_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); + 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_30___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_30___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___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_30___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_30___init__ *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___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_30___init__ = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_24___init__ = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_30___init__", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_30___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_30___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_24___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -29419,8 +27226,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_30___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_30___init__, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_30___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*/ @@ -29435,7 +27242,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_30___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_30___init__, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_24___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -29450,14 +27257,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_30___init__ = { #endif }; -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 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_31_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_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)); + 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 { @@ -29467,62 +27274,56 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr(PyTypeObjec return 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; +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); - Py_CLEAR(p->__pyx_t_0); - 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); + 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_31_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_31_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_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; } if (p->__pyx_v_k) { e = (*v)(p->__pyx_v_k, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_31_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_31_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_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_30___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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_25_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_31_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_31_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_31_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -29536,8 +27337,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_31_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_31_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_31_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*/ @@ -29552,7 +27353,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_31_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_25_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -29567,14 +27368,14 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_31_genexpr = { #endif }; -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 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_32_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_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)); + 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 { @@ -29584,62 +27385,56 @@ static PyObject *__pyx_tp_new_7pykeyvi___pyx_scope_struct_32_genexpr(PyTypeObjec return 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; +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); - Py_CLEAR(p->__pyx_t_0); - 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); + 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_32_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_32_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_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; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_7pykeyvi___pyx_scope_struct_32_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_32_genexpr *p = (struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_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_30___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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); return 0; } -static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_32_genexpr = { +static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_26_genexpr = { PyVarObject_HEAD_INIT(0, 0) - "pykeyvi.__pyx_scope_struct_32_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_7pykeyvi___pyx_scope_struct_32_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_32_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ - #else - 0, /*reserved*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ @@ -29653,8 +27448,8 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_32_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_32_genexpr, /*tp_traverse*/ - __pyx_tp_clear_7pykeyvi___pyx_scope_struct_32_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*/ @@ -29669,7 +27464,7 @@ static PyTypeObject __pyx_type_7pykeyvi___pyx_scope_struct_32_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7pykeyvi___pyx_scope_struct_32_genexpr, /*tp_new*/ + __pyx_tp_new_7pykeyvi___pyx_scope_struct_26_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -29717,8 +27512,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}, @@ -29729,13 +27524,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, {&__pyx_kp_s_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 0, 1, 0}, {&__pyx_kp_s_Unsupported_Value_Type, __pyx_k_Unsupported_Value_Type, sizeof(__pyx_k_Unsupported_Value_Type), 0, 0, 1, 0}, - {&__pyx_kp_s_Users_narek_projects_keyvi_pyke, __pyx_k_Users_narek_projects_keyvi_pyke, sizeof(__pyx_k_Users_narek_projects_keyvi_pyke), 0, 0, 1, 0}, {&__pyx_kp_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 0}, {&__pyx_kp_s__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 0, 1, 0}, {&__pyx_kp_s__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 0, 1, 0}, {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0}, {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0}, - {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, {&__pyx_kp_s_arg_end_wrong_type, __pyx_k_arg_end_wrong_type, sizeof(__pyx_k_arg_end_wrong_type), 0, 0, 1, 0}, {&__pyx_kp_s_arg_filename_wrong_type, __pyx_k_arg_filename_wrong_type, sizeof(__pyx_k_arg_filename_wrong_type), 0, 0, 1, 0}, {&__pyx_kp_s_arg_greedy_wrong_type, __pyx_k_arg_greedy_wrong_type, sizeof(__pyx_k_arg_greedy_wrong_type), 0, 0, 1, 0}, @@ -29761,6 +27554,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1}, {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1}, {&__pyx_n_s_greedy, __pyx_k_greedy, sizeof(__pyx_k_greedy), 0, 0, 1, 1}, + {&__pyx_kp_s_home_hendrik_dev_git_cliqz_keyv, __pyx_k_home_hendrik_dev_git_cliqz_keyv, sizeof(__pyx_k_home_hendrik_dev_git_cliqz_keyv), 0, 0, 1, 0}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_in_0, __pyx_k_in_0, sizeof(__pyx_k_in_0), 0, 0, 1, 1}, {&__pyx_n_s_in_1, __pyx_k_in_1, sizeof(__pyx_k_in_1), 0, 0, 1, 1}, @@ -29814,12 +27608,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 = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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;} + __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;} return 0; __pyx_L1_error:; return -1; @@ -29829,149 +27622,149 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "pykeyvi.pyx":228 + /* "pykeyvi.pyx":203 * * if isinstance(key, unicode): * key = key.encode('UTF-8') # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = key + * 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 = 228; __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 = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "pykeyvi.pyx":232 + /* "pykeyvi.pyx":207 * * if isinstance(value, unicode): * value = value.encode('UTF-8') # <<<<<<<<<<<<<< - * cdef const_char * input_in_1 = value + * 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 = 232; __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 = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "pykeyvi.pyx":342 + /* "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' * */ - __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_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_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "pykeyvi.pyx":355 + /* "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_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_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_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "pykeyvi.pyx":366 + /* "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_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_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_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "pykeyvi.pyx":423 + /* "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")] # <<<<<<<<<<<<<< * )} * */ - __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_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_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 = 423; __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 = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "pykeyvi.pyx":867 + /* "pykeyvi.pyx":842 * 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 = 867; __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 = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "pykeyvi.pyx":875 + /* "pykeyvi.pyx":850 * 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 = 875; __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 = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "pykeyvi.pyx":881 + /* "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_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_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_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "pykeyvi.pyx":891 + /* "pykeyvi.pyx":866 * 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 = 891; __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 = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "pykeyvi.pyx":901 + /* "pykeyvi.pyx":876 * * 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 = 901; __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 = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_slice__15); __Pyx_GIVEREF(__pyx_slice__15); - /* "pykeyvi.pyx":904 + /* "pykeyvi.pyx":879 * * 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 = 904; __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 = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_slice__17); __Pyx_GIVEREF(__pyx_slice__17); - /* "pykeyvi.pyx":907 + /* "pykeyvi.pyx":882 * * 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 = 907; __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_slice__19); __Pyx_GIVEREF(__pyx_slice__19); @@ -29985,19 +27778,19 @@ static int __Pyx_InitCachedConstants(void) { __pyx_tuple__20 = PyTuple_Pack(5, __pyx_n_s_in_0, __pyx_n_s_in_1, __pyx_n_s_input_in_0, __pyx_n_s_r, __pyx_n_s_py_result); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__20); __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_Users_narek_projects_keyvi_pyke, __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;} + __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":941 + /* "pykeyvi.pyx":916 * * @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 = 941; __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 = 916; __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_Users_narek_projects_keyvi_pyke, __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_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_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -30006,6 +27799,9 @@ static int __Pyx_InitCachedConstants(void) { } static int __Pyx_InitGlobals(void) { + __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -30044,18 +27840,24 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pykeyvi(void)", 0); - if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED - if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS @@ -30078,12 +27880,12 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_pykeyvi) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if PY_MAJOR_VERSION >= 3 { @@ -30094,9 +27896,9 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) } #endif /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ @@ -30105,165 +27907,157 @@ 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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_StringDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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 = 89; __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 = 64; __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 = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_JsonDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __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 = 167; __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 = 142; __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_Dictionary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __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 = 253; __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 = 228; __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 = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_FsaTransform) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __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 = 426; __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 = 401; __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 = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_PrefixCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __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 = 446; __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 = 421; __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 = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_ForwardBackwardCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __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 = 479; __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 = 454; __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 = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __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 = 522; __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 = 497; __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 = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_CompletionDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __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 = 532; __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 = 507; __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 = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_MultiWordCompletion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __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 = 615; __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 = 590; __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 = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_PredictiveCompression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __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 = 656; __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 = 631; __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 = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_KeyOnlyDictionaryGenerator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __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 = 683; __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 = 658; __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 = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_KeyOnlyDictionaryCompiler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __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 = 707; __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 = 682; __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 = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_Match) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __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 = 776; __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 = 751; __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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7pykeyvi_MatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __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 = 972; __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 = 947; __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 = 59; __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 = 80; __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 = 61; __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 = 82; __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 = 61; __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 = 82; __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 = 69; __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 = 90; __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 = 74; __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 = 95; __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 = 74; __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 = 95; __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 = 105; __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 = 165; __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 = 107; __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 = 167; __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 = 107; __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 = 167; __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 = 115; __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 = 175; __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 = 120; __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 = 180; __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 = 120; __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 = 180; __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__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;} + 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;} __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 = 205; __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 = 539; __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__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;} + 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;} __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 = 564; __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 = 700; __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 = 564; __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 = 700; __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 = 572; __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 = 708; __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 = 577; __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 = 713; __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 = 577; __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 = 713; __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 + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /* "pykeyvi.pyx":34 * char * _cast_const_away(char *) @@ -30277,190 +28071,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":523 + /* "pykeyvi.pyx":498 * * 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 = 523; __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 = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":524 + /* "pykeyvi.pyx":499 * 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 = 524; __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":525 + /* "pykeyvi.pyx":500 * 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 = 525; __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 = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":526 + /* "pykeyvi.pyx":501 * 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 = 526; __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 = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":527 + /* "pykeyvi.pyx":502 * 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 = 527; __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 = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":528 + /* "pykeyvi.pyx":503 * 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 = 528; __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 = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":529 + /* "pykeyvi.pyx":504 * 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 = 529; __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 = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":530 + /* "pykeyvi.pyx":505 * 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 = 530; __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 = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyType_Modified(__pyx_ptype_7pykeyvi_loading_strategy_types); - /* "pykeyvi.pyx":941 + /* "pykeyvi.pyx":916 * * @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 = 941; __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 = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "pykeyvi.pyx":940 + /* "pykeyvi.pyx":915 * 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 = 940; __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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __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 = 940; __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 = 915; __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 = 941; __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 = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7pykeyvi_Match); - /* "pykeyvi.pyx":941 + /* "pykeyvi.pyx":916 * * @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 = 941; __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 = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "pykeyvi.pyx":940 + /* "pykeyvi.pyx":915 * 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 = 940; __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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __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 = 940; __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 = 915; __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 = 941; __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 = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7pykeyvi_Match); - /* "pykeyvi.pyx":963 + /* "pykeyvi.pyx":938 * 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 = 963; __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 = 938; __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 = 963; __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 = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":964 + /* "pykeyvi.pyx":939 * * 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 = 964; __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 = 939; __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 = 964; __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 = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":965 + /* "pykeyvi.pyx":940 * 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 = 965; __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 = 940; __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 = 965; __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 = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pykeyvi.pyx":966 + /* "pykeyvi.pyx":941 * 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 = 966; __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 = 941; __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 = 966; __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 = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pykeyvi.pyx":1 @@ -30473,11 +28267,11 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "string.to_py":30 + /* "string.to_py":55 * - * @cname("__pyx_convert_string_to_py_") - * cdef object __pyx_convert_string_to_py_(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * @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()) * */ @@ -30490,7 +28284,6 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init pykeyvi", __pyx_clineno, __pyx_lineno, __pyx_filename); - Py_DECREF(__pyx_d); __pyx_d = 0; } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { @@ -30505,7 +28298,7 @@ PyMODINIT_FUNC PyInit_pykeyvi(void) #endif } -/* Runtime support code */ +/* --- Runtime support code --- */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -30660,7 +28453,73 @@ static int __Pyx_ParseOptionalKeywords( invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); - goto bad; + goto bad; +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 +bad: + return -1; +} + +static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(PyObject_TypeCheck(obj, type))) return 1; + } + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); + 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 @@ -30670,33 +28529,6 @@ static int __Pyx_ParseOptionalKeywords( "%s() got an unexpected keyword argument '%U'", function_name, key); #endif -bad: - return -1; -} - -static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } @@ -30723,103 +28555,60 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + #if PY_MAJOR_VERSION >= 3 + if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_O | METH_NOARGS); } - return result; -} -#endif - -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { #endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject* args = PyTuple_Pack(1, arg); - return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL; + return 0; } -#endif -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method, *result = NULL; - method = __Pyx_PyObject_GetAttrStr(obj, method_name); - if (unlikely(!method)) goto bad; +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *args, *result = NULL; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyMethod_Check(method))) { - PyObject *self = PyMethod_GET_SELF(method); - if (likely(self)) { - PyObject *args; - PyObject *function = PyMethod_GET_FUNCTION(method); - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - Py_INCREF(function); - Py_DECREF(method); method = NULL; - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); - return result; - } - } + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); +#else + args = PyTuple_Pack(1, self); + if (unlikely(!args)) goto bad; #endif - result = __Pyx_PyObject_CallOneArg(method, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + Py_DECREF(args); bad: - Py_XDECREF(method); return result; } static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) { if (PY_MAJOR_VERSION >= 3) - return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_keys, d); + return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d); else return PyDict_Keys(d); } static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { if (PY_MAJOR_VERSION >= 3) - return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_values, d); + return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_values, d); else return PyDict_Values(d); } static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { if (PY_MAJOR_VERSION >= 3) - return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_items, d); + return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d); else return PyDict_Items(d); } @@ -30880,44 +28669,58 @@ 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 CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); } - 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; + return result; +} #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 PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; } +#endif #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { @@ -31039,10 +28842,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { - if (PyObject_IsSubclass(instance_class, type)) { - type = instance_class; - } else { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; } } } @@ -31100,6 +28906,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -31107,40 +28920,202 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (likely(result)) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +#if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { + if (op1 == op2) { + Py_RETURN_TRUE; + } + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long a = PyInt_AS_LONG(op1); + if (a == b) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a; + const digit* digits = ((PyLongObject*)op1)->ob_digit; + const Py_ssize_t size = Py_SIZE(op1); + if (likely(__Pyx_sst_abs(size) <= 1)) { + a = likely(size) ? digits[0] : 0; + if (size == -1) a = -a; + } else { + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 + default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); + #else + default: Py_RETURN_FALSE; + #endif + } + } + if (a == b) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } } -bad: - Py_XDECREF(owned_instance); - return; + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = PyFloat_AS_DOUBLE(op1); + if ((double)a == (double)b) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } + return PyObject_RichCompare(op1, op2, Py_EQ); } #endif -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; } - return result; -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { @@ -31151,7 +29126,8 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck) { + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { @@ -31165,7 +29141,8 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck) { + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { @@ -31178,8 +29155,9 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize return PySequence_GetItem(o, i); #endif } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); @@ -31412,15 +29390,25 @@ __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; + #if CYTHON_COMPILING_IN_CPYTHON op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif Py_DECREF(res); - return 0; + return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { @@ -31530,9 +29518,6 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {0, 0, 0, 0, 0} }; -#ifndef PY_WRITE_RESTRICTED -#define PY_WRITE_RESTRICTED WRITE_RESTRICTED -#endif static PyMemberDef __pyx_CyFunction_members[] = { {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} @@ -31651,12 +29636,11 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { if (type == NULL) type = (PyObject *)(Py_TYPE(obj)); - return PyMethod_New(func, - type, (PyObject *)(Py_TYPE(type))); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); } if (obj == Py_None) obj = NULL; - return PyMethod_New(func, obj, type); + return __Pyx_PyMethod_New(func, obj, type); } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) @@ -31672,34 +29656,39 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) #if CYTHON_COMPILING_IN_PYPY static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); + PyCFunction meth = f->m_ml->ml_meth; + PyObject *self = f->m_self; Py_ssize_t size; - switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: - if (likely(kw == NULL) || PyDict_Size(kw) == 0) + if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); case METH_NOARGS: - if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); - if (size == 0) + if (likely(size == 0)) return (*meth)(self, NULL); PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; case METH_O: - if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); - if (size == 1) - return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); + if (likely(size == 1)) { + PyObject *result, *arg0 = PySequence_ITEM(arg, 0); + if (unlikely(!arg0)) return NULL; + result = (*meth)(self, arg0); + Py_DECREF(arg0); + return result; + } PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } @@ -31779,7 +29768,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, #endif }; -static int __Pyx_CyFunction_init(void) { +static int __pyx_CyFunction_init(void) { #if !CYTHON_COMPILING_IN_PYPY __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; #endif @@ -31816,9 +29805,14 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback) { + int full_traceback, CYTHON_UNUSED int nogil) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#endif __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); if (full_traceback) { Py_XINCREF(old_exc); @@ -31839,6 +29833,10 @@ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif } static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { @@ -31961,8 +29959,8 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #endif } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { #if CYTHON_COMPILING_IN_CPYTHON @@ -32072,7 +30070,7 @@ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int co return count; } while (start < end) { - mid = (start + end) / 2; + mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { @@ -32225,29 +30223,29 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_frame); } -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \ - { \ - func_type value = func_value; \ - if (sizeof(target_type) < sizeof(func_type)) { \ - if (unlikely(value != (func_type) (target_type) value)) { \ - func_type zero = 0; \ - if (is_unsigned && unlikely(value < zero)) \ - goto raise_neg_overflow; \ - else \ - goto raise_overflow; \ - } \ - } \ - return (target_type) value; \ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = 0; + const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -32264,36 +30262,125 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]); + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; } - #endif #endif +#if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(int) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0]) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; } - #endif #endif if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x)) - } else if (sizeof(int) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { @@ -32341,81 +30428,8 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { return (int) -1; } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { - const uint32_t neg_one = (uint32_t) -1, const_zero = 0; + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -32432,36 +30446,125 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, ((PyLongObject*)x)->ob_digit[0]); + case 0: return (uint32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; } - #endif #endif +#if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + case 0: return (uint32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, -(sdigit) digits[0]) + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + case -2: + if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; } - #endif #endif if (sizeof(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyLong_AsLong(x)) - } else if (sizeof(uint32_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long long, PyLong_AsLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { @@ -32510,21 +30613,21 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { } static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { - const uint32_t neg_one = (uint32_t) -1, const_zero = 0; + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(uint32_t) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) { - return PyLong_FromUnsignedLongLong((unsigned long long) value); + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(uint32_t) <= sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(uint32_t) <= sizeof(long long)) { - return PyLong_FromLongLong((long long) value); + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); } } { @@ -32536,7 +30639,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { } static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { - const size_t neg_one = (size_t) -1, const_zero = 0; + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -32553,36 +30656,125 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]); + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; } - #endif #endif +#if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif if (sizeof(size_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(size_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + case 0: return (size_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) digits[0]) + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) + case -2: + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; } - #endif #endif if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x)) - } else if (sizeof(size_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { @@ -32631,21 +30823,21 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { } static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = 0; + const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(long) <= sizeof(unsigned long long)) { - return PyLong_FromUnsignedLongLong((unsigned long long) value); + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(long long)) { - return PyLong_FromLongLong((long long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); } } { @@ -32657,7 +30849,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = 0; + const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -32674,36 +30866,125 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]); + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; } - #endif #endif +#if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(long) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0]) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case -2: + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; } - #endif #endif if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x)) - } else if (sizeof(long) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x)) + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { @@ -32770,13 +31051,43 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, *tb = tmp_tb; } -static PyObject *__Pyx_Generator_Next(PyObject *self); -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); -static PyObject *__Pyx_Generator_Close(PyObject *self); -static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); -static PyTypeObject *__pyx_GeneratorType = 0; -#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) -#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method, *result = NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyMethod_Check(method))) { + PyObject *self = PyMethod_GET_SELF(method); + if (likely(self)) { + PyObject *args; + PyObject *function = PyMethod_GET_FUNCTION(method); + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + Py_INCREF(function); + Py_DECREF(method); method = NULL; + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); + return result; + } + } +#endif + result = __Pyx_PyObject_CallOneArg(method, arg); +bad: + Py_XDECREF(method); + return result; +} + +#include +#include +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Coroutine_Close(PyObject *self); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { PyObject *et, *ev, *tb; @@ -32789,25 +31100,50 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { *pvalue = Py_None; return 0; } - if (unlikely(et != PyExc_StopIteration) && - unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } if (likely(et == PyExc_StopIteration)) { - if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { +#if PY_VERSION_HEX >= 0x030300A0 + if (ev && Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } +#endif + if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { if (!ev) { Py_INCREF(Py_None); ev = Py_None; + } else if (PyTuple_Check(ev)) { + if (PyTuple_GET_SIZE(ev) >= 1) { + PyObject *value; +#if CYTHON_COMPILING_IN_CPYTHON + value = PySequence_ITEM(ev, 0); +#else + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#endif + Py_DECREF(ev); + ev = value; + } else { + Py_INCREF(Py_None); + Py_DECREF(ev); + ev = Py_None; + } } Py_XDECREF(tb); Py_DECREF(et); *pvalue = ev; return 0; } + } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; } PyErr_NormalizeException(&et, &ev, &tb); - if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) { + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { __Pyx_ErrRestore(et, ev, tb); return -1; } @@ -32819,10 +31155,10 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { Py_DECREF(ev); #else { - PyObject* args = PyObject_GetAttr(ev, __pyx_n_s_args); + PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); Py_DECREF(ev); if (likely(args)) { - value = PyObject_GetItem(args, 0); + value = PySequence_GetItem(args, 0); Py_DECREF(args); } if (unlikely(!value)) { @@ -32837,7 +31173,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { } #endif static CYTHON_INLINE -void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { +void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) { PyObject *exc_type = self->exc_type; PyObject *exc_value = self->exc_value; PyObject *exc_traceback = self->exc_traceback; @@ -32849,7 +31185,7 @@ void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { Py_XDECREF(exc_traceback); } static CYTHON_INLINE -int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { +int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) { if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); @@ -32858,7 +31194,7 @@ int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { return 0; } static CYTHON_INLINE -PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { +PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { PyObject *retval; assert(!self->is_running); if (unlikely(self->resume_label == 0)) { @@ -32888,7 +31224,7 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); } else { - __Pyx_Generator_ExceptionClear(self); + __Pyx_Coroutine_ExceptionClear(self); } self->is_running = 1; retval = self->body((PyObject *) self, value); @@ -32905,48 +31241,47 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { } #endif } else { - __Pyx_Generator_ExceptionClear(self); + __Pyx_Coroutine_ExceptionClear(self); + } + return retval; +} +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) { + if (unlikely(!retval && !PyErr_Occurred())) { + PyErr_SetNone(PyExc_StopIteration); } return retval; } static CYTHON_INLINE -PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { +PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { PyObject *ret; PyObject *val = NULL; - __Pyx_Generator_Undelegate(gen); + __Pyx_Coroutine_Undelegate(gen); __Pyx_PyGen_FetchStopIterationValue(&val); - ret = __Pyx_Generator_SendEx(gen, val); + ret = __Pyx_Coroutine_SendEx(gen, val); Py_XDECREF(val); return ret; } -static PyObject *__Pyx_Generator_Next(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - gen->is_running = 1; - ret = Py_TYPE(yf)->tp_iternext(yf); - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - return __Pyx_Generator_FinishDelegation(gen); - } - return __Pyx_Generator_SendEx(gen, Py_None); -} -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) + if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; + #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Generator_Send(yf, value); - } else { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + { if (value == Py_None) ret = PyIter_Next(yf); else @@ -32956,21 +31291,33 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { if (likely(ret)) { return ret; } - return __Pyx_Generator_FinishDelegation(gen); + retval = __Pyx_Coroutine_FinishDelegation(gen); + } else { + retval = __Pyx_Coroutine_SendEx(gen, value); } - return __Pyx_Generator_SendEx(gen, value); + return __Pyx_Coroutine_MethodReturn(retval); } -static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { PyObject *retval = NULL; int err = 0; + #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { - retval = __Pyx_Generator_Close(yf); + retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; - } else { + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + #endif + { PyObject *meth; gen->is_running = 1; - meth = PyObject_GetAttr(yf, __pyx_n_s_close); + meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); if (unlikely(!meth)) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_WriteUnraisable(yf); @@ -32987,22 +31334,39 @@ static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { Py_XDECREF(retval); return err; } -static PyObject *__Pyx_Generator_Close(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_SendEx(gen, Py_None); +} +static PyObject *__Pyx_Coroutine_Close(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *retval, *raised_exception; PyObject *yf = gen->yieldfrom; int err = 0; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) + if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { Py_INCREF(yf); - err = __Pyx_Generator_CloseIter(gen, yf); - __Pyx_Generator_Undelegate(gen); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); Py_DECREF(yf); } if (err == 0) PyErr_SetNone(PyExc_GeneratorExit); - retval = __Pyx_Generator_SendEx(gen, NULL); + retval = __Pyx_Coroutine_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, @@ -33022,32 +31386,40 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) { } return NULL; } -static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; PyObject *yf = gen->yieldfrom; if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) return NULL; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) + if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; Py_INCREF(yf); if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { - int err = __Pyx_Generator_CloseIter(gen, yf); + int err = __Pyx_Coroutine_CloseIter(gen, yf); Py_DECREF(yf); - __Pyx_Generator_Undelegate(gen); + __Pyx_Coroutine_Undelegate(gen); if (err < 0) - return __Pyx_Generator_SendEx(gen, NULL); + return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); goto throw_here; } gen->is_running = 1; + #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Generator_Throw(yf, args); - } else { - PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw); + ret = __Pyx_Coroutine_Throw(yf, args); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Throw(yf, args); + } else + #endif + { + PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); if (unlikely(!meth)) { Py_DECREF(yf); if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -33055,7 +31427,7 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { return NULL; } PyErr_Clear(); - __Pyx_Generator_Undelegate(gen); + __Pyx_Coroutine_Undelegate(gen); gen->is_running = 0; goto throw_here; } @@ -33065,16 +31437,16 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { gen->is_running = 0; Py_DECREF(yf); if (!ret) { - ret = __Pyx_Generator_FinishDelegation(gen); + ret = __Pyx_Coroutine_FinishDelegation(gen); } - return ret; + return __Pyx_Coroutine_MethodReturn(ret); } throw_here: __Pyx_Raise(typ, val, tb, NULL); - return __Pyx_Generator_SendEx(gen, NULL); + return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); } -static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; +static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_VISIT(gen->closure); Py_VISIT(gen->classobj); Py_VISIT(gen->yieldfrom); @@ -33083,8 +31455,8 @@ static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) Py_VISIT(gen->exc_traceback); return 0; } -static int __Pyx_Generator_clear(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_CLEAR(gen->closure); Py_CLEAR(gen->classobj); Py_CLEAR(gen->yieldfrom); @@ -33095,8 +31467,8 @@ static int __Pyx_Generator_clear(PyObject *self) { Py_CLEAR(gen->gi_qualname); return 0; } -static void __Pyx_Generator_dealloc(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); @@ -33113,13 +31485,13 @@ static void __Pyx_Generator_dealloc(PyObject *self) { } PyObject_GC_UnTrack(self); } - __Pyx_Generator_clear(self); + __Pyx_Coroutine_clear(self); PyObject_GC_Del(gen); } -static void __Pyx_Generator_del(PyObject *self) { +static void __Pyx_Coroutine_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; if (gen->resume_label <= 0) return ; #if PY_VERSION_HEX < 0x030400a1 @@ -33127,7 +31499,7 @@ static void __Pyx_Generator_del(PyObject *self) { self->ob_refcnt = 1; #endif __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); - res = __Pyx_Generator_Close(self); + res = __Pyx_Coroutine_Close(self); if (res == NULL) PyErr_WriteUnraisable(self); else @@ -33155,13 +31527,13 @@ static void __Pyx_Generator_del(PyObject *self) { #endif } static PyObject * -__Pyx_Generator_get_name(__pyx_GeneratorObject *self) +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self) { Py_INCREF(self->gi_name); return self->gi_name; } static int -__Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value) +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 @@ -33180,13 +31552,13 @@ __Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value) return 0; } static PyObject * -__Pyx_Generator_get_qualname(__pyx_GeneratorObject *self) +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self) { Py_INCREF(self->gi_qualname); return self->gi_qualname; } static int -__Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value) +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 @@ -33204,37 +31576,154 @@ __Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value) Py_XDECREF(tmp); return 0; } -static PyGetSetDef __pyx_Generator_getsets[] = { - {(char *) "__name__", (getter)__Pyx_Generator_get_name, (setter)__Pyx_Generator_set_name, - (char*) PyDoc_STR("name of the generator"), 0}, - {(char *) "__qualname__", (getter)__Pyx_Generator_get_qualname, (setter)__Pyx_Generator_set_qualname, - (char*) PyDoc_STR("qualified name of the generator"), 0}, - {0, 0, 0, 0, 0} +static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject* type, __pyx_coroutine_body_t body, + PyObject *closure, PyObject *name, PyObject *qualname) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (gen == NULL) + return NULL; + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->exc_type = NULL; + gen->exc_value = NULL; + gen->exc_traceback = NULL; + gen->gi_weakreflist = NULL; + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + PyObject_GC_Track(gen); + return gen; +} + +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + int result; + PyObject *globals, *result_obj; + globals = PyDict_New(); if (unlikely(!globals)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_coroutine_type", + #ifdef __Pyx_Coroutine_USED + (PyObject*)__pyx_CoroutineType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_generator_type", + #ifdef __Pyx_Generator_USED + (PyObject*)__pyx_GeneratorType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; + result_obj = PyRun_String(py_code, Py_file_input, globals, globals); + if (unlikely(!result_obj)) goto ignore; + Py_DECREF(result_obj); + Py_DECREF(globals); + return module; +ignore: + Py_XDECREF(globals); + PyErr_WriteUnraisable(module); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { + Py_DECREF(module); + module = NULL; + } +#else + py_code++; +#endif + return module; +} + +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) +static PyObject* __Pyx_patch_abc_module(PyObject *module); +static PyObject* __Pyx_patch_abc_module(PyObject *module) { + module = __Pyx_Coroutine_patch_module( + module, "" +"if _cython_generator_type is not None:\n" +" try: Generator = _module.Generator\n" +" except AttributeError: pass\n" +" else: Generator.register(_cython_generator_type)\n" +"if _cython_coroutine_type is not None:\n" +" try: Coroutine = _module.Coroutine\n" +" except AttributeError: pass\n" +" else: Coroutine.register(_cython_coroutine_type)\n" + ); + return module; +} +#endif +static int __Pyx_patch_abc(void) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + static int abc_patched = 0; + if (!abc_patched) { + PyObject *module; + module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections"); + if (!module) { + PyErr_WriteUnraisable(NULL); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, + ((PY_VERSION_HEX >= 0x03030000) ? + "Cython module failed to register with collections.abc module" : + "Cython module failed to register with collections module"), 1) < 0)) { + return -1; + } + } else { + module = __Pyx_patch_abc_module(module); + abc_patched = 1; + if (unlikely(!module)) + return -1; + Py_DECREF(module); + } + module = PyImport_ImportModule("backports_abc"); + if (module) { + module = __Pyx_patch_abc_module(module); + Py_XDECREF(module); + } + if (!module) { + PyErr_Clear(); + } + } +#else + if (0) __Pyx_Coroutine_patch_module(NULL, NULL); +#endif + return 0; +} + +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS, + (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {0, 0, 0, 0} }; static PyMemberDef __pyx_Generator_memberlist[] = { - {(char *) "gi_running", T_BOOL, offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL}, + {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, + {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, {0, 0, 0, 0, 0} }; -static PyMethodDef __pyx_Generator_methods[] = { - {"send", (PyCFunction) __Pyx_Generator_Send, METH_O, 0}, - {"throw", (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0}, - {"close", (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, - {0, 0, 0, 0} +static PyGetSetDef __pyx_Generator_getsets[] = { + {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + (char*) PyDoc_STR("name of the generator"), 0}, + {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + (char*) PyDoc_STR("qualified name of the generator"), 0}, + {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) "generator", - sizeof(__pyx_GeneratorObject), - 0, - (destructor) __Pyx_Generator_dealloc, + sizeof(__pyx_CoroutineObject), 0, + (destructor) __Pyx_Coroutine_dealloc, 0, 0, -#if PY_MAJOR_VERSION < 3 0, -#else 0, -#endif 0, 0, 0, @@ -33247,10 +31736,10 @@ static PyTypeObject __pyx_GeneratorType_type = { 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, 0, - (traverseproc) __Pyx_Generator_traverse, + (traverseproc) __Pyx_Coroutine_traverse, 0, 0, - offsetof(__pyx_GeneratorObject, gi_weakreflist), + offsetof(__pyx_CoroutineObject, gi_weakreflist), 0, (iternextfunc) __Pyx_Generator_Next, __pyx_Generator_methods, @@ -33274,42 +31763,18 @@ static PyTypeObject __pyx_GeneratorType_type = { #if PY_VERSION_HEX >= 0x030400a1 0, #else - __Pyx_Generator_del, + __Pyx_Coroutine_del, #endif 0, #if PY_VERSION_HEX >= 0x030400a1 - __Pyx_Generator_del, + __Pyx_Coroutine_del, #endif }; -static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, - PyObject *closure, PyObject *name, PyObject *qualname) { - __pyx_GeneratorObject *gen = - PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); - if (gen == NULL) - return NULL; - gen->body = body; - gen->closure = closure; - Py_XINCREF(closure); - gen->is_running = 0; - gen->resume_label = 0; - gen->classobj = NULL; - gen->yieldfrom = NULL; - gen->exc_type = NULL; - gen->exc_value = NULL; - gen->exc_traceback = NULL; - gen->gi_weakreflist = NULL; - Py_XINCREF(qualname); - gen->gi_qualname = qualname; - Py_XINCREF(name); - gen->gi_name = name; - PyObject_GC_Track(gen); - return gen; -} static int __pyx_Generator_init(void) { __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); - if (__pyx_GeneratorType == NULL) { + if (unlikely(!__pyx_GeneratorType)) { return -1; } return 0; @@ -33330,6 +31795,87 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 @@ -33368,7 +31914,7 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && @@ -33409,7 +31955,7 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ #endif } else #endif -#if !CYTHON_COMPILING_IN_PYPY +#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -33439,7 +31985,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { #else if (PyLong_Check(x)) #endif - return Py_INCREF(x), x; + return __Pyx_NewRef(x); m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { @@ -33479,18 +32025,55 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) - return PyInt_AS_LONG(b); + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(x); + } #endif if (likely(PyLong_CheckExact(b))) { - #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(b)) { - case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0]; - case 0: return 0; - case 1: return ((PyLongObject*)b)->ob_digit[0]; - } - #endif + #if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)b)->ob_digit; + const Py_ssize_t size = Py_SIZE(b); + if (likely(__Pyx_sst_abs(size) <= 1)) { + ival = likely(size) ? digits[0] : 0; + if (size == -1) ival = -ival; + return ival; + } else { + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } #endif return PyLong_AsSsize_t(b); } diff --git a/pykeyvi/src/pykeyvi.pyx b/pykeyvi/src/pykeyvi.pyx index eac21bb1..06da1361 100644 --- a/pykeyvi/src/pykeyvi.pyx +++ b/pykeyvi/src/pykeyvi.pyx @@ -125,21 +125,21 @@ cdef class StringDictionaryCompiler: 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' - cdef const_char * input_in_0 = in_0 - cdef const_char * input_in_1 = in_1 - self.inst.get().Add(input_in_0, input_in_1) + + + 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' - cdef const_char * input_in_0 = in_0 - cdef const_char * input_in_1 = in_1 - self.inst.get().__setitem__(input_in_0, input_in_1) + + + self.inst.get().__setitem__((in_0), (in_1)) 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) + + self.inst.get().WriteToFile((in_0)) def __enter__(self): return self @@ -175,9 +175,9 @@ cdef class JsonDictionaryCompiler: 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 const_char * input_in_0 = in_0 - cdef const_char * input_in_1 = in_1 - self.inst.get().__setitem__(input_in_0, input_in_1) + + + self.inst.get().__setitem__((in_0), (in_1)) def _init_0(self): self.inst = shared_ptr[_JsonDictionaryCompiler](new _JsonDictionaryCompiler()) @@ -209,8 +209,8 @@ cdef class JsonDictionaryCompiler: 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) + + self.inst.get().WriteToFile((in_0)) def __enter__(self): return self @@ -226,11 +226,11 @@ cdef class JsonDictionaryCompiler: if isinstance(key, unicode): key = key.encode('UTF-8') - cdef const_char * input_in_0 = key + cdef libcpp_string input_in_0 = key if isinstance(value, unicode): value = value.encode('UTF-8') - cdef const_char * input_in_1 = value + cdef libcpp_string input_in_1 = value self.inst.get().Add(input_in_0, input_in_1) @@ -260,8 +260,8 @@ cdef class Dictionary: def LookupText(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().LookupText(input_in_0) + + 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() @@ -269,8 +269,8 @@ cdef class Dictionary: def Lookup(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().Lookup(input_in_0) + + 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() @@ -310,15 +310,15 @@ cdef class Dictionary: def _init_0(self, bytes filename ): assert isinstance(filename, bytes), 'arg filename wrong type' - cdef const_char * input_filename = filename - self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename)) + + 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' - cdef const_char * input_filename = filename - self.inst = shared_ptr[_Dictionary](new _Dictionary(input_filename, (<_loading_strategy_types>in_1))) + + 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)): @@ -330,8 +330,8 @@ cdef class Dictionary: def Get(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().Get(input_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() @@ -342,7 +342,7 @@ cdef class Dictionary: 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)])) + cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) if _r.get().IsEmpty(): return default @@ -367,7 +367,7 @@ cdef class Dictionary: assert isinstance(key, bytes), 'arg in_0 wrong type' - cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) + cdef shared_ptr[_Match] _r = shared_ptr[_Match](new _Match(deref(self.inst.get())[(key)])) if _r.get().IsEmpty(): raise KeyError(key) @@ -540,16 +540,16 @@ cdef class CompletionDictionaryCompiler: 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' - cdef const_char * input_in_0 = in_0 - self.inst.get().__setitem__(input_in_0, (in_1)) + + 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' - cdef const_char * input_in_0 = in_0 - self.inst.get().Add(input_in_0, (in_1)) + + self.inst.get().Add((in_0), (in_1)) def _init_0(self): self.inst = shared_ptr[_CompletionDictionaryCompiler](new _CompletionDictionaryCompiler()) @@ -693,16 +693,16 @@ cdef class KeyOnlyDictionaryGenerator: def Add(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().Add(input_in_0) + + self.inst.get().Add((in_0)) def CloseFeeding(self): self.inst.get().CloseFeeding() 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) + + self.inst.get().WriteToFile((in_0)) cdef class KeyOnlyDictionaryCompiler: @@ -742,8 +742,8 @@ cdef class KeyOnlyDictionaryCompiler: def Add(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().Add(input_in_0) + + self.inst.get().Add((in_0)) def WriteToFile(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' From 31261bebfdc21b3899bac695db5b44cd980415ea Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Mon, 11 Jul 2016 16:10:54 +0200 Subject: [PATCH 2/8] remove zerobyte limitation --- keyvi/src/cpp/dictionary/fsa/automata.h | 31 +------- keyvi/src/cpp/dictionary/fsa/generator.h | 6 +- .../fsa/internal/sparse_array_builder.h | 39 +++++++++- .../tests/cpp/dictionary/dictionary_test.cpp | 26 +++++++ .../cpp/dictionary/fsa/generator_test.cpp | 78 +++++++++++++++++++ 5 files changed, 146 insertions(+), 34 deletions(-) diff --git a/keyvi/src/cpp/dictionary/fsa/automata.h b/keyvi/src/cpp/dictionary/fsa/automata.h index 47a1fe60..90e04502 100644 --- a/keyvi/src/cpp/dictionary/fsa/automata.h +++ b/keyvi/src/cpp/dictionary/fsa/automata.h @@ -194,24 +194,12 @@ final { TRACE ("Bitmask %d", mask_int); if (mask_int != 0) { - if (offset == 0) { - // in this case we have to ignore the first bit, so start counting from 1 - mask_int = mask_int >> 1; - for (auto i=1; i<16; ++i) { - if ((mask_int & 1) == 1) { - TRACE("push symbol+%d", symbol + i); - traversal_state.Add(ResolvePointer(starting_state, symbol + i), symbol + i, payload); - } - mask_int = mask_int >> 1; - } - } else { for (auto i=0; i<16; ++i) { if ((mask_int & 1) == 1) { TRACE("push symbol+%d", symbol + i); traversal_state.Add(ResolvePointer(starting_state, symbol + i), symbol + i, payload); } mask_int = mask_int >> 1; - } } } @@ -229,7 +217,7 @@ final { uint64_t xor_labels_with_mask = *labels_as_ll^*mask_as_ll; - if (((xor_labels_with_mask & 0x00000000000000ffULL) == 0) && offset > 0){ + if (((xor_labels_with_mask & 0x00000000000000ffULL) == 0)){ traversal_state.Add(ResolvePointer(starting_state, symbol), symbol, payload); } if ((xor_labels_with_mask & 0x000000000000ff00ULL)== 0){ @@ -291,20 +279,6 @@ final { TRACE ("Bitmask %d", mask_int); if (mask_int != 0) { - if (offset == 0) { - // in this case we have to ignore the first bit, so start counting from 1 - mask_int = mask_int >> 1; - for (auto i=1; i<16; ++i) { - if ((mask_int & 1) == 1) { - TRACE("push symbol+%d", symbol + i); - uint64_t child_state = ResolvePointer(starting_state, symbol + i); - uint32_t weight = GetWeightValue(child_state); - weight = weight != 0 ? weight : parent_weight; - traversal_state.Add(child_state, weight, symbol + i, payload); - } - mask_int = mask_int >> 1; - } - } else { for (auto i=0; i<16; ++i) { if ((mask_int & 1) == 1) { TRACE("push symbol+%d", symbol + i); @@ -315,7 +289,6 @@ final { } mask_int = mask_int >> 1; } - } } ++labels_as_m128; @@ -332,7 +305,7 @@ final { uint64_t xor_labels_with_mask = *labels_as_ll^*mask_as_ll; - if (((xor_labels_with_mask & 0x00000000000000ffULL) == 0) && offset > 0){ + if (((xor_labels_with_mask & 0x00000000000000ffULL) == 0)){ uint64_t child_state = ResolvePointer(starting_state, symbol); uint32_t weight = GetWeightValue(child_state); weight = weight != 0 ? weight : parent_weight; diff --git a/keyvi/src/cpp/dictionary/fsa/generator.h b/keyvi/src/cpp/dictionary/fsa/generator.h index bd54ae6b..8c77fb71 100644 --- a/keyvi/src/cpp/dictionary/fsa/generator.h +++ b/keyvi/src/cpp/dictionary/fsa/generator.h @@ -190,6 +190,7 @@ final { ValueStoreT::no_value) { size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); + TRACE ("%d key (%ld), common prefix %ld", number_of_keys_added_, input_key.size(), commonPrefixLength); // keys are equal, just return if (commonPrefixLength == input_key.size() && last_key_.size() == input_key.size()) { @@ -200,7 +201,7 @@ final { ConsumeStack(commonPrefixLength); // put everything that is not common between the two strings (the suffix) into the stack - FeedStack(commonPrefixLength, input_key.size(), input_key.c_str()); + FeedStack(commonPrefixLength, input_key.size(), input_key); // get value and mark final state bool no_minimization = false; @@ -229,6 +230,7 @@ final { void Add(const std::string& input_key, const ValueHandle& handle) { size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); + TRACE ("%d key, common prefix %ld", number_of_keys_added_, commonPrefixLength); // keys are equal, just return if (commonPrefixLength == input_key.size() && last_key_.size() == input_key.size()) { @@ -239,7 +241,7 @@ final { ConsumeStack(commonPrefixLength); // put everything that is not common between the two strings (the suffix) into the stack - FeedStack(commonPrefixLength, input_key.size(), input_key.c_str()); + FeedStack(commonPrefixLength, input_key.size(), input_key); stack_->InsertFinalState(input_key.size(), handle.value_idx, handle.no_minimization); diff --git a/keyvi/src/cpp/dictionary/fsa/internal/sparse_array_builder.h b/keyvi/src/cpp/dictionary/fsa/internal/sparse_array_builder.h index c1569b02..137428f6 100644 --- a/keyvi/src/cpp/dictionary/fsa/internal/sparse_array_builder.h +++ b/keyvi/src/cpp/dictionary/fsa/internal/sparse_array_builder.h @@ -200,9 +200,41 @@ class SparseArrayBuilder, OffsetTypeT, HashCode highest_persisted_state_ = offset; } - // make sure no other state is placed at offset - 255, which could cause interference - if ((unpacked_state[0].label == 1) && offset >= NUMBER_OF_STATE_CODINGS) { - state_start_positions_.Set(offset - NUMBER_OF_STATE_CODINGS); + if (unpacked_state[0].label != 0) { + // make sure no other state is placed at offset - 256, which could cause interference + if ((unpacked_state[0].label == 1) && offset >= FINAL_OFFSET_TRANSITION) { + state_start_positions_.Set(offset - FINAL_OFFSET_TRANSITION); + } + + TRACE ("no zero byte, need special handling"); + + // check if something is already written there + if (!taken_positions_in_sparsearray_.IsSet(offset)) { + + // no 0-byte, we have to 'scramble' the 0-byte to avoid a zombie state + int invalid_label = 0xff; + if (offset > NUMBER_OF_STATE_CODINGS) { + size_t safe_state_id = offset; + while (state_start_positions_.IsSet(safe_state_id)) { + ++safe_state_id; + --invalid_label; + } + + // block the position as a possible start state + state_start_positions_.Set(safe_state_id); + } + + // write the bogus label (it can get overriden later, which is ok) + WriteTransition(offset, invalid_label, 0); + } + } else { + // first bit is a 0 byte, so check [1] + // make sure no other state is placed at offset - 256, which could cause interference + if (unpacked_state.size() > 1 && (unpacked_state[1].label == 1) && offset >= FINAL_OFFSET_TRANSITION) { + state_start_positions_.Set(offset - FINAL_OFFSET_TRANSITION); + } + + TRACE ("zero byte to be written"); } persistence_->BeginNewState(offset); @@ -318,6 +350,7 @@ class SparseArrayBuilder, OffsetTypeT, HashCode inline void WriteTransition(size_t offset, unsigned char transitionId, uint64_t transitionPointer) { + TRACE("Write offset: %ld, label: %d", offset, transitionId); size_t difference = SIZE_MAX; if (offset + 512 > transitionPointer) { diff --git a/keyvi/tests/cpp/dictionary/dictionary_test.cpp b/keyvi/tests/cpp/dictionary/dictionary_test.cpp index 2235dc6e..21cebf26 100644 --- a/keyvi/tests/cpp/dictionary/dictionary_test.cpp +++ b/keyvi/tests/cpp/dictionary/dictionary_test.cpp @@ -157,6 +157,32 @@ BOOST_AUTO_TEST_CASE( DictGetNear ) { BOOST_CHECK_EQUAL(expected_matches.size(), i); } +BOOST_AUTO_TEST_CASE( DictGetZerobyte ) { + std::vector> test_data = { { std::string("\0test", 5), 22 }, { + "otherkey", 24 }, { std::string("ot\0her",6), 444 }, { "bar\0", 200 }, }; + + testing::TempDictionary dictionary(test_data); + dictionary_t d(new Dictionary(dictionary.GetFsa())); + + bool matched = false; + for (auto m : d->Get(std::string("\0test", 5))){ + BOOST_CHECK_EQUAL(std::string("\0test", 5), m.GetMatchedString()); + BOOST_CHECK_EQUAL(std::string("22"), boost::get(m.GetAttribute("weight"))); + matched=true; + } + BOOST_CHECK(matched); + + matched = false; + for (auto m : d->Get("test2")){ + matched=true; + } + + BOOST_CHECK(!matched); + + auto m = (*d)[std::string("\0test", 5)]; + BOOST_CHECK_EQUAL("22", boost::get(m.GetAttribute("weight"))); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/keyvi/tests/cpp/dictionary/fsa/generator_test.cpp b/keyvi/tests/cpp/dictionary/fsa/generator_test.cpp index 9ea91e5b..86fae1a5 100644 --- a/keyvi/tests/cpp/dictionary/fsa/generator_test.cpp +++ b/keyvi/tests/cpp/dictionary/fsa/generator_test.cpp @@ -31,6 +31,9 @@ #include "dictionary/fsa/internal/sparse_array_persistence.h" #include "dictionary/fsa/internal/int_value_store.h" +//#define ENABLE_TRACING +#include "dictionary/util/trace.h" + namespace keyvi { namespace dictionary { namespace fsa { @@ -172,6 +175,81 @@ BOOST_AUTO_TEST_CASE( intvaluetest ) { BOOST_CHECK(it == end_it); } +BOOST_AUTO_TEST_CASE( feedwithoutclose ) { + // test that just triggers the case (if) generato is created but FSA creation is not finalized + + auto g = new Generator, internal::IntValueStoreWithInnerWeights>; + g->Add("eads", 576); + + g->Add("facebook", 4368451); + g->Add("youtube", 2622207); + delete g; +} + +BOOST_AUTO_TEST_CASE( manifesttest ) { + Generator> g; + g.Add(std::string("aaa")); + g.Add(std::string("abcde")); + g.Add("bar"); + g.Add("foo"); + g.Add("zar"); + + g.CloseFeeding(); + + g.SetManifestFromString("{\"version\":\"42\"}"); + + std::ofstream out_stream("testFile3", std::ios::binary); + g.Write(out_stream); + out_stream.close(); + + automata_t f(new Automata("testFile3")); + BOOST_CHECK_EQUAL("{\"version\":\"42\"}\n", f->GetManifestAsString()); +} + + +BOOST_AUTO_TEST_CASE( zeroBytes ) { + internal::SparseArrayPersistence<> p(2048, + boost::filesystem::temp_directory_path()); + + TRACE("test zerobyte"); + Generator> g; + g.Add(std::string("\0bbcd", 5)); + g.Add(std::string("a\0abc", 5)); + g.Add("aaaa"); + g.Add(std::string("aabb\0", 5)); + g.Add("aacd"); + g.Add("bbcd"); + + g.CloseFeeding(); + + std::ofstream out_stream("testFileZB", std::ios::binary); + g.Write(out_stream); + out_stream.close(); + + TRACE("test zerobyte: load FSA"); + automata_t f(new Automata("testFileZB")); + + auto zero_state_walk = f->TryWalkTransition(f->GetStartState(), 0); + BOOST_CHECK(zero_state_walk != 0); + TRACE("test zerobyte: tested zb FSA"); + EntryIterator it(f); + EntryIterator end_it; + + BOOST_CHECK_EQUAL(std::string("\0bbcd", 5), it.GetKey()); + ++it; + BOOST_CHECK_EQUAL(std::string("a\0abc", 5), it.GetKey()); + ++it; + BOOST_CHECK_EQUAL("aaaa", it.GetKey()); + ++it; + BOOST_CHECK_EQUAL(std::string("aabb\0",5), it.GetKey()); + ++it; + BOOST_CHECK_EQUAL("aacd", it.GetKey()); + ++it; + BOOST_CHECK_EQUAL("bbcd", it.GetKey()); + ++it; + BOOST_CHECK(it == end_it); +} + BOOST_AUTO_TEST_SUITE_END() } /* namespace fsa */ From 8d7a0afd5f6faf3707e2154147b02f73209240bd Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Mon, 11 Jul 2016 17:01:02 +0200 Subject: [PATCH 3/8] replace more const char* with std::string --- .../completion/forward_backward_completion.h | 4 +- .../completion/multiword_completion.h | 2 +- .../dictionary/completion/prefix_completion.h | 14 +- keyvi/src/cpp/dictionary/dictionary.h | 10 +- keyvi/src/cpp/dictionary/fsa/generator.h | 4 +- .../src/pxds/forward_backward_completion.pxd | 7 +- pykeyvi/src/pxds/multi_word_completion.pxd | 7 +- pykeyvi/src/pxds/prefix_completion.pxd | 7 +- pykeyvi/src/pykeyvi.cpp | 186 ++++++------------ pykeyvi/src/pykeyvi.pyx | 24 +-- 10 files changed, 101 insertions(+), 164 deletions(-) diff --git a/keyvi/src/cpp/dictionary/completion/forward_backward_completion.h b/keyvi/src/cpp/dictionary/completion/forward_backward_completion.h index ddd8eb3c..45c43c83 100644 --- a/keyvi/src/cpp/dictionary/completion/forward_backward_completion.h +++ b/keyvi/src/cpp/dictionary/completion/forward_backward_completion.h @@ -57,10 +57,10 @@ final { }; MatchIterator::MatchIteratorPair GetCompletions( - const char* query, int number_of_results = 10) { + const std::string& query, int number_of_results = 10) { // get query length - size_t query_length = strlen(query); + const size_t query_length = query.size(); // get tokens std::vector strs; diff --git a/keyvi/src/cpp/dictionary/completion/multiword_completion.h b/keyvi/src/cpp/dictionary/completion/multiword_completion.h index 2ab651c2..90593de8 100644 --- a/keyvi/src/cpp/dictionary/completion/multiword_completion.h +++ b/keyvi/src/cpp/dictionary/completion/multiword_completion.h @@ -49,7 +49,7 @@ class MultiWordCompletion final { } MatchIterator::MatchIteratorPair GetCompletions( - const char* query, int number_of_results = 10) { + const std::string& query, int number_of_results = 10) const { uint64_t state = fsa_->GetStartState(); size_t number_of_tokens; diff --git a/keyvi/src/cpp/dictionary/completion/prefix_completion.h b/keyvi/src/cpp/dictionary/completion/prefix_completion.h index 4b1698b7..cf7aa1f8 100644 --- a/keyvi/src/cpp/dictionary/completion/prefix_completion.h +++ b/keyvi/src/cpp/dictionary/completion/prefix_completion.h @@ -50,10 +50,10 @@ final { } MatchIterator::MatchIteratorPair GetCompletions( - const char* query, int number_of_results = 10) { + const std::string& query, int number_of_results = 10) { uint64_t state = fsa_->GetStartState(); - size_t query_length = strlen(query); + const size_t query_length = query.size(); size_t depth = 0; std::vector traversal_stack; @@ -93,7 +93,7 @@ final { if (fsa_->IsFinalState(state)) { TRACE("prefix matched depth %d %s", query_length + data->traverser.GetDepth(), std::string(reinterpret_cast (&data->traversal_stack[0]), query_length + data->traverser.GetDepth()).c_str()); first_match = Match( - 0, query_length, std::string(query, query_length), 0, fsa_, fsa_->GetStateValue(state)); + 0, query_length, std::string(query.c_str(), query_length), 0, fsa_, fsa_->GetStateValue(state)); } auto tfunc = @@ -137,16 +137,16 @@ final { } MatchIterator::MatchIteratorPair GetFuzzyCompletions( - const char* query, int max_edit_distance) { + const std::string& query, int max_edit_distance) { uint64_t state = fsa_->GetStartState(); - size_t query_length = strlen(query); + const size_t query_length = query.size(); size_t depth = 0; const size_t minimum_exact_prefix = 2; size_t exact_prefix = std::min(query_length, minimum_exact_prefix); std::vector codepoints; - utf8::unchecked::utf8to32(query, query + query_length, + utf8::unchecked::utf8to32(query.c_str(), query.c_str() + query_length, back_inserter(codepoints)); stringdistance::Levenshtein metric(codepoints, 20, 3); @@ -185,7 +185,7 @@ final { if (depth == query_length && fsa_->IsFinalState(state)) { TRACE("prefix matched depth %d %s", query_length + data->traverser.GetDepth(), std::string(query, query_length).c_str()); first_match = Match( - 0, query_length, std::string(query, query_length), 0, fsa_, fsa_->GetStateValue(state)); + 0, query_length, std::string(query.c_str(), query_length), 0, fsa_, fsa_->GetStateValue(state)); } auto tfunc = diff --git a/keyvi/src/cpp/dictionary/dictionary.h b/keyvi/src/cpp/dictionary/dictionary.h index 9698b013..9050a4b3 100644 --- a/keyvi/src/cpp/dictionary/dictionary.h +++ b/keyvi/src/cpp/dictionary/dictionary.h @@ -90,7 +90,7 @@ final { */ bool Contains(const std::string& key) const { uint64_t state = fsa_->GetStartState(); - size_t key_length = key.size(); + const size_t key_length = key.size(); TRACE("Contains for %s", key); for (size_t i = 0; i < key_length; ++i) { @@ -113,7 +113,7 @@ final { Match operator[](const std::string& key) const { uint64_t state = fsa_->GetStartState(); - size_t text_length = key.size(); + const size_t text_length = key.size(); for (size_t i = 0; i < text_length; ++i) { state = fsa_->TryWalkTransition(state, key[i]); @@ -144,7 +144,7 @@ final { */ MatchIterator::MatchIteratorPair Get(const std::string& key) const { uint64_t state = fsa_->GetStartState(); - size_t text_length = key.size(); + const size_t text_length = key.size(); for (size_t i = 0; i < text_length; ++i) { state = fsa_->TryWalkTransition(state, key[i]); @@ -260,7 +260,7 @@ final { size_t offset = 0) { uint64_t state = fsa_->GetStartState(); - size_t text_length = text.size(); + const size_t text_length = text.size(); uint64_t last_final_state = 0; size_t last_final_state_position = 0; @@ -315,7 +315,7 @@ final { */ MatchIterator::MatchIteratorPair LookupText(const std::string& text) { - size_t text_length = text.size(); + const size_t text_length = text.size(); std::queue iterators; TRACE("LookupText, 1st lookup for: %s", text); diff --git a/keyvi/src/cpp/dictionary/fsa/generator.h b/keyvi/src/cpp/dictionary/fsa/generator.h index 8c77fb71..964bd995 100644 --- a/keyvi/src/cpp/dictionary/fsa/generator.h +++ b/keyvi/src/cpp/dictionary/fsa/generator.h @@ -189,7 +189,7 @@ final { void Add(const std::string& input_key, typename ValueStoreT::value_t value = ValueStoreT::no_value) { - size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); + const size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); TRACE ("%d key (%ld), common prefix %ld", number_of_keys_added_, input_key.size(), commonPrefixLength); // keys are equal, just return @@ -229,7 +229,7 @@ final { */ void Add(const std::string& input_key, const ValueHandle& handle) { - size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); + const size_t commonPrefixLength = get_common_prefix_length(last_key_, input_key); TRACE ("%d key, common prefix %ld", number_of_keys_added_, commonPrefixLength); // keys are equal, just return diff --git a/pykeyvi/src/pxds/forward_backward_completion.pxd b/pykeyvi/src/pxds/forward_backward_completion.pxd index 1c7001f4..191d959c 100644 --- a/pykeyvi/src/pxds/forward_backward_completion.pxd +++ b/pykeyvi/src/pxds/forward_backward_completion.pxd @@ -1,5 +1,4 @@ -from libcpp.string cimport string -from libc.string cimport const_char +from libcpp.string cimport string as libcpp_string from dictionary cimport Dictionary from smart_ptr cimport shared_ptr from match_iterator cimport MatchIteratorPair as _MatchIteratorPair @@ -7,5 +6,5 @@ from match_iterator cimport MatchIteratorPair as _MatchIteratorPair cdef extern from "dictionary/completion/forward_backward_completion.h" namespace "keyvi::dictionary::completion": cdef cppclass ForwardBackwardCompletion: ForwardBackwardCompletion(shared_ptr[Dictionary], shared_ptr[Dictionary]) except + - _MatchIteratorPair GetCompletions(const_char*) - _MatchIteratorPair GetCompletions(const_char*, int) + _MatchIteratorPair GetCompletions(libcpp_string) + _MatchIteratorPair GetCompletions(libcpp_string, int) diff --git a/pykeyvi/src/pxds/multi_word_completion.pxd b/pykeyvi/src/pxds/multi_word_completion.pxd index 60dfc716..bd8683cd 100644 --- a/pykeyvi/src/pxds/multi_word_completion.pxd +++ b/pykeyvi/src/pxds/multi_word_completion.pxd @@ -1,5 +1,4 @@ -from libcpp.string cimport string -from libc.string cimport const_char +from libcpp.string cimport string as libcpp_string from dictionary cimport Dictionary from smart_ptr cimport shared_ptr from match_iterator cimport MatchIteratorPair as _MatchIteratorPair @@ -7,7 +6,7 @@ from match_iterator cimport MatchIteratorPair as _MatchIteratorPair cdef extern from "dictionary/completion/multiword_completion.h" namespace "keyvi::dictionary::completion": cdef cppclass MultiWordCompletion: MultiWordCompletion(shared_ptr[Dictionary]) except + - _MatchIteratorPair GetCompletions(const_char*) - _MatchIteratorPair GetCompletions(const_char*, int) + _MatchIteratorPair GetCompletions(libcpp_string) + _MatchIteratorPair GetCompletions(libcpp_string, int) diff --git a/pykeyvi/src/pxds/prefix_completion.pxd b/pykeyvi/src/pxds/prefix_completion.pxd index 8a5bc821..53b0c75d 100644 --- a/pykeyvi/src/pxds/prefix_completion.pxd +++ b/pykeyvi/src/pxds/prefix_completion.pxd @@ -1,5 +1,4 @@ -from libcpp.string cimport string -from libc.string cimport const_char +from libcpp.string cimport string as libcpp_string from dictionary cimport Dictionary from smart_ptr cimport shared_ptr from match_iterator cimport MatchIteratorPair as _MatchIteratorPair @@ -7,7 +6,7 @@ from match_iterator cimport MatchIteratorPair as _MatchIteratorPair cdef extern from "dictionary/completion/prefix_completion.h" namespace "keyvi::dictionary::completion": cdef cppclass PrefixCompletion: PrefixCompletion(shared_ptr[Dictionary]) except + - _MatchIteratorPair GetCompletions(const_char*) - _MatchIteratorPair GetFuzzyCompletions(const_char*, int max_edit_distance) + _MatchIteratorPair GetCompletions(libcpp_string) + _MatchIteratorPair GetFuzzyCompletions(libcpp_string, int max_edit_distance) diff --git a/pykeyvi/src/pykeyvi.cpp b/pykeyvi/src/pykeyvi.cpp index 821ad013..eee05267 100644 --- a/pykeyvi/src/pykeyvi.cpp +++ b/pykeyvi/src/pykeyvi.cpp @@ -11746,7 +11746,6 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_3GetFuzzyCompletions(PyObj } 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) { - const char *__pyx_v_input_in_0; keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; @@ -11754,7 +11753,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - const char *__pyx_t_4; + std::string __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; @@ -11767,7 +11766,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc * 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 const_char * input_in_0 = in_0 + * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -11783,7 +11782,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc * 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 const_char * input_in_0 = in_0 + * * */ #ifndef CYTHON_WITHOUT_ASSERTIONS @@ -11806,29 +11805,20 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc } #endif - /* "pykeyvi.pyx":432 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(max_edit_distance, (int, long)), 'arg max_edit_distance wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - /* "pykeyvi.pyx":434 - * cdef const_char * input_in_0 = in_0 * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) # <<<<<<<<<<<<<< + * + * 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(__pyx_v_input_in_0, ((int)__pyx_t_5)); + __pyx_v__r = __pyx_v_self->inst.get()->GetFuzzyCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); /* "pykeyvi.pyx":435 * - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) + * 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() @@ -11840,7 +11830,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_2GetFuzzyCompletions(struc __pyx_t_6 = 0; /* "pykeyvi.pyx":436 - * cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) + * 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() @@ -12032,7 +12022,7 @@ static int __pyx_pf_7pykeyvi_16PrefixCompletion_4__init__(struct __pyx_obj_7pyke * * def GetCompletions(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * */ /* Python wrapper */ @@ -12057,13 +12047,12 @@ static PyObject *__pyx_pw_7pykeyvi_16PrefixCompletion_7GetCompletions(PyObject * } static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __pyx_obj_7pykeyvi_PrefixCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_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; - const char *__pyx_t_2; + std::string __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -12074,8 +12063,8 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __p * * def GetCompletions(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -12087,28 +12076,19 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __p } #endif - /* "pykeyvi.pyx":447 - * def GetCompletions(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - /* "pykeyvi.pyx":448 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_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 = 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 const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * 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() @@ -12120,7 +12100,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __p __pyx_t_3 = 0; /* "pykeyvi.pyx":450 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * 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() @@ -12154,7 +12134,7 @@ static PyObject *__pyx_pf_7pykeyvi_16PrefixCompletion_6GetCompletions(struct __p * * def GetCompletions(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 */ @@ -12218,7 +12198,7 @@ static void __pyx_pf_7pykeyvi_25ForwardBackwardCompletion___dealloc__(struct __p * * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * */ /* Python wrapper */ @@ -12243,13 +12223,12 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_3_GetCompletions_ } static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_0(struct __pyx_obj_7pykeyvi_ForwardBackwardCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_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; - const char *__pyx_t_2; + std::string __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -12260,8 +12239,8 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ * * def _GetCompletions_0(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -12273,28 +12252,19 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ } #endif - /* "pykeyvi.pyx":464 - * def _GetCompletions_0(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - /* "pykeyvi.pyx":465 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_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 = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); /* "pykeyvi.pyx":466 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * 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() @@ -12306,7 +12276,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ __pyx_t_3 = 0; /* "pykeyvi.pyx":467 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * 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() @@ -12340,7 +12310,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_2_GetCompletions_ * * def _GetCompletions_0(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 */ @@ -12430,7 +12400,6 @@ static PyObject *__pyx_pw_7pykeyvi_25ForwardBackwardCompletion_5_GetCompletions_ } 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) { - const char *__pyx_v_input_in_0; keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; @@ -12438,7 +12407,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_ int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - const char *__pyx_t_4; + std::string __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; @@ -12451,7 +12420,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_ * 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' - * cdef const_char * input_in_0 = in_0 + * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -12467,7 +12436,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_ * 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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 + * * */ #ifndef CYTHON_WITHOUT_ASSERTIONS @@ -12490,29 +12459,20 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_ } #endif - /* "pykeyvi.pyx":474 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - /* "pykeyvi.pyx":476 - * cdef const_char * input_in_0 = in_0 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) # <<<<<<<<<<<<<< + * + * 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 = 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(__pyx_v_input_in_0, ((int)__pyx_t_5)); + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); /* "pykeyvi.pyx":477 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + * 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() @@ -12524,7 +12484,7 @@ static PyObject *__pyx_pf_7pykeyvi_25ForwardBackwardCompletion_4_GetCompletions_ __pyx_t_6 = 0; /* "pykeyvi.pyx":478 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + * 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() @@ -15634,7 +15594,7 @@ static int __pyx_pf_7pykeyvi_19MultiWordCompletion_2__init__(struct __pyx_obj_7p * * def _GetCompletions_0(self, bytes in_0 ): # <<<<<<<<<<<<<< * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 + * */ /* Python wrapper */ @@ -15659,13 +15619,12 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_5_GetCompletions_0(PyOb } static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(struct __pyx_obj_7pykeyvi_MultiWordCompletion *__pyx_v_self, PyObject *__pyx_v_in_0) { - const char *__pyx_v_input_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; - const char *__pyx_t_2; + std::string __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -15676,8 +15635,8 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru * * def _GetCompletions_0(self, bytes in_0 ): * assert isinstance(in_0, bytes), 'arg in_0 wrong type' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -15689,28 +15648,19 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru } #endif - /* "pykeyvi.pyx":605 - * def _GetCompletions_0(self, bytes in_0 ): - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) - * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_2); - /* "pykeyvi.pyx":606 * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) # <<<<<<<<<<<<<< + * + * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions((in_0)) # <<<<<<<<<<<<<< * cdef MatchIterator py_result = MatchIterator.__new__(MatchIterator) * py_result.it = _r.begin() */ - __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_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 = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_2)); /* "pykeyvi.pyx":607 - * cdef const_char * input_in_0 = in_0 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * + * 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() @@ -15722,7 +15672,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru __pyx_t_3 = 0; /* "pykeyvi.pyx":608 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + * 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() @@ -15756,7 +15706,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_4_GetCompletions_0(stru * * def _GetCompletions_0(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 */ @@ -15846,7 +15796,6 @@ static PyObject *__pyx_pw_7pykeyvi_19MultiWordCompletion_7_GetCompletions_1(PyOb } 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) { - const char *__pyx_v_input_in_0; keyvi::dictionary::MatchIterator::MatchIteratorPair __pyx_v__r; struct __pyx_obj_7pykeyvi_MatchIterator *__pyx_v_py_result = 0; PyObject *__pyx_r = NULL; @@ -15854,7 +15803,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - const char *__pyx_t_4; + std::string __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; @@ -15867,7 +15816,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru * 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' - * cdef const_char * input_in_0 = in_0 + * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { @@ -15883,7 +15832,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru * 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' # <<<<<<<<<<<<<< - * cdef const_char * input_in_0 = in_0 + * * */ #ifndef CYTHON_WITHOUT_ASSERTIONS @@ -15906,29 +15855,20 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru } #endif - /* "pykeyvi.pyx":615 - * assert isinstance(in_0, bytes), 'arg in_0 wrong type' - * assert isinstance(in_1, (int, long)), 'arg in_1 wrong type' - * cdef const_char * input_in_0 = in_0 # <<<<<<<<<<<<<< - * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_in_0); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_input_in_0 = ((const char *)__pyx_t_4); - /* "pykeyvi.pyx":617 - * cdef const_char * input_in_0 = in_0 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) # <<<<<<<<<<<<<< + * + * 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_v__r = __pyx_v_self->inst.get()->GetCompletions(__pyx_v_input_in_0, ((int)__pyx_t_5)); + __pyx_v__r = __pyx_v_self->inst.get()->GetCompletions(((std::string)__pyx_t_4), ((int)__pyx_t_5)); /* "pykeyvi.pyx":618 * - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + * 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() @@ -15940,7 +15880,7 @@ static PyObject *__pyx_pf_7pykeyvi_19MultiWordCompletion_6_GetCompletions_1(stru __pyx_t_6 = 0; /* "pykeyvi.pyx":619 - * cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + * 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() diff --git a/pykeyvi/src/pykeyvi.pyx b/pykeyvi/src/pykeyvi.pyx index 06da1361..575a2fe6 100644 --- a/pykeyvi/src/pykeyvi.pyx +++ b/pykeyvi/src/pykeyvi.pyx @@ -454,9 +454,9 @@ cdef class PrefixCompletion: 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 const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().GetFuzzyCompletions(input_in_0, (max_edit_distance)) + + 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() @@ -469,8 +469,8 @@ cdef class PrefixCompletion: def GetCompletions(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + + 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() @@ -486,8 +486,8 @@ cdef class ForwardBackwardCompletion: def _GetCompletions_0(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + + 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() @@ -496,9 +496,9 @@ cdef class ForwardBackwardCompletion: 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' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + + 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() @@ -627,8 +627,8 @@ cdef class MultiWordCompletion: def _GetCompletions_0(self, bytes in_0 ): assert isinstance(in_0, bytes), 'arg in_0 wrong type' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0) + + 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() @@ -637,9 +637,9 @@ cdef class MultiWordCompletion: 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' - cdef const_char * input_in_0 = in_0 - cdef _MatchIteratorPair _r = self.inst.get().GetCompletions(input_in_0, (in_1)) + + 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() From fa32d8b67690bede1685f42d897c99e738f51b55 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Thu, 14 Jul 2016 11:37:54 +0200 Subject: [PATCH 4/8] make traversers aware of zerobyte labels --- .../completion/multiword_completion.h | 6 +- .../dictionary/completion/prefix_completion.h | 12 +- keyvi/src/cpp/dictionary/dictionary.h | 22 ++- .../fsa/bounded_weighted_state_traverser.h | 14 +- .../fsa/codepoint_state_traverser.h | 6 +- .../src/cpp/dictionary/fsa/state_traverser.h | 22 ++- .../dictionary/fsa/state_traverser_test.cpp | 128 ++++++++++++++++++ 7 files changed, 179 insertions(+), 31 deletions(-) diff --git a/keyvi/src/cpp/dictionary/completion/multiword_completion.h b/keyvi/src/cpp/dictionary/completion/multiword_completion.h index 90593de8..c2a5b35e 100644 --- a/keyvi/src/cpp/dictionary/completion/multiword_completion.h +++ b/keyvi/src/cpp/dictionary/completion/multiword_completion.h @@ -107,10 +107,8 @@ class MultiWordCompletion final { TRACE("prefix completion callback called"); for (;;) { - unsigned char label = data->traverser.GetStateLabel(); - - if (label) { - + if (data->traverser) { + unsigned char label = data->traverser.GetStateLabel(); if (label == 0x1b){ data->multi_word_boundary = data->traverser.GetDepth(); TRACE("found MW boundary at %d", data->multi_word_boundary); diff --git a/keyvi/src/cpp/dictionary/completion/prefix_completion.h b/keyvi/src/cpp/dictionary/completion/prefix_completion.h index cf7aa1f8..1f4bd8a5 100644 --- a/keyvi/src/cpp/dictionary/completion/prefix_completion.h +++ b/keyvi/src/cpp/dictionary/completion/prefix_completion.h @@ -101,12 +101,10 @@ final { TRACE("prefix completion callback called"); for (;;) { - unsigned char label = data->traverser.GetStateLabel(); - - if (label) { + if (data->traverser) { data->traversal_stack.resize(query_length+data->traverser.GetDepth()-1); - data->traversal_stack.push_back(label); + data->traversal_stack.push_back(data->traverser.GetStateLabel()); TRACE("Current depth %d (%d)", query_length + data->traverser.GetDepth() -1, data->traversal_stack.size()); if (data->traverser.IsFinalState()) { std::string match_str = std::string(reinterpret_cast (&data->traversal_stack[0]), query_length + data->traverser.GetDepth()) @@ -192,13 +190,11 @@ final { [data, query_length, max_edit_distance, exact_prefix] () { TRACE("prefix completion callback called"); for (;;) { - int label = data->traverser.GetStateLabel(); - - if (label) { + if (data->traverser) { TRACE("Current depth %d", exact_prefix + data->traverser.GetDepth() -1); - int score = data->metric.Put(label, exact_prefix + data->traverser.GetDepth() - 1); + int score = data->metric.Put(data->traverser.GetStateLabel(), exact_prefix + data->traverser.GetDepth() - 1); TRACE("Intermediate score %d", score); diff --git a/keyvi/src/cpp/dictionary/dictionary.h b/keyvi/src/cpp/dictionary/dictionary.h index 9050a4b3..03d90724 100644 --- a/keyvi/src/cpp/dictionary/dictionary.h +++ b/keyvi/src/cpp/dictionary/dictionary.h @@ -51,7 +51,7 @@ final { */ Dictionary(const std::string& filename, bool load_lazy) : fsa_(std::make_shared(filename, load_lazy)) { - TRACE("Dictionary from file %s", filename); + TRACE("Dictionary from file %s", filename.c_str()); } /** @@ -62,7 +62,7 @@ final { */ explicit Dictionary(const std::string& filename, loading_strategy_types loading_strategy = loading_strategy_types::lazy) : fsa_(std::make_shared(filename, loading_strategy)) { - TRACE("Dictionary from file %s", filename); + TRACE("Dictionary from file %s", filename.c_str()); } Dictionary(fsa::automata_t f) @@ -92,7 +92,7 @@ final { uint64_t state = fsa_->GetStartState(); const size_t key_length = key.size(); - TRACE("Contains for %s", key); + TRACE("Contains for %s", key.c_str()); for (size_t i = 0; i < key_length; ++i) { state = fsa_->TryWalkTransition(state, key[i]); @@ -217,11 +217,9 @@ final { TRACE("GetAllKeys callback called"); for (;;) { - unsigned char label = data->traverser.GetStateLabel(); - - if (label) { + if (!data->traverser.AtEnd()) { data->traversal_stack.resize(data->traverser.GetDepth()-1); - data->traversal_stack.push_back(label); + data->traversal_stack.push_back(data->traverser.GetStateLabel()); TRACE("Current depth %d (%d)", data->traverser.GetDepth() -1, data->traversal_stack.size()); if (data->traverser.IsFinalState()) { @@ -318,7 +316,7 @@ final { const size_t text_length = text.size(); std::queue iterators; - TRACE("LookupText, 1st lookup for: %s", text); + TRACE("LookupText, 1st lookup for: %s", text.c_str()); iterators.push(Lookup(text).begin()); size_t position = 1; @@ -330,7 +328,7 @@ final { } ++position; - TRACE("LookupText, starting lookup for: %s", text+position); + TRACE("LookupText, starting lookup for: %s", text.c_str()+position); iterators.push(Lookup(text, position).begin()); } @@ -407,13 +405,11 @@ final { for (;;) { - unsigned char label = data->traverser.GetStateLabel(); - // check minimum depth - if (label && data->traverser.GetDepth() > data->matched_depth) { + if (!data->traverser.AtEnd() && data->traverser.GetDepth() > data->matched_depth) { data->traversal_stack.resize(data->traverser.GetDepth()-1); - data->traversal_stack.push_back(label); + data->traversal_stack.push_back(data->traverser.GetStateLabel()); TRACE("Current depth %d (%d)", minimum_prefix_length + data->traverser.GetDepth() -1, data->traversal_stack.size()); if (data->traverser.IsFinalState()) { // optimize? fill vector upfront? diff --git a/keyvi/src/cpp/dictionary/fsa/bounded_weighted_state_traverser.h b/keyvi/src/cpp/dictionary/fsa/bounded_weighted_state_traverser.h index 34bd182d..2e803215 100644 --- a/keyvi/src/cpp/dictionary/fsa/bounded_weighted_state_traverser.h +++ b/keyvi/src/cpp/dictionary/fsa/bounded_weighted_state_traverser.h @@ -67,6 +67,7 @@ final { current_state_(other.current_state_), current_label_(other.current_label_), current_depth_(other.current_depth_), + at_end_(other.at_end_), state_traversal_stack_(std::move(other.state_traversal_stack_)), entry_traversal_stack_(std::move(other.entry_traversal_stack_)), priority_queue_ (std::move(other.priority_queue_)){ @@ -74,6 +75,7 @@ final { other.current_state_ = 0; other.current_label_ = 0; other.current_depth_ = 0; + other.at_end_ = false; } automata_t GetFsa() const { @@ -185,6 +187,7 @@ final { current_state_ = 0; current_depth_ = 0; current_label_ = 0; + at_end_ = true; return; } } @@ -201,10 +204,18 @@ final { return !(operator==(other)); } - unsigned char GetStateLabel() { + unsigned char GetStateLabel() const { return current_label_; } + operator bool() const { + return !at_end_; + } + + bool AtEnd() const { + return at_end_; + } + private: typedef std::deque> traversal_entry_t; @@ -212,6 +223,7 @@ final { uint64_t current_state_ = 0; unsigned char current_label_ = 0; int current_depth_ = 0; + bool at_end_ = false; std::vector state_traversal_stack_; std::vector entry_traversal_stack_; util::BoundedPriorityQueue priority_queue_; diff --git a/keyvi/src/cpp/dictionary/fsa/codepoint_state_traverser.h b/keyvi/src/cpp/dictionary/fsa/codepoint_state_traverser.h index 596abe54..2854da92 100644 --- a/keyvi/src/cpp/dictionary/fsa/codepoint_state_traverser.h +++ b/keyvi/src/cpp/dictionary/fsa/codepoint_state_traverser.h @@ -72,7 +72,7 @@ final { TRACE("CP traverser: wrapped traverser %x %d", label, wrapped_state_traverser_.GetDepth()); - if (label > 0) { + if (wrapped_state_traverser_) { PruneHistory(wrapped_state_traverser_.GetDepth() - 1); if (transitions_stack_.empty() || utf8_length_stack_.back() == 0) { @@ -137,6 +137,10 @@ final { return codepoint_; } + operator bool() const { + return wrapped_state_traverser_; + } + private: innerTraverserType wrapped_state_traverser_; std::vector transitions_stack_; diff --git a/keyvi/src/cpp/dictionary/fsa/state_traverser.h b/keyvi/src/cpp/dictionary/fsa/state_traverser.h index 493ce85b..9ae9ea7f 100644 --- a/keyvi/src/cpp/dictionary/fsa/state_traverser.h +++ b/keyvi/src/cpp/dictionary/fsa/state_traverser.h @@ -44,8 +44,9 @@ final { StateTraverser(automata_t f, uint64_t start_state, traversal::TraversalPayload& payload, bool advance = true) : fsa_(f), - current_label_(0), current_weight_(0), + current_label_(0), + at_end_(false), stack_(payload) { current_state_ = start_state; @@ -59,8 +60,9 @@ final { StateTraverser(automata_t f, uint64_t start_state, bool advance = true) : fsa_(f), - current_label_(0), current_weight_(0), + current_label_(0), + at_end_(false), stack_() { current_state_ = start_state; @@ -78,14 +80,16 @@ final { StateTraverser(StateTraverser&& other) : fsa_(other.fsa_), - current_label_(other.current_label_), current_state_(other.current_state_), current_weight_(other.current_weight_), + current_label_(other.current_label_), + at_end_(other.at_end_), stack_(std::move(other.stack_)) { other.fsa_ = 0; other.current_state_ = 0; other.current_weight_ = 0; other.current_label_ = 0; + other.at_end_ = true; } automata_t GetFsa() const { @@ -137,6 +141,7 @@ final { if (stack_.GetDepth() == 0) { TRACE("traverser exhausted."); current_label_ = 0; + at_end_ = true; return; } @@ -163,11 +168,20 @@ final { return stack_.traversal_stack_payload; } + operator bool() const { + return !at_end_; + } + + bool AtEnd() const { + return at_end_; + } + private: automata_t fsa_; - unsigned char current_label_; uint64_t current_state_; uint32_t current_weight_; + unsigned char current_label_; + bool at_end_; traversal::TraversalStack stack_; }; diff --git a/keyvi/tests/cpp/dictionary/fsa/state_traverser_test.cpp b/keyvi/tests/cpp/dictionary/fsa/state_traverser_test.cpp index 197d8628..2e890095 100644 --- a/keyvi/tests/cpp/dictionary/fsa/state_traverser_test.cpp +++ b/keyvi/tests/cpp/dictionary/fsa/state_traverser_test.cpp @@ -45,6 +45,9 @@ BOOST_AUTO_TEST_CASE( someTraversalNoPrune ) { BOOST_CHECK_EQUAL('a', s.GetStateLabel()); BOOST_CHECK_EQUAL(1, s.GetDepth()); + BOOST_CHECK(!s.AtEnd()); + BOOST_CHECK(s); + s++; BOOST_CHECK_EQUAL('a', s.GetStateLabel()); BOOST_CHECK_EQUAL(2, s.GetDepth()); @@ -102,9 +105,12 @@ BOOST_AUTO_TEST_CASE( someTraversalNoPrune ) { // traverser shall be exhausted s++; BOOST_CHECK_EQUAL(0, s.GetStateLabel()); + BOOST_CHECK(s.AtEnd()); + BOOST_CHECK(!s); BOOST_CHECK_EQUAL(0, s.GetDepth()); s++; BOOST_CHECK_EQUAL(0, s.GetStateLabel()); + BOOST_CHECK(s.AtEnd()); BOOST_CHECK_EQUAL(0, s.GetDepth()); } @@ -118,6 +124,8 @@ BOOST_AUTO_TEST_CASE( someTraversalWithPrune ) { BOOST_CHECK_EQUAL('a', s.GetStateLabel()); BOOST_CHECK_EQUAL(1, s.GetDepth()); + BOOST_CHECK(!s.AtEnd()); + s++; BOOST_CHECK_EQUAL('a', s.GetStateLabel()); BOOST_CHECK_EQUAL(2, s.GetDepth()); @@ -133,6 +141,7 @@ BOOST_AUTO_TEST_CASE( someTraversalWithPrune ) { s.Prune(); s++; + BOOST_CHECK(!s.AtEnd()); BOOST_CHECK_EQUAL('c', s.GetStateLabel()); BOOST_CHECK_EQUAL(3, s.GetDepth()); @@ -153,9 +162,11 @@ BOOST_AUTO_TEST_CASE( someTraversalWithPrune ) { // traverser shall be exhausted s++; BOOST_CHECK_EQUAL(0, s.GetStateLabel()); + BOOST_CHECK(s.AtEnd()); BOOST_CHECK_EQUAL(0, s.GetDepth()); s++; BOOST_CHECK_EQUAL(0, s.GetStateLabel()); + BOOST_CHECK(s.AtEnd()); BOOST_CHECK_EQUAL(0, s.GetDepth()); } @@ -183,13 +194,130 @@ BOOST_AUTO_TEST_CASE( longkeys ) { s++; } + // traverser shall be exhausted + s++; + BOOST_CHECK_EQUAL(0, s.GetStateLabel()); + BOOST_CHECK(s.AtEnd()); + BOOST_CHECK_EQUAL(0, s.GetDepth()); + s++; + BOOST_CHECK_EQUAL(0, s.GetStateLabel()); + BOOST_CHECK(s.AtEnd()); + + BOOST_CHECK_EQUAL(0, s.GetDepth()); +} + + +BOOST_AUTO_TEST_CASE( zeroByte ) { + + std::vector test_data = { + std::string("\0aaaa", 5), + std::string("aa\0bb", 5), + "aabc", "aacd", + std::string("bbcd\0", 5)}; + testing::TempDictionary dictionary (test_data); + automata_t f = dictionary.GetFsa(); + + StateTraverser<> s(f); + + BOOST_CHECK_EQUAL('\0', s.GetStateLabel()); + BOOST_CHECK_EQUAL(1, s.GetDepth()); + BOOST_CHECK(!s.AtEnd()); + + s++; + BOOST_CHECK_EQUAL('a', s.GetStateLabel()); + BOOST_CHECK_EQUAL(2, s.GetDepth()); + s++; + BOOST_CHECK_EQUAL('a', s.GetStateLabel()); + BOOST_CHECK_EQUAL(3, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('a', s.GetStateLabel()); + BOOST_CHECK_EQUAL(4, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('a', s.GetStateLabel()); + BOOST_CHECK_EQUAL(5, s.GetDepth()); + BOOST_CHECK(s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('a', s.GetStateLabel()); + BOOST_CHECK_EQUAL(1, s.GetDepth()); + s++; + BOOST_CHECK_EQUAL('a', s.GetStateLabel()); + BOOST_CHECK_EQUAL(2, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('\0', s.GetStateLabel()); + BOOST_CHECK_EQUAL(3, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('b', s.GetStateLabel()); + BOOST_CHECK_EQUAL(4, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('b', s.GetStateLabel()); + BOOST_CHECK_EQUAL(5, s.GetDepth()); + BOOST_CHECK(s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('b', s.GetStateLabel()); + BOOST_CHECK_EQUAL(3, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + + s++; + BOOST_CHECK_EQUAL('c', s.GetStateLabel()); + BOOST_CHECK_EQUAL(4, s.GetDepth()); + BOOST_CHECK(s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('c', s.GetStateLabel()); + BOOST_CHECK_EQUAL(3, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('d', s.GetStateLabel()); + BOOST_CHECK_EQUAL(4, s.GetDepth()); + BOOST_CHECK(s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('b', s.GetStateLabel()); + BOOST_CHECK_EQUAL(1, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('b', s.GetStateLabel()); + BOOST_CHECK_EQUAL(2, s.GetDepth()); + s++; + BOOST_CHECK_EQUAL('c', s.GetStateLabel()); + BOOST_CHECK_EQUAL(3, s.GetDepth()); + s++; + BOOST_CHECK_EQUAL('d', s.GetStateLabel()); + BOOST_CHECK_EQUAL(4, s.GetDepth()); + BOOST_CHECK(!s.IsFinalState()); + + s++; + BOOST_CHECK_EQUAL('\0', s.GetStateLabel()); + BOOST_CHECK_EQUAL(5, s.GetDepth()); + BOOST_CHECK(s.IsFinalState()); + // traverser shall be exhausted s++; BOOST_CHECK_EQUAL(0, s.GetStateLabel()); BOOST_CHECK_EQUAL(0, s.GetDepth()); + BOOST_CHECK(s.AtEnd()); + s++; BOOST_CHECK_EQUAL(0, s.GetStateLabel()); BOOST_CHECK_EQUAL(0, s.GetDepth()); + BOOST_CHECK(s.AtEnd()); + + } BOOST_AUTO_TEST_SUITE_END() From c6916e153daa4f616af4359f4df696d416e2926a Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Thu, 14 Jul 2016 11:38:10 +0200 Subject: [PATCH 5/8] add test for zerobyte --- pykeyvi/tests/dictionary/zerobyte_test.py | 26 ++++++++++++++++++++++ pykeyvi/tests/json/json_dictionary_test.py | 1 + 2 files changed, 27 insertions(+) create mode 100644 pykeyvi/tests/dictionary/zerobyte_test.py diff --git a/pykeyvi/tests/dictionary/zerobyte_test.py b/pykeyvi/tests/dictionary/zerobyte_test.py new file mode 100644 index 00000000..8666ba24 --- /dev/null +++ b/pykeyvi/tests/dictionary/zerobyte_test.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Usage: py.test tests + +import contextlib +import os + +import pykeyvi + +import sys +import os + +root = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(root, "../")) + +from test_tools import tmp_dictionary + +def test_zerobyte(): + c=pykeyvi.JsonDictionaryCompiler() + c.Add("\x00abc", '["a" : 2]') + c.Add("abc\x00def", '["a" : 3]') + c.Add("cd\x00", '["a" : 4]') + with tmp_dictionary(c, 'zerobyte.kv') as d: + assert d["\x00abc"].GetValue() == '["a" : 2]' + assert d["abc\x00def"].GetValue() == '["a" : 3]' + assert d["cd\x00"].GetValue() == '["a" : 4]' + assert len([(k, v) for k, v in d.GetAllItems()]) == 3 \ No newline at end of file diff --git a/pykeyvi/tests/json/json_dictionary_test.py b/pykeyvi/tests/json/json_dictionary_test.py index 24d252a9..fd64a889 100644 --- a/pykeyvi/tests/json/json_dictionary_test.py +++ b/pykeyvi/tests/json/json_dictionary_test.py @@ -24,6 +24,7 @@ def test_simple(): assert len(d) == 2 assert d["abc"].GetValueAsString() == '{"a":2}' assert d["abd"].GetValueAsString() == '{"a":3}' + assert len([(k, v) for k, v in d.GetAllItems()]) == 2 def test_simple_zlib(): c = pykeyvi.JsonDictionaryCompiler(50000000, {'compression': 'z', 'compression_threshold': '0'}) From e68cef9d38a0f2134bc524c1764f93d72718d8a8 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Thu, 14 Jul 2016 18:59:13 +0200 Subject: [PATCH 6/8] simplify code (also based on review comments) --- keyvi/src/cpp/dictionary/completion/prefix_completion.h | 4 ++-- keyvi/src/cpp/dictionary/dictionary.h | 3 +-- keyvi/src/cpp/dictionary/fsa/generator.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/keyvi/src/cpp/dictionary/completion/prefix_completion.h b/keyvi/src/cpp/dictionary/completion/prefix_completion.h index 1f4bd8a5..7aff43db 100644 --- a/keyvi/src/cpp/dictionary/completion/prefix_completion.h +++ b/keyvi/src/cpp/dictionary/completion/prefix_completion.h @@ -93,7 +93,7 @@ final { if (fsa_->IsFinalState(state)) { TRACE("prefix matched depth %d %s", query_length + data->traverser.GetDepth(), std::string(reinterpret_cast (&data->traversal_stack[0]), query_length + data->traverser.GetDepth()).c_str()); first_match = Match( - 0, query_length, std::string(query.c_str(), query_length), 0, fsa_, fsa_->GetStateValue(state)); + 0, query_length, query, 0, fsa_, fsa_->GetStateValue(state)); } auto tfunc = @@ -183,7 +183,7 @@ final { if (depth == query_length && fsa_->IsFinalState(state)) { TRACE("prefix matched depth %d %s", query_length + data->traverser.GetDepth(), std::string(query, query_length).c_str()); first_match = Match( - 0, query_length, std::string(query.c_str(), query_length), 0, fsa_, fsa_->GetStateValue(state)); + 0, query_length, query, 0, fsa_, fsa_->GetStateValue(state)); } auto tfunc = diff --git a/keyvi/src/cpp/dictionary/dictionary.h b/keyvi/src/cpp/dictionary/dictionary.h index 03d90724..06fb5b77 100644 --- a/keyvi/src/cpp/dictionary/dictionary.h +++ b/keyvi/src/cpp/dictionary/dictionary.h @@ -285,8 +285,7 @@ final { m = Match( offset, last_final_state_position, - /*text.substr(0, last_final_state_position),*/ - std::string(text.c_str() + offset, last_final_state_position - offset), + text.substr(offset, last_final_state_position - offset), 0, fsa_, fsa_->GetStateValue(last_final_state)); diff --git a/keyvi/src/cpp/dictionary/fsa/generator.h b/keyvi/src/cpp/dictionary/fsa/generator.h index 964bd995..f9480b49 100644 --- a/keyvi/src/cpp/dictionary/fsa/generator.h +++ b/keyvi/src/cpp/dictionary/fsa/generator.h @@ -218,7 +218,7 @@ final { stack_->UpdateWeights(0, input_key.size() + 1, weight); } - last_key_ = std::move(input_key); + last_key_ = input_key; state_ = generator_state::FEEDING; } @@ -253,7 +253,7 @@ final { stack_->UpdateWeights(0, input_key.size() + 1, handle.weight); } - last_key_ = std::move(input_key); + last_key_ = input_key; state_ = generator_state::FEEDING; } From 1019e02fff600ecc158f7b83ae5bbeb8684c225a Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 15 Jul 2016 15:38:27 +0200 Subject: [PATCH 7/8] set TPIE temp path according to compiler parameter --- keyvi/src/cpp/dictionary/dictionary_compiler.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/keyvi/src/cpp/dictionary/dictionary_compiler.h b/keyvi/src/cpp/dictionary/dictionary_compiler.h index 96ea9183..386404ea 100644 --- a/keyvi/src/cpp/dictionary/dictionary_compiler.h +++ b/keyvi/src/cpp/dictionary/dictionary_compiler.h @@ -109,7 +109,9 @@ class DictionaryCompiler if (params_.count(TEMPORARY_PATH_KEY) == 0) { params_[TEMPORARY_PATH_KEY] = boost::filesystem::temp_directory_path().string(); - + } else { + // set temp path for tpie + initializer_.SetTempDirectory(params_[TEMPORARY_PATH_KEY]); } TRACE("tmp path set to %s", params_[TEMPORARY_PATH_KEY].c_str()); From 793f0ff01e61291cef6070f4c375cdfed4266dea Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Mon, 22 Aug 2016 10:15:47 +0200 Subject: [PATCH 8/8] rerun autowrap --- pykeyvi/src/pykeyvi.cpp | 30497 ++++++++++++++++++++------------------ 1 file changed, 16342 insertions(+), 14155 deletions(-) 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;