From 662b4834403e097331d263705d6f0ab4e6b411a0 Mon Sep 17 00:00:00 2001 From: Eugene Scherba Date: Wed, 29 Dec 2021 01:42:07 -0800 Subject: [PATCH] fix import --- README.rst | 17 ++ pip-freeze.txt | 16 +- requirements.txt | 1 + setup.py | 2 +- src/metrohash.cpp | 557 +++++++++++++++++++--------------------------- src/metrohash.pyx | 5 +- 6 files changed, 263 insertions(+), 335 deletions(-) diff --git a/README.rst b/README.rst index 052565b..30d656d 100644 --- a/README.rst +++ b/README.rst @@ -68,6 +68,23 @@ Note that the resulting hash value above is the same as in: >>> mh.intdigest() 7851180100622203313 +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: + +.. code-block:: python + + >>> import numpy as np + >>> arr = np.zeros((256, 256, 4)) + >>> metrohash.metrohash64(arr) + 12125832280816116063 + +Note that arrays need to be contiguous for this to work. To convert a +non-contiguous array, use ``np.ascontiguousarray()`` method. Development ----------- diff --git a/pip-freeze.txt b/pip-freeze.txt index 6ecb9ca..030856a 100644 --- a/pip-freeze.txt +++ b/pip-freeze.txt @@ -1,15 +1,29 @@ attrs==21.3.0 +backcall==0.2.0 Cython==0.29.26 +decorator==5.1.0 distlib==0.3.4 filelock==3.4.2 iniconfig==1.1.1 --e git+https://github.com/escherba/python-metrohash@f44727818a7218a25bc319215a4ff461f1ca7f4b#egg=metrohash +ipython==7.30.1 +jedi==0.18.1 +matplotlib-inline==0.1.3 +-e git+https://github.com/escherba/python-metrohash@d3f96245c18e7e3724b8e8c8c211ff5c524beed0#egg=metrohash +numpy==1.21.5 packaging==21.3 +parso==0.8.3 +pexpect==4.8.0 +pickleshare==0.7.5 platformdirs==2.4.1 pluggy==1.0.0 +prompt-toolkit==3.0.24 +ptyprocess==0.7.0 py==1.11.0 +Pygments==2.10.0 pyparsing==3.0.6 pytest==6.2.5 six==1.16.0 toml==0.10.2 +traitlets==5.1.1 virtualenv==20.11.0 +wcwidth==0.2.5 diff --git a/requirements.txt b/requirements.txt index bd3b0ec..3b255f5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ cython +numpy pytest setuptools virtualenv diff --git a/setup.py b/setup.py index 0934c56..45cda1a 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def is_pure(self): ) -VERSION = '0.1.0' +VERSION = '0.1.0.post0' URL = "https://github.com/escherba/python-metrohash" diff --git a/src/metrohash.cpp b/src/metrohash.cpp index 2971c8a..df447e1 100644 --- a/src/metrohash.cpp +++ b/src/metrohash.cpp @@ -917,7 +917,7 @@ struct __pyx_obj_9metrohash_MetroHash128; struct __pyx_opt_args_9metrohash_metrohash64; struct __pyx_opt_args_9metrohash_metrohash128; -/* "metrohash.pyx":86 +/* "metrohash.pyx":85 * * * cpdef metrohash64(data, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -929,7 +929,7 @@ struct __pyx_opt_args_9metrohash_metrohash64 { uint64 seed; }; -/* "metrohash.pyx":109 +/* "metrohash.pyx":108 * * * cpdef metrohash128(data, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -941,7 +941,7 @@ struct __pyx_opt_args_9metrohash_metrohash128 { uint64 seed; }; -/* "metrohash.pyx":133 +/* "metrohash.pyx":132 * * * cdef class MetroHash64(object): # <<<<<<<<<<<<<< @@ -954,7 +954,7 @@ struct __pyx_obj_9metrohash_MetroHash64 { }; -/* "metrohash.pyx":177 +/* "metrohash.pyx":176 * * * cdef class MetroHash128(object): # <<<<<<<<<<<<<< @@ -1041,6 +1041,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* PyUnicode_Unicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); + /* PyObjectFormatAndDecref.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); @@ -1189,12 +1192,6 @@ enum __Pyx_ImportType_CheckSize { static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); #endif -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1386,17 +1383,15 @@ static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_[] = ")"; static const char __pyx_k_all[] = "__all__"; static const char __pyx_k_got[] = ", got "; +static const char __pyx_k_None[] = "None"; static const char __pyx_k_data[] = "data"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_seed[] = "seed"; static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_0_1_0[] = "0.1.0"; static const char __pyx_k_email[] = "__email__"; static const char __pyx_k_author[] = "__author__"; static const char __pyx_k_buffer[] = "buffer"; -static const char __pyx_k_cython[] = "cython"; -static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_version[] = "__version__"; static const char __pyx_k_Argument[] = "Argument '"; @@ -1405,6 +1400,7 @@ static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_basestring[] = "basestring"; +static const char __pyx_k_0_1_0_post0[] = "0.1.0.post0"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_MetroHash64[] = "MetroHash64"; static const char __pyx_k_metrohash64[] = "metrohash64"; @@ -1419,7 +1415,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_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static PyObject *__pyx_kp_u_; -static PyObject *__pyx_kp_u_0_1_0; +static PyObject *__pyx_kp_u_0_1_0_post0; static PyObject *__pyx_kp_u_Argument; static PyObject *__pyx_kp_u_Eugene_Scherba; static PyObject *__pyx_n_s_MemoryError; @@ -1427,14 +1423,13 @@ static PyObject *__pyx_n_s_MetroHash128; static PyObject *__pyx_n_u_MetroHash128; static PyObject *__pyx_n_s_MetroHash64; static PyObject *__pyx_n_u_MetroHash64; +static PyObject *__pyx_kp_u_None; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_all; static PyObject *__pyx_n_s_author; -static PyObject *__pyx_n_s_basestring; static PyObject *__pyx_n_u_basestring; static PyObject *__pyx_n_u_buffer; static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_cython; static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_u_data; static PyObject *__pyx_n_s_email; @@ -1442,7 +1437,6 @@ static PyObject *__pyx_kp_u_escherba_metrohash_gmail_com; static PyObject *__pyx_n_s_getstate; static PyObject *__pyx_kp_u_got; static PyObject *__pyx_kp_u_has_incorrect_type_expected; -static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_u_metrohash128; static PyObject *__pyx_n_u_metrohash64; @@ -1481,10 +1475,10 @@ static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; /* Late includes */ -/* "metrohash.pyx":79 +/* "metrohash.pyx":78 * * - * cdef object _type_error(argname: basestring, expected: object, value: object): # <<<<<<<<<<<<<< + * cdef object _type_error(argname: str, expected: object, value: object): # <<<<<<<<<<<<<< * return TypeError( * "Argument '%s' has incorrect type (expected %s, got %s)" % */ @@ -1501,23 +1495,23 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_type_error", 0); - /* "metrohash.pyx":80 + /* "metrohash.pyx":79 * - * cdef object _type_error(argname: basestring, expected: object, value: object): + * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( # <<<<<<<<<<<<<< * "Argument '%s' has incorrect type (expected %s, got %s)" % * (argname, expected, type(value)) */ __Pyx_XDECREF(__pyx_r); - /* "metrohash.pyx":81 - * cdef object _type_error(argname: basestring, expected: object, value: object): + /* "metrohash.pyx":80 + * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( * "Argument '%s' has incorrect type (expected %s, got %s)" % # <<<<<<<<<<<<<< * (argname, expected, type(value)) * ) */ - __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; @@ -1526,14 +1520,14 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj __Pyx_GIVEREF(__pyx_kp_u_Argument); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Argument); - /* "metrohash.pyx":82 + /* "metrohash.pyx":81 * return TypeError( * "Argument '%s' has incorrect type (expected %s, got %s)" % * (argname, expected, type(value)) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_argname), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_argname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); @@ -1544,7 +1538,7 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj __pyx_t_2 += 31; __Pyx_GIVEREF(__pyx_kp_u_has_incorrect_type_expected); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_has_incorrect_type_expected); - __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_expected), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_expected), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); @@ -1555,7 +1549,7 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj __pyx_t_2 += 6; __Pyx_GIVEREF(__pyx_kp_u_got); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_got); - __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(((PyObject *)Py_TYPE(__pyx_v_value))), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(((PyObject *)Py_TYPE(__pyx_v_value))), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); @@ -1567,35 +1561,35 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj __Pyx_GIVEREF(__pyx_kp_u_); PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_); - /* "metrohash.pyx":81 - * cdef object _type_error(argname: basestring, expected: object, value: object): + /* "metrohash.pyx":80 + * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( * "Argument '%s' has incorrect type (expected %s, got %s)" % # <<<<<<<<<<<<<< * (argname, expected, type(value)) * ) */ - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":80 + /* "metrohash.pyx":79 * - * cdef object _type_error(argname: basestring, expected: object, value: object): + * cdef object _type_error(argname: str, expected: object, value: object): * return TypeError( # <<<<<<<<<<<<<< * "Argument '%s' has incorrect type (expected %s, got %s)" % * (argname, expected, type(value)) */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":79 + /* "metrohash.pyx":78 * * - * cdef object _type_error(argname: basestring, expected: object, value: object): # <<<<<<<<<<<<<< + * cdef object _type_error(argname: str, expected: object, value: object): # <<<<<<<<<<<<<< * return TypeError( * "Argument '%s' has incorrect type (expected %s, got %s)" % */ @@ -1612,7 +1606,7 @@ static PyObject *__pyx_f_9metrohash__type_error(PyObject *__pyx_v_argname, PyObj return __pyx_r; } -/* "metrohash.pyx":86 +/* "metrohash.pyx":85 * * * cpdef metrohash64(data, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -1642,7 +1636,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U } } - /* "metrohash.pyx":92 + /* "metrohash.pyx":91 * cdef bytes obj * cdef uint64 result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -1652,28 +1646,28 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U __pyx_t_1 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":93 + /* "metrohash.pyx":92 * 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, 93, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":94 + /* "metrohash.pyx":93 * 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, 94, __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, 93, __pyx_L1_error) - /* "metrohash.pyx":95 + /* "metrohash.pyx":94 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -1682,7 +1676,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U */ __pyx_v_result = metrohash64(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":96 + /* "metrohash.pyx":95 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -1691,7 +1685,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":92 + /* "metrohash.pyx":91 * cdef bytes obj * cdef uint64 result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -1701,7 +1695,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U goto __pyx_L3; } - /* "metrohash.pyx":97 + /* "metrohash.pyx":96 * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -1711,7 +1705,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U __pyx_t_1 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":98 + /* "metrohash.pyx":97 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * result = c_metrohash64(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -1720,7 +1714,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U */ __pyx_v_result = metrohash64(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data), __pyx_v_seed); - /* "metrohash.pyx":97 + /* "metrohash.pyx":96 * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -1730,7 +1724,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U goto __pyx_L3; } - /* "metrohash.pyx":100 + /* "metrohash.pyx":99 * result = c_metrohash64(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -1740,16 +1734,16 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_1)) { - /* "metrohash.pyx":101 + /* "metrohash.pyx":100 * 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, 101, __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, 100, __pyx_L1_error) - /* "metrohash.pyx":102 + /* "metrohash.pyx":101 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -1758,7 +1752,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U */ __pyx_v_result = metrohash64(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":103 + /* "metrohash.pyx":102 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash64(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -1767,7 +1761,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":100 + /* "metrohash.pyx":99 * result = c_metrohash64(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -1777,7 +1771,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U goto __pyx_L3; } - /* "metrohash.pyx":105 + /* "metrohash.pyx":104 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -1785,7 +1779,7 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U * */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_basestring); __Pyx_GIVEREF(__pyx_n_u_basestring); @@ -1793,16 +1787,16 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U __Pyx_INCREF(__pyx_n_u_buffer); __Pyx_GIVEREF(__pyx_n_u_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __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, 105, __pyx_L1_error) + __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":106 + /* "metrohash.pyx":105 * else: * raise _type_error("data", ["basestring", "buffer"], data) * return result # <<<<<<<<<<<<<< @@ -1810,13 +1804,13 @@ static PyObject *__pyx_f_9metrohash_metrohash64(PyObject *__pyx_v_data, CYTHON_U * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "metrohash.pyx":86 + /* "metrohash.pyx":85 * * * cpdef metrohash64(data, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -1876,7 +1870,7 @@ static PyObject *__pyx_pw_9metrohash_1metrohash64(PyObject *__pyx_self, PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "metrohash64") < 0)) __PYX_ERR(0, 86, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "metrohash64") < 0)) __PYX_ERR(0, 85, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1889,14 +1883,14 @@ static PyObject *__pyx_pw_9metrohash_1metrohash64(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, 86, __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, 85, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("metrohash64", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("metrohash64", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 85, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.metrohash64", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1921,7 +1915,7 @@ static PyObject *__pyx_pf_9metrohash_metrohash64(CYTHON_UNUSED PyObject *__pyx_s __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.seed = __pyx_v_seed; - __pyx_t_1 = __pyx_f_9metrohash_metrohash64(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9metrohash_metrohash64(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1938,7 +1932,7 @@ static PyObject *__pyx_pf_9metrohash_metrohash64(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "metrohash.pyx":109 +/* "metrohash.pyx":108 * * * cpdef metrohash128(data, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -1970,7 +1964,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ } } - /* "metrohash.pyx":115 + /* "metrohash.pyx":114 * cdef bytes obj * cdef pair[uint64, uint64] result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -1980,28 +1974,28 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ __pyx_t_1 = (PyUnicode_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":116 + /* "metrohash.pyx":115 * cdef pair[uint64, uint64] 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, 116, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":117 + /* "metrohash.pyx":116 * 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, 117, __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, 116, __pyx_L1_error) - /* "metrohash.pyx":118 + /* "metrohash.pyx":117 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -2010,7 +2004,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ */ __pyx_v_result = metrohash128(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":119 + /* "metrohash.pyx":118 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2019,7 +2013,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":115 + /* "metrohash.pyx":114 * cdef bytes obj * cdef pair[uint64, uint64] result * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -2029,7 +2023,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ goto __pyx_L3; } - /* "metrohash.pyx":120 + /* "metrohash.pyx":119 * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2039,7 +2033,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ __pyx_t_1 = (PyBytes_Check(__pyx_v_data) != 0); if (__pyx_t_1) { - /* "metrohash.pyx":121 + /* "metrohash.pyx":120 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * result = c_metrohash128(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -2048,7 +2042,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ */ __pyx_v_result = metrohash128(((uint8 const *)PyBytes_AS_STRING(__pyx_v_data)), PyBytes_GET_SIZE(__pyx_v_data), __pyx_v_seed); - /* "metrohash.pyx":120 + /* "metrohash.pyx":119 * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2058,7 +2052,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ goto __pyx_L3; } - /* "metrohash.pyx":123 + /* "metrohash.pyx":122 * result = c_metrohash128(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2068,16 +2062,16 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_data) != 0); if (likely(__pyx_t_1)) { - /* "metrohash.pyx":124 + /* "metrohash.pyx":123 * 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, 124, __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, 123, __pyx_L1_error) - /* "metrohash.pyx":125 + /* "metrohash.pyx":124 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) # <<<<<<<<<<<<<< @@ -2086,7 +2080,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ */ __pyx_v_result = metrohash128(((uint8 const *)__pyx_v_buf.buf), __pyx_v_buf.len, __pyx_v_seed); - /* "metrohash.pyx":126 + /* "metrohash.pyx":125 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * result = c_metrohash128(buf.buf, buf.len, seed) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2095,7 +2089,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":123 + /* "metrohash.pyx":122 * result = c_metrohash128(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data), seed) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2105,7 +2099,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ goto __pyx_L3; } - /* "metrohash.pyx":128 + /* "metrohash.pyx":127 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -2113,7 +2107,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ * return final */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_basestring); __Pyx_GIVEREF(__pyx_n_u_basestring); @@ -2121,44 +2115,44 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ __Pyx_INCREF(__pyx_n_u_buffer); __Pyx_GIVEREF(__pyx_n_u_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __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, 128, __pyx_L1_error) + __PYX_ERR(0, 127, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":129 + /* "metrohash.pyx":128 * else: * raise _type_error("data", ["basestring", "buffer"], data) * final = 0x10000000000000000L * long(result.first) + long(result.second) # <<<<<<<<<<<<<< * return final * */ - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __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, 129, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __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, 129, __pyx_L1_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_int_18446744073709551616L, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __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, 129, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __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, 129, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __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, 129, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __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; - if (!(likely(PyLong_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "long", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 129, __pyx_L1_error) + if (!(likely(PyLong_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "long", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 128, __pyx_L1_error) __pyx_v_final = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":130 + /* "metrohash.pyx":129 * raise _type_error("data", ["basestring", "buffer"], data) * final = 0x10000000000000000L * long(result.first) + long(result.second) * return final # <<<<<<<<<<<<<< @@ -2170,7 +2164,7 @@ static PyObject *__pyx_f_9metrohash_metrohash128(PyObject *__pyx_v_data, CYTHON_ __pyx_r = __pyx_v_final; goto __pyx_L0; - /* "metrohash.pyx":109 + /* "metrohash.pyx":108 * * * cpdef metrohash128(data, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -2232,7 +2226,7 @@ static PyObject *__pyx_pw_9metrohash_3metrohash128(PyObject *__pyx_self, PyObjec } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "metrohash128") < 0)) __PYX_ERR(0, 109, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "metrohash128") < 0)) __PYX_ERR(0, 108, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2245,14 +2239,14 @@ static PyObject *__pyx_pw_9metrohash_3metrohash128(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, 109, __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, 108, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("metrohash128", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 109, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("metrohash128", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.metrohash128", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2277,7 +2271,7 @@ static PyObject *__pyx_pf_9metrohash_2metrohash128(CYTHON_UNUSED PyObject *__pyx __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.seed = __pyx_v_seed; - __pyx_t_1 = __pyx_f_9metrohash_metrohash128(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __pyx_f_9metrohash_metrohash128(__pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2294,7 +2288,7 @@ static PyObject *__pyx_pf_9metrohash_2metrohash128(CYTHON_UNUSED PyObject *__pyx return __pyx_r; } -/* "metrohash.pyx":140 +/* "metrohash.pyx":139 * cdef CCMetroHash64* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -2333,7 +2327,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, 140, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 139, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2344,14 +2338,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, 140, __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, 139, __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, 140, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash64.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2373,7 +2367,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "metrohash.pyx":141 + /* "metrohash.pyx":140 * * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash64(seed) # <<<<<<<<<<<<<< @@ -2382,7 +2376,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha */ __pyx_v_self->_m = new MetroHash64(__pyx_v_seed); - /* "metrohash.pyx":142 + /* "metrohash.pyx":141 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash64(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -2392,16 +2386,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":143 + /* "metrohash.pyx":142 * self._m = new CCMetroHash64(seed) * if self._m is NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); __PYX_ERR(0, 143, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 142, __pyx_L1_error) - /* "metrohash.pyx":142 + /* "metrohash.pyx":141 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash64(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -2410,7 +2404,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha */ } - /* "metrohash.pyx":140 + /* "metrohash.pyx":139 * cdef CCMetroHash64* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -2429,7 +2423,7 @@ static int __pyx_pf_9metrohash_11MetroHash64___cinit__(struct __pyx_obj_9metroha return __pyx_r; } -/* "metrohash.pyx":145 +/* "metrohash.pyx":144 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2453,7 +2447,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "metrohash.pyx":146 + /* "metrohash.pyx":145 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -2463,7 +2457,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":147 + /* "metrohash.pyx":146 * def __dealloc__(self): * if not self._m is NULL: * del self._m # <<<<<<<<<<<<<< @@ -2472,7 +2466,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met */ delete __pyx_v_self->_m; - /* "metrohash.pyx":148 + /* "metrohash.pyx":147 * if not self._m is NULL: * del self._m * self._m = NULL # <<<<<<<<<<<<<< @@ -2481,7 +2475,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met */ __pyx_v_self->_m = NULL; - /* "metrohash.pyx":146 + /* "metrohash.pyx":145 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -2490,7 +2484,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met */ } - /* "metrohash.pyx":145 + /* "metrohash.pyx":144 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2502,7 +2496,7 @@ static void __pyx_pf_9metrohash_11MetroHash64_2__dealloc__(struct __pyx_obj_9met __Pyx_RefNannyFinishContext(); } -/* "metrohash.pyx":150 +/* "metrohash.pyx":149 * self._m = NULL * * def initialize(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -2541,7 +2535,7 @@ static PyObject *__pyx_pw_9metrohash_11MetroHash64_5initialize(PyObject *__pyx_v } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize") < 0)) __PYX_ERR(0, 150, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize") < 0)) __PYX_ERR(0, 149, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2552,14 +2546,14 @@ static PyObject *__pyx_pw_9metrohash_11MetroHash64_5initialize(PyObject *__pyx_v } } 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, 150, __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, 149, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("initialize", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 150, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("initialize", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 149, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash64.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2577,7 +2571,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_4initialize(struct __pyx_obj_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("initialize", 0); - /* "metrohash.pyx":151 + /* "metrohash.pyx":150 * * def initialize(self, uint64 seed=0ULL): * self._m.Initialize(seed) # <<<<<<<<<<<<<< @@ -2586,7 +2580,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_4initialize(struct __pyx_obj_ */ __pyx_v_self->_m->Initialize(__pyx_v_seed); - /* "metrohash.pyx":150 + /* "metrohash.pyx":149 * self._m = NULL * * def initialize(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -2601,7 +2595,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_4initialize(struct __pyx_obj_ return __pyx_r; } -/* "metrohash.pyx":153 +/* "metrohash.pyx":152 * self._m.Initialize(seed) * * def update(self, data): # <<<<<<<<<<<<<< @@ -2636,7 +2630,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update", 0); - /* "metrohash.pyx":156 + /* "metrohash.pyx":155 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -2646,28 +2640,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":157 + /* "metrohash.pyx":156 * 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, 157, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":158 + /* "metrohash.pyx":157 * 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, 158, __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, 157, __pyx_L1_error) - /* "metrohash.pyx":159 + /* "metrohash.pyx":158 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -2676,7 +2670,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":160 + /* "metrohash.pyx":159 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2685,7 +2679,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":156 + /* "metrohash.pyx":155 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -2695,7 +2689,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met goto __pyx_L3; } - /* "metrohash.pyx":161 + /* "metrohash.pyx":160 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2705,7 +2699,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":162 + /* "metrohash.pyx":161 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * self._m.Update(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -2714,7 +2708,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":161 + /* "metrohash.pyx":160 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -2724,7 +2718,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met goto __pyx_L3; } - /* "metrohash.pyx":164 + /* "metrohash.pyx":163 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2734,16 +2728,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":165 + /* "metrohash.pyx":164 * 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, 165, __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, 164, __pyx_L1_error) - /* "metrohash.pyx":166 + /* "metrohash.pyx":165 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -2752,7 +2746,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":167 + /* "metrohash.pyx":166 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -2761,7 +2755,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":164 + /* "metrohash.pyx":163 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -2771,7 +2765,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met goto __pyx_L3; } - /* "metrohash.pyx":169 + /* "metrohash.pyx":168 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -2779,7 +2773,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met * def intdigest(self): */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_basestring); __Pyx_GIVEREF(__pyx_n_u_basestring); @@ -2787,16 +2781,16 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met __Pyx_INCREF(__pyx_n_u_buffer); __Pyx_GIVEREF(__pyx_n_u_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __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, 169, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":153 + /* "metrohash.pyx":152 * self._m.Initialize(seed) * * def update(self, data): # <<<<<<<<<<<<<< @@ -2819,7 +2813,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_6update(struct __pyx_obj_9met return __pyx_r; } -/* "metrohash.pyx":171 +/* "metrohash.pyx":170 * raise _type_error("data", ["basestring", "buffer"], data) * * def intdigest(self): # <<<<<<<<<<<<<< @@ -2850,7 +2844,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_8intdigest(struct __pyx_obj_9 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intdigest", 0); - /* "metrohash.pyx":173 + /* "metrohash.pyx":172 * def intdigest(self): * cdef uint8 buf[8] * self._m.Finalize(buf) # <<<<<<<<<<<<<< @@ -2859,7 +2853,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_8intdigest(struct __pyx_obj_9 */ __pyx_v_self->_m->Finalize(__pyx_v_buf); - /* "metrohash.pyx":174 + /* "metrohash.pyx":173 * cdef uint8 buf[8] * self._m.Finalize(buf) * return c_bytes2int64(buf) # <<<<<<<<<<<<<< @@ -2867,13 +2861,13 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_8intdigest(struct __pyx_obj_9 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint64_t(bytes2int64(__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(bytes2int64(__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "metrohash.pyx":171 + /* "metrohash.pyx":170 * raise _type_error("data", ["basestring", "buffer"], data) * * def intdigest(self): # <<<<<<<<<<<<<< @@ -3005,7 +2999,7 @@ static PyObject *__pyx_pf_9metrohash_11MetroHash64_12__setstate_cython__(CYTHON_ return __pyx_r; } -/* "metrohash.pyx":184 +/* "metrohash.pyx":183 * cdef CCMetroHash128* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -3044,7 +3038,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, 184, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 183, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3055,14 +3049,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, 184, __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, 183, __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, 184, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 183, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash128.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3084,7 +3078,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "metrohash.pyx":185 + /* "metrohash.pyx":184 * * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash128(seed) # <<<<<<<<<<<<<< @@ -3093,7 +3087,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh */ __pyx_v_self->_m = new MetroHash128(__pyx_v_seed); - /* "metrohash.pyx":186 + /* "metrohash.pyx":185 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash128(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -3103,16 +3097,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":187 + /* "metrohash.pyx":186 * self._m = new CCMetroHash128(seed) * if self._m is NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); __PYX_ERR(0, 187, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 186, __pyx_L1_error) - /* "metrohash.pyx":186 + /* "metrohash.pyx":185 * def __cinit__(self, uint64 seed=0ULL): * self._m = new CCMetroHash128(seed) * if self._m is NULL: # <<<<<<<<<<<<<< @@ -3121,7 +3115,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh */ } - /* "metrohash.pyx":184 + /* "metrohash.pyx":183 * cdef CCMetroHash128* _m * * def __cinit__(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -3140,7 +3134,7 @@ static int __pyx_pf_9metrohash_12MetroHash128___cinit__(struct __pyx_obj_9metroh return __pyx_r; } -/* "metrohash.pyx":189 +/* "metrohash.pyx":188 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3164,7 +3158,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "metrohash.pyx":190 + /* "metrohash.pyx":189 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -3174,7 +3168,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":191 + /* "metrohash.pyx":190 * def __dealloc__(self): * if not self._m is NULL: * del self._m # <<<<<<<<<<<<<< @@ -3183,7 +3177,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me */ delete __pyx_v_self->_m; - /* "metrohash.pyx":192 + /* "metrohash.pyx":191 * if not self._m is NULL: * del self._m * self._m = NULL # <<<<<<<<<<<<<< @@ -3192,7 +3186,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me */ __pyx_v_self->_m = NULL; - /* "metrohash.pyx":190 + /* "metrohash.pyx":189 * * def __dealloc__(self): * if not self._m is NULL: # <<<<<<<<<<<<<< @@ -3201,7 +3195,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me */ } - /* "metrohash.pyx":189 + /* "metrohash.pyx":188 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3213,7 +3207,7 @@ static void __pyx_pf_9metrohash_12MetroHash128_2__dealloc__(struct __pyx_obj_9me __Pyx_RefNannyFinishContext(); } -/* "metrohash.pyx":194 +/* "metrohash.pyx":193 * self._m = NULL * * def initialize(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -3252,7 +3246,7 @@ static PyObject *__pyx_pw_9metrohash_12MetroHash128_5initialize(PyObject *__pyx_ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize") < 0)) __PYX_ERR(0, 194, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize") < 0)) __PYX_ERR(0, 193, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3263,14 +3257,14 @@ static PyObject *__pyx_pw_9metrohash_12MetroHash128_5initialize(PyObject *__pyx_ } } 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, 194, __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, 193, __pyx_L3_error) } else { __pyx_v_seed = ((uint64)0ULL); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("initialize", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 194, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("initialize", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 193, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("metrohash.MetroHash128.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3288,7 +3282,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_4initialize(struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("initialize", 0); - /* "metrohash.pyx":195 + /* "metrohash.pyx":194 * * def initialize(self, uint64 seed=0ULL): * self._m.Initialize(seed) # <<<<<<<<<<<<<< @@ -3297,7 +3291,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_4initialize(struct __pyx_obj */ __pyx_v_self->_m->Initialize(__pyx_v_seed); - /* "metrohash.pyx":194 + /* "metrohash.pyx":193 * self._m = NULL * * def initialize(self, uint64 seed=0ULL): # <<<<<<<<<<<<<< @@ -3312,7 +3306,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_4initialize(struct __pyx_obj return __pyx_r; } -/* "metrohash.pyx":197 +/* "metrohash.pyx":196 * self._m.Initialize(seed) * * def update(self, data): # <<<<<<<<<<<<<< @@ -3347,7 +3341,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update", 0); - /* "metrohash.pyx":200 + /* "metrohash.pyx":199 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -3357,28 +3351,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":201 + /* "metrohash.pyx":200 * 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, 201, __pyx_L1_error) + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":202 + /* "metrohash.pyx":201 * 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, 202, __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, 201, __pyx_L1_error) - /* "metrohash.pyx":203 + /* "metrohash.pyx":202 * obj = PyUnicode_AsUTF8String(data) * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -3387,7 +3381,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":204 + /* "metrohash.pyx":203 * PyObject_GetBuffer(obj, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3396,7 +3390,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":200 + /* "metrohash.pyx":199 * cdef Py_buffer buf * cdef bytes obj * if PyUnicode_Check(data): # <<<<<<<<<<<<<< @@ -3406,7 +3400,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me goto __pyx_L3; } - /* "metrohash.pyx":205 + /* "metrohash.pyx":204 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3416,7 +3410,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":206 + /* "metrohash.pyx":205 * PyBuffer_Release(&buf) * elif PyBytes_Check(data): * self._m.Update(PyBytes_AS_STRING(data), # <<<<<<<<<<<<<< @@ -3425,7 +3419,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":205 + /* "metrohash.pyx":204 * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) * elif PyBytes_Check(data): # <<<<<<<<<<<<<< @@ -3435,7 +3429,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me goto __pyx_L3; } - /* "metrohash.pyx":208 + /* "metrohash.pyx":207 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3445,16 +3439,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":209 + /* "metrohash.pyx":208 * 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, 209, __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, 208, __pyx_L1_error) - /* "metrohash.pyx":210 + /* "metrohash.pyx":209 * elif PyObject_CheckBuffer(data): * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) # <<<<<<<<<<<<<< @@ -3463,7 +3457,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":211 + /* "metrohash.pyx":210 * PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE) * self._m.Update(buf.buf, buf.len) * PyBuffer_Release(&buf) # <<<<<<<<<<<<<< @@ -3472,7 +3466,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me */ PyBuffer_Release((&__pyx_v_buf)); - /* "metrohash.pyx":208 + /* "metrohash.pyx":207 * self._m.Update(PyBytes_AS_STRING(data), * PyBytes_GET_SIZE(data)) * elif PyObject_CheckBuffer(data): # <<<<<<<<<<<<<< @@ -3482,7 +3476,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me goto __pyx_L3; } - /* "metrohash.pyx":213 + /* "metrohash.pyx":212 * PyBuffer_Release(&buf) * else: * raise _type_error("data", ["basestring", "buffer"], data) # <<<<<<<<<<<<<< @@ -3490,7 +3484,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me * def intdigest(self): */ /*else*/ { - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_basestring); __Pyx_GIVEREF(__pyx_n_u_basestring); @@ -3498,16 +3492,16 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me __Pyx_INCREF(__pyx_n_u_buffer); __Pyx_GIVEREF(__pyx_n_u_buffer); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_buffer); - __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_4 = __pyx_f_9metrohash__type_error(__pyx_n_u_data, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __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, 213, __pyx_L1_error) + __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_L3:; - /* "metrohash.pyx":197 + /* "metrohash.pyx":196 * self._m.Initialize(seed) * * def update(self, data): # <<<<<<<<<<<<<< @@ -3530,7 +3524,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_6update(struct __pyx_obj_9me return __pyx_r; } -/* "metrohash.pyx":215 +/* "metrohash.pyx":214 * raise _type_error("data", ["basestring", "buffer"], data) * * def intdigest(self): # <<<<<<<<<<<<<< @@ -3564,7 +3558,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_8intdigest(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intdigest", 0); - /* "metrohash.pyx":217 + /* "metrohash.pyx":216 * def intdigest(self): * cdef uint8 buf[16] * self._m.Finalize(buf) # <<<<<<<<<<<<<< @@ -3573,7 +3567,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_8intdigest(struct __pyx_obj_ */ __pyx_v_self->_m->Finalize(__pyx_v_buf); - /* "metrohash.pyx":218 + /* "metrohash.pyx":217 * cdef uint8 buf[16] * self._m.Finalize(buf) * cdef pair[uint64, uint64] result = c_bytes2int128(buf) # <<<<<<<<<<<<<< @@ -3581,26 +3575,26 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_8intdigest(struct __pyx_obj_ */ __pyx_v_result = bytes2int128(__pyx_v_buf); - /* "metrohash.pyx":219 + /* "metrohash.pyx":218 * self._m.Finalize(buf) * cdef pair[uint64, uint64] 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, 219, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __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, 219, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __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, 219, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_int_18446744073709551616L, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __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, 219, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_result.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __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, 219, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __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, 219, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __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; @@ -3608,7 +3602,7 @@ static PyObject *__pyx_pf_9metrohash_12MetroHash128_8intdigest(struct __pyx_obj_ __pyx_t_2 = 0; goto __pyx_L0; - /* "metrohash.pyx":215 + /* "metrohash.pyx":214 * raise _type_error("data", ["basestring", "buffer"], data) * * def intdigest(self): # <<<<<<<<<<<<<< @@ -4017,7 +4011,7 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, - {&__pyx_kp_u_0_1_0, __pyx_k_0_1_0, sizeof(__pyx_k_0_1_0), 0, 1, 0, 0}, + {&__pyx_kp_u_0_1_0_post0, __pyx_k_0_1_0_post0, sizeof(__pyx_k_0_1_0_post0), 0, 1, 0, 0}, {&__pyx_kp_u_Argument, __pyx_k_Argument, sizeof(__pyx_k_Argument), 0, 1, 0, 0}, {&__pyx_kp_u_Eugene_Scherba, __pyx_k_Eugene_Scherba, sizeof(__pyx_k_Eugene_Scherba), 0, 1, 0, 0}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, @@ -4025,14 +4019,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_u_MetroHash128, __pyx_k_MetroHash128, sizeof(__pyx_k_MetroHash128), 0, 1, 0, 1}, {&__pyx_n_s_MetroHash64, __pyx_k_MetroHash64, sizeof(__pyx_k_MetroHash64), 0, 0, 1, 1}, {&__pyx_n_u_MetroHash64, __pyx_k_MetroHash64, sizeof(__pyx_k_MetroHash64), 0, 1, 0, 1}, + {&__pyx_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0, 0}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, {&__pyx_n_s_author, __pyx_k_author, sizeof(__pyx_k_author), 0, 0, 1, 1}, - {&__pyx_n_s_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 0, 0, 1, 1}, {&__pyx_n_u_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 0, 1, 0, 1}, {&__pyx_n_u_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 1, 0, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_cython, __pyx_k_cython, sizeof(__pyx_k_cython), 0, 0, 1, 1}, {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, {&__pyx_n_u_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 1, 0, 1}, {&__pyx_n_s_email, __pyx_k_email, sizeof(__pyx_k_email), 0, 0, 1, 1}, @@ -4040,7 +4033,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, {&__pyx_kp_u_has_incorrect_type_expected, __pyx_k_has_incorrect_type_expected, sizeof(__pyx_k_has_incorrect_type_expected), 0, 1, 0, 0}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_u_metrohash128, __pyx_k_metrohash128, sizeof(__pyx_k_metrohash128), 0, 1, 0, 1}, {&__pyx_n_u_metrohash64, __pyx_k_metrohash64, sizeof(__pyx_k_metrohash64), 0, 1, 0, 1}, @@ -4057,8 +4049,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, 80, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 142, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -4159,25 +4151,25 @@ static int __Pyx_modinit_type_init_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 133, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 132, __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 (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash64, (PyObject *)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 133, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 133, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash64, (PyObject *)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 132, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash64) < 0) __PYX_ERR(0, 132, __pyx_L1_error) __pyx_ptype_9metrohash_MetroHash64 = &__pyx_type_9metrohash_MetroHash64; - if (PyType_Ready(&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 177, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 176, __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 (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash128, (PyObject *)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 177, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 177, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetroHash128, (PyObject *)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 176, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9metrohash_MetroHash128) < 0) __PYX_ERR(0, 176, __pyx_L1_error) __pyx_ptype_9metrohash_MetroHash128 = &__pyx_type_9metrohash_MetroHash128; __Pyx_RefNannyFinishContext(); return 0; @@ -4334,7 +4326,6 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_metrohash(PyObject *__pyx_pyinit_m #endif { PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4445,7 +4436,7 @@ if (!__Pyx_RefNanny) { * * __author__ = "Eugene Scherba" # <<<<<<<<<<<<<< * __email__ = "escherba+metrohash@gmail.com" - * __version__ = "0.1.0" + * __version__ = "0.1.0.post0" */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_author, __pyx_kp_u_Eugene_Scherba) < 0) __PYX_ERR(0, 9, __pyx_L1_error) @@ -4453,7 +4444,7 @@ if (!__Pyx_RefNanny) { * * __author__ = "Eugene Scherba" * __email__ = "escherba+metrohash@gmail.com" # <<<<<<<<<<<<<< - * __version__ = "0.1.0" + * __version__ = "0.1.0.post0" * __all__ = [ */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_email, __pyx_kp_u_escherba_metrohash_gmail_com) < 0) __PYX_ERR(0, 10, __pyx_L1_error) @@ -4461,15 +4452,15 @@ if (!__Pyx_RefNanny) { /* "metrohash.pyx":11 * __author__ = "Eugene Scherba" * __email__ = "escherba+metrohash@gmail.com" - * __version__ = "0.1.0" # <<<<<<<<<<<<<< + * __version__ = "0.1.0.post0" # <<<<<<<<<<<<<< * __all__ = [ * "metrohash64", */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_u_0_1_0) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_u_0_1_0_post0) < 0) __PYX_ERR(0, 11, __pyx_L1_error) /* "metrohash.pyx":12 * __email__ = "escherba+metrohash@gmail.com" - * __version__ = "0.1.0" + * __version__ = "0.1.0.post0" * __all__ = [ # <<<<<<<<<<<<<< * "metrohash64", * "metrohash128", @@ -4491,43 +4482,21 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "metrohash.pyx":64 - * - * from cpython cimport long - * from cython import basestring # <<<<<<<<<<<<<< - * - * from cpython.buffer cimport PyObject_CheckBuffer - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_basestring); - __Pyx_GIVEREF(__pyx_n_s_basestring); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_basestring); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_cython, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_basestring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_basestring, __pyx_t_1) < 0) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "metrohash.pyx":1 * #cython: infer_types=True # <<<<<<<<<<<<<< * #cython: language_level=3 * #distutils: language=c++ */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init metrohash", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4593,6 +4562,13 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* PyUnicode_Unicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { + if (unlikely(obj == Py_None)) + obj = __pyx_kp_u_None; + return __Pyx_NewRef(obj); +} + /* PyObjectFormatAndDecref */ static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { if (unlikely(!s)) return NULL; @@ -5463,85 +5439,6 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, } #endif -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { diff --git a/src/metrohash.pyx b/src/metrohash.pyx index 7658623..a532163 100644 --- a/src/metrohash.pyx +++ b/src/metrohash.pyx @@ -8,7 +8,7 @@ Python wrapper for MetroHash, a fast non-cryptographic hashing algorithm __author__ = "Eugene Scherba" __email__ = "escherba+metrohash@gmail.com" -__version__ = "0.1.0" +__version__ = "0.1.0.post0" __all__ = [ "metrohash64", "metrohash128", @@ -61,7 +61,6 @@ cdef extern from "metro.h" nogil: void Finalize(uint8* const result) from cpython cimport long -from cython import basestring from cpython.buffer cimport PyObject_CheckBuffer from cpython.buffer cimport PyBUF_SIMPLE @@ -76,7 +75,7 @@ from cpython.bytes cimport PyBytes_GET_SIZE from cpython.bytes cimport PyBytes_AS_STRING -cdef object _type_error(argname: basestring, expected: object, value: object): +cdef object _type_error(argname: str, expected: object, value: object): return TypeError( "Argument '%s' has incorrect type (expected %s, got %s)" % (argname, expected, type(value))