diff --git a/MANIFEST.in b/MANIFEST.in index 85ec854..e2e7cd8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ include LICENSE include README.rst include cpuinfo.py -include include/*.h +include src/*.h include src/*.cc include src/*.cpp include src/*.pyx diff --git a/README.rst b/README.rst index 9d6d034..424c881 100644 --- a/README.rst +++ b/README.rst @@ -60,10 +60,12 @@ MetroHash algorithm. For stateless hashing, it exports ``metrohash64`` and Incremental hashing ~~~~~~~~~~~~~~~~~~~ -For incremental hashing, use ``MetroHash64`` and ``MetroHash128`` classes. -Incremental hashing is associative and guarantees that any combination of input -slices will result in the same final hash value. This is useful for processing -large inputs and stream data. Example with two slices: +Unlike its cousins CityHash and FarmHash, MetroHash allows incremental +(stateful) hashing. For incremental hashing, use ``MetroHash64`` and +``MetroHash128`` classes. Incremental hashing is associative and guarantees +that any combination of input slices will result in the same final hash value. +This is useful for processing large inputs and stream data. Example with two +slices: .. code-block:: python @@ -85,10 +87,14 @@ Note that the resulting hash value above is the same as in: Buffer protocol support ~~~~~~~~~~~~~~~~~~~~~~~ -The methods in this module support Python `Buffer Protocol -`__, which allows them to be used -on any object that exports a buffer interface. Here is an example showing -hashing of a 4D NumPy array: +The Python `Buffer Protocol `__ +allows Python objects to expose their data as raw byte arrays to other objects, +for fast access without copying to a separate location in memory. Among +others, NumPy is a major framework that supports this protocol. + +All hashing functions in this packege will read byte arrays from objects that +expose them via the buffer protocol. Here is an example showing hashing of a 4D +NumPy array: .. code-block:: python @@ -97,8 +103,8 @@ hashing of a 4D NumPy array: >>> metrohash.hash64_int(arr) 12125832280816116063 -Note that arrays need to be contiguous for this to work. To convert a -non-contiguous array, use ``np.ascontiguousarray()`` method. +The arrays need to be contiguous for this to work. To convert a non-contiguous +array, use NumPy's ``ascontiguousarray()`` function. Development ----------- diff --git a/cpp.mk b/cpp.mk index 5f41131..f68fb50 100644 --- a/cpp.mk +++ b/cpp.mk @@ -2,7 +2,7 @@ CXX := g++ CXXFLAGS := -std=c++11 -O3 -msse4.2 LDFLAGS := SRCEXT := cc -INC := -I include +INC := -I src LIB := -L lib INPUT := ./data/sample_100k.txt diff --git a/pip-freeze.txt b/pip-freeze.txt index e1c44b8..dfe6fa2 100644 --- a/pip-freeze.txt +++ b/pip-freeze.txt @@ -8,7 +8,7 @@ ipdb==0.13.9 ipython==7.30.1 jedi==0.18.1 matplotlib-inline==0.1.3 --e git+https://github.com/escherba/python-metrohash@03ec8e4b0b21bf4a9726b3625d5ebc6e791b2a82#egg=metrohash +-e git+https://github.com/escherba/python-metrohash@cffe9bc1c0b48c2269c9e0abe1fb564ccf86d41f#egg=metrohash numpy==1.21.5 packaging==21.3 parso==0.8.3 @@ -18,7 +18,7 @@ pluggy==1.0.0 prompt-toolkit==3.0.24 ptyprocess==0.7.0 py==1.11.0 -Pygments==2.11.0 +Pygments==2.11.1 pyparsing==3.0.6 pytest==6.2.5 toml==0.10.2 diff --git a/setup.py b/setup.py index 4db8067..95b3a0d 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,9 @@ def is_pure(self): CXXFLAGS = [] -print(f"building for platform: {os.name}") +print("building for platform: %s" % os.name) +print("available CPU flags: %s" % CPU_FLAGS) + if os.name == "nt": CXXFLAGS.extend(["/O2"]) else: @@ -42,6 +44,13 @@ def is_pure(self): ]) +if 'ssse3' in CPU_FLAGS: + print("Compiling with SSSE3 enabled") + CXXFLAGS.append('-mssse3') +else: + print("compiling without SSE3 support") + + if 'sse4_2' in CPU_FLAGS: print("Compiling with SSE4.2 enabled") CXXFLAGS.append('-msse4.2') @@ -49,51 +58,44 @@ def is_pure(self): print("compiling without SSE4.2 support") -INCLUDE_DIRS = ['include'] +INCLUDE_DIRS = ['src'] CXXHEADERS = [ - "include/metro.h", - "include/metrohash.h", - "include/metrohash128.h", - "include/metrohash128crc.h", - "include/metrohash64.h", - "include/platform.h", + "src/metro.h", + "src/metrohash.h", + "src/metrohash128.h", + "src/metrohash128crc.h", + "src/metrohash64.h", + "src/platform.h", ] CXXSOURCES = [ "src/metrohash64.cc", "src/metrohash128.cc", ] -CMDCLASS = {} EXT_MODULES = [] if USE_CYTHON: print("building extension using Cython") - CMDCLASS['build_ext'] = build_ext - EXT_MODULES.append( - Extension( - "metrohash", - CXXSOURCES + ["src/metrohash.pyx"], - depends=CXXHEADERS, - language="c++", - extra_compile_args=CXXFLAGS, - include_dirs=INCLUDE_DIRS, - ) - ) + CMDCLASS = {'build_ext': build_ext} + SRC_EXT = ".pyx" else: print("building extension w/o Cython") - EXT_MODULES.append( - Extension( - "metrohash", - CXXSOURCES + ["src/metrohash.cpp"], - depends=CXXHEADERS, - language="c++", - extra_compile_args=CXXFLAGS, - include_dirs=INCLUDE_DIRS, - ) - ) - - -VERSION = '0.1.1.post2' + CMDCLASS = {} + SRC_EXT = ".cpp" + + +EXT_MODULES = [ + Extension( + "metrohash", + CXXSOURCES + ["src/metrohash" + SRC_EXT], + depends=CXXHEADERS, + language="c++", + extra_compile_args=CXXFLAGS, + include_dirs=INCLUDE_DIRS, + ), +] + +VERSION = '0.1.1.post3' URL = "https://github.com/escherba/python-metrohash" diff --git a/include/metro.h b/src/metro.h similarity index 100% rename from include/metro.h rename to src/metro.h diff --git a/src/metrohash.cpp b/src/metrohash.cpp index ee3c2de..537055a 100644 --- a/src/metrohash.cpp +++ b/src/metrohash.cpp @@ -917,7 +917,7 @@ struct __pyx_obj_9metrohash_MetroHash128; struct __pyx_opt_args_9metrohash_hash64; struct __pyx_opt_args_9metrohash_hash128; -/* "metrohash.pyx":98 +/* "metrohash.pyx":100 * * * cpdef bytes hash64(data, uint64_t seed=0ULL): # <<<<<<<<<<<<<< @@ -929,7 +929,7 @@ struct __pyx_opt_args_9metrohash_hash64 { uint64_t seed; }; -/* "metrohash.pyx":131 +/* "metrohash.pyx":133 * * * cpdef bytes hash128(data, uint64_t seed=0ULL): # <<<<<<<<<<<<<< @@ -941,7 +941,7 @@ struct __pyx_opt_args_9metrohash_hash128 { uint64_t seed; }; -/* "metrohash.pyx":258 +/* "metrohash.pyx":261 * * * cdef class MetroHash64(object): # <<<<<<<<<<<<<< @@ -955,7 +955,7 @@ struct __pyx_obj_9metrohash_MetroHash64 { }; -/* "metrohash.pyx":342 +/* "metrohash.pyx":345 * * * cdef class MetroHash128(object): # <<<<<<<<<<<<<< @@ -970,7 +970,7 @@ struct __pyx_obj_9metrohash_MetroHash128 { -/* "metrohash.pyx":258 +/* "metrohash.pyx":261 * * * cdef class MetroHash64(object): # <<<<<<<<<<<<<< @@ -984,7 +984,7 @@ struct __pyx_vtabstruct_9metrohash_MetroHash64 { static struct __pyx_vtabstruct_9metrohash_MetroHash64 *__pyx_vtabptr_9metrohash_MetroHash64; -/* "metrohash.pyx":342 +/* "metrohash.pyx":345 * * * cdef class MetroHash128(object): # <<<<<<<<<<<<<< @@ -1508,7 +1508,7 @@ static const char __pyx_k_basestring[] = "basestring"; static const char __pyx_k_hash64_hex[] = "hash64_hex"; static const char __pyx_k_hash64_int[] = "hash64_int"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_0_1_1_post2[] = "0.1.1.post2"; +static const char __pyx_k_0_1_1_post3[] = "0.1.1.post3"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_MetroHash64[] = "MetroHash64"; static const char __pyx_k_hash128_hex[] = "hash128_hex"; @@ -1526,7 +1526,7 @@ static const char __pyx_k_escherba_metrohash_gmail_com[] = "escherba+metrohash@g static const char __pyx_k_Python_wrapper_for_MetroHash_a[] = "\nPython wrapper for MetroHash, a fast non-cryptographic hashing algorithm\n"; static const char __pyx_k_Argument_s_has_incorrect_type_ex[] = "Argument '%s' has incorrect type: expected %s, got '%s' instead"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; -static PyObject *__pyx_kp_s_0_1_1_post2; +static PyObject *__pyx_kp_s_0_1_1_post3; static PyObject *__pyx_kp_s_Argument_s_has_incorrect_type_ex; static PyObject *__pyx_kp_s_Eugene_Scherba; static PyObject *__pyx_n_s_MemoryError; @@ -1628,7 +1628,7 @@ static PyObject *__pyx_codeobj__17; static PyObject *__pyx_codeobj__19; /* Late includes */ -/* "metrohash.pyx":84 +/* "metrohash.pyx":86 * * if sys.version_info < (3, ): * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< @@ -1647,7 +1647,7 @@ static PyObject *__pyx_pw_9metrohash_1bytes2hex(PyObject *__pyx_self, PyObject * PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("bytes2hex (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bs), (&PyBytes_Type), 1, "bs", 1))) __PYX_ERR(0, 84, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bs), (&PyBytes_Type), 1, "bs", 1))) __PYX_ERR(0, 86, __pyx_L1_error) __pyx_r = __pyx_pf_9metrohash_bytes2hex(__pyx_self, ((PyObject*)__pyx_v_bs)); /* function exit code */ @@ -1668,7 +1668,7 @@ static PyObject *__pyx_pf_9metrohash_bytes2hex(CYTHON_UNUSED PyObject *__pyx_sel int __pyx_clineno = 0; __Pyx_RefNannySetupContext("bytes2hex", 0); - /* "metrohash.pyx":85 + /* "metrohash.pyx":87 * if sys.version_info < (3, ): * def bytes2hex(bs: bytes) -> str: * return bs.encode("hex") # <<<<<<<<<<<<<< @@ -1676,14 +1676,14 @@ static PyObject *__pyx_pf_9metrohash_bytes2hex(CYTHON_UNUSED PyObject *__pyx_sel * def bytes2hex(bs: bytes) -> str: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyBytes_Type_encode, __pyx_v_bs, __pyx_n_s_hex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyBytes_Type_encode, __pyx_v_bs, __pyx_n_s_hex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 85, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 87, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":84 + /* "metrohash.pyx":86 * * if sys.version_info < (3, ): * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< @@ -1702,7 +1702,7 @@ static PyObject *__pyx_pf_9metrohash_bytes2hex(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "metrohash.pyx":87 +/* "metrohash.pyx":89 * return bs.encode("hex") * else: * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< @@ -1721,7 +1721,7 @@ static PyObject *__pyx_pw_9metrohash_3bytes2hex(PyObject *__pyx_self, PyObject * PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("bytes2hex (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bs), (&PyBytes_Type), 1, "bs", 1))) __PYX_ERR(0, 87, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bs), (&PyBytes_Type), 1, "bs", 1))) __PYX_ERR(0, 89, __pyx_L1_error) __pyx_r = __pyx_pf_9metrohash_2bytes2hex(__pyx_self, ((PyObject*)__pyx_v_bs)); /* function exit code */ @@ -1742,7 +1742,7 @@ static PyObject *__pyx_pf_9metrohash_2bytes2hex(CYTHON_UNUSED PyObject *__pyx_se int __pyx_clineno = 0; __Pyx_RefNannySetupContext("bytes2hex", 0); - /* "metrohash.pyx":88 + /* "metrohash.pyx":90 * else: * def bytes2hex(bs: bytes) -> str: * return bs.hex() # <<<<<<<<<<<<<< @@ -1750,14 +1750,14 @@ static PyObject *__pyx_pf_9metrohash_2bytes2hex(CYTHON_UNUSED PyObject *__pyx_se * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyBytes_Type_hex, __pyx_v_bs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyBytes_Type_hex, __pyx_v_bs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 88, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 90, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":87 + /* "metrohash.pyx":89 * return bs.encode("hex") * else: * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< @@ -1776,7 +1776,7 @@ static PyObject *__pyx_pf_9metrohash_2bytes2hex(CYTHON_UNUSED PyObject *__pyx_se return __pyx_r; } -/* "metrohash.pyx":91 +/* "metrohash.pyx":93 * * * cdef object _type_error(argname: str, expected: object, value: object): # <<<<<<<<<<<<<< @@ -1794,7 +1794,7 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_type_error", 0); - /* "metrohash.pyx":92 + /* "metrohash.pyx":94 * * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( # <<<<<<<<<<<<<< @@ -1803,16 +1803,16 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj */ __Pyx_XDECREF(__pyx_r); - /* "metrohash.pyx":94 + /* "metrohash.pyx":96 * return TypeError( * "Argument '%s' has incorrect type: expected %s, got '%s' instead" % * (argname, expected, type(value).__name__) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_argname); __Pyx_GIVEREF(__pyx_v_argname); @@ -1824,32 +1824,32 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":93 + /* "metrohash.pyx":95 * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( * "Argument '%s' has incorrect type: expected %s, got '%s' instead" % # <<<<<<<<<<<<<< * (argname, expected, type(value).__name__) * ) */ - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Argument_s_has_incorrect_type_ex, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Argument_s_has_incorrect_type_ex, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":92 + /* "metrohash.pyx":94 * * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( # <<<<<<<<<<<<<< * "Argument '%s' has incorrect type: expected %s, got '%s' instead" % * (argname, expected, type(value).__name__) */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "metrohash.pyx":91 + /* "metrohash.pyx":93 * * * cdef object _type_error(argname: str, expected: object, value: object): # <<<<<<<<<<<<<< @@ -1869,7 +1869,7 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj return __pyx_r; } -/* "metrohash.pyx":98 +/* "metrohash.pyx":100 * * * cpdef bytes hash64(data, uint64_t seed=0ULL): # <<<<<<<<<<<<<< @@ -1900,19 +1900,19 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED } } - /* "metrohash.pyx":112 + /* "metrohash.pyx":114 * cdef Py_buffer buf * cdef bytes obj * cdef bytearray out = bytearray(8) # <<<<<<<<<<<<<< * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_out = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":113 + /* "metrohash.pyx":115 * cdef bytes obj * cdef bytearray out = bytearray(8) * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -1922,38 +1922,38 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED __pyx_t_2 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_2) { - /* "metrohash.pyx":114 + /* "metrohash.pyx":116 * cdef bytearray out = bytearray(8) * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) # <<<<<<<<<<<<<< * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) */ - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_obj = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":115 + /* "metrohash.pyx":117 * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 117, __pyx_L1_error) - /* "metrohash.pyx":116 + /* "metrohash.pyx":118 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) # <<<<<<<<<<<<<< * PyBuffer_Release(&buf) * elif PyBytes_Check(data): */ - __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error) MetroHash64::Hash(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_t_4, __pyx_v_seed); - /* "metrohash.pyx":117 + /* "metrohash.pyx":119 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -1962,7 +1962,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":113 + /* "metrohash.pyx":115 * cdef bytes obj * cdef bytearray out = bytearray(8) * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -1972,7 +1972,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED goto __pyx_L3; } - /* "metrohash.pyx":118 + /* "metrohash.pyx":120 * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -1982,16 +1982,16 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED __pyx_t_2 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_2) { - /* "metrohash.pyx":121 + /* "metrohash.pyx":123 * CCMetroHash64.Hash( * PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), out, seed) # <<<<<<<<<<<<<< * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) */ - __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) - /* "metrohash.pyx":119 + /* "metrohash.pyx":121 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * CCMetroHash64.Hash( # <<<<<<<<<<<<<< @@ -2000,7 +2000,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED */ MetroHash64::Hash(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data), __pyx_t_4, __pyx_v_seed); - /* "metrohash.pyx":118 + /* "metrohash.pyx":120 * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2010,7 +2010,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED goto __pyx_L3; } - /* "metrohash.pyx":122 + /* "metrohash.pyx":124 * PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), out, seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2020,26 +2020,26 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED __pyx_t_2 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_2)) { - /* "metrohash.pyx":123 + /* "metrohash.pyx":125 * PyBytes_GET_SIZE(data), out, seed) * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 125, __pyx_L1_error) - /* "metrohash.pyx":124 + /* "metrohash.pyx":126 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) # <<<<<<<<<<<<<< * PyBuffer_Release(&buf) * else: */ - __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) MetroHash64::Hash(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_t_4, __pyx_v_seed); - /* "metrohash.pyx":125 + /* "metrohash.pyx":127 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * CCMetroHash64.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2048,7 +2048,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":122 + /* "metrohash.pyx":124 * PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), out, seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2058,7 +2058,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED goto __pyx_L3; } - /* "metrohash.pyx":127 + /* "metrohash.pyx":129 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -2066,7 +2066,7 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED * */ /*else*/ { - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_basestring); __Pyx_GIVEREF(__pyx_n_s_basestring); @@ -2074,16 +2074,16 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED __Pyx_INCREF(__pyx_n_s_buffer); __Pyx_GIVEREF(__pyx_n_s_buffer); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_buffer); - __pyx_t_5 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_1, __pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_5 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_1, __pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 127, __pyx_L1_error) + __PYX_ERR(0, 129, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":128 + /* "metrohash.pyx":130 * else: * raise _type_error("data", ["basestring", "buffer"], data) * return bytes(out) # <<<<<<<<<<<<<< @@ -2091,13 +2091,13 @@ static PyObject *__pyx_f_9metrohash_hash64(PyObject *__pyx_v_data, CYTHON_UNUSED * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; - /* "metrohash.pyx":98 + /* "metrohash.pyx":100 * * * cpdef bytes hash64(data, uint64_t seed=0ULL): # <<<<<<<<<<<<<< @@ -2158,7 +2158,7 @@ static PyObject *__pyx_pw_9metrohash_5hash64(PyObject *__pyx_self, PyObject *__p } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash64") < 0)) __PYX_ERR(0, 98, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash64") < 0)) __PYX_ERR(0, 100, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2171,14 +2171,14 @@ static PyObject *__pyx_pw_9metrohash_5hash64(PyObject *__pyx_self, PyObject *__p } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) } else { __pyx_v_seed = ((uint64_t)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hash64", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 98, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hash64", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 100, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.hash64", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2203,7 +2203,7 @@ static PyObject *__pyx_pf_9metrohash_4hash64(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.seed = __pyx_v_seed; - __pyx_t_1 = __pyx_f_9metrohash_hash64(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9metrohash_hash64(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2220,7 +2220,7 @@ static PyObject *__pyx_pf_9metrohash_4hash64(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "metrohash.pyx":131 +/* "metrohash.pyx":133 * * * cpdef bytes hash128(data, uint64_t seed=0ULL): # <<<<<<<<<<<<<< @@ -2251,19 +2251,19 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE } } - /* "metrohash.pyx":145 + /* "metrohash.pyx":147 * cdef Py_buffer buf * cdef bytes obj * cdef bytearray out = bytearray(16) # <<<<<<<<<<<<<< * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_out = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":146 + /* "metrohash.pyx":148 * cdef bytes obj * cdef bytearray out = bytearray(16) * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -2273,38 +2273,38 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE __pyx_t_2 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_2) { - /* "metrohash.pyx":147 + /* "metrohash.pyx":149 * cdef bytearray out = bytearray(16) * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) # <<<<<<<<<<<<<< * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) */ - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_obj = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":148 + /* "metrohash.pyx":150 * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L1_error) - /* "metrohash.pyx":149 + /* "metrohash.pyx":151 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) # <<<<<<<<<<<<<< * PyBuffer_Release(&buf) * elif PyBytes_Check(data): */ - __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) MetroHash128::Hash(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_t_4, __pyx_v_seed); - /* "metrohash.pyx":150 + /* "metrohash.pyx":152 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2313,7 +2313,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":146 + /* "metrohash.pyx":148 * cdef bytes obj * cdef bytearray out = bytearray(16) * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -2323,7 +2323,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE goto __pyx_L3; } - /* "metrohash.pyx":151 + /* "metrohash.pyx":153 * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2333,16 +2333,16 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE __pyx_t_2 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_2) { - /* "metrohash.pyx":154 + /* "metrohash.pyx":156 * CCMetroHash128.Hash( * PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), out, seed) # <<<<<<<<<<<<<< * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) */ - __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error) - /* "metrohash.pyx":152 + /* "metrohash.pyx":154 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * CCMetroHash128.Hash( # <<<<<<<<<<<<<< @@ -2351,7 +2351,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE */ MetroHash128::Hash(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data), __pyx_t_4, __pyx_v_seed); - /* "metrohash.pyx":151 + /* "metrohash.pyx":153 * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2361,7 +2361,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE goto __pyx_L3; } - /* "metrohash.pyx":155 + /* "metrohash.pyx":157 * PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), out, seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2371,26 +2371,26 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE __pyx_t_2 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_2)) { - /* "metrohash.pyx":156 + /* "metrohash.pyx":158 * PyBytes_GET_SIZE(data), out, seed) * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 158, __pyx_L1_error) - /* "metrohash.pyx":157 + /* "metrohash.pyx":159 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) # <<<<<<<<<<<<<< * PyBuffer_Release(&buf) * else: */ - __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error) MetroHash128::Hash(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_t_4, __pyx_v_seed); - /* "metrohash.pyx":158 + /* "metrohash.pyx":160 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * CCMetroHash128.Hash(buf.buf, buf.len, out, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2399,7 +2399,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":155 + /* "metrohash.pyx":157 * PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), out, seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2409,7 +2409,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE goto __pyx_L3; } - /* "metrohash.pyx":160 + /* "metrohash.pyx":162 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -2417,7 +2417,7 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE * */ /*else*/ { - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_basestring); __Pyx_GIVEREF(__pyx_n_s_basestring); @@ -2425,16 +2425,16 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE __Pyx_INCREF(__pyx_n_s_buffer); __Pyx_GIVEREF(__pyx_n_s_buffer); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_buffer); - __pyx_t_5 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_1, __pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_5 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_1, __pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 160, __pyx_L1_error) + __PYX_ERR(0, 162, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":161 + /* "metrohash.pyx":163 * else: * raise _type_error("data", ["basestring", "buffer"], data) * return bytes(out) # <<<<<<<<<<<<<< @@ -2442,13 +2442,13 @@ static PyObject *__pyx_f_9metrohash_hash128(PyObject *__pyx_v_data, CYTHON_UNUSE * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; - /* "metrohash.pyx":131 + /* "metrohash.pyx":133 * * * cpdef bytes hash128(data, uint64_t seed=0ULL): # <<<<<<<<<<<<<< @@ -2509,7 +2509,7 @@ static PyObject *__pyx_pw_9metrohash_7hash128(PyObject *__pyx_self, PyObject *__ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash128") < 0)) __PYX_ERR(0, 131, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash128") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2522,14 +2522,14 @@ static PyObject *__pyx_pw_9metrohash_7hash128(PyObject *__pyx_self, PyObject *__ } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) } else { __pyx_v_seed = ((uint64_t)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hash128", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 131, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hash128", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.hash128", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2554,7 +2554,7 @@ static PyObject *__pyx_pf_9metrohash_6hash128(CYTHON_UNUSED PyObject *__pyx_self __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.seed = __pyx_v_seed; - __pyx_t_1 = __pyx_f_9metrohash_hash128(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9metrohash_hash128(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2571,7 +2571,7 @@ static PyObject *__pyx_pf_9metrohash_6hash128(CYTHON_UNUSED PyObject *__pyx_self return __pyx_r; } -/* "metrohash.pyx":164 +/* "metrohash.pyx":167 * * * def hash64_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< @@ -2619,7 +2619,7 @@ static PyObject *__pyx_pw_9metrohash_9hash64_hex(PyObject *__pyx_self, PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash64_hex") < 0)) __PYX_ERR(0, 164, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash64_hex") < 0)) __PYX_ERR(0, 167, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2632,14 +2632,14 @@ static PyObject *__pyx_pw_9metrohash_9hash64_hex(PyObject *__pyx_self, PyObject } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) } else { __pyx_v_seed = ((uint64_t)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hash64_hex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 164, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hash64_hex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 167, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.hash64_hex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2665,7 +2665,7 @@ static PyObject *__pyx_pf_9metrohash_8hash64_hex(CYTHON_UNUSED PyObject *__pyx_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hash64_hex", 0); - /* "metrohash.pyx":176 + /* "metrohash.pyx":179 * OverflowError: if seed cannot be converted to unsigned int64 * """ * return bytes2hex(hash64(data, seed=seed)) # <<<<<<<<<<<<<< @@ -2673,11 +2673,11 @@ static PyObject *__pyx_pf_9metrohash_8hash64_hex(CYTHON_UNUSED PyObject *__pyx_s * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4.__pyx_n = 1; __pyx_t_4.seed = __pyx_v_seed; - __pyx_t_3 = __pyx_f_9metrohash_hash64(__pyx_v_data, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_3 = __pyx_f_9metrohash_hash64(__pyx_v_data, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -2692,15 +2692,15 @@ static PyObject *__pyx_pf_9metrohash_8hash64_hex(CYTHON_UNUSED PyObject *__pyx_s __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 176, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 179, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":164 + /* "metrohash.pyx":167 * * * def hash64_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< @@ -2722,7 +2722,7 @@ static PyObject *__pyx_pf_9metrohash_8hash64_hex(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "metrohash.pyx":179 +/* "metrohash.pyx":182 * * * def hash128_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< @@ -2770,7 +2770,7 @@ static PyObject *__pyx_pw_9metrohash_11hash128_hex(PyObject *__pyx_self, PyObjec } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash128_hex") < 0)) __PYX_ERR(0, 179, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash128_hex") < 0)) __PYX_ERR(0, 182, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2783,14 +2783,14 @@ static PyObject *__pyx_pw_9metrohash_11hash128_hex(PyObject *__pyx_self, PyObjec } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error) } else { __pyx_v_seed = ((uint64_t)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hash128_hex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 179, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hash128_hex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 182, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.hash128_hex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2816,7 +2816,7 @@ static PyObject *__pyx_pf_9metrohash_10hash128_hex(CYTHON_UNUSED PyObject *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hash128_hex", 0); - /* "metrohash.pyx":191 + /* "metrohash.pyx":194 * OverflowError: if seed cannot be converted to unsigned int64 * """ * return bytes2hex(hash128(data, seed=seed)) # <<<<<<<<<<<<<< @@ -2824,11 +2824,11 @@ static PyObject *__pyx_pf_9metrohash_10hash128_hex(CYTHON_UNUSED PyObject *__pyx * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4.__pyx_n = 1; __pyx_t_4.seed = __pyx_v_seed; - __pyx_t_3 = __pyx_f_9metrohash_hash128(__pyx_v_data, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_3 = __pyx_f_9metrohash_hash128(__pyx_v_data, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -2843,15 +2843,15 @@ static PyObject *__pyx_pf_9metrohash_10hash128_hex(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 191, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 194, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":179 + /* "metrohash.pyx":182 * * * def hash128_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< @@ -2873,7 +2873,7 @@ static PyObject *__pyx_pf_9metrohash_10hash128_hex(CYTHON_UNUSED PyObject *__pyx return __pyx_r; } -/* "metrohash.pyx":194 +/* "metrohash.pyx":197 * * * def hash64_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< @@ -2921,7 +2921,7 @@ static PyObject *__pyx_pw_9metrohash_13hash64_int(PyObject *__pyx_self, PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash64_int") < 0)) __PYX_ERR(0, 194, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash64_int") < 0)) __PYX_ERR(0, 197, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2934,14 +2934,14 @@ static PyObject *__pyx_pw_9metrohash_13hash64_int(PyObject *__pyx_self, PyObject } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hash64_int", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 194, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hash64_int", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 197, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.hash64_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2969,7 +2969,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hash64_int", 0); - /* "metrohash.pyx":209 + /* "metrohash.pyx":212 * cdef bytes obj * cdef uint64 result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -2979,28 +2979,28 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ __pyx_t_1 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":210 + /* "metrohash.pyx":213 * cdef uint64 result * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) # <<<<<<<<<<<<<< * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) */ - __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":211 + /* "metrohash.pyx":214 * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error) - /* "metrohash.pyx":212 + /* "metrohash.pyx":215 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -3009,7 +3009,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ */ __pyx_v_result = metrohash64(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":213 + /* "metrohash.pyx":216 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3018,7 +3018,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":209 + /* "metrohash.pyx":212 * cdef bytes obj * cdef uint64 result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -3028,7 +3028,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ goto __pyx_L3; } - /* "metrohash.pyx":214 + /* "metrohash.pyx":217 * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3038,7 +3038,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ __pyx_t_1 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":215 + /* "metrohash.pyx":218 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * result = c_metrohash64(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -3047,7 +3047,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ */ __pyx_v_result = metrohash64(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data), __pyx_v_seed); - /* "metrohash.pyx":214 + /* "metrohash.pyx":217 * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3057,7 +3057,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ goto __pyx_L3; } - /* "metrohash.pyx":217 + /* "metrohash.pyx":220 * result = c_metrohash64(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3067,16 +3067,16 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_1)) { - /* "metrohash.pyx":218 + /* "metrohash.pyx":221 * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 221, __pyx_L1_error) - /* "metrohash.pyx":219 + /* "metrohash.pyx":222 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -3085,7 +3085,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ */ __pyx_v_result = metrohash64(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":220 + /* "metrohash.pyx":223 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3094,7 +3094,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":217 + /* "metrohash.pyx":220 * result = c_metrohash64(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3104,7 +3104,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ goto __pyx_L3; } - /* "metrohash.pyx":222 + /* "metrohash.pyx":225 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -3112,7 +3112,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ * */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_basestring); __Pyx_GIVEREF(__pyx_n_s_basestring); @@ -3120,16 +3120,16 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ __Pyx_INCREF(__pyx_n_s_buffer); __Pyx_GIVEREF(__pyx_n_s_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 222, __pyx_L1_error) + __PYX_ERR(0, 225, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":223 + /* "metrohash.pyx":226 * else: * raise _type_error("data", ["basestring", "buffer"], data) * return result # <<<<<<<<<<<<<< @@ -3137,13 +3137,13 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "metrohash.pyx":194 + /* "metrohash.pyx":197 * * * def hash64_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< @@ -3164,7 +3164,7 @@ static PyObject *__pyx_pf_9metrohash_12hash64_int(CYTHON_UNUSED PyObject *__pyx_ return __pyx_r; } -/* "metrohash.pyx":226 +/* "metrohash.pyx":229 * * * def hash128_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< @@ -3212,7 +3212,7 @@ static PyObject *__pyx_pw_9metrohash_15hash128_int(PyObject *__pyx_self, PyObjec } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash128_int") < 0)) __PYX_ERR(0, 226, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hash128_int") < 0)) __PYX_ERR(0, 229, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3225,14 +3225,14 @@ static PyObject *__pyx_pw_9metrohash_15hash128_int(PyObject *__pyx_self, PyObjec } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hash128_int", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 226, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("hash128_int", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 229, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.hash128_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3248,7 +3248,7 @@ static PyObject *__pyx_pw_9metrohash_15hash128_int(PyObject *__pyx_self, PyObjec static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, uint64 __pyx_v_seed) { Py_buffer __pyx_v_buf; PyObject *__pyx_v_obj = 0; - std::pair __pyx_v_result; + uint128 __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3261,9 +3261,9 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hash128_int", 0); - /* "metrohash.pyx":241 + /* "metrohash.pyx":244 * cdef bytes obj - * cdef pair[uint64, uint64] result + * cdef uint128 result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) @@ -3271,28 +3271,28 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":242 - * cdef pair[uint64, uint64] result + /* "metrohash.pyx":245 + * cdef uint128 result * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) # <<<<<<<<<<<<<< * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) */ - __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":243 + /* "metrohash.pyx":246 * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 246, __pyx_L1_error) - /* "metrohash.pyx":244 + /* "metrohash.pyx":247 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -3301,7 +3301,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_result = metrohash128(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":245 + /* "metrohash.pyx":248 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3310,9 +3310,9 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":241 + /* "metrohash.pyx":244 * cdef bytes obj - * cdef pair[uint64, uint64] result + * cdef uint128 result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) @@ -3320,7 +3320,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx goto __pyx_L3; } - /* "metrohash.pyx":246 + /* "metrohash.pyx":249 * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3330,7 +3330,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":247 + /* "metrohash.pyx":250 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * result = c_metrohash128(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -3339,7 +3339,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_result = metrohash128(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data), __pyx_v_seed); - /* "metrohash.pyx":246 + /* "metrohash.pyx":249 * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3349,7 +3349,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx goto __pyx_L3; } - /* "metrohash.pyx":249 + /* "metrohash.pyx":252 * result = c_metrohash128(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3359,16 +3359,16 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_1)) { - /* "metrohash.pyx":250 + /* "metrohash.pyx":253 * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 253, __pyx_L1_error) - /* "metrohash.pyx":251 + /* "metrohash.pyx":254 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -3377,7 +3377,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_result = metrohash128(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":252 + /* "metrohash.pyx":255 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3386,7 +3386,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":249 + /* "metrohash.pyx":252 * result = c_metrohash128(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3396,7 +3396,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx goto __pyx_L3; } - /* "metrohash.pyx":254 + /* "metrohash.pyx":257 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -3404,7 +3404,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx * */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_basestring); __Pyx_GIVEREF(__pyx_n_s_basestring); @@ -3412,16 +3412,16 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx __Pyx_INCREF(__pyx_n_s_buffer); __Pyx_GIVEREF(__pyx_n_s_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 254, __pyx_L1_error) + __PYX_ERR(0, 257, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":255 + /* "metrohash.pyx":258 * else: * raise _type_error("data", ["basestring", "buffer"], data) * return 0x10000000000000000L * long(result.first) + long(result.second) # <<<<<<<<<<<<<< @@ -3429,20 +3429,20 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_int_18446744073709551616L, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_int_18446744073709551616L, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -3450,7 +3450,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx __pyx_t_2 = 0; goto __pyx_L0; - /* "metrohash.pyx":226 + /* "metrohash.pyx":229 * * * def hash128_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< @@ -3472,7 +3472,7 @@ static PyObject *__pyx_pf_9metrohash_14hash128_int(CYTHON_UNUSED PyObject *__pyx return __pyx_r; } -/* "metrohash.pyx":271 +/* "metrohash.pyx":274 * cdef CCMetroHash64* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -3511,7 +3511,7 @@ static int __pyx_pw_9metrohash_11MetroHash64_1__cinit__(PyObject *__pyx_v_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 271, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 274, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3522,14 +3522,14 @@ static int __pyx_pw_9metrohash_11MetroHash64_1__cinit__(PyObject *__pyx_v_self, } } if (values[0]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 274, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash64.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3551,7 +3551,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "metrohash.pyx":272 + /* "metrohash.pyx":275 * * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash64(seed) # <<<<<<<<<<<<<< @@ -3560,7 +3560,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha */ __pyx_v_self->_m = new MetroHash64(__pyx_v_seed); - /* "metrohash.pyx":273 + /* "metrohash.pyx":276 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash64(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -3570,16 +3570,16 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha __pyx_t_1 = ((__pyx_v_self->_m == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "metrohash.pyx":274 + /* "metrohash.pyx":277 * self._m = new CCMetroHash64(seed) * if self._m is NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); __PYX_ERR(0, 274, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 277, __pyx_L1_error) - /* "metrohash.pyx":273 + /* "metrohash.pyx":276 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash64(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -3588,7 +3588,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha */ } - /* "metrohash.pyx":271 + /* "metrohash.pyx":274 * cdef CCMetroHash64* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -3607,7 +3607,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha return __pyx_r; } -/* "metrohash.pyx":276 +/* "metrohash.pyx":279 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3631,7 +3631,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "metrohash.pyx":277 + /* "metrohash.pyx":280 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -3641,7 +3641,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met __pyx_t_1 = ((__pyx_v_self->_m != NULL) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":278 + /* "metrohash.pyx":281 * def __dealloc__(self): * if not self._m is NULL: * del self._m # <<<<<<<<<<<<<< @@ -3650,7 +3650,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met */ delete __pyx_v_self->_m; - /* "metrohash.pyx":279 + /* "metrohash.pyx":282 * if not self._m is NULL: * del self._m * self._m = NULL # <<<<<<<<<<<<<< @@ -3659,7 +3659,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met */ __pyx_v_self->_m = NULL; - /* "metrohash.pyx":277 + /* "metrohash.pyx":280 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -3668,7 +3668,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met */ } - /* "metrohash.pyx":276 + /* "metrohash.pyx":279 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3680,7 +3680,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met __Pyx_RefNannyFinishContext(); } -/* "metrohash.pyx":281 +/* "metrohash.pyx":284 * self._m = NULL * * def reset(self, uint64 seed=0ULL) -> None: # <<<<<<<<<<<<<< @@ -3720,7 +3720,7 @@ static PyObject *__pyx_pw_9metrohash_11MetroHash64_5reset(PyObject *__pyx_v_self } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reset") < 0)) __PYX_ERR(0, 281, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reset") < 0)) __PYX_ERR(0, 284, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3731,14 +3731,14 @@ static PyObject *__pyx_pw_9metrohash_11MetroHash64_5reset(PyObject *__pyx_v_self } } if (values[0]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 284, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reset", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 281, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("reset", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 284, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash64.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3756,7 +3756,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_4reset(struct __pyx_obj_9metr __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset", 0); - /* "metrohash.pyx":289 + /* "metrohash.pyx":292 * OverflowError: if seed is out of bounds * """ * self._m.Initialize(seed) # <<<<<<<<<<<<<< @@ -3765,7 +3765,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_4reset(struct __pyx_obj_9metr */ __pyx_v_self->_m->Initialize(__pyx_v_seed); - /* "metrohash.pyx":281 + /* "metrohash.pyx":284 * self._m = NULL * * def reset(self, uint64 seed=0ULL) -> None: # <<<<<<<<<<<<<< @@ -3780,7 +3780,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_4reset(struct __pyx_obj_9metr return __pyx_r; } -/* "metrohash.pyx":291 +/* "metrohash.pyx":294 * self._m.Initialize(seed) * * def update(self, data) -> None: # <<<<<<<<<<<<<< @@ -3816,7 +3816,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update", 0); - /* "metrohash.pyx":301 + /* "metrohash.pyx":304 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -3826,28 +3826,28 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met __pyx_t_1 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":302 + /* "metrohash.pyx":305 * cdef bytes obj * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) # <<<<<<<<<<<<<< * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) */ - __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":303 + /* "metrohash.pyx":306 * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 306, __pyx_L1_error) - /* "metrohash.pyx":304 + /* "metrohash.pyx":307 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -3856,7 +3856,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ __pyx_v_self->_m->Update(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len); - /* "metrohash.pyx":305 + /* "metrohash.pyx":308 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3865,7 +3865,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":301 + /* "metrohash.pyx":304 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -3875,7 +3875,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met goto __pyx_L3; } - /* "metrohash.pyx":306 + /* "metrohash.pyx":309 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3885,7 +3885,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met __pyx_t_1 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":307 + /* "metrohash.pyx":310 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * self._m.Update(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -3894,7 +3894,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ __pyx_v_self->_m->Update(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data)); - /* "metrohash.pyx":306 + /* "metrohash.pyx":309 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3904,7 +3904,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met goto __pyx_L3; } - /* "metrohash.pyx":309 + /* "metrohash.pyx":312 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3914,16 +3914,16 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_1)) { - /* "metrohash.pyx":310 + /* "metrohash.pyx":313 * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 313, __pyx_L1_error) - /* "metrohash.pyx":311 + /* "metrohash.pyx":314 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -3932,7 +3932,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ __pyx_v_self->_m->Update(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len); - /* "metrohash.pyx":312 + /* "metrohash.pyx":315 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3941,7 +3941,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":309 + /* "metrohash.pyx":312 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3951,7 +3951,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met goto __pyx_L3; } - /* "metrohash.pyx":314 + /* "metrohash.pyx":317 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -3959,7 +3959,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met * cpdef bytes digest(self): */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_basestring); __Pyx_GIVEREF(__pyx_n_s_basestring); @@ -3967,16 +3967,16 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met __Pyx_INCREF(__pyx_n_s_buffer); __Pyx_GIVEREF(__pyx_n_s_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 314, __pyx_L1_error) + __PYX_ERR(0, 317, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":291 + /* "metrohash.pyx":294 * self._m.Initialize(seed) * * def update(self, data) -> None: # <<<<<<<<<<<<<< @@ -3999,7 +3999,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met return __pyx_r; } -/* "metrohash.pyx":316 +/* "metrohash.pyx":319 * raise _type_error("data", ["basestring", "buffer"], data) * * cpdef bytes digest(self): # <<<<<<<<<<<<<< @@ -4030,7 +4030,7 @@ static PyObject *__pyx_f_9metrohash_11MetroHash64_digest(struct __pyx_obj_9metro if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_digest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_digest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9metrohash_11MetroHash64_9digest)) { __Pyx_XDECREF(__pyx_r); @@ -4047,10 +4047,10 @@ static PyObject *__pyx_f_9metrohash_11MetroHash64_digest(struct __pyx_obj_9metro } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 316, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 319, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4069,29 +4069,29 @@ static PyObject *__pyx_f_9metrohash_11MetroHash64_digest(struct __pyx_obj_9metro #endif } - /* "metrohash.pyx":321 + /* "metrohash.pyx":324 * bytes: eight bytes representing the 64-bit hash * """ * cdef bytearray out = bytearray(8) # <<<<<<<<<<<<<< * self._m.Finalize(out) * return bytes(out) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_out = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":322 + /* "metrohash.pyx":325 * """ * cdef bytearray out = bytearray(8) * self._m.Finalize(out) # <<<<<<<<<<<<<< * return bytes(out) * */ - __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error) __pyx_v_self->_m->Finalize(__pyx_t_5); - /* "metrohash.pyx":323 + /* "metrohash.pyx":326 * cdef bytearray out = bytearray(8) * self._m.Finalize(out) * return bytes(out) # <<<<<<<<<<<<<< @@ -4099,13 +4099,13 @@ static PyObject *__pyx_f_9metrohash_11MetroHash64_digest(struct __pyx_obj_9metro * def hexdigest(self) -> str: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":316 + /* "metrohash.pyx":319 * raise _type_error("data", ["basestring", "buffer"], data) * * cpdef bytes digest(self): # <<<<<<<<<<<<<< @@ -4151,7 +4151,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_8digest(struct __pyx_obj_9met int __pyx_clineno = 0; __Pyx_RefNannySetupContext("digest", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_9metrohash_11MetroHash64_digest(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9metrohash_11MetroHash64_digest(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4168,7 +4168,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_8digest(struct __pyx_obj_9met return __pyx_r; } -/* "metrohash.pyx":325 +/* "metrohash.pyx":328 * return bytes(out) * * def hexdigest(self) -> str: # <<<<<<<<<<<<<< @@ -4202,7 +4202,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_10hexdigest(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hexdigest", 0); - /* "metrohash.pyx":330 + /* "metrohash.pyx":333 * str: hash string * """ * return bytes2hex(self.digest()) # <<<<<<<<<<<<<< @@ -4210,9 +4210,9 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_10hexdigest(struct __pyx_obj_ * def intdigest(self) -> int: */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_9metrohash_MetroHash64 *)__pyx_v_self->__pyx_vtab)->digest(__pyx_v_self, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_9metrohash_MetroHash64 *)__pyx_v_self->__pyx_vtab)->digest(__pyx_v_self, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4227,15 +4227,15 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_10hexdigest(struct __pyx_obj_ __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 330, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 333, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":325 + /* "metrohash.pyx":328 * return bytes(out) * * def hexdigest(self) -> str: # <<<<<<<<<<<<<< @@ -4257,7 +4257,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_10hexdigest(struct __pyx_obj_ return __pyx_r; } -/* "metrohash.pyx":332 +/* "metrohash.pyx":335 * return bytes2hex(self.digest()) * * def intdigest(self) -> int: # <<<<<<<<<<<<<< @@ -4289,7 +4289,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_12intdigest(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intdigest", 0); - /* "metrohash.pyx":338 + /* "metrohash.pyx":341 * """ * cdef uint8 buf[8] * self._m.Finalize(buf) # <<<<<<<<<<<<<< @@ -4298,7 +4298,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_12intdigest(struct __pyx_obj_ */ __pyx_v_self->_m->Finalize(__pyx_v_buf); - /* "metrohash.pyx":339 + /* "metrohash.pyx":342 * cdef uint8 buf[8] * self._m.Finalize(buf) * return c_bytes2int64(buf) # <<<<<<<<<<<<<< @@ -4306,13 +4306,13 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_12intdigest(struct __pyx_obj_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint64_t(bytes2int64(__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(bytes2int64(__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":332 + /* "metrohash.pyx":335 * return bytes2hex(self.digest()) * * def intdigest(self) -> int: # <<<<<<<<<<<<<< @@ -4446,7 +4446,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_16__setstate_cython__(CYTHON_ return __pyx_r; } -/* "metrohash.pyx":355 +/* "metrohash.pyx":358 * cdef CCMetroHash128* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -4485,7 +4485,7 @@ static int __pyx_pw_9metrohash_12MetroHash128_1__cinit__(PyObject *__pyx_v_self, } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 355, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 358, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4496,14 +4496,14 @@ static int __pyx_pw_9metrohash_12MetroHash128_1__cinit__(PyObject *__pyx_v_self, } } if (values[0]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 355, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 358, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash128.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4525,7 +4525,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "metrohash.pyx":356 + /* "metrohash.pyx":359 * * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash128(seed) # <<<<<<<<<<<<<< @@ -4534,7 +4534,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh */ __pyx_v_self->_m = new MetroHash128(__pyx_v_seed); - /* "metrohash.pyx":357 + /* "metrohash.pyx":360 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash128(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -4544,16 +4544,16 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh __pyx_t_1 = ((__pyx_v_self->_m == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "metrohash.pyx":358 + /* "metrohash.pyx":361 * self._m = new CCMetroHash128(seed) * if self._m is NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); __PYX_ERR(0, 358, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 361, __pyx_L1_error) - /* "metrohash.pyx":357 + /* "metrohash.pyx":360 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash128(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -4562,7 +4562,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh */ } - /* "metrohash.pyx":355 + /* "metrohash.pyx":358 * cdef CCMetroHash128* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -4581,7 +4581,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh return __pyx_r; } -/* "metrohash.pyx":360 +/* "metrohash.pyx":363 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -4605,7 +4605,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "metrohash.pyx":361 + /* "metrohash.pyx":364 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -4615,7 +4615,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me __pyx_t_1 = ((__pyx_v_self->_m != NULL) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":362 + /* "metrohash.pyx":365 * def __dealloc__(self): * if not self._m is NULL: * del self._m # <<<<<<<<<<<<<< @@ -4624,7 +4624,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me */ delete __pyx_v_self->_m; - /* "metrohash.pyx":363 + /* "metrohash.pyx":366 * if not self._m is NULL: * del self._m * self._m = NULL # <<<<<<<<<<<<<< @@ -4633,7 +4633,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me */ __pyx_v_self->_m = NULL; - /* "metrohash.pyx":361 + /* "metrohash.pyx":364 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -4642,7 +4642,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me */ } - /* "metrohash.pyx":360 + /* "metrohash.pyx":363 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -4654,7 +4654,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me __Pyx_RefNannyFinishContext(); } -/* "metrohash.pyx":365 +/* "metrohash.pyx":368 * self._m = NULL * * def reset(self, uint64 seed=0ULL) -> None: # <<<<<<<<<<<<<< @@ -4694,7 +4694,7 @@ static PyObject *__pyx_pw_9metrohash_12MetroHash128_5reset(PyObject *__pyx_v_sel } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reset") < 0)) __PYX_ERR(0, 365, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reset") < 0)) __PYX_ERR(0, 368, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4705,14 +4705,14 @@ static PyObject *__pyx_pw_9metrohash_12MetroHash128_5reset(PyObject *__pyx_v_sel } } if (values[0]) { - __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 365, __pyx_L3_error) + __pyx_v_seed = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_seed == ((uint64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reset", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 365, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("reset", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 368, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash128.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4730,7 +4730,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_4reset(struct __pyx_obj_9met __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset", 0); - /* "metrohash.pyx":373 + /* "metrohash.pyx":376 * OverflowError: if seed is out of bounds * """ * self._m.Initialize(seed) # <<<<<<<<<<<<<< @@ -4739,7 +4739,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_4reset(struct __pyx_obj_9met */ __pyx_v_self->_m->Initialize(__pyx_v_seed); - /* "metrohash.pyx":365 + /* "metrohash.pyx":368 * self._m = NULL * * def reset(self, uint64 seed=0ULL) -> None: # <<<<<<<<<<<<<< @@ -4754,7 +4754,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_4reset(struct __pyx_obj_9met return __pyx_r; } -/* "metrohash.pyx":375 +/* "metrohash.pyx":378 * self._m.Initialize(seed) * * def update(self, data) -> None: # <<<<<<<<<<<<<< @@ -4790,7 +4790,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update", 0); - /* "metrohash.pyx":385 + /* "metrohash.pyx":388 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -4800,28 +4800,28 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me __pyx_t_1 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":386 + /* "metrohash.pyx":389 * cdef bytes obj * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) # <<<<<<<<<<<<<< * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) */ - __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":387 + /* "metrohash.pyx":390 * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 390, __pyx_L1_error) - /* "metrohash.pyx":388 + /* "metrohash.pyx":391 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -4830,7 +4830,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ __pyx_v_self->_m->Update(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len); - /* "metrohash.pyx":389 + /* "metrohash.pyx":392 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -4839,7 +4839,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":385 + /* "metrohash.pyx":388 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -4849,7 +4849,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me goto __pyx_L3; } - /* "metrohash.pyx":390 + /* "metrohash.pyx":393 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -4859,7 +4859,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me __pyx_t_1 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":391 + /* "metrohash.pyx":394 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * self._m.Update(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -4868,7 +4868,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ __pyx_v_self->_m->Update(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data)); - /* "metrohash.pyx":390 + /* "metrohash.pyx":393 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -4878,7 +4878,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me goto __pyx_L3; } - /* "metrohash.pyx":393 + /* "metrohash.pyx":396 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -4888,16 +4888,16 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_1)) { - /* "metrohash.pyx":394 + /* "metrohash.pyx":397 * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) # <<<<<<<<<<<<<< * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) */ - __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 394, __pyx_L1_error) + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_data, (&__pyx_v_buf), PyBUF_SIMPLE); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 397, __pyx_L1_error) - /* "metrohash.pyx":395 + /* "metrohash.pyx":398 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -4906,7 +4906,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ __pyx_v_self->_m->Update(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len); - /* "metrohash.pyx":396 + /* "metrohash.pyx":399 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -4915,7 +4915,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":393 + /* "metrohash.pyx":396 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -4925,7 +4925,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me goto __pyx_L3; } - /* "metrohash.pyx":398 + /* "metrohash.pyx":401 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -4933,7 +4933,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me * cpdef bytes digest(self): */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_basestring); __Pyx_GIVEREF(__pyx_n_s_basestring); @@ -4941,16 +4941,16 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me __Pyx_INCREF(__pyx_n_s_buffer); __Pyx_GIVEREF(__pyx_n_s_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_s_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 398, __pyx_L1_error) + __PYX_ERR(0, 401, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":375 + /* "metrohash.pyx":378 * self._m.Initialize(seed) * * def update(self, data) -> None: # <<<<<<<<<<<<<< @@ -4973,7 +4973,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me return __pyx_r; } -/* "metrohash.pyx":400 +/* "metrohash.pyx":403 * raise _type_error("data", ["basestring", "buffer"], data) * * cpdef bytes digest(self): # <<<<<<<<<<<<<< @@ -5004,7 +5004,7 @@ static PyObject *__pyx_f_9metrohash_12MetroHash128_digest(struct __pyx_obj_9metr if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_digest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_digest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_9metrohash_12MetroHash128_9digest)) { __Pyx_XDECREF(__pyx_r); @@ -5021,10 +5021,10 @@ static PyObject *__pyx_f_9metrohash_12MetroHash128_digest(struct __pyx_obj_9metr } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 400, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 403, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5043,29 +5043,29 @@ static PyObject *__pyx_f_9metrohash_12MetroHash128_digest(struct __pyx_obj_9metr #endif } - /* "metrohash.pyx":405 + /* "metrohash.pyx":408 * bytes: sixteen bytes representing the 128-bit hash * """ * cdef bytearray out = bytearray(16) # <<<<<<<<<<<<<< * self._m.Finalize(out) * return bytes(out) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_out = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":406 + /* "metrohash.pyx":409 * """ * cdef bytearray out = bytearray(16) * self._m.Finalize(out) # <<<<<<<<<<<<<< * return bytes(out) * */ - __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error) __pyx_v_self->_m->Finalize(__pyx_t_5); - /* "metrohash.pyx":407 + /* "metrohash.pyx":410 * cdef bytearray out = bytearray(16) * self._m.Finalize(out) * return bytes(out) # <<<<<<<<<<<<<< @@ -5073,13 +5073,13 @@ static PyObject *__pyx_f_9metrohash_12MetroHash128_digest(struct __pyx_obj_9metr * def hexdigest(self) -> str: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":400 + /* "metrohash.pyx":403 * raise _type_error("data", ["basestring", "buffer"], data) * * cpdef bytes digest(self): # <<<<<<<<<<<<<< @@ -5125,7 +5125,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_8digest(struct __pyx_obj_9me int __pyx_clineno = 0; __Pyx_RefNannySetupContext("digest", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_9metrohash_12MetroHash128_digest(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9metrohash_12MetroHash128_digest(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5142,7 +5142,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_8digest(struct __pyx_obj_9me return __pyx_r; } -/* "metrohash.pyx":409 +/* "metrohash.pyx":412 * return bytes(out) * * def hexdigest(self) -> str: # <<<<<<<<<<<<<< @@ -5176,7 +5176,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_10hexdigest(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hexdigest", 0); - /* "metrohash.pyx":414 + /* "metrohash.pyx":417 * str: hash string * """ * return bytes2hex(self.digest()) # <<<<<<<<<<<<<< @@ -5184,9 +5184,9 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_10hexdigest(struct __pyx_obj * def intdigest(self) -> int: */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bytes2hex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_9metrohash_MetroHash128 *)__pyx_v_self->__pyx_vtab)->digest(__pyx_v_self, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_9metrohash_MetroHash128 *)__pyx_v_self->__pyx_vtab)->digest(__pyx_v_self, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -5201,15 +5201,15 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_10hexdigest(struct __pyx_obj __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 414, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 417, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":409 + /* "metrohash.pyx":412 * return bytes(out) * * def hexdigest(self) -> str: # <<<<<<<<<<<<<< @@ -5231,7 +5231,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_10hexdigest(struct __pyx_obj return __pyx_r; } -/* "metrohash.pyx":416 +/* "metrohash.pyx":419 * return bytes2hex(self.digest()) * * def intdigest(self) -> int: # <<<<<<<<<<<<<< @@ -5255,7 +5255,7 @@ static PyObject *__pyx_pw_9metrohash_12MetroHash128_13intdigest(PyObject *__pyx_ static PyObject *__pyx_pf_9metrohash_12MetroHash128_12intdigest(struct __pyx_obj_9metrohash_MetroHash128 *__pyx_v_self) { uint8 __pyx_v_buf[16]; - std::pair __pyx_v_result; + uint128 __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5266,43 +5266,43 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_12intdigest(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intdigest", 0); - /* "metrohash.pyx":422 + /* "metrohash.pyx":425 * """ * cdef uint8 buf[16] * self._m.Finalize(buf) # <<<<<<<<<<<<<< - * cdef pair[uint64, uint64] result = c_bytes2int128(buf) + * cdef uint128 result = c_bytes2int128(buf) * return 0x10000000000000000L * long(result.first) + long(result.second) */ __pyx_v_self->_m->Finalize(__pyx_v_buf); - /* "metrohash.pyx":423 + /* "metrohash.pyx":426 * cdef uint8 buf[16] * self._m.Finalize(buf) - * cdef pair[uint64, uint64] result = c_bytes2int128(buf) # <<<<<<<<<<<<<< + * cdef uint128 result = c_bytes2int128(buf) # <<<<<<<<<<<<<< * return 0x10000000000000000L * long(result.first) + long(result.second) */ __pyx_v_result = bytes2int128(__pyx_v_buf); - /* "metrohash.pyx":424 + /* "metrohash.pyx":427 * self._m.Finalize(buf) - * cdef pair[uint64, uint64] result = c_bytes2int128(buf) + * cdef uint128 result = c_bytes2int128(buf) * return 0x10000000000000000L * long(result.first) + long(result.second) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_18446744073709551616L, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_int_18446744073709551616L, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5310,7 +5310,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_12intdigest(struct __pyx_obj __pyx_t_2 = 0; goto __pyx_L0; - /* "metrohash.pyx":416 + /* "metrohash.pyx":419 * return bytes2hex(self.digest()) * * def intdigest(self) -> int: # <<<<<<<<<<<<<< @@ -5732,7 +5732,7 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_0_1_1_post2, __pyx_k_0_1_1_post2, sizeof(__pyx_k_0_1_1_post2), 0, 0, 1, 0}, + {&__pyx_kp_s_0_1_1_post3, __pyx_k_0_1_1_post3, sizeof(__pyx_k_0_1_1_post3), 0, 0, 1, 0}, {&__pyx_kp_s_Argument_s_has_incorrect_type_ex, __pyx_k_Argument_s_has_incorrect_type_ex, sizeof(__pyx_k_Argument_s_has_incorrect_type_ex), 0, 0, 1, 0}, {&__pyx_kp_s_Eugene_Scherba, __pyx_k_Eugene_Scherba, sizeof(__pyx_k_Eugene_Scherba), 0, 0, 1, 0}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, @@ -5782,8 +5782,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 277, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -5793,25 +5793,25 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "metrohash.pyx":112 + /* "metrohash.pyx":114 * cdef Py_buffer buf * cdef bytes obj * cdef bytearray out = bytearray(8) # <<<<<<<<<<<<<< * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "metrohash.pyx":145 + /* "metrohash.pyx":147 * cdef Py_buffer buf * cdef bytes obj * cdef bytearray out = bytearray(16) # <<<<<<<<<<<<<< * if PyUnicode_Check(data): * obj = PyUnicode_AsUTF8String(data) */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_16); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_16); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); @@ -5853,88 +5853,88 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "metrohash.pyx":83 + /* "metrohash.pyx":85 * * * if sys.version_info < (3, ): # <<<<<<<<<<<<<< * def bytes2hex(bs: bytes) -> str: * return bs.encode("hex") */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "metrohash.pyx":84 + /* "metrohash.pyx":86 * * if sys.version_info < (3, ): * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< * return bs.encode("hex") * else: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_bs); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_bs); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_bytes2hex, 84, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_bytes2hex, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 86, __pyx_L1_error) - /* "metrohash.pyx":87 + /* "metrohash.pyx":89 * return bs.encode("hex") * else: * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< * return bs.hex() * */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_bs); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_bs); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_bytes2hex, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_bytes2hex, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 89, __pyx_L1_error) - /* "metrohash.pyx":164 + /* "metrohash.pyx":167 * * * def hash64_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< * """Obtain a 64-bit hash from data using MetroHash-64. * Args: */ - __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_data, __pyx_n_s_seed); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_data, __pyx_n_s_seed); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash64_hex, 164, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash64_hex, 167, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 167, __pyx_L1_error) - /* "metrohash.pyx":179 + /* "metrohash.pyx":182 * * * def hash128_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< * """Obtain a 128-bit hash from data using MetroHash-128. * Args: */ - __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_data, __pyx_n_s_seed); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_data, __pyx_n_s_seed); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash128_hex, 179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash128_hex, 182, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 182, __pyx_L1_error) - /* "metrohash.pyx":194 + /* "metrohash.pyx":197 * * * def hash64_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< * """Obtain a 64-bit hash from data using MetroHash-64. * Args: */ - __pyx_tuple__16 = PyTuple_Pack(5, __pyx_n_s_data, __pyx_n_s_seed, __pyx_n_s_buf, __pyx_n_s_obj, __pyx_n_s_result); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(5, __pyx_n_s_data, __pyx_n_s_seed, __pyx_n_s_buf, __pyx_n_s_obj, __pyx_n_s_result); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash64_int, 194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash64_int, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 197, __pyx_L1_error) - /* "metrohash.pyx":226 + /* "metrohash.pyx":229 * * * def hash128_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< * """Obtain a 128-bit hash from data using MetroHash-128. * Args: */ - __pyx_tuple__18 = PyTuple_Pack(5, __pyx_n_s_data, __pyx_n_s_seed, __pyx_n_s_buf, __pyx_n_s_obj, __pyx_n_s_result); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(5, __pyx_n_s_data, __pyx_n_s_seed, __pyx_n_s_buf, __pyx_n_s_obj, __pyx_n_s_result); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash128_int, 226, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_metrohash_pyx, __pyx_n_s_hash128_int, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5996,29 +5996,29 @@ static int __Pyx_modinit_type_init_code(void) { /*--- Type init code ---*/ __pyx_vtabptr_9metrohash_MetroHash64 = &__pyx_vtable_9metrohash_MetroHash64; __pyx_vtable_9metrohash_MetroHash64.digest = (PyObject *(*)(struct __pyx_obj_9metrohash_MetroHash64 *, int __pyx_skip_dispatch))__pyx_f_9metrohash_11MetroHash64_digest; - if (PyType_Ready(&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 258, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 261, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_9metrohash_MetroHash64.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9metrohash_MetroHash64.tp_dictoffset && __pyx_type_9metrohash_MetroHash64.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_9metrohash_MetroHash64.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_9metrohash_MetroHash64.tp_dict, __pyx_vtabptr_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 258, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash64, (PyObject *)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 258, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 258, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_9metrohash_MetroHash64.tp_dict, __pyx_vtabptr_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 261, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash64, (PyObject *)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 261, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 261, __pyx_L1_error) __pyx_ptype_9metrohash_MetroHash64 = &__pyx_type_9metrohash_MetroHash64; __pyx_vtabptr_9metrohash_MetroHash128 = &__pyx_vtable_9metrohash_MetroHash128; __pyx_vtable_9metrohash_MetroHash128.digest = (PyObject *(*)(struct __pyx_obj_9metrohash_MetroHash128 *, int __pyx_skip_dispatch))__pyx_f_9metrohash_12MetroHash128_digest; - if (PyType_Ready(&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 342, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 345, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_9metrohash_MetroHash128.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9metrohash_MetroHash128.tp_dictoffset && __pyx_type_9metrohash_MetroHash128.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_9metrohash_MetroHash128.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_9metrohash_MetroHash128.tp_dict, __pyx_vtabptr_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 342, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash128, (PyObject *)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 342, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 342, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_9metrohash_MetroHash128.tp_dict, __pyx_vtabptr_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 345, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash128, (PyObject *)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 345, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 345, __pyx_L1_error) __pyx_ptype_9metrohash_MetroHash128 = &__pyx_type_9metrohash_MetroHash128; __Pyx_RefNannyFinishContext(); return 0; @@ -6287,7 +6287,7 @@ if (!__Pyx_RefNanny) { * * __author__ = "Eugene Scherba" # <<<<<<<<<<<<<< * __email__ = "escherba+metrohash@gmail.com" - * __version__ = "0.1.1.post2" + * __version__ = "0.1.1.post3" */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_author, __pyx_kp_s_Eugene_Scherba) < 0) __PYX_ERR(0, 11, __pyx_L1_error) @@ -6295,7 +6295,7 @@ if (!__Pyx_RefNanny) { * * __author__ = "Eugene Scherba" * __email__ = "escherba+metrohash@gmail.com" # <<<<<<<<<<<<<< - * __version__ = "0.1.1.post2" + * __version__ = "0.1.1.post3" * __all__ = [ */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_email, __pyx_kp_s_escherba_metrohash_gmail_com) < 0) __PYX_ERR(0, 12, __pyx_L1_error) @@ -6303,15 +6303,15 @@ if (!__Pyx_RefNanny) { /* "metrohash.pyx":13 * __author__ = "Eugene Scherba" * __email__ = "escherba+metrohash@gmail.com" - * __version__ = "0.1.1.post2" # <<<<<<<<<<<<<< + * __version__ = "0.1.1.post3" # <<<<<<<<<<<<<< * __all__ = [ * "metrohash64", */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_1_1_post2) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_1_1_post3) < 0) __PYX_ERR(0, 13, __pyx_L1_error) /* "metrohash.pyx":14 * __email__ = "escherba+metrohash@gmail.com" - * __version__ = "0.1.1.post2" + * __version__ = "0.1.1.post3" * __all__ = [ # <<<<<<<<<<<<<< * "metrohash64", * "metrohash128", @@ -6333,49 +6333,49 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":67 - * void Hash(const uint8_t* buffer, const uint64_t length, uint8_t* const hash, const uint64_t seed) + /* "metrohash.pyx":68 + * * * import sys # <<<<<<<<<<<<<< * from cpython cimport long * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":83 + /* "metrohash.pyx":85 * * * if sys.version_info < (3, ): # <<<<<<<<<<<<<< * def bytes2hex(bs: bytes) -> str: * return bs.encode("hex") */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_tuple__7, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_tuple__7, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "metrohash.pyx":84 + /* "metrohash.pyx":86 * * if sys.version_info < (3, ): * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< * return bs.encode("hex") * else: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_1bytes2hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_1bytes2hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes2hex, __pyx_t_1) < 0) __PYX_ERR(0, 84, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes2hex, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":83 + /* "metrohash.pyx":85 * * * if sys.version_info < (3, ): # <<<<<<<<<<<<<< @@ -6385,7 +6385,7 @@ if (!__Pyx_RefNanny) { goto __pyx_L2; } - /* "metrohash.pyx":87 + /* "metrohash.pyx":89 * return bs.encode("hex") * else: * def bytes2hex(bs: bytes) -> str: # <<<<<<<<<<<<<< @@ -6393,59 +6393,59 @@ if (!__Pyx_RefNanny) { * */ /*else*/ { - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_3bytes2hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_3bytes2hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes2hex, __pyx_t_1) < 0) __PYX_ERR(0, 87, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes2hex, __pyx_t_1) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L2:; - /* "metrohash.pyx":164 + /* "metrohash.pyx":167 * * * def hash64_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< * """Obtain a 64-bit hash from data using MetroHash-64. * Args: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_9hash64_hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_9hash64_hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash64_hex, __pyx_t_1) < 0) __PYX_ERR(0, 164, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash64_hex, __pyx_t_1) < 0) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":179 + /* "metrohash.pyx":182 * * * def hash128_hex(data, uint64_t seed=0ULL) -> str: # <<<<<<<<<<<<<< * """Obtain a 128-bit hash from data using MetroHash-128. * Args: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_11hash128_hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_11hash128_hex, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash128_hex, __pyx_t_1) < 0) __PYX_ERR(0, 179, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash128_hex, __pyx_t_1) < 0) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":194 + /* "metrohash.pyx":197 * * * def hash64_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< * """Obtain a 64-bit hash from data using MetroHash-64. * Args: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_13hash64_int, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_13hash64_int, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash64_int, __pyx_t_1) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash64_int, __pyx_t_1) < 0) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":226 + /* "metrohash.pyx":229 * * * def hash128_int(data, uint64 seed=0ULL) -> int: # <<<<<<<<<<<<<< * """Obtain a 128-bit hash from data using MetroHash-128. * Args: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_15hash128_int, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9metrohash_15hash128_int, NULL, __pyx_n_s_metrohash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash128_int, __pyx_t_1) < 0) __PYX_ERR(0, 226, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash128_int, __pyx_t_1) < 0) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "metrohash.pyx":1 diff --git a/include/metrohash.h b/src/metrohash.h similarity index 100% rename from include/metrohash.h rename to src/metrohash.h diff --git a/src/metrohash.pyx b/src/metrohash.pyx index 713d41f..2fe8526 100644 --- a/src/metrohash.pyx +++ b/src/metrohash.pyx @@ -10,7 +10,7 @@ Python wrapper for MetroHash, a fast non-cryptographic hashing algorithm __author__ = "Eugene Scherba" __email__ = "escherba+metrohash@gmail.com" -__version__ = "0.1.1.post2" +__version__ = "0.1.1.post3" __all__ = [ "metrohash64", "metrohash128", @@ -25,7 +25,7 @@ cdef extern from * nogil: ctypedef unsigned long long int uint64_t -cdef extern from "" namespace "std": +cdef extern from "" namespace "std" nogil: cdef cppclass pair[T, U]: T first U second @@ -44,25 +44,26 @@ cdef extern from "metro.h" nogil: ctypedef uint8_t uint8 ctypedef uint32_t uint32 ctypedef uint64_t uint64 - ctypedef pair uint128 - cdef uint64 c_metrohash64 "metrohash64" (const uint8* buf, uint64 length, uint64 seed) + ctypedef pair[uint64, uint64] uint128 + cdef uint64 c_metrohash64 "metrohash64" (const uint8* key, uint64 length, uint64 seed) cdef uint64 c_bytes2int64 "bytes2int64" (uint8* const array) - cdef uint128[uint64,uint64] c_bytes2int128 "bytes2int128" (uint8* const array) - cdef uint128[uint64,uint64] c_metrohash128 "metrohash128" (const uint8* buf, uint64 length, uint64 seed) + cdef uint128 c_bytes2int128 "bytes2int128" (uint8* const array) + cdef uint128 c_metrohash128 "metrohash128" (const uint8* key, uint64 length, uint64 seed) cdef cppclass CCMetroHash64 "MetroHash64": CCMetroHash64(const uint64 seed) void Initialize(const uint64 seed) - void Update(const uint8* buf, const uint64 length) + void Update(const uint8* key, const uint64 length) void Finalize(uint8* const result) @staticmethod - void Hash(const uint8_t* buffer, const uint64_t length, uint8_t* const hash, const uint64_t seed) + void Hash(const uint8_t* key, const uint64_t length, uint8_t* const out, const uint64_t seed) cdef cppclass CCMetroHash128 "MetroHash128": CCMetroHash128(const uint64 seed) void Initialize(const uint64 seed) - void Update(const uint8* buf, const uint64 length) + void Update(const uint8* key, const uint64 length) void Finalize(uint8* const result) @staticmethod - void Hash(const uint8_t* buffer, const uint64_t length, uint8_t* const hash, const uint64_t seed) + void Hash(const uint8_t* key, const uint64_t length, uint8_t* const out, const uint64_t seed) + import sys from cpython cimport long @@ -78,6 +79,7 @@ from cpython.unicode cimport PyUnicode_AsUTF8String from cpython.bytes cimport PyBytes_Check from cpython.bytes cimport PyBytes_GET_SIZE from cpython.bytes cimport PyBytes_AS_STRING +from cpython.bytes cimport PyBytes_FromStringAndSize if sys.version_info < (3, ): @@ -161,6 +163,7 @@ cpdef bytes hash128(data, uint64_t seed=0ULL): return bytes(out) + def hash64_hex(data, uint64_t seed=0ULL) -> str: """Obtain a 64-bit hash from data using MetroHash-64. Args: @@ -237,7 +240,7 @@ def hash128_int(data, uint64 seed=0ULL) -> int: """ cdef Py_buffer buf cdef bytes obj - cdef pair[uint64, uint64] result + cdef uint128 result if PyUnicode_Check(data): obj = PyUnicode_AsUTF8String(data) PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) @@ -420,5 +423,5 @@ cdef class MetroHash128(object): """ cdef uint8 buf[16] self._m.Finalize(buf) - cdef pair[uint64, uint64] result = c_bytes2int128(buf) + cdef uint128 result = c_bytes2int128(buf) return 0x10000000000000000L * long(result.first) + long(result.second) diff --git a/include/metrohash128.h b/src/metrohash128.h similarity index 100% rename from include/metrohash128.h rename to src/metrohash128.h diff --git a/include/metrohash128crc.h b/src/metrohash128crc.h similarity index 100% rename from include/metrohash128crc.h rename to src/metrohash128crc.h diff --git a/include/metrohash64.h b/src/metrohash64.h similarity index 100% rename from include/metrohash64.h rename to src/metrohash64.h diff --git a/include/platform.h b/src/platform.h similarity index 100% rename from include/platform.h rename to src/platform.h