1 /* Generated by Cython 3.0.0a9 */
2
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #if defined(CYTHON_LIMITED_API) && 0
7 #ifndef Py_LIMITED_API
8 #if CYTHON_LIMITED_API+0 > 0x03030000
9 #define Py_LIMITED_API CYTHON_LIMITED_API
10 #else
11 #define Py_LIMITED_API 0x03030000
12 #endif
13 #endif
14 #endif
15
16 #include "Python.h"
17 #ifndef Py_PYTHON_H
18 #error Python headers needed to compile C extensions, please install development version of Python.
19 #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
20 #error Cython requires Python 2.7+ or Python 3.3+.
21 #else
22 #define CYTHON_ABI "3_0_0a9"
23 #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
24 #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
25 #define CYTHON_HEX_VERSION 0x030000A9
26 #define CYTHON_FUTURE_DIVISION 1
27 #include <stddef.h>
28 #ifndef offsetof
29 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
30 #endif
31 #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
32 #ifndef __stdcall
33 #define __stdcall
34 #endif
35 #ifndef __cdecl
36 #define __cdecl
37 #endif
38 #ifndef __fastcall
39 #define __fastcall
40 #endif
41 #endif
42 #ifndef DL_IMPORT
43 #define DL_IMPORT(t) t
44 #endif
45 #ifndef DL_EXPORT
46 #define DL_EXPORT(t) t
47 #endif
48 #define __PYX_COMMA ,
49 #ifndef HAVE_LONG_LONG
50 #define HAVE_LONG_LONG
51 #endif
52 #ifndef PY_LONG_LONG
53 #define PY_LONG_LONG LONG_LONG
54 #endif
55 #ifndef Py_HUGE_VAL
56 #define Py_HUGE_VAL HUGE_VAL
57 #endif
58 #ifdef PYPY_VERSION
59 #define CYTHON_COMPILING_IN_PYPY 1
60 #define CYTHON_COMPILING_IN_CPYTHON 0
61 #define CYTHON_COMPILING_IN_LIMITED_API 0
62 #undef CYTHON_USE_TYPE_SLOTS
63 #define CYTHON_USE_TYPE_SLOTS 0
64 #undef CYTHON_USE_TYPE_SPECS
65 #define CYTHON_USE_TYPE_SPECS 0
66 #undef CYTHON_USE_PYTYPE_LOOKUP
67 #define CYTHON_USE_PYTYPE_LOOKUP 0
68 #if PY_VERSION_HEX < 0x03050000
69 #undef CYTHON_USE_ASYNC_SLOTS
70 #define CYTHON_USE_ASYNC_SLOTS 0
71 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
72 #define CYTHON_USE_ASYNC_SLOTS 1
73 #endif
74 #undef CYTHON_USE_PYLIST_INTERNALS
75 #define CYTHON_USE_PYLIST_INTERNALS 0
76 #undef CYTHON_USE_UNICODE_INTERNALS
77 #define CYTHON_USE_UNICODE_INTERNALS 0
78 #undef CYTHON_USE_UNICODE_WRITER
79 #define CYTHON_USE_UNICODE_WRITER 0
80 #undef CYTHON_USE_PYLONG_INTERNALS
81 #define CYTHON_USE_PYLONG_INTERNALS 0
82 #undef CYTHON_AVOID_BORROWED_REFS
83 #define CYTHON_AVOID_BORROWED_REFS 1
84 #undef CYTHON_ASSUME_SAFE_MACROS
85 #define CYTHON_ASSUME_SAFE_MACROS 0
86 #undef CYTHON_UNPACK_METHODS
87 #define CYTHON_UNPACK_METHODS 0
88 #undef CYTHON_FAST_THREAD_STATE
89 #define CYTHON_FAST_THREAD_STATE 0
90 #undef CYTHON_FAST_GIL
91 #define CYTHON_FAST_GIL 0
92 #undef CYTHON_METH_FASTCALL
93 #define CYTHON_METH_FASTCALL 0
94 #undef CYTHON_FAST_PYCALL
95 #define CYTHON_FAST_PYCALL 0
96 #ifndef CYTHON_PEP487_INIT_SUBCLASS
97 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
98 #endif
99 #undef CYTHON_PEP489_MULTI_PHASE_INIT
100 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
101 #undef CYTHON_USE_MODULE_STATE
102 #define CYTHON_USE_MODULE_STATE 0
103 #undef CYTHON_USE_TP_FINALIZE
104 #define CYTHON_USE_TP_FINALIZE 0
105 #undef CYTHON_USE_DICT_VERSIONS
106 #define CYTHON_USE_DICT_VERSIONS 0
107 #undef CYTHON_USE_EXC_INFO_STACK
108 #define CYTHON_USE_EXC_INFO_STACK 0
109 #elif defined(CYTHON_LIMITED_API)
110 #define CYTHON_COMPILING_IN_PYPY 0
111 #define CYTHON_COMPILING_IN_CPYTHON 0
112 #define CYTHON_COMPILING_IN_LIMITED_API 1
113 #undef CYTHON_USE_TYPE_SLOTS
114 #define CYTHON_USE_TYPE_SLOTS 0
115 #undef CYTHON_USE_TYPE_SPECS
116 #define CYTHON_USE_TYPE_SPECS 1
117 #undef CYTHON_USE_PYTYPE_LOOKUP
118 #define CYTHON_USE_PYTYPE_LOOKUP 0
119 #undef CYTHON_USE_ASYNC_SLOTS
120 #define CYTHON_USE_ASYNC_SLOTS 0
121 #undef CYTHON_USE_PYLIST_INTERNALS
122 #define CYTHON_USE_PYLIST_INTERNALS 0
123 #undef CYTHON_USE_UNICODE_INTERNALS
124 #define CYTHON_USE_UNICODE_INTERNALS 0
125 #ifndef CYTHON_USE_UNICODE_WRITER
126 #define CYTHON_USE_UNICODE_WRITER 1
127 #endif
128 #undef CYTHON_USE_PYLONG_INTERNALS
129 #define CYTHON_USE_PYLONG_INTERNALS 0
130 #ifndef CYTHON_AVOID_BORROWED_REFS
131 #define CYTHON_AVOID_BORROWED_REFS 0
132 #endif
133 #undef CYTHON_ASSUME_SAFE_MACROS
134 #define CYTHON_ASSUME_SAFE_MACROS 0
135 #undef CYTHON_UNPACK_METHODS
136 #define CYTHON_UNPACK_METHODS 0
137 #undef CYTHON_FAST_THREAD_STATE
138 #define CYTHON_FAST_THREAD_STATE 0
139 #undef CYTHON_FAST_GIL
140 #define CYTHON_FAST_GIL 0
141 #undef CYTHON_METH_FASTCALL
142 #define CYTHON_METH_FASTCALL 0
143 #undef CYTHON_FAST_PYCALL
144 #define CYTHON_FAST_PYCALL 0
145 #ifndef CYTHON_PEP487_INIT_SUBCLASS
146 #define CYTHON_PEP487_INIT_SUBCLASS 1
147 #endif
148 #undef CYTHON_PEP489_MULTI_PHASE_INIT
149 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
150 #undef CYTHON_USE_MODULE_STATE
151 #define CYTHON_USE_MODULE_STATE 1
152 #ifndef CYTHON_USE_TP_FINALIZE
153 #define CYTHON_USE_TP_FINALIZE 1
154 #endif
155 #undef CYTHON_USE_DICT_VERSIONS
156 #define CYTHON_USE_DICT_VERSIONS 0
157 #undef CYTHON_USE_EXC_INFO_STACK
158 #define CYTHON_USE_EXC_INFO_STACK 0
159 #else
160 #define CYTHON_COMPILING_IN_PYPY 0
161 #define CYTHON_COMPILING_IN_CPYTHON 1
162 #define CYTHON_COMPILING_IN_LIMITED_API 0
163 #ifndef CYTHON_USE_TYPE_SLOTS
164 #define CYTHON_USE_TYPE_SLOTS 1
165 #endif
166 #ifndef CYTHON_USE_TYPE_SPECS
167 #define CYTHON_USE_TYPE_SPECS 0
168 #endif
169 #ifndef CYTHON_USE_PYTYPE_LOOKUP
170 #define CYTHON_USE_PYTYPE_LOOKUP 1
171 #endif
172 #if PY_MAJOR_VERSION < 3
173 #undef CYTHON_USE_ASYNC_SLOTS
174 #define CYTHON_USE_ASYNC_SLOTS 0
175 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
176 #define CYTHON_USE_ASYNC_SLOTS 1
177 #endif
178 #ifndef CYTHON_USE_PYLONG_INTERNALS
179 #define CYTHON_USE_PYLONG_INTERNALS 1
180 #endif
181 #ifndef CYTHON_USE_PYLIST_INTERNALS
182 #define CYTHON_USE_PYLIST_INTERNALS 1
183 #endif
184 #ifndef CYTHON_USE_UNICODE_INTERNALS
185 #define CYTHON_USE_UNICODE_INTERNALS 1
186 #endif
187 #if PY_VERSION_HEX < 0x030300F0
188 #undef CYTHON_USE_UNICODE_WRITER
189 #define CYTHON_USE_UNICODE_WRITER 0
190 #elif !defined(CYTHON_USE_UNICODE_WRITER)
191 #define CYTHON_USE_UNICODE_WRITER 1
192 #endif
193 #ifndef CYTHON_AVOID_BORROWED_REFS
194 #define CYTHON_AVOID_BORROWED_REFS 0
195 #endif
196 #ifndef CYTHON_ASSUME_SAFE_MACROS
197 #define CYTHON_ASSUME_SAFE_MACROS 1
198 #endif
199 #ifndef CYTHON_UNPACK_METHODS
200 #define CYTHON_UNPACK_METHODS 1
201 #endif
202 #ifndef CYTHON_FAST_THREAD_STATE
203 #define CYTHON_FAST_THREAD_STATE 1
204 #endif
205 #ifndef CYTHON_FAST_GIL
206 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000)
207 #endif
208 #ifndef CYTHON_METH_FASTCALL
209 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
210 #endif
211 #ifndef CYTHON_FAST_PYCALL
212 #define CYTHON_FAST_PYCALL 1
213 #endif
214 #ifndef CYTHON_PEP487_INIT_SUBCLASS
215 #define CYTHON_PEP487_INIT_SUBCLASS 1
216 #endif
217 #if PY_VERSION_HEX < 0x03050000
218 #undef CYTHON_PEP489_MULTI_PHASE_INIT
219 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
220 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
221 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
222 #endif
223 #ifndef CYTHON_USE_MODULE_STATE
224 #define CYTHON_USE_MODULE_STATE 0
225 #endif
226 #if PY_VERSION_HEX < 0x030400a1
227 #undef CYTHON_USE_TP_FINALIZE
228 #define CYTHON_USE_TP_FINALIZE 0
229 #elif !defined(CYTHON_USE_TP_FINALIZE)
230 #define CYTHON_USE_TP_FINALIZE 1
231 #endif
232 #if PY_VERSION_HEX < 0x030600B1
233 #undef CYTHON_USE_DICT_VERSIONS
234 #define CYTHON_USE_DICT_VERSIONS 0
235 #elif !defined(CYTHON_USE_DICT_VERSIONS)
236 #define CYTHON_USE_DICT_VERSIONS 1
237 #endif
238 #if PY_VERSION_HEX < 0x030700A3
239 #undef CYTHON_USE_EXC_INFO_STACK
240 #define CYTHON_USE_EXC_INFO_STACK 0
241 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
242 #define CYTHON_USE_EXC_INFO_STACK 1
243 #endif
244 #endif
245 #if !defined(CYTHON_FAST_PYCCALL)
246 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
247 #endif
248 #if !defined(CYTHON_VECTORCALL)
249 #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
250 #endif
251 #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
252 #if CYTHON_USE_PYLONG_INTERNALS
253 #include "longintrepr.h"
254 #undef SHIFT
255 #undef BASE
256 #undef MASK
257 #ifdef SIZEOF_VOID_P
258 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
259 #endif
260 #endif
261 #ifndef __has_attribute
262 #define __has_attribute(x) 0
263 #endif
264 #ifndef __has_cpp_attribute
265 #define __has_cpp_attribute(x) 0
266 #endif
267 #ifndef CYTHON_RESTRICT
268 #if defined(__GNUC__)
269 #define CYTHON_RESTRICT __restrict__
270 #elif defined(_MSC_VER) && _MSC_VER >= 1400
271 #define CYTHON_RESTRICT __restrict
272 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
273 #define CYTHON_RESTRICT restrict
274 #else
275 #define CYTHON_RESTRICT
276 #endif
277 #endif
278 #ifndef CYTHON_UNUSED
279 # if defined(__GNUC__)
280 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
281 # define CYTHON_UNUSED __attribute__ ((__unused__))
282 # else
283 # define CYTHON_UNUSED
284 # endif
285 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
286 # define CYTHON_UNUSED __attribute__ ((__unused__))
287 # else
288 # define CYTHON_UNUSED
289 # endif
290 #endif
291 #ifndef CYTHON_UNUSED_VAR
292 # if defined(__cplusplus)
CYTHON_UNUSED_VAR(const T &)293 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
294 # else
295 # define CYTHON_UNUSED_VAR(x) (void)(x)
296 # endif
297 #endif
298 #ifndef CYTHON_MAYBE_UNUSED_VAR
299 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
300 #endif
301 #ifndef CYTHON_NCP_UNUSED
302 # if CYTHON_COMPILING_IN_CPYTHON
303 # define CYTHON_NCP_UNUSED
304 # else
305 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
306 # endif
307 #endif
308 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
309 #ifdef _MSC_VER
310 #ifndef _MSC_STDINT_H_
311 #if _MSC_VER < 1300
312 typedef unsigned char uint8_t;
313 typedef unsigned short uint16_t;
314 typedef unsigned int uint32_t;
315 #else
316 typedef unsigned __int8 uint8_t;
317 typedef unsigned __int16 uint16_t;
318 typedef unsigned __int32 uint32_t;
319 #endif
320 #endif
321 #if _MSC_VER < 1300
322 #ifdef _WIN64
323 typedef unsigned long long __pyx_uintptr_t;
324 #else
325 typedef unsigned int __pyx_uintptr_t;
326 #endif
327 #else
328 #ifdef _WIN64
329 typedef unsigned __int64 __pyx_uintptr_t;
330 #else
331 typedef unsigned __int32 __pyx_uintptr_t;
332 #endif
333 #endif
334 #else
335 #include <stdint.h>
336 typedef uintptr_t __pyx_uintptr_t;
337 #endif
338 #ifndef CYTHON_FALLTHROUGH
339 #if defined(__cplusplus) && __cplusplus >= 201103L
340 #if __has_cpp_attribute(fallthrough)
341 #define CYTHON_FALLTHROUGH [[fallthrough]]
342 #elif __has_cpp_attribute(clang::fallthrough)
343 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
344 #elif __has_cpp_attribute(gnu::fallthrough)
345 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
346 #endif
347 #endif
348 #ifndef CYTHON_FALLTHROUGH
349 #if __has_attribute(fallthrough)
350 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
351 #else
352 #define CYTHON_FALLTHROUGH
353 #endif
354 #endif
355 #if defined(__clang__ ) && defined(__apple_build_version__)
356 #if __apple_build_version__ < 7000000
357 #undef CYTHON_FALLTHROUGH
358 #define CYTHON_FALLTHROUGH
359 #endif
360 #endif
361 #endif
362
363 #ifndef __cplusplus
364 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
365 #endif
366 #ifndef CYTHON_INLINE
367 #if defined(__clang__)
368 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
369 #else
370 #define CYTHON_INLINE inline
371 #endif
372 #endif
373 template<typename T>
__Pyx_call_destructor(T & x)374 void __Pyx_call_destructor(T& x) {
375 x.~T();
376 }
377 template<typename T>
378 class __Pyx_FakeReference {
379 public:
__Pyx_FakeReference()380 __Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T & ref)381 __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
operator ->()382 T *operator->() { return ptr; }
operator &()383 T *operator&() { return ptr; }
operator T&()384 operator T&() { return *ptr; }
operator ==(U other)385 template<typename U> bool operator ==(U other) { return *ptr == other; }
operator !=(U other)386 template<typename U> bool operator !=(U other) { return *ptr != other; }
387 private:
388 T *ptr;
389 };
390
391 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
392 #define Py_OptimizeFlag 0
393 #endif
394 #define __PYX_BUILD_PY_SSIZE_T "n"
395 #define CYTHON_FORMAT_SSIZE_T "z"
396 #if PY_MAJOR_VERSION < 3
397 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
398 #define __Pyx_DefaultClassType PyClass_Type
399 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
400 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
401 #else
402 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
403 #define __Pyx_DefaultClassType PyType_Type
404 #if PY_VERSION_HEX >= 0x030800B2
405 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
406 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
407 #elif PY_VERSION_HEX >= 0x030800A4
408 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
409 PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
410 #else
411 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
412 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
413 #endif
414 #endif
415 #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
416 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
417 #else
418 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
419 #endif
420 #ifndef Py_TPFLAGS_CHECKTYPES
421 #define Py_TPFLAGS_CHECKTYPES 0
422 #endif
423 #ifndef Py_TPFLAGS_HAVE_INDEX
424 #define Py_TPFLAGS_HAVE_INDEX 0
425 #endif
426 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
427 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
428 #endif
429 #ifndef Py_TPFLAGS_HAVE_FINALIZE
430 #define Py_TPFLAGS_HAVE_FINALIZE 0
431 #endif
432 #ifndef METH_STACKLESS
433 #define METH_STACKLESS 0
434 #endif
435 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
436 #ifndef METH_FASTCALL
437 #define METH_FASTCALL 0x80
438 #endif
439 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
440 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
441 Py_ssize_t nargs, PyObject *kwnames);
442 #else
443 #define __Pyx_PyCFunctionFast _PyCFunctionFast
444 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
445 #endif
446 #if CYTHON_METH_FASTCALL
447 #define __Pyx_METH_FASTCALL METH_FASTCALL
448 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
449 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
450 #else
451 #define __Pyx_METH_FASTCALL METH_VARARGS
452 #define __Pyx_PyCFunction_FastCall PyCFunction
453 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
454 #endif
455 #if CYTHON_VECTORCALL
456 #define __pyx_vectorcallfunc vectorcallfunc
457 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
458 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
459 #elif CYTHON_BACKPORT_VECTORCALL
460 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
461 size_t nargsf, PyObject *kwnames);
462 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
463 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
464 #else
465 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
466 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
467 #endif
468 #if PY_VERSION_HEX < 0x030900B1
469 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
470 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
471 #else
472 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
473 #define __Pyx_PyCMethod PyCMethod
474 #endif
475 #ifndef METH_METHOD
476 #define METH_METHOD 0x200
477 #endif
478 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
479 #define PyObject_Malloc(s) PyMem_Malloc(s)
480 #define PyObject_Free(p) PyMem_Free(p)
481 #define PyObject_Realloc(p) PyMem_Realloc(p)
482 #endif
483 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
484 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
485 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
486 #define PyMem_RawFree(p) PyMem_Free(p)
487 #endif
488 #if CYTHON_COMPILING_IN_LIMITED_API
489 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
490 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
491 #else
492 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
493 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
494 #endif
495 #if CYTHON_COMPILING_IN_LIMITED_API
496 #define __Pyx_PyThreadState_Current PyThreadState_Get()
497 #elif !CYTHON_FAST_THREAD_STATE
498 #define __Pyx_PyThreadState_Current PyThreadState_GET()
499 #elif PY_VERSION_HEX >= 0x03060000
500 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
501 #elif PY_VERSION_HEX >= 0x03000000
502 #define __Pyx_PyThreadState_Current PyThreadState_GET()
503 #else
504 #define __Pyx_PyThreadState_Current _PyThreadState_Current
505 #endif
506 #if CYTHON_COMPILING_IN_LIMITED_API
__Pyx_PyModule_GetState(PyObject * op)507 static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
508 {
509 void *result;
510 result = PyModule_GetState(op);
511 if (!result)
512 Py_FatalError("Couldn't find the module state");
513 return result;
514 }
515 #endif
516 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
517 #include "pythread.h"
518 #define Py_tss_NEEDS_INIT 0
519 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)520 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
521 *key = PyThread_create_key();
522 return 0;
523 }
PyThread_tss_alloc(void)524 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
525 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
526 *key = Py_tss_NEEDS_INIT;
527 return key;
528 }
PyThread_tss_free(Py_tss_t * key)529 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
530 PyObject_Free(key);
531 }
PyThread_tss_is_created(Py_tss_t * key)532 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
533 return *key != Py_tss_NEEDS_INIT;
534 }
PyThread_tss_delete(Py_tss_t * key)535 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
536 PyThread_delete_key(*key);
537 *key = Py_tss_NEEDS_INIT;
538 }
PyThread_tss_set(Py_tss_t * key,void * value)539 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
540 return PyThread_set_key_value(*key, value);
541 }
PyThread_tss_get(Py_tss_t * key)542 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
543 return PyThread_get_key_value(*key);
544 }
545 #endif
546 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
547 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
548 #else
549 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
550 #endif
551 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
552 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
553 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
554 #else
555 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
556 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
557 #endif
558 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS
559 #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
__Pyx_PyDict_GetItemStr(PyObject * dict,PyObject * name)560 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
561 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
562 if (res == NULL) PyErr_Clear();
563 return res;
564 }
565 #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
566 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
567 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
568 #else
__Pyx_PyDict_GetItemStrWithError(PyObject * dict,PyObject * name)569 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
570 #if CYTHON_COMPILING_IN_PYPY
571 return PyDict_GetItem(dict, name);
572 #else
573 PyDictEntry *ep;
574 PyDictObject *mp = (PyDictObject*) dict;
575 long hash = ((PyStringObject *) name)->ob_shash;
576 assert(hash != -1);
577 ep = (mp->ma_lookup)(mp, name, hash);
578 if (ep == NULL) {
579 return NULL;
580 }
581 return ep->me_value;
582 #endif
583 }
584 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
585 #endif
586 #if CYTHON_USE_TYPE_SLOTS
587 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
588 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
589 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
590 #else
591 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
592 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
593 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
594 #endif
595 #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
596 #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
597 PyTypeObject *type = Py_TYPE(obj);\
598 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
599 PyObject_GC_Del(obj);\
600 Py_DECREF(type);\
601 }
602 #else
603 #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
604 #endif
605 #if CYTHON_COMPILING_IN_LIMITED_API
606 #define CYTHON_PEP393_ENABLED 1
607 #define __Pyx_PyUnicode_READY(op) (0)
608 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
609 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
610 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111)
611 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
612 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
613 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
614 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
615 #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
616 #define CYTHON_PEP393_ENABLED 1
617 #if defined(PyUnicode_IS_READY)
618 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
619 0 : _PyUnicode_Ready((PyObject *)(op)))
620 #else
621 #define __Pyx_PyUnicode_READY(op) (0)
622 #endif
623 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
624 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
625 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
626 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
627 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
628 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
629 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
630 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
631 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
632 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
633 #else
634 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
635 #endif
636 #else
637 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
638 #endif
639 #else
640 #define CYTHON_PEP393_ENABLED 0
641 #define PyUnicode_1BYTE_KIND 1
642 #define PyUnicode_2BYTE_KIND 2
643 #define PyUnicode_4BYTE_KIND 4
644 #define __Pyx_PyUnicode_READY(op) (0)
645 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
646 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
647 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
648 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
649 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
650 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
651 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
652 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
653 #endif
654 #if CYTHON_COMPILING_IN_PYPY
655 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
656 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
657 #else
658 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
659 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
660 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
661 #endif
662 #if CYTHON_COMPILING_IN_PYPY
663 #if !defined(PyUnicode_DecodeUnicodeEscape)
664 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
665 #endif
666 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
667 #undef PyUnicode_Contains
668 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
669 #endif
670 #if !defined(PyByteArray_Check)
671 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
672 #endif
673 #if !defined(PyObject_Format)
674 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
675 #endif
676 #endif
677 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
678 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
679 #if PY_MAJOR_VERSION >= 3
680 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
681 #else
682 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
683 #endif
684 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
685 #define PyObject_ASCII(o) PyObject_Repr(o)
686 #endif
687 #if PY_MAJOR_VERSION >= 3
688 #define PyBaseString_Type PyUnicode_Type
689 #define PyStringObject PyUnicodeObject
690 #define PyString_Type PyUnicode_Type
691 #define PyString_Check PyUnicode_Check
692 #define PyString_CheckExact PyUnicode_CheckExact
693 #ifndef PyObject_Unicode
694 #define PyObject_Unicode PyObject_Str
695 #endif
696 #endif
697 #if PY_MAJOR_VERSION >= 3
698 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
699 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
700 #else
701 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
702 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
703 #endif
704 #if CYTHON_COMPILING_IN_CPYTHON
705 #define __Pyx_PySequence_ListKeepNew(obj)\
706 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
707 #else
708 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
709 #endif
710 #ifndef PySet_CheckExact
711 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
712 #endif
713 #if PY_VERSION_HEX >= 0x030900A4
714 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
715 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
716 #else
717 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
718 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
719 #endif
720 #if CYTHON_ASSUME_SAFE_MACROS
721 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
722 #else
723 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
724 #endif
725 #if PY_MAJOR_VERSION >= 3
726 #define PyIntObject PyLongObject
727 #define PyInt_Type PyLong_Type
728 #define PyInt_Check(op) PyLong_Check(op)
729 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
730 #define PyInt_FromString PyLong_FromString
731 #define PyInt_FromUnicode PyLong_FromUnicode
732 #define PyInt_FromLong PyLong_FromLong
733 #define PyInt_FromSize_t PyLong_FromSize_t
734 #define PyInt_FromSsize_t PyLong_FromSsize_t
735 #define PyInt_AsLong PyLong_AsLong
736 #define PyInt_AS_LONG PyLong_AS_LONG
737 #define PyInt_AsSsize_t PyLong_AsSsize_t
738 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
739 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
740 #define PyNumber_Int PyNumber_Long
741 #endif
742 #if PY_MAJOR_VERSION >= 3
743 #define PyBoolObject PyLongObject
744 #endif
745 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
746 #ifndef PyUnicode_InternFromString
747 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
748 #endif
749 #endif
750 #if PY_VERSION_HEX < 0x030200A4
751 typedef long Py_hash_t;
752 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
753 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
754 #else
755 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
756 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
757 #endif
758 #if CYTHON_USE_ASYNC_SLOTS
759 #if PY_VERSION_HEX >= 0x030500B1
760 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
761 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
762 #else
763 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
764 #endif
765 #else
766 #define __Pyx_PyType_AsAsync(obj) NULL
767 #endif
768 #ifndef __Pyx_PyAsyncMethodsStruct
769 typedef struct {
770 unaryfunc am_await;
771 unaryfunc am_aiter;
772 unaryfunc am_anext;
773 } __Pyx_PyAsyncMethodsStruct;
774 #endif
775
776 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
777 #define _USE_MATH_DEFINES
778 #endif
779 #include <math.h>
780 #ifdef NAN
781 #define __PYX_NAN() ((float) NAN)
782 #else
__PYX_NAN()783 static CYTHON_INLINE float __PYX_NAN() {
784 float value;
785 memset(&value, 0xFF, sizeof(value));
786 return value;
787 }
788 #endif
789 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
790 #define __Pyx_truncl trunc
791 #else
792 #define __Pyx_truncl truncl
793 #endif
794
795 #define __PYX_MARK_ERR_POS(f_index, lineno) \
796 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
797 #define __PYX_ERR(f_index, lineno, Ln_error) \
798 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
799
800 #ifndef __PYX_EXTERN_C
801 #ifdef __cplusplus
802 #define __PYX_EXTERN_C extern "C"
803 #else
804 #define __PYX_EXTERN_C extern
805 #endif
806 #endif
807
808 #define __PYX_HAVE__cpp_process_cdist
809 #define __PYX_HAVE_API__cpp_process_cdist
810 /* Early includes */
811 #include "ios"
812 #include "new"
813 #include "stdexcept"
814 #include "typeinfo"
815 #include <vector>
816 #include <utility>
817
818 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
819 // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
820 #include <type_traits>
821
822 namespace cython_std {
move(T & t)823 template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
move(T && t)824 template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
825 }
826
827 #endif
828
829 #include <stdint.h>
830 #include <math.h>
831 #include <string.h>
832 #include <stdio.h>
833 #include <stdlib.h>
834 #include <stddef.h>
835 #include "cpp_common.hpp"
836
837 /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
838
839 #include "numpy/arrayobject.h"
840 #include "numpy/ndarrayobject.h"
841 #include "numpy/ndarraytypes.h"
842 #include "numpy/arrayscalars.h"
843 #include "numpy/ufuncobject.h"
844 #include "rapidfuzz/details/types.hpp"
845 #include "cpp_process.hpp"
846 #include "cpp_process_cdist.hpp"
847 #ifdef _OPENMP
848 #include <omp.h>
849 #endif /* _OPENMP */
850
851 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
852 #define CYTHON_WITHOUT_ASSERTIONS
853 #endif
854
855 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
856 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
857
858 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
859 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
860 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
861 #define __PYX_DEFAULT_STRING_ENCODING ""
862 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
863 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
864 #define __Pyx_uchar_cast(c) ((unsigned char)c)
865 #define __Pyx_long_cast(x) ((long)x)
866 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
867 (sizeof(type) < sizeof(Py_ssize_t)) ||\
868 (sizeof(type) > sizeof(Py_ssize_t) &&\
869 likely(v < (type)PY_SSIZE_T_MAX ||\
870 v == (type)PY_SSIZE_T_MAX) &&\
871 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
872 v == (type)PY_SSIZE_T_MIN))) ||\
873 (sizeof(type) == sizeof(Py_ssize_t) &&\
874 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
875 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)876 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
877 return (size_t) i < (size_t) limit;
878 }
879 #if defined (__cplusplus) && __cplusplus >= 201103L
880 #include <cstdlib>
881 #define __Pyx_sst_abs(value) std::abs(value)
882 #elif SIZEOF_INT >= SIZEOF_SIZE_T
883 #define __Pyx_sst_abs(value) abs(value)
884 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
885 #define __Pyx_sst_abs(value) labs(value)
886 #elif defined (_MSC_VER)
887 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
888 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
889 #define __Pyx_sst_abs(value) llabs(value)
890 #elif defined (__GNUC__)
891 #define __Pyx_sst_abs(value) __builtin_llabs(value)
892 #else
893 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
894 #endif
895 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
896 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
897 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
898 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
899 #define __Pyx_PyBytes_FromString PyBytes_FromString
900 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
901 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
902 #if PY_MAJOR_VERSION < 3
903 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
904 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
905 #else
906 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
907 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
908 #endif
909 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
910 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
911 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
912 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
913 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
914 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
915 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
916 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
917 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
918 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
919 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
920 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
921 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
922 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
923 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
924 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
925 #if CYTHON_COMPILING_IN_LIMITED_API
__Pyx_Py_UNICODE_strlen(const wchar_t * u)926 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u)
927 {
928 const wchar_t *u_end = u;
929 while (*u_end++) ;
930 return (size_t)(u_end - u - 1);
931 }
932 #else
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)933 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
934 {
935 const Py_UNICODE *u_end = u;
936 while (*u_end++) ;
937 return (size_t)(u_end - u - 1);
938 }
939 #endif
940 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
941 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
942 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
943 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
944 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
945 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
946 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
947 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
948 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
949 #define __Pyx_PySequence_Tuple(obj)\
950 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
951 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
952 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
953 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
954 #if CYTHON_ASSUME_SAFE_MACROS
955 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
956 #else
957 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
958 #endif
959 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
960 #if PY_MAJOR_VERSION >= 3
961 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
962 #else
963 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
964 #endif
965 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
966 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)967 static int __Pyx_init_sys_getdefaultencoding_params(void) {
968 PyObject* sys;
969 PyObject* default_encoding = NULL;
970 PyObject* ascii_chars_u = NULL;
971 PyObject* ascii_chars_b = NULL;
972 const char* default_encoding_c;
973 sys = PyImport_ImportModule("sys");
974 if (!sys) goto bad;
975 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
976 Py_DECREF(sys);
977 if (!default_encoding) goto bad;
978 default_encoding_c = PyBytes_AsString(default_encoding);
979 if (!default_encoding_c) goto bad;
980 if (strcmp(default_encoding_c, "ascii") == 0) {
981 __Pyx_sys_getdefaultencoding_not_ascii = 0;
982 } else {
983 char ascii_chars[128];
984 int c;
985 for (c = 0; c < 128; c++) {
986 ascii_chars[c] = c;
987 }
988 __Pyx_sys_getdefaultencoding_not_ascii = 1;
989 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
990 if (!ascii_chars_u) goto bad;
991 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
992 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
993 PyErr_Format(
994 PyExc_ValueError,
995 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
996 default_encoding_c);
997 goto bad;
998 }
999 Py_DECREF(ascii_chars_u);
1000 Py_DECREF(ascii_chars_b);
1001 }
1002 Py_DECREF(default_encoding);
1003 return 0;
1004 bad:
1005 Py_XDECREF(default_encoding);
1006 Py_XDECREF(ascii_chars_u);
1007 Py_XDECREF(ascii_chars_b);
1008 return -1;
1009 }
1010 #endif
1011 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1012 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1013 #else
1014 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1015 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1016 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)1017 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1018 PyObject* sys;
1019 PyObject* default_encoding = NULL;
1020 char* default_encoding_c;
1021 sys = PyImport_ImportModule("sys");
1022 if (!sys) goto bad;
1023 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1024 Py_DECREF(sys);
1025 if (!default_encoding) goto bad;
1026 default_encoding_c = PyBytes_AsString(default_encoding);
1027 if (!default_encoding_c) goto bad;
1028 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1029 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1030 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1031 Py_DECREF(default_encoding);
1032 return 0;
1033 bad:
1034 Py_XDECREF(default_encoding);
1035 return -1;
1036 }
1037 #endif
1038 #endif
1039
1040
1041 /* Test for GCC > 2.95 */
1042 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1043 #define likely(x) __builtin_expect(!!(x), 1)
1044 #define unlikely(x) __builtin_expect(!!(x), 0)
1045 #else /* !__GNUC__ or GCC < 2.95 */
1046 #define likely(x) (x)
1047 #define unlikely(x) (x)
1048 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)1049 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1050
1051 #if !CYTHON_USE_MODULE_STATE
1052 static PyObject *__pyx_m = NULL;
1053 static PyObject *__pyx_d;
1054 static PyObject *__pyx_b;
1055 static PyObject *__pyx_cython_runtime = NULL;
1056 static PyObject *__pyx_empty_tuple;
1057 static PyObject *__pyx_empty_bytes;
1058 static PyObject *__pyx_empty_unicode;
1059 #endif
1060 static int __pyx_lineno;
1061 static int __pyx_clineno = 0;
1062 static const char * __pyx_cfilenm = __FILE__;
1063 static const char *__pyx_filename;
1064
1065 /* Header.proto */
1066 #if !defined(CYTHON_CCOMPLEX)
1067 #if defined(__cplusplus)
1068 #define CYTHON_CCOMPLEX 1
1069 #elif defined(_Complex_I)
1070 #define CYTHON_CCOMPLEX 1
1071 #else
1072 #define CYTHON_CCOMPLEX 0
1073 #endif
1074 #endif
1075 #if CYTHON_CCOMPLEX
1076 #ifdef __cplusplus
1077 #include <complex>
1078 #else
1079 #include <complex.h>
1080 #endif
1081 #endif
1082 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
1083 #undef _Complex_I
1084 #define _Complex_I 1.0fj
1085 #endif
1086
1087 /* #### Code section: filename_table ### */
1088
1089 static const char *__pyx_f[] = {
1090 "cpp_process_cdist.pyx",
1091 "cpp_common.pxd",
1092 "__init__.cython-30.pxd",
1093 "type.pxd",
1094 };
1095 /* #### Code section: utility_code_proto_before_types ### */
1096 /* NoFastGil.proto */
1097 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1098 #define __Pyx_PyGILState_Release PyGILState_Release
1099 #define __Pyx_FastGIL_Remember()
1100 #define __Pyx_FastGIL_Forget()
1101 #define __Pyx_FastGilFuncInit()
1102
1103 /* #### Code section: numeric_typedefs ### */
1104
1105 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":732
1106 * # in Cython to enable them only on the right systems.
1107 *
1108 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
1109 * ctypedef npy_int16 int16_t
1110 * ctypedef npy_int32 int32_t
1111 */
1112 typedef npy_int8 __pyx_t_5numpy_int8_t;
1113
1114 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":733
1115 *
1116 * ctypedef npy_int8 int8_t
1117 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
1118 * ctypedef npy_int32 int32_t
1119 * ctypedef npy_int64 int64_t
1120 */
1121 typedef npy_int16 __pyx_t_5numpy_int16_t;
1122
1123 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":734
1124 * ctypedef npy_int8 int8_t
1125 * ctypedef npy_int16 int16_t
1126 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
1127 * ctypedef npy_int64 int64_t
1128 * #ctypedef npy_int96 int96_t
1129 */
1130 typedef npy_int32 __pyx_t_5numpy_int32_t;
1131
1132 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":735
1133 * ctypedef npy_int16 int16_t
1134 * ctypedef npy_int32 int32_t
1135 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
1136 * #ctypedef npy_int96 int96_t
1137 * #ctypedef npy_int128 int128_t
1138 */
1139 typedef npy_int64 __pyx_t_5numpy_int64_t;
1140
1141 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":739
1142 * #ctypedef npy_int128 int128_t
1143 *
1144 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
1145 * ctypedef npy_uint16 uint16_t
1146 * ctypedef npy_uint32 uint32_t
1147 */
1148 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1149
1150 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":740
1151 *
1152 * ctypedef npy_uint8 uint8_t
1153 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1154 * ctypedef npy_uint32 uint32_t
1155 * ctypedef npy_uint64 uint64_t
1156 */
1157 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1158
1159 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":741
1160 * ctypedef npy_uint8 uint8_t
1161 * ctypedef npy_uint16 uint16_t
1162 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1163 * ctypedef npy_uint64 uint64_t
1164 * #ctypedef npy_uint96 uint96_t
1165 */
1166 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1167
1168 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":742
1169 * ctypedef npy_uint16 uint16_t
1170 * ctypedef npy_uint32 uint32_t
1171 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1172 * #ctypedef npy_uint96 uint96_t
1173 * #ctypedef npy_uint128 uint128_t
1174 */
1175 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1176
1177 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":746
1178 * #ctypedef npy_uint128 uint128_t
1179 *
1180 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1181 * ctypedef npy_float64 float64_t
1182 * #ctypedef npy_float80 float80_t
1183 */
1184 typedef npy_float32 __pyx_t_5numpy_float32_t;
1185
1186 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":747
1187 *
1188 * ctypedef npy_float32 float32_t
1189 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1190 * #ctypedef npy_float80 float80_t
1191 * #ctypedef npy_float128 float128_t
1192 */
1193 typedef npy_float64 __pyx_t_5numpy_float64_t;
1194
1195 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":756
1196 * # The int types are mapped a bit surprising --
1197 * # numpy.int corresponds to 'l' and numpy.long to 'q'
1198 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1199 * ctypedef npy_longlong long_t
1200 * ctypedef npy_longlong longlong_t
1201 */
1202 typedef npy_long __pyx_t_5numpy_int_t;
1203
1204 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":757
1205 * # numpy.int corresponds to 'l' and numpy.long to 'q'
1206 * ctypedef npy_long int_t
1207 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1208 * ctypedef npy_longlong longlong_t
1209 *
1210 */
1211 typedef npy_longlong __pyx_t_5numpy_long_t;
1212
1213 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":758
1214 * ctypedef npy_long int_t
1215 * ctypedef npy_longlong long_t
1216 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1217 *
1218 * ctypedef npy_ulong uint_t
1219 */
1220 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1221
1222 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":760
1223 * ctypedef npy_longlong longlong_t
1224 *
1225 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1226 * ctypedef npy_ulonglong ulong_t
1227 * ctypedef npy_ulonglong ulonglong_t
1228 */
1229 typedef npy_ulong __pyx_t_5numpy_uint_t;
1230
1231 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":761
1232 *
1233 * ctypedef npy_ulong uint_t
1234 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1235 * ctypedef npy_ulonglong ulonglong_t
1236 *
1237 */
1238 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1239
1240 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":762
1241 * ctypedef npy_ulong uint_t
1242 * ctypedef npy_ulonglong ulong_t
1243 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1244 *
1245 * ctypedef npy_intp intp_t
1246 */
1247 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1248
1249 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":764
1250 * ctypedef npy_ulonglong ulonglong_t
1251 *
1252 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1253 * ctypedef npy_uintp uintp_t
1254 *
1255 */
1256 typedef npy_intp __pyx_t_5numpy_intp_t;
1257
1258 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":765
1259 *
1260 * ctypedef npy_intp intp_t
1261 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1262 *
1263 * ctypedef npy_double float_t
1264 */
1265 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1266
1267 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":767
1268 * ctypedef npy_uintp uintp_t
1269 *
1270 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1271 * ctypedef npy_double double_t
1272 * ctypedef npy_longdouble longdouble_t
1273 */
1274 typedef npy_double __pyx_t_5numpy_float_t;
1275
1276 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":768
1277 *
1278 * ctypedef npy_double float_t
1279 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1280 * ctypedef npy_longdouble longdouble_t
1281 *
1282 */
1283 typedef npy_double __pyx_t_5numpy_double_t;
1284
1285 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":769
1286 * ctypedef npy_double float_t
1287 * ctypedef npy_double double_t
1288 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1289 *
1290 * ctypedef npy_cfloat cfloat_t
1291 */
1292 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1293 /* #### Code section: complex_type_declarations ### */
1294 /* Declarations.proto */
1295 #if CYTHON_CCOMPLEX
1296 #ifdef __cplusplus
1297 typedef ::std::complex< float > __pyx_t_float_complex;
1298 #else
1299 typedef float _Complex __pyx_t_float_complex;
1300 #endif
1301 #else
1302 typedef struct { float real, imag; } __pyx_t_float_complex;
1303 #endif
1304 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1305
1306 /* Declarations.proto */
1307 #if CYTHON_CCOMPLEX
1308 #ifdef __cplusplus
1309 typedef ::std::complex< double > __pyx_t_double_complex;
1310 #else
1311 typedef double _Complex __pyx_t_double_complex;
1312 #endif
1313 #else
1314 typedef struct { double real, imag; } __pyx_t_double_complex;
1315 #endif
1316 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1317
1318 /* #### Code section: type_declarations ### */
1319
1320 /*--- Type declarations ---*/
1321
1322 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":771
1323 * ctypedef npy_longdouble longdouble_t
1324 *
1325 * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1326 * ctypedef npy_cdouble cdouble_t
1327 * ctypedef npy_clongdouble clongdouble_t
1328 */
1329 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1330
1331 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":772
1332 *
1333 * ctypedef npy_cfloat cfloat_t
1334 * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1335 * ctypedef npy_clongdouble clongdouble_t
1336 *
1337 */
1338 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1339
1340 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":773
1341 * ctypedef npy_cfloat cfloat_t
1342 * ctypedef npy_cdouble cdouble_t
1343 * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1344 *
1345 * ctypedef npy_cdouble complex_t
1346 */
1347 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1348
1349 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":775
1350 * ctypedef npy_clongdouble clongdouble_t
1351 *
1352 * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1353 *
1354 * cdef inline object PyArray_MultiIterNew1(a):
1355 */
1356 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1357 struct __pyx_defaults;
1358 typedef struct __pyx_defaults __pyx_defaults;
1359 struct __pyx_defaults {
1360 PyObject *__pyx_arg_scorer;
1361 };
1362 /* #### Code section: utility_code_proto ### */
1363
1364 /* --- Runtime support code (head) --- */
1365 /* Refnanny.proto */
1366 #ifndef CYTHON_REFNANNY
1367 #define CYTHON_REFNANNY 0
1368 #endif
1369 #if CYTHON_REFNANNY
1370 typedef struct {
1371 void (*INCREF)(void*, PyObject*, Py_ssize_t);
1372 void (*DECREF)(void*, PyObject*, Py_ssize_t);
1373 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1374 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1375 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1376 void (*FinishContext)(void**);
1377 } __Pyx_RefNannyAPIStruct;
1378 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1379 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1380 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1381 #ifdef WITH_THREAD
1382 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1383 if (acquire_gil) {\
1384 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1385 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1386 PyGILState_Release(__pyx_gilstate_save);\
1387 } else {\
1388 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1389 }
1390 #define __Pyx_RefNannyFinishContextNogil() {\
1391 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1392 __Pyx_RefNannyFinishContext();\
1393 PyGILState_Release(__pyx_gilstate_save);\
1394 }
1395 #else
1396 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1397 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1398 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1399 #endif
1400 #define __Pyx_RefNannyFinishContext()\
1401 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1402 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1403 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1404 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1405 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1406 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1407 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1408 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1409 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1410 #else
1411 #define __Pyx_RefNannyDeclarations
1412 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1413 #define __Pyx_RefNannyFinishContextNogil()
1414 #define __Pyx_RefNannyFinishContext()
1415 #define __Pyx_INCREF(r) Py_INCREF(r)
1416 #define __Pyx_DECREF(r) Py_DECREF(r)
1417 #define __Pyx_GOTREF(r)
1418 #define __Pyx_GIVEREF(r)
1419 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1420 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1421 #define __Pyx_XGOTREF(r)
1422 #define __Pyx_XGIVEREF(r)
1423 #endif
1424 #define __Pyx_Py_XDECREF_SET(r, v) do {\
1425 PyObject *tmp = (PyObject *) r;\
1426 r = v; Py_XDECREF(tmp);\
1427 } while (0)
1428 #define __Pyx_XDECREF_SET(r, v) do {\
1429 PyObject *tmp = (PyObject *) r;\
1430 r = v; __Pyx_XDECREF(tmp);\
1431 } while (0)
1432 #define __Pyx_DECREF_SET(r, v) do {\
1433 PyObject *tmp = (PyObject *) r;\
1434 r = v; __Pyx_DECREF(tmp);\
1435 } while (0)
1436 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1437 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1438
1439 /* PyErrExceptionMatches.proto */
1440 #if CYTHON_FAST_THREAD_STATE
1441 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1442 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1443 #else
1444 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1445 #endif
1446
1447 /* PyThreadStateGet.proto */
1448 #if CYTHON_FAST_THREAD_STATE
1449 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1450 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1451 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1452 #else
1453 #define __Pyx_PyThreadState_declare
1454 #define __Pyx_PyThreadState_assign
1455 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1456 #endif
1457
1458 /* PyErrFetchRestore.proto */
1459 #if CYTHON_FAST_THREAD_STATE
1460 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1461 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1462 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1463 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1464 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1465 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1466 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1467 #if CYTHON_COMPILING_IN_CPYTHON
1468 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1469 #else
1470 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1471 #endif
1472 #else
1473 #define __Pyx_PyErr_Clear() PyErr_Clear()
1474 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1475 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1476 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1477 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1478 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1479 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1480 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1481 #endif
1482
1483 /* PyObjectGetAttrStr.proto */
1484 #if CYTHON_USE_TYPE_SLOTS
1485 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1486 #else
1487 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1488 #endif
1489
1490 /* PyObjectGetAttrStrNoError.proto */
1491 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1492
1493 /* GetBuiltinName.proto */
1494 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1495
1496 /* Profile.proto */
1497 #ifndef CYTHON_PROFILE
1498 #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
1499 #define CYTHON_PROFILE 0
1500 #else
1501 #define CYTHON_PROFILE 1
1502 #endif
1503 #endif
1504 #ifndef CYTHON_TRACE_NOGIL
1505 #define CYTHON_TRACE_NOGIL 0
1506 #else
1507 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
1508 #define CYTHON_TRACE 1
1509 #endif
1510 #endif
1511 #ifndef CYTHON_TRACE
1512 #define CYTHON_TRACE 0
1513 #endif
1514 #if CYTHON_TRACE
1515 #undef CYTHON_PROFILE_REUSE_FRAME
1516 #endif
1517 #ifndef CYTHON_PROFILE_REUSE_FRAME
1518 #define CYTHON_PROFILE_REUSE_FRAME 0
1519 #endif
1520 #if CYTHON_PROFILE || CYTHON_TRACE
1521 #include "compile.h"
1522 #include "frameobject.h"
1523 #include "traceback.h"
1524 #if CYTHON_PROFILE_REUSE_FRAME
1525 #define CYTHON_FRAME_MODIFIER static
1526 #define CYTHON_FRAME_DEL(frame)
1527 #else
1528 #define CYTHON_FRAME_MODIFIER
1529 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1530 #endif
1531 #define __Pyx_TraceDeclarations\
1532 static PyCodeObject *__pyx_frame_code = NULL;\
1533 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1534 int __Pyx_use_tracing = 0;
1535 #define __Pyx_TraceFrameInit(codeobj)\
1536 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1537 #if PY_VERSION_HEX >= 0x030a00b1
1538 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1539 (unlikely((tstate)->cframe->use_tracing) &&\
1540 (!(check_tracing) || !(tstate)->tracing) &&\
1541 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1542 #define __Pyx_SetTracing(tstate, enable)\
1543 (tstate)->cframe->use_tracing = (enable)
1544 #else
1545 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1546 (unlikely((tstate)->use_tracing) &&\
1547 (!(check_tracing) || !(tstate)->tracing) &&\
1548 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1549 #define __Pyx_SetTracing(tstate, enable)\
1550 (tstate)->use_tracing = (enable)
1551 #endif
1552 #ifdef WITH_THREAD
1553 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1554 if (nogil) {\
1555 if (CYTHON_TRACE_NOGIL) {\
1556 PyThreadState *tstate;\
1557 PyGILState_STATE state = PyGILState_Ensure();\
1558 tstate = __Pyx_PyThreadState_Current;\
1559 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1560 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1561 }\
1562 PyGILState_Release(state);\
1563 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1564 }\
1565 } else {\
1566 PyThreadState* tstate = PyThreadState_GET();\
1567 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1568 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1569 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1570 }\
1571 }
1572 #else
1573 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1574 { PyThreadState* tstate = PyThreadState_GET();\
1575 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1576 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1577 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1578 }\
1579 }
1580 #endif
1581 #define __Pyx_TraceException()\
1582 if (likely(!__Pyx_use_tracing)); else {\
1583 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1584 if (__Pyx_IsTracing(tstate, 0, 1)) {\
1585 tstate->tracing++;\
1586 __Pyx_SetTracing(tstate, 0);\
1587 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1588 if (exc_info) {\
1589 if (CYTHON_TRACE && tstate->c_tracefunc)\
1590 tstate->c_tracefunc(\
1591 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1592 tstate->c_profilefunc(\
1593 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1594 Py_DECREF(exc_info);\
1595 }\
1596 __Pyx_SetTracing(tstate, 1);\
1597 tstate->tracing--;\
1598 }\
1599 }
__Pyx_call_return_trace_func(PyThreadState * tstate,PyFrameObject * frame,PyObject * result)1600 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1601 PyObject *type, *value, *traceback;
1602 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1603 tstate->tracing++;
1604 __Pyx_SetTracing(tstate, 0);
1605 if (CYTHON_TRACE && tstate->c_tracefunc)
1606 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1607 if (tstate->c_profilefunc)
1608 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1609 CYTHON_FRAME_DEL(frame);
1610 __Pyx_SetTracing(tstate, 1);
1611 tstate->tracing--;
1612 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1613 }
1614 #ifdef WITH_THREAD
1615 #define __Pyx_TraceReturn(result, nogil)\
1616 if (likely(!__Pyx_use_tracing)); else {\
1617 if (nogil) {\
1618 if (CYTHON_TRACE_NOGIL) {\
1619 PyThreadState *tstate;\
1620 PyGILState_STATE state = PyGILState_Ensure();\
1621 tstate = __Pyx_PyThreadState_Current;\
1622 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1623 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1624 }\
1625 PyGILState_Release(state);\
1626 }\
1627 } else {\
1628 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1629 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1630 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1631 }\
1632 }\
1633 }
1634 #else
1635 #define __Pyx_TraceReturn(result, nogil)\
1636 if (likely(!__Pyx_use_tracing)); else {\
1637 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1638 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1639 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1640 }\
1641 }
1642 #endif
1643 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
1644 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
1645 #else
1646 #define __Pyx_TraceDeclarations
1647 #define __Pyx_TraceFrameInit(codeobj)
1648 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
1649 #define __Pyx_TraceException()
1650 #define __Pyx_TraceReturn(result, nogil)
1651 #endif
1652 #if CYTHON_TRACE
__Pyx_call_line_trace_func(PyThreadState * tstate,PyFrameObject * frame,int lineno)1653 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
1654 int ret;
1655 PyObject *type, *value, *traceback;
1656 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1657 __Pyx_PyFrame_SetLineNumber(frame, lineno);
1658 tstate->tracing++;
1659 __Pyx_SetTracing(tstate, 0);
1660 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
1661 __Pyx_SetTracing(tstate, 1);
1662 tstate->tracing--;
1663 if (likely(!ret)) {
1664 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1665 } else {
1666 Py_XDECREF(type);
1667 Py_XDECREF(value);
1668 Py_XDECREF(traceback);
1669 }
1670 return ret;
1671 }
1672 #ifdef WITH_THREAD
1673 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1674 if (likely(!__Pyx_use_tracing)); else {\
1675 if (nogil) {\
1676 if (CYTHON_TRACE_NOGIL) {\
1677 int ret = 0;\
1678 PyThreadState *tstate;\
1679 PyGILState_STATE state = __Pyx_PyGILState_Ensure();\
1680 tstate = __Pyx_PyThreadState_Current;\
1681 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1682 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1683 }\
1684 __Pyx_PyGILState_Release(state);\
1685 if (unlikely(ret)) goto_error;\
1686 }\
1687 } else {\
1688 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1689 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1690 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1691 if (unlikely(ret)) goto_error;\
1692 }\
1693 }\
1694 }
1695 #else
1696 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1697 if (likely(!__Pyx_use_tracing)); else {\
1698 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1699 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1700 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1701 if (unlikely(ret)) goto_error;\
1702 }\
1703 }
1704 #endif
1705 #else
1706 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
1707 #endif
1708
1709 /* PyDictVersioning.proto */
1710 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1711 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1712 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1713 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1714 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1715 (cache_var) = (value);
1716 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1717 static PY_UINT64_T __pyx_dict_version = 0;\
1718 static PyObject *__pyx_dict_cached_value = NULL;\
1719 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1720 (VAR) = __pyx_dict_cached_value;\
1721 } else {\
1722 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1723 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1724 }\
1725 }
1726 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1727 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1728 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1729 #else
1730 #define __PYX_GET_DICT_VERSION(dict) (0)
1731 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1732 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1733 #endif
1734
1735 /* GetModuleGlobalName.proto */
1736 #if CYTHON_USE_DICT_VERSIONS
1737 #define __Pyx_GetModuleGlobalName(var, name) {\
1738 static PY_UINT64_T __pyx_dict_version = 0;\
1739 static PyObject *__pyx_dict_cached_value = NULL;\
1740 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1741 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1742 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1743 }
1744 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1745 PY_UINT64_T __pyx_dict_version;\
1746 PyObject *__pyx_dict_cached_value;\
1747 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1748 }
1749 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1750 #else
1751 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1752 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1753 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1754 #endif
1755
1756 /* MoveIfSupported.proto */
1757 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
1758 #include <utility>
1759 #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
1760 #else
1761 #define __PYX_STD_MOVE_IF_SUPPORTED(x) x
1762 #endif
1763
1764 /* dict_getitem_default.proto */
1765 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
1766
1767 /* PyObjectCall.proto */
1768 #if CYTHON_COMPILING_IN_CPYTHON
1769 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1770 #else
1771 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1772 #endif
1773
1774 /* UnpackUnboundCMethod.proto */
1775 typedef struct {
1776 PyObject *type;
1777 PyObject **method_name;
1778 PyCFunction func;
1779 PyObject *method;
1780 int flag;
1781 } __Pyx_CachedCFunction;
1782
1783 /* CallUnboundCMethod1.proto */
1784 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1785 #if CYTHON_COMPILING_IN_CPYTHON
1786 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1787 #else
1788 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1789 #endif
1790
1791 /* CallUnboundCMethod2.proto */
1792 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
1793 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
1794 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
1795 #else
1796 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1797 #endif
1798
1799 /* RaiseTooManyValuesToUnpack.proto */
1800 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1801
1802 /* RaiseNeedMoreValuesToUnpack.proto */
1803 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1804
1805 /* IterFinish.proto */
1806 static CYTHON_INLINE int __Pyx_IterFinish(void);
1807
1808 /* UnpackItemEndCheck.proto */
1809 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1810
1811 /* WriteUnraisableException.proto */
1812 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1813 int lineno, const char *filename,
1814 int full_traceback, int nogil);
1815
1816 /* RaiseException.proto */
1817 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1818
1819 /* PyIntCompare.proto */
1820 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1821
1822 /* CallableCheck.proto */
1823 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
1824 #define __Pyx_PyCallable_Check(obj) (Py_TYPE(obj)->tp_call != NULL)
1825 #else
1826 #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj)
1827 #endif
1828
1829 /* PyFunctionFastCall.proto */
1830 #if CYTHON_FAST_PYCALL
1831 #if !CYTHON_VECTORCALL
1832 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1833 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1834 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1835 #endif
1836 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1837 (sizeof(char [1 - 2*!(cond)]) - 1)
1838 #ifndef Py_MEMBER_SIZE
1839 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1840 #endif
1841 static size_t __pyx_pyframe_localsplus_offset = 0;
1842 #include "frameobject.h"
1843 #define __Pxy_PyFrame_Initialize_Offsets()\
1844 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1845 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1846 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1847 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1848 #endif
1849
1850 /* PyObjectCallMethO.proto */
1851 #if CYTHON_COMPILING_IN_CPYTHON
1852 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1853 #endif
1854
1855 /* PyObjectFastCall.proto */
1856 #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
1857 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
1858
1859 /* GetException.proto */
1860 #if CYTHON_FAST_THREAD_STATE
1861 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1862 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1863 #else
1864 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1865 #endif
1866
1867 /* SwapException.proto */
1868 #if CYTHON_FAST_THREAD_STATE
1869 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1870 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1871 #else
1872 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1873 #endif
1874
1875 /* GetTopmostException.proto */
1876 #if CYTHON_USE_EXC_INFO_STACK
1877 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1878 #endif
1879
1880 /* SaveResetException.proto */
1881 #if CYTHON_FAST_THREAD_STATE
1882 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1883 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1884 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1885 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1886 #else
1887 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1888 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1889 #endif
1890
1891 /* TupleAndListFromArray.proto */
1892 #if CYTHON_COMPILING_IN_CPYTHON
1893 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
1894 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
1895 #endif
1896
1897 /* IncludeStringH.proto */
1898 #include <string.h>
1899
1900 /* BytesEquals.proto */
1901 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1902
1903 /* UnicodeEquals.proto */
1904 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1905
1906 /* fastcall.proto */
1907 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
1908 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
1909 #define __Pyx_KwValues_VARARGS(args, nargs) NULL
1910 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
1911 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
1912 #if CYTHON_METH_FASTCALL
1913 #define __Pyx_Arg_FASTCALL(args, i) args[i]
1914 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
1915 #define __Pyx_KwValues_FASTCALL(args, nargs) (&args[nargs])
1916 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
1917 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
1918 #else
1919 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
1920 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
1921 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
1922 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
1923 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
1924 #endif
1925 #if CYTHON_COMPILING_IN_CPYTHON
1926 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
1927 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
1928 #else
1929 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
1930 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
1931 #endif
1932
1933 /* RaiseArgTupleInvalid.proto */
1934 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1935 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1936
1937 /* RaiseDoubleKeywords.proto */
1938 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1939
1940 /* ParseKeywords.proto */
1941 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
1942 PyObject **argnames[],
1943 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
1944 const char* function_name);
1945
1946 /* GetItemInt.proto */
1947 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1948 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1949 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1950 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1951 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1952 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1953 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1954 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1955 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1956 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1957 int wraparound, int boundscheck);
1958 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1959 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1960 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1961 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1962 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1963 int wraparound, int boundscheck);
1964 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1965 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1966 int is_list, int wraparound, int boundscheck);
1967
1968 /* TypeImport.proto */
1969 #ifndef __PYX_HAVE_RT_ImportType_proto
1970 #define __PYX_HAVE_RT_ImportType_proto
1971 enum __Pyx_ImportType_CheckSize {
1972 __Pyx_ImportType_CheckSize_Error = 0,
1973 __Pyx_ImportType_CheckSize_Warn = 1,
1974 __Pyx_ImportType_CheckSize_Ignore = 2
1975 };
1976 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1977 #endif
1978
1979 /* Import.proto */
1980 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1981
1982 /* ImportFrom.proto */
1983 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1984
1985 /* ImportDottedModule.proto */
1986 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
1987
1988 /* IncludeStructmemberH.proto */
1989 #include <structmember.h>
1990
1991 /* FixUpExtensionType.proto */
1992 #if CYTHON_USE_TYPE_SPECS
1993 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
1994 #endif
1995
1996 /* FetchCommonType.proto */
1997 #if !CYTHON_USE_TYPE_SPECS
1998 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1999 #else
2000 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
2001 #endif
2002
2003 /* PyMethodNew.proto */
2004 #if PY_MAJOR_VERSION >= 3
__Pyx_PyMethod_New(PyObject * func,PyObject * self,PyObject * typ)2005 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
2006 CYTHON_UNUSED_VAR(typ);
2007 if (!self)
2008 return __Pyx_NewRef(func);
2009 return PyMethod_New(func, self);
2010 }
2011 #else
2012 #define __Pyx_PyMethod_New PyMethod_New
2013 #endif
2014
2015 /* PyVectorcallFastCallDict.proto */
2016 #if CYTHON_METH_FASTCALL
2017 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
2018 #endif
2019
2020 /* CythonFunctionShared.proto */
2021 #define __Pyx_CyFunction_USED
2022 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2023 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2024 #define __Pyx_CYFUNCTION_CCLASS 0x04
2025 #define __Pyx_CYFUNCTION_COROUTINE 0x08
2026 #define __Pyx_CyFunction_GetClosure(f)\
2027 (((__pyx_CyFunctionObject *) (f))->func_closure)
2028 #if PY_VERSION_HEX < 0x030900B1
2029 #define __Pyx_CyFunction_GetClassObj(f)\
2030 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2031 #else
2032 #define __Pyx_CyFunction_GetClassObj(f)\
2033 ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
2034 #endif
2035 #define __Pyx_CyFunction_SetClassObj(f, classobj)\
2036 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
2037 #define __Pyx_CyFunction_Defaults(type, f)\
2038 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2039 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2040 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2041 typedef struct {
2042 #if PY_VERSION_HEX < 0x030900B1
2043 PyCFunctionObject func;
2044 #else
2045 PyCMethodObject func;
2046 #endif
2047 #if CYTHON_BACKPORT_VECTORCALL
2048 __pyx_vectorcallfunc func_vectorcall;
2049 #endif
2050 #if PY_VERSION_HEX < 0x030500A0
2051 PyObject *func_weakreflist;
2052 #endif
2053 PyObject *func_dict;
2054 PyObject *func_name;
2055 PyObject *func_qualname;
2056 PyObject *func_doc;
2057 PyObject *func_globals;
2058 PyObject *func_code;
2059 PyObject *func_closure;
2060 #if PY_VERSION_HEX < 0x030900B1
2061 PyObject *func_classobj;
2062 #endif
2063 void *defaults;
2064 int defaults_pyobjects;
2065 size_t defaults_size; // used by FusedFunction for copying defaults
2066 int flags;
2067 PyObject *defaults_tuple;
2068 PyObject *defaults_kwdict;
2069 PyObject *(*defaults_getter)(PyObject *);
2070 PyObject *func_annotations;
2071 PyObject *func_is_coroutine;
2072 } __pyx_CyFunctionObject;
2073 #if !CYTHON_USE_MODULE_STATE
2074 static PyTypeObject *__pyx_CyFunctionType = 0;
2075 #endif
2076 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
2077 #define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
2078 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
2079 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2080 int flags, PyObject* qualname,
2081 PyObject *closure,
2082 PyObject *module, PyObject *globals,
2083 PyObject* code);
2084 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
2085 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2086 size_t size,
2087 int pyobjects);
2088 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2089 PyObject *tuple);
2090 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2091 PyObject *dict);
2092 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2093 PyObject *dict);
2094 static int __pyx_CyFunction_init(PyObject *module);
2095 #if CYTHON_METH_FASTCALL
2096 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2097 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2098 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2099 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2100 #if CYTHON_BACKPORT_VECTORCALL
2101 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
2102 #else
2103 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
2104 #endif
2105 #endif
2106
2107 /* CythonFunction.proto */
2108 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2109 int flags, PyObject* qualname,
2110 PyObject *closure,
2111 PyObject *module, PyObject *globals,
2112 PyObject* code);
2113
2114 /* CLineInTraceback.proto */
2115 #ifdef CYTHON_CLINE_IN_TRACEBACK
2116 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2117 #else
2118 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2119 #endif
2120
2121 /* CodeObjectCache.proto */
2122 #if !CYTHON_COMPILING_IN_LIMITED_API
2123 typedef struct {
2124 PyCodeObject* code_object;
2125 int code_line;
2126 } __Pyx_CodeObjectCacheEntry;
2127 struct __Pyx_CodeObjectCache {
2128 int count;
2129 int max_count;
2130 __Pyx_CodeObjectCacheEntry* entries;
2131 };
2132 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2133 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2134 static PyCodeObject *__pyx_find_code_object(int code_line);
2135 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2136 #endif
2137
2138 /* AddTraceback.proto */
2139 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2140 int py_line, const char *filename);
2141
2142 /* CppExceptionConversion.proto */
2143 #ifndef __Pyx_CppExn2PyErr
2144 #include <new>
2145 #include <typeinfo>
2146 #include <stdexcept>
2147 #include <ios>
__Pyx_CppExn2PyErr()2148 static void __Pyx_CppExn2PyErr() {
2149 try {
2150 if (PyErr_Occurred())
2151 ; // let the latest Python exn pass through and ignore the current one
2152 else
2153 throw;
2154 } catch (const std::bad_alloc& exn) {
2155 PyErr_SetString(PyExc_MemoryError, exn.what());
2156 } catch (const std::bad_cast& exn) {
2157 PyErr_SetString(PyExc_TypeError, exn.what());
2158 } catch (const std::bad_typeid& exn) {
2159 PyErr_SetString(PyExc_TypeError, exn.what());
2160 } catch (const std::domain_error& exn) {
2161 PyErr_SetString(PyExc_ValueError, exn.what());
2162 } catch (const std::invalid_argument& exn) {
2163 PyErr_SetString(PyExc_ValueError, exn.what());
2164 } catch (const std::ios_base::failure& exn) {
2165 PyErr_SetString(PyExc_IOError, exn.what());
2166 } catch (const std::out_of_range& exn) {
2167 PyErr_SetString(PyExc_IndexError, exn.what());
2168 } catch (const std::overflow_error& exn) {
2169 PyErr_SetString(PyExc_OverflowError, exn.what());
2170 } catch (const std::range_error& exn) {
2171 PyErr_SetString(PyExc_ArithmeticError, exn.what());
2172 } catch (const std::underflow_error& exn) {
2173 PyErr_SetString(PyExc_ArithmeticError, exn.what());
2174 } catch (const std::exception& exn) {
2175 PyErr_SetString(PyExc_RuntimeError, exn.what());
2176 }
2177 catch (...)
2178 {
2179 PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
2180 }
2181 }
2182 #endif
2183
2184 /* GCCDiagnostics.proto */
2185 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2186 #define __Pyx_HAS_GCC_DIAGNOSTIC
2187 #endif
2188
2189 /* UnicodeAsUCS4.proto */
2190 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);
2191
2192 /* RealImag.proto */
2193 #if CYTHON_CCOMPLEX
2194 #ifdef __cplusplus
2195 #define __Pyx_CREAL(z) ((z).real())
2196 #define __Pyx_CIMAG(z) ((z).imag())
2197 #else
2198 #define __Pyx_CREAL(z) (__real__(z))
2199 #define __Pyx_CIMAG(z) (__imag__(z))
2200 #endif
2201 #else
2202 #define __Pyx_CREAL(z) ((z).real)
2203 #define __Pyx_CIMAG(z) ((z).imag)
2204 #endif
2205 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2206 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2207 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2208 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2209 #else
2210 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2211 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2212 #endif
2213
2214 /* Arithmetic.proto */
2215 #if CYTHON_CCOMPLEX
2216 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2217 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2218 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2219 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2220 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2221 #define __Pyx_c_neg_float(a) (-(a))
2222 #ifdef __cplusplus
2223 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2224 #define __Pyx_c_conj_float(z) (::std::conj(z))
2225 #if 1
2226 #define __Pyx_c_abs_float(z) (::std::abs(z))
2227 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2228 #endif
2229 #else
2230 #define __Pyx_c_is_zero_float(z) ((z)==0)
2231 #define __Pyx_c_conj_float(z) (conjf(z))
2232 #if 1
2233 #define __Pyx_c_abs_float(z) (cabsf(z))
2234 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2235 #endif
2236 #endif
2237 #else
2238 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2239 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2240 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2241 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2242 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2243 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2244 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2245 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2246 #if 1
2247 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2248 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2249 #endif
2250 #endif
2251
2252 /* Arithmetic.proto */
2253 #if CYTHON_CCOMPLEX
2254 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2255 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2256 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2257 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2258 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2259 #define __Pyx_c_neg_double(a) (-(a))
2260 #ifdef __cplusplus
2261 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2262 #define __Pyx_c_conj_double(z) (::std::conj(z))
2263 #if 1
2264 #define __Pyx_c_abs_double(z) (::std::abs(z))
2265 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2266 #endif
2267 #else
2268 #define __Pyx_c_is_zero_double(z) ((z)==0)
2269 #define __Pyx_c_conj_double(z) (conj(z))
2270 #if 1
2271 #define __Pyx_c_abs_double(z) (cabs(z))
2272 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2273 #endif
2274 #endif
2275 #else
2276 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2277 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2278 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2279 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2280 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2281 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2282 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2283 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2284 #if 1
2285 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2286 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2287 #endif
2288 #endif
2289
2290 /* CIntFromPy.proto */
2291 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
2292
2293 /* CIntFromPy.proto */
2294 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2295
2296 /* CIntFromPy.proto */
2297 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
2298
2299 /* ObjectAsUCS4.proto */
2300 #define __Pyx_PyObject_AsPy_UCS4(x)\
2301 (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x))
2302 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*);
2303
2304 /* FormatTypeName.proto */
2305 #if CYTHON_COMPILING_IN_LIMITED_API
2306 typedef PyObject *__Pyx_TypeName;
2307 #define __Pyx_FMT_TYPENAME "%U"
2308 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
2309 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
2310 #else
2311 typedef const char *__Pyx_TypeName;
2312 #define __Pyx_FMT_TYPENAME "%.200s"
2313 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
2314 #define __Pyx_DECREF_TypeName(obj)
2315 #endif
2316
2317 /* CIntToPy.proto */
2318 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2319
2320 /* CIntFromPy.proto */
2321 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2322
2323 /* FastTypeChecks.proto */
2324 #if CYTHON_COMPILING_IN_CPYTHON
2325 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2326 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
2327 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2328 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
2329 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2330 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2331 #else
2332 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2333 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
2334 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2335 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2336 #endif
2337 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_Occurred(), err1, err2)
2338 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2339
2340 /* CheckBinaryVersion.proto */
2341 static int __Pyx_check_binary_version(void);
2342
2343 /* InitStrings.proto */
2344 #if CYTHON_COMPILING_IN_LIMITED_API
2345 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str);
2346 #else
2347 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2348 #endif
2349
2350 /* #### Code section: module_declarations ### */
2351 static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/
2352 static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/
2353 static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/
2354 static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/
2355 static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/
2356 static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/
2357 static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/
2358
2359 /* Module declarations from "libcpp.vector" */
2360 #if !CYTHON_USE_MODULE_STATE
2361 #endif
2362
2363 /* Module declarations from "libcpp.utility" */
2364 #if !CYTHON_USE_MODULE_STATE
2365 #endif
2366
2367 /* Module declarations from "libc.stdint" */
2368 #if !CYTHON_USE_MODULE_STATE
2369 #endif
2370
2371 /* Module declarations from "libc.math" */
2372 #if !CYTHON_USE_MODULE_STATE
2373 #endif
2374
2375 /* Module declarations from "libc.string" */
2376 #if !CYTHON_USE_MODULE_STATE
2377 #endif
2378
2379 /* Module declarations from "libc.stdio" */
2380 #if !CYTHON_USE_MODULE_STATE
2381 #endif
2382
2383 /* Module declarations from "__builtin__" */
2384 #if !CYTHON_USE_MODULE_STATE
2385 #endif
2386
2387 /* Module declarations from "cpython.type" */
2388 #if !CYTHON_USE_MODULE_STATE
2389 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2390 #endif
2391
2392 /* Module declarations from "cpython" */
2393 #if !CYTHON_USE_MODULE_STATE
2394 #endif
2395
2396 /* Module declarations from "cpython.object" */
2397 #if !CYTHON_USE_MODULE_STATE
2398 #endif
2399
2400 /* Module declarations from "cpython.ref" */
2401 #if !CYTHON_USE_MODULE_STATE
2402 #endif
2403
2404 /* Module declarations from "libc.stdlib" */
2405 #if !CYTHON_USE_MODULE_STATE
2406 #endif
2407
2408 /* Module declarations from "libc.stddef" */
2409 #if !CYTHON_USE_MODULE_STATE
2410 #endif
2411
2412 /* Module declarations from "libcpp" */
2413 #if !CYTHON_USE_MODULE_STATE
2414 #endif
2415
2416 /* Module declarations from "cpp_common" */
2417 #if !CYTHON_USE_MODULE_STATE
2418 #endif
2419 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *); /*proto*/
2420 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *); /*proto*/
2421
2422 /* Module declarations from "numpy" */
2423 #if !CYTHON_USE_MODULE_STATE
2424 #endif
2425
2426 /* Module declarations from "numpy" */
2427 #if !CYTHON_USE_MODULE_STATE
2428 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2429 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2430 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2431 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2432 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2433 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2434 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2435 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2436 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2437 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2438 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2439 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2440 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2441 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2442 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2443 #endif
2444 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/
2445
2446 /* Module declarations from "cython" */
2447 #if !CYTHON_USE_MODULE_STATE
2448 #endif
2449
2450 /* Module declarations from "cpp_process_cdist" */
2451 #if !CYTHON_USE_MODULE_STATE
2452 #endif
2453 static CYTHON_INLINE proc_string __pyx_f_17cpp_process_cdist_conv_sequence(PyObject *); /*proto*/
2454 static KwargsContext __pyx_f_17cpp_process_cdist_LevenshteinKwargsInit(PyObject *); /*proto*/
2455 static CYTHON_INLINE struct ScorerFunctionTable __pyx_f_17cpp_process_cdist_CreateNormalizedLevenshteinFunctionTable(void); /*proto*/
2456 static CYTHON_INLINE struct DistanceFunctionTable __pyx_f_17cpp_process_cdist_CreateLevenshteinFunctionTable(void); /*proto*/
2457 static KwargsContext __pyx_f_17cpp_process_cdist_JaroWinklerKwargsInit(PyObject *); /*proto*/
2458 static CYTHON_INLINE struct ScorerFunctionTable __pyx_f_17cpp_process_cdist_CreateJaroWinklerSimilarityFunctionTable(void); /*proto*/
2459 static CYTHON_INLINE int __pyx_f_17cpp_process_cdist_IsIntegratedScorer(PyObject *); /*proto*/
2460 static CYTHON_INLINE int __pyx_f_17cpp_process_cdist_IsIntegratedDistance(PyObject *); /*proto*/
2461 static CYTHON_INLINE struct ScorerFunctionTable __pyx_f_17cpp_process_cdist_CachedScorerInit(PyObject *); /*proto*/
2462 static CYTHON_INLINE struct DistanceFunctionTable __pyx_f_17cpp_process_cdist_CachedDistanceInit(PyObject *); /*proto*/
2463 static int __pyx_f_17cpp_process_cdist_dtype_to_type_num_similarity(PyObject *); /*proto*/
2464 static int __pyx_f_17cpp_process_cdist_dtype_to_type_num_distance(PyObject *); /*proto*/
2465 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_two_lists_similarity(std::vector<proc_string> const &, std::vector<proc_string> const &, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2466 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_two_lists_distance(std::vector<proc_string> const &, std::vector<proc_string> const &, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2467 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_py_cdist_two_lists(std::vector<PyObject *> const &, std::vector<PyObject *> const &, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2468 static PyObject *__pyx_f_17cpp_process_cdist_cdist_two_lists(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2469 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_single_list_similarity(std::vector<proc_string> const &, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2470 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_single_list_distance(std::vector<proc_string> const &, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2471 static PyObject *__pyx_f_17cpp_process_cdist_cdist_single_list(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2472 /* #### Code section: typeinfo ### */
2473 /* #### Code section: before_global_var ### */
2474 #define __Pyx_MODULE_NAME "cpp_process_cdist"
2475 extern int __pyx_module_is_main_cpp_process_cdist;
2476 int __pyx_module_is_main_cpp_process_cdist = 0;
2477
2478 /* Implementation of "cpp_process_cdist" */
2479 /* #### Code section: global_var ### */
2480 static PyObject *__pyx_builtin_MemoryError;
2481 static PyObject *__pyx_builtin_TypeError;
2482 static PyObject *__pyx_builtin_range;
2483 static PyObject *__pyx_builtin_ImportError;
2484 /* #### Code section: string_decls ### */
2485 static const char __pyx_k__8[] = "*";
2486 static const char __pyx_k_np[] = "np";
2487 static const char __pyx_k__10[] = "?";
2488 static const char __pyx_k_get[] = "get";
2489 static const char __pyx_k_int8[] = "int8";
2490 static const char __pyx_k_main[] = "__main__";
2491 static const char __pyx_k_name[] = "__name__";
2492 static const char __pyx_k_spec[] = "__spec__";
2493 static const char __pyx_k_test[] = "__test__";
2494 static const char __pyx_k_array[] = "array";
2495 static const char __pyx_k_cdist[] = "cdist";
2496 static const char __pyx_k_dtype[] = "dtype";
2497 static const char __pyx_k_empty[] = "empty";
2498 static const char __pyx_k_int16[] = "int16";
2499 static const char __pyx_k_int32[] = "int32";
2500 static const char __pyx_k_int64[] = "int64";
2501 static const char __pyx_k_numpy[] = "numpy";
2502 static const char __pyx_k_range[] = "range";
2503 static const char __pyx_k_ratio[] = "ratio";
2504 static const char __pyx_k_uint8[] = "uint8";
2505 static const char __pyx_k_QRatio[] = "QRatio";
2506 static const char __pyx_k_WRatio[] = "WRatio";
2507 static const char __pyx_k_import[] = "__import__";
2508 static const char __pyx_k_kwargs[] = "kwargs";
2509 static const char __pyx_k_scorer[] = "scorer";
2510 static const char __pyx_k_choices[] = "choices";
2511 static const char __pyx_k_float32[] = "float32";
2512 static const char __pyx_k_float64[] = "float64";
2513 static const char __pyx_k_hamming[] = "hamming";
2514 static const char __pyx_k_queries[] = "queries";
2515 static const char __pyx_k_weights[] = "weights";
2516 static const char __pyx_k_workers[] = "workers";
2517 static const char __pyx_k_typecode[] = "typecode";
2518 static const char __pyx_k_TypeError[] = "TypeError";
2519 static const char __pyx_k_processor[] = "processor";
2520 static const char __pyx_k_ImportError[] = "ImportError";
2521 static const char __pyx_k_MemoryError[] = "MemoryError";
2522 static const char __pyx_k_levenshtein[] = "levenshtein";
2523 static const char __pyx_k_token_ratio[] = "token_ratio";
2524 static const char __pyx_k_initializing[] = "_initializing";
2525 static const char __pyx_k_is_coroutine[] = "_is_coroutine";
2526 static const char __pyx_k_score_cutoff[] = "score_cutoff";
2527 static const char __pyx_k_partial_ratio[] = "partial_ratio";
2528 static const char __pyx_k_prefix_weight[] = "prefix_weight";
2529 static const char __pyx_k_rapidfuzz_fuzz[] = "rapidfuzz.fuzz";
2530 static const char __pyx_k_default_process[] = "default_process";
2531 static const char __pyx_k_jaro_similarity[] = "jaro_similarity";
2532 static const char __pyx_k_rapidfuzz_utils[] = "rapidfuzz.utils";
2533 static const char __pyx_k_token_set_ratio[] = "token_set_ratio";
2534 static const char __pyx_k_token_sort_ratio[] = "token_sort_ratio";
2535 static const char __pyx_k_cpp_process_cdist[] = "cpp_process_cdist";
2536 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
2537 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2538 static const char __pyx_k_normalized_hamming[] = "normalized_hamming";
2539 static const char __pyx_k_partial_token_ratio[] = "partial_token_ratio";
2540 static const char __pyx_k_cpp_process_cdist_pyx[] = "cpp_process_cdist.pyx";
2541 static const char __pyx_k_normalized_levenshtein[] = "normalized_levenshtein";
2542 static const char __pyx_k_jaro_winkler_similarity[] = "jaro_winkler_similarity";
2543 static const char __pyx_k_partial_token_set_ratio[] = "partial_token_set_ratio";
2544 static const char __pyx_k_rapidfuzz_string_metric[] = "rapidfuzz.string_metric";
2545 static const char __pyx_k_partial_token_sort_ratio[] = "partial_token_sort_ratio";
2546 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2547 static const char __pyx_k_invalid_dtype_use_np_int8_np_int[] = "invalid dtype (use np.int8, np.int16, np.int32 or np.int64)";
2548 static const char __pyx_k_invalid_dtype_use_np_uint8_np_fl[] = "invalid dtype (use np.uint8, np.float32 or np.float64)";
2549 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2550 static const char __pyx_k_score_cutoff_has_to_be_in_the_ra[] = "score_cutoff has to be in the range of 0.0 - 100.0";
2551 #if !CYTHON_USE_MODULE_STATE
2552 static PyObject *__pyx_n_s_ImportError;
2553 static PyObject *__pyx_n_s_MemoryError;
2554 static PyObject *__pyx_n_s_QRatio;
2555 static PyObject *__pyx_n_s_TypeError;
2556 static PyObject *__pyx_n_s_WRatio;
2557 static PyObject *__pyx_n_s__10;
2558 static PyObject *__pyx_n_s__8;
2559 static PyObject *__pyx_n_s_array;
2560 static PyObject *__pyx_n_s_asyncio_coroutines;
2561 static PyObject *__pyx_n_s_cdist;
2562 static PyObject *__pyx_n_s_choices;
2563 static PyObject *__pyx_n_s_cline_in_traceback;
2564 static PyObject *__pyx_n_s_cpp_process_cdist;
2565 static PyObject *__pyx_kp_s_cpp_process_cdist_pyx;
2566 static PyObject *__pyx_n_s_default_process;
2567 static PyObject *__pyx_n_s_dtype;
2568 static PyObject *__pyx_n_s_empty;
2569 static PyObject *__pyx_n_s_float32;
2570 static PyObject *__pyx_n_s_float64;
2571 static PyObject *__pyx_n_s_get;
2572 static PyObject *__pyx_n_s_hamming;
2573 static PyObject *__pyx_n_s_import;
2574 static PyObject *__pyx_n_s_initializing;
2575 static PyObject *__pyx_n_s_int16;
2576 static PyObject *__pyx_n_s_int32;
2577 static PyObject *__pyx_n_s_int64;
2578 static PyObject *__pyx_n_s_int8;
2579 static PyObject *__pyx_kp_u_invalid_dtype_use_np_int8_np_int;
2580 static PyObject *__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl;
2581 static PyObject *__pyx_n_s_is_coroutine;
2582 static PyObject *__pyx_n_s_jaro_similarity;
2583 static PyObject *__pyx_n_s_jaro_winkler_similarity;
2584 static PyObject *__pyx_n_s_kwargs;
2585 static PyObject *__pyx_n_s_levenshtein;
2586 static PyObject *__pyx_n_s_main;
2587 static PyObject *__pyx_n_s_name;
2588 static PyObject *__pyx_n_s_normalized_hamming;
2589 static PyObject *__pyx_n_s_normalized_levenshtein;
2590 static PyObject *__pyx_n_s_np;
2591 static PyObject *__pyx_n_s_numpy;
2592 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2593 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2594 static PyObject *__pyx_n_s_partial_ratio;
2595 static PyObject *__pyx_n_s_partial_token_ratio;
2596 static PyObject *__pyx_n_s_partial_token_set_ratio;
2597 static PyObject *__pyx_n_s_partial_token_sort_ratio;
2598 static PyObject *__pyx_n_u_prefix_weight;
2599 static PyObject *__pyx_n_s_processor;
2600 static PyObject *__pyx_n_u_processor;
2601 static PyObject *__pyx_n_s_queries;
2602 static PyObject *__pyx_n_s_range;
2603 static PyObject *__pyx_n_s_rapidfuzz_fuzz;
2604 static PyObject *__pyx_n_s_rapidfuzz_string_metric;
2605 static PyObject *__pyx_n_s_rapidfuzz_utils;
2606 static PyObject *__pyx_n_s_ratio;
2607 static PyObject *__pyx_n_s_score_cutoff;
2608 static PyObject *__pyx_n_u_score_cutoff;
2609 static PyObject *__pyx_kp_u_score_cutoff_has_to_be_in_the_ra;
2610 static PyObject *__pyx_n_s_scorer;
2611 static PyObject *__pyx_n_s_spec;
2612 static PyObject *__pyx_n_s_test;
2613 static PyObject *__pyx_n_s_token_ratio;
2614 static PyObject *__pyx_n_s_token_set_ratio;
2615 static PyObject *__pyx_n_s_token_sort_ratio;
2616 static PyObject *__pyx_n_s_typecode;
2617 static PyObject *__pyx_n_s_uint8;
2618 static PyObject *__pyx_n_u_weights;
2619 static PyObject *__pyx_n_s_workers;
2620 #endif
2621 /* #### Code section: decls ### */
2622 static PyObject *__pyx_pf_17cpp_process_cdist_2__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
2623 static PyObject *__pyx_pf_17cpp_process_cdist_cdist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_queries, PyObject *__pyx_v_choices, PyObject *__pyx_v_scorer, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs); /* proto */
2624 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0};
2625 #if !CYTHON_USE_MODULE_STATE
2626 static PyObject *__pyx_float_0_1;
2627 static PyObject *__pyx_int_1;
2628 static PyObject *__pyx_int_neg_1;
2629 #endif
2630 #if !CYTHON_USE_MODULE_STATE
2631 static PyObject *__pyx_tuple_;
2632 static PyObject *__pyx_tuple__2;
2633 static PyObject *__pyx_tuple__3;
2634 static PyObject *__pyx_tuple__4;
2635 static PyObject *__pyx_tuple__6;
2636 static PyObject *__pyx_tuple__7;
2637 static PyObject *__pyx_tuple__9;
2638 static PyObject *__pyx_codeobj__5;
2639 #endif
2640 /* #### Code section: late_includes ### */
2641 /* #### Code section: module_state ### */
2642 #if CYTHON_USE_MODULE_STATE
2643 typedef struct {
2644 PyObject *__pyx_d;
2645 PyObject *__pyx_b;
2646 PyObject *__pyx_cython_runtime;
2647 PyObject *__pyx_empty_tuple;
2648 PyObject *__pyx_empty_bytes;
2649 PyObject *__pyx_empty_unicode;
2650 #ifdef __Pyx_CyFunction_USED
2651 PyTypeObject *__pyx_CyFunctionType;
2652 #endif
2653 #ifdef __Pyx_FusedFunction_USED
2654 PyTypeObject *__pyx_FusedFunctionType;
2655 #endif
2656 PyTypeObject *__pyx_ptype_7cpython_4type_type;
2657 PyTypeObject *__pyx_ptype_5numpy_dtype;
2658 PyTypeObject *__pyx_ptype_5numpy_flatiter;
2659 PyTypeObject *__pyx_ptype_5numpy_broadcast;
2660 PyTypeObject *__pyx_ptype_5numpy_ndarray;
2661 PyTypeObject *__pyx_ptype_5numpy_generic;
2662 PyTypeObject *__pyx_ptype_5numpy_number;
2663 PyTypeObject *__pyx_ptype_5numpy_integer;
2664 PyTypeObject *__pyx_ptype_5numpy_signedinteger;
2665 PyTypeObject *__pyx_ptype_5numpy_unsignedinteger;
2666 PyTypeObject *__pyx_ptype_5numpy_inexact;
2667 PyTypeObject *__pyx_ptype_5numpy_floating;
2668 PyTypeObject *__pyx_ptype_5numpy_complexfloating;
2669 PyTypeObject *__pyx_ptype_5numpy_flexible;
2670 PyTypeObject *__pyx_ptype_5numpy_character;
2671 PyTypeObject *__pyx_ptype_5numpy_ufunc;
2672 PyObject *__pyx_n_s_ImportError;
2673 PyObject *__pyx_n_s_MemoryError;
2674 PyObject *__pyx_n_s_QRatio;
2675 PyObject *__pyx_n_s_TypeError;
2676 PyObject *__pyx_n_s_WRatio;
2677 PyObject *__pyx_n_s__10;
2678 PyObject *__pyx_n_s__8;
2679 PyObject *__pyx_n_s_array;
2680 PyObject *__pyx_n_s_asyncio_coroutines;
2681 PyObject *__pyx_n_s_cdist;
2682 PyObject *__pyx_n_s_choices;
2683 PyObject *__pyx_n_s_cline_in_traceback;
2684 PyObject *__pyx_n_s_cpp_process_cdist;
2685 PyObject *__pyx_kp_s_cpp_process_cdist_pyx;
2686 PyObject *__pyx_n_s_default_process;
2687 PyObject *__pyx_n_s_dtype;
2688 PyObject *__pyx_n_s_empty;
2689 PyObject *__pyx_n_s_float32;
2690 PyObject *__pyx_n_s_float64;
2691 PyObject *__pyx_n_s_get;
2692 PyObject *__pyx_n_s_hamming;
2693 PyObject *__pyx_n_s_import;
2694 PyObject *__pyx_n_s_initializing;
2695 PyObject *__pyx_n_s_int16;
2696 PyObject *__pyx_n_s_int32;
2697 PyObject *__pyx_n_s_int64;
2698 PyObject *__pyx_n_s_int8;
2699 PyObject *__pyx_kp_u_invalid_dtype_use_np_int8_np_int;
2700 PyObject *__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl;
2701 PyObject *__pyx_n_s_is_coroutine;
2702 PyObject *__pyx_n_s_jaro_similarity;
2703 PyObject *__pyx_n_s_jaro_winkler_similarity;
2704 PyObject *__pyx_n_s_kwargs;
2705 PyObject *__pyx_n_s_levenshtein;
2706 PyObject *__pyx_n_s_main;
2707 PyObject *__pyx_n_s_name;
2708 PyObject *__pyx_n_s_normalized_hamming;
2709 PyObject *__pyx_n_s_normalized_levenshtein;
2710 PyObject *__pyx_n_s_np;
2711 PyObject *__pyx_n_s_numpy;
2712 PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2713 PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2714 PyObject *__pyx_n_s_partial_ratio;
2715 PyObject *__pyx_n_s_partial_token_ratio;
2716 PyObject *__pyx_n_s_partial_token_set_ratio;
2717 PyObject *__pyx_n_s_partial_token_sort_ratio;
2718 PyObject *__pyx_n_u_prefix_weight;
2719 PyObject *__pyx_n_s_processor;
2720 PyObject *__pyx_n_u_processor;
2721 PyObject *__pyx_n_s_queries;
2722 PyObject *__pyx_n_s_range;
2723 PyObject *__pyx_n_s_rapidfuzz_fuzz;
2724 PyObject *__pyx_n_s_rapidfuzz_string_metric;
2725 PyObject *__pyx_n_s_rapidfuzz_utils;
2726 PyObject *__pyx_n_s_ratio;
2727 PyObject *__pyx_n_s_score_cutoff;
2728 PyObject *__pyx_n_u_score_cutoff;
2729 PyObject *__pyx_kp_u_score_cutoff_has_to_be_in_the_ra;
2730 PyObject *__pyx_n_s_scorer;
2731 PyObject *__pyx_n_s_spec;
2732 PyObject *__pyx_n_s_test;
2733 PyObject *__pyx_n_s_token_ratio;
2734 PyObject *__pyx_n_s_token_set_ratio;
2735 PyObject *__pyx_n_s_token_sort_ratio;
2736 PyObject *__pyx_n_s_typecode;
2737 PyObject *__pyx_n_s_uint8;
2738 PyObject *__pyx_n_u_weights;
2739 PyObject *__pyx_n_s_workers;
2740 PyObject *__pyx_float_0_1;
2741 PyObject *__pyx_int_1;
2742 PyObject *__pyx_int_neg_1;
2743 PyObject *__pyx_tuple_;
2744 PyObject *__pyx_tuple__2;
2745 PyObject *__pyx_tuple__3;
2746 PyObject *__pyx_tuple__4;
2747 PyObject *__pyx_tuple__6;
2748 PyObject *__pyx_tuple__7;
2749 PyObject *__pyx_tuple__9;
2750 PyObject *__pyx_codeobj__5;
2751 } __pyx_mstate;
2752
2753 #ifdef __cplusplus
2754 namespace {
2755 extern struct PyModuleDef __pyx_moduledef;
2756 } /* anonymous namespace */
2757 #else
2758 static struct PyModuleDef __pyx_moduledef;
2759 #endif
2760
2761 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
2762
2763 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
2764
2765 #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
2766 #endif
2767 /* #### Code section: module_state_clear ### */
2768 #if CYTHON_USE_MODULE_STATE
__pyx_m_clear(PyObject * m)2769 static int __pyx_m_clear(PyObject *m) {
2770 __pyx_mstate *clear_module_state = __pyx_mstate(m);
2771 if (!clear_module_state) return 0;
2772 Py_CLEAR(clear_module_state->__pyx_d);
2773 Py_CLEAR(clear_module_state->__pyx_b);
2774 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
2775 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
2776 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
2777 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
2778 #ifdef __Pyx_CyFunction_USED
2779 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
2780 #endif
2781 #ifdef __Pyx_FusedFunction_USED
2782 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
2783 #endif
2784 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
2785 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype);
2786 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter);
2787 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast);
2788 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray);
2789 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic);
2790 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number);
2791 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer);
2792 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger);
2793 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger);
2794 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact);
2795 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating);
2796 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating);
2797 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible);
2798 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character);
2799 Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc);
2800 Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
2801 Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
2802 Py_CLEAR(clear_module_state->__pyx_n_s_QRatio);
2803 Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
2804 Py_CLEAR(clear_module_state->__pyx_n_s_WRatio);
2805 Py_CLEAR(clear_module_state->__pyx_n_s__10);
2806 Py_CLEAR(clear_module_state->__pyx_n_s__8);
2807 Py_CLEAR(clear_module_state->__pyx_n_s_array);
2808 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
2809 Py_CLEAR(clear_module_state->__pyx_n_s_cdist);
2810 Py_CLEAR(clear_module_state->__pyx_n_s_choices);
2811 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
2812 Py_CLEAR(clear_module_state->__pyx_n_s_cpp_process_cdist);
2813 Py_CLEAR(clear_module_state->__pyx_kp_s_cpp_process_cdist_pyx);
2814 Py_CLEAR(clear_module_state->__pyx_n_s_default_process);
2815 Py_CLEAR(clear_module_state->__pyx_n_s_dtype);
2816 Py_CLEAR(clear_module_state->__pyx_n_s_empty);
2817 Py_CLEAR(clear_module_state->__pyx_n_s_float32);
2818 Py_CLEAR(clear_module_state->__pyx_n_s_float64);
2819 Py_CLEAR(clear_module_state->__pyx_n_s_get);
2820 Py_CLEAR(clear_module_state->__pyx_n_s_hamming);
2821 Py_CLEAR(clear_module_state->__pyx_n_s_import);
2822 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
2823 Py_CLEAR(clear_module_state->__pyx_n_s_int16);
2824 Py_CLEAR(clear_module_state->__pyx_n_s_int32);
2825 Py_CLEAR(clear_module_state->__pyx_n_s_int64);
2826 Py_CLEAR(clear_module_state->__pyx_n_s_int8);
2827 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_dtype_use_np_int8_np_int);
2828 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl);
2829 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
2830 Py_CLEAR(clear_module_state->__pyx_n_s_jaro_similarity);
2831 Py_CLEAR(clear_module_state->__pyx_n_s_jaro_winkler_similarity);
2832 Py_CLEAR(clear_module_state->__pyx_n_s_kwargs);
2833 Py_CLEAR(clear_module_state->__pyx_n_s_levenshtein);
2834 Py_CLEAR(clear_module_state->__pyx_n_s_main);
2835 Py_CLEAR(clear_module_state->__pyx_n_s_name);
2836 Py_CLEAR(clear_module_state->__pyx_n_s_normalized_hamming);
2837 Py_CLEAR(clear_module_state->__pyx_n_s_normalized_levenshtein);
2838 Py_CLEAR(clear_module_state->__pyx_n_s_np);
2839 Py_CLEAR(clear_module_state->__pyx_n_s_numpy);
2840 Py_CLEAR(clear_module_state->__pyx_kp_u_numpy_core_multiarray_failed_to);
2841 Py_CLEAR(clear_module_state->__pyx_kp_u_numpy_core_umath_failed_to_impor);
2842 Py_CLEAR(clear_module_state->__pyx_n_s_partial_ratio);
2843 Py_CLEAR(clear_module_state->__pyx_n_s_partial_token_ratio);
2844 Py_CLEAR(clear_module_state->__pyx_n_s_partial_token_set_ratio);
2845 Py_CLEAR(clear_module_state->__pyx_n_s_partial_token_sort_ratio);
2846 Py_CLEAR(clear_module_state->__pyx_n_u_prefix_weight);
2847 Py_CLEAR(clear_module_state->__pyx_n_s_processor);
2848 Py_CLEAR(clear_module_state->__pyx_n_u_processor);
2849 Py_CLEAR(clear_module_state->__pyx_n_s_queries);
2850 Py_CLEAR(clear_module_state->__pyx_n_s_range);
2851 Py_CLEAR(clear_module_state->__pyx_n_s_rapidfuzz_fuzz);
2852 Py_CLEAR(clear_module_state->__pyx_n_s_rapidfuzz_string_metric);
2853 Py_CLEAR(clear_module_state->__pyx_n_s_rapidfuzz_utils);
2854 Py_CLEAR(clear_module_state->__pyx_n_s_ratio);
2855 Py_CLEAR(clear_module_state->__pyx_n_s_score_cutoff);
2856 Py_CLEAR(clear_module_state->__pyx_n_u_score_cutoff);
2857 Py_CLEAR(clear_module_state->__pyx_kp_u_score_cutoff_has_to_be_in_the_ra);
2858 Py_CLEAR(clear_module_state->__pyx_n_s_scorer);
2859 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
2860 Py_CLEAR(clear_module_state->__pyx_n_s_test);
2861 Py_CLEAR(clear_module_state->__pyx_n_s_token_ratio);
2862 Py_CLEAR(clear_module_state->__pyx_n_s_token_set_ratio);
2863 Py_CLEAR(clear_module_state->__pyx_n_s_token_sort_ratio);
2864 Py_CLEAR(clear_module_state->__pyx_n_s_typecode);
2865 Py_CLEAR(clear_module_state->__pyx_n_s_uint8);
2866 Py_CLEAR(clear_module_state->__pyx_n_u_weights);
2867 Py_CLEAR(clear_module_state->__pyx_n_s_workers);
2868 Py_CLEAR(clear_module_state->__pyx_float_0_1);
2869 Py_CLEAR(clear_module_state->__pyx_int_1);
2870 Py_CLEAR(clear_module_state->__pyx_int_neg_1);
2871 Py_CLEAR(clear_module_state->__pyx_tuple_);
2872 Py_CLEAR(clear_module_state->__pyx_tuple__2);
2873 Py_CLEAR(clear_module_state->__pyx_tuple__3);
2874 Py_CLEAR(clear_module_state->__pyx_tuple__4);
2875 Py_CLEAR(clear_module_state->__pyx_tuple__6);
2876 Py_CLEAR(clear_module_state->__pyx_tuple__7);
2877 Py_CLEAR(clear_module_state->__pyx_tuple__9);
2878 Py_CLEAR(clear_module_state->__pyx_codeobj__5);
2879 return 0;
2880 }
2881 #endif
2882 /* #### Code section: module_state_traverse ### */
2883 #if CYTHON_USE_MODULE_STATE
__pyx_m_traverse(PyObject * m,visitproc visit,void * arg)2884 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2885 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
2886 if (!traverse_module_state) return 0;
2887 Py_VISIT(traverse_module_state->__pyx_d);
2888 Py_VISIT(traverse_module_state->__pyx_b);
2889 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
2890 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
2891 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
2892 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
2893 #ifdef __Pyx_CyFunction_USED
2894 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
2895 #endif
2896 #ifdef __Pyx_FusedFunction_USED
2897 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
2898 #endif
2899 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
2900 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype);
2901 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter);
2902 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast);
2903 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray);
2904 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic);
2905 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number);
2906 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer);
2907 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger);
2908 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger);
2909 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact);
2910 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating);
2911 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating);
2912 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible);
2913 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character);
2914 Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc);
2915 Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
2916 Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
2917 Py_VISIT(traverse_module_state->__pyx_n_s_QRatio);
2918 Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
2919 Py_VISIT(traverse_module_state->__pyx_n_s_WRatio);
2920 Py_VISIT(traverse_module_state->__pyx_n_s__10);
2921 Py_VISIT(traverse_module_state->__pyx_n_s__8);
2922 Py_VISIT(traverse_module_state->__pyx_n_s_array);
2923 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
2924 Py_VISIT(traverse_module_state->__pyx_n_s_cdist);
2925 Py_VISIT(traverse_module_state->__pyx_n_s_choices);
2926 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
2927 Py_VISIT(traverse_module_state->__pyx_n_s_cpp_process_cdist);
2928 Py_VISIT(traverse_module_state->__pyx_kp_s_cpp_process_cdist_pyx);
2929 Py_VISIT(traverse_module_state->__pyx_n_s_default_process);
2930 Py_VISIT(traverse_module_state->__pyx_n_s_dtype);
2931 Py_VISIT(traverse_module_state->__pyx_n_s_empty);
2932 Py_VISIT(traverse_module_state->__pyx_n_s_float32);
2933 Py_VISIT(traverse_module_state->__pyx_n_s_float64);
2934 Py_VISIT(traverse_module_state->__pyx_n_s_get);
2935 Py_VISIT(traverse_module_state->__pyx_n_s_hamming);
2936 Py_VISIT(traverse_module_state->__pyx_n_s_import);
2937 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
2938 Py_VISIT(traverse_module_state->__pyx_n_s_int16);
2939 Py_VISIT(traverse_module_state->__pyx_n_s_int32);
2940 Py_VISIT(traverse_module_state->__pyx_n_s_int64);
2941 Py_VISIT(traverse_module_state->__pyx_n_s_int8);
2942 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_dtype_use_np_int8_np_int);
2943 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl);
2944 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
2945 Py_VISIT(traverse_module_state->__pyx_n_s_jaro_similarity);
2946 Py_VISIT(traverse_module_state->__pyx_n_s_jaro_winkler_similarity);
2947 Py_VISIT(traverse_module_state->__pyx_n_s_kwargs);
2948 Py_VISIT(traverse_module_state->__pyx_n_s_levenshtein);
2949 Py_VISIT(traverse_module_state->__pyx_n_s_main);
2950 Py_VISIT(traverse_module_state->__pyx_n_s_name);
2951 Py_VISIT(traverse_module_state->__pyx_n_s_normalized_hamming);
2952 Py_VISIT(traverse_module_state->__pyx_n_s_normalized_levenshtein);
2953 Py_VISIT(traverse_module_state->__pyx_n_s_np);
2954 Py_VISIT(traverse_module_state->__pyx_n_s_numpy);
2955 Py_VISIT(traverse_module_state->__pyx_kp_u_numpy_core_multiarray_failed_to);
2956 Py_VISIT(traverse_module_state->__pyx_kp_u_numpy_core_umath_failed_to_impor);
2957 Py_VISIT(traverse_module_state->__pyx_n_s_partial_ratio);
2958 Py_VISIT(traverse_module_state->__pyx_n_s_partial_token_ratio);
2959 Py_VISIT(traverse_module_state->__pyx_n_s_partial_token_set_ratio);
2960 Py_VISIT(traverse_module_state->__pyx_n_s_partial_token_sort_ratio);
2961 Py_VISIT(traverse_module_state->__pyx_n_u_prefix_weight);
2962 Py_VISIT(traverse_module_state->__pyx_n_s_processor);
2963 Py_VISIT(traverse_module_state->__pyx_n_u_processor);
2964 Py_VISIT(traverse_module_state->__pyx_n_s_queries);
2965 Py_VISIT(traverse_module_state->__pyx_n_s_range);
2966 Py_VISIT(traverse_module_state->__pyx_n_s_rapidfuzz_fuzz);
2967 Py_VISIT(traverse_module_state->__pyx_n_s_rapidfuzz_string_metric);
2968 Py_VISIT(traverse_module_state->__pyx_n_s_rapidfuzz_utils);
2969 Py_VISIT(traverse_module_state->__pyx_n_s_ratio);
2970 Py_VISIT(traverse_module_state->__pyx_n_s_score_cutoff);
2971 Py_VISIT(traverse_module_state->__pyx_n_u_score_cutoff);
2972 Py_VISIT(traverse_module_state->__pyx_kp_u_score_cutoff_has_to_be_in_the_ra);
2973 Py_VISIT(traverse_module_state->__pyx_n_s_scorer);
2974 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
2975 Py_VISIT(traverse_module_state->__pyx_n_s_test);
2976 Py_VISIT(traverse_module_state->__pyx_n_s_token_ratio);
2977 Py_VISIT(traverse_module_state->__pyx_n_s_token_set_ratio);
2978 Py_VISIT(traverse_module_state->__pyx_n_s_token_sort_ratio);
2979 Py_VISIT(traverse_module_state->__pyx_n_s_typecode);
2980 Py_VISIT(traverse_module_state->__pyx_n_s_uint8);
2981 Py_VISIT(traverse_module_state->__pyx_n_u_weights);
2982 Py_VISIT(traverse_module_state->__pyx_n_s_workers);
2983 Py_VISIT(traverse_module_state->__pyx_float_0_1);
2984 Py_VISIT(traverse_module_state->__pyx_int_1);
2985 Py_VISIT(traverse_module_state->__pyx_int_neg_1);
2986 Py_VISIT(traverse_module_state->__pyx_tuple_);
2987 Py_VISIT(traverse_module_state->__pyx_tuple__2);
2988 Py_VISIT(traverse_module_state->__pyx_tuple__3);
2989 Py_VISIT(traverse_module_state->__pyx_tuple__4);
2990 Py_VISIT(traverse_module_state->__pyx_tuple__6);
2991 Py_VISIT(traverse_module_state->__pyx_tuple__7);
2992 Py_VISIT(traverse_module_state->__pyx_tuple__9);
2993 Py_VISIT(traverse_module_state->__pyx_codeobj__5);
2994 return 0;
2995 }
2996 #endif
2997 /* #### Code section: module_state_defines ### */
2998 #if CYTHON_USE_MODULE_STATE
2999 #define __pyx_d __pyx_mstate_global->__pyx_d
3000 #define __pyx_b __pyx_mstate_global->__pyx_b
3001 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
3002 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
3003 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
3004 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
3005 #ifdef __Pyx_CyFunction_USED
3006 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
3007 #endif
3008 #ifdef __Pyx_FusedFunction_USED
3009 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
3010 #endif
3011 #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
3012 #define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype
3013 #define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter
3014 #define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast
3015 #define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray
3016 #define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic
3017 #define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number
3018 #define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer
3019 #define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger
3020 #define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger
3021 #define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact
3022 #define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating
3023 #define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating
3024 #define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible
3025 #define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character
3026 #define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc
3027 #define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
3028 #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
3029 #define __pyx_n_s_QRatio __pyx_mstate_global->__pyx_n_s_QRatio
3030 #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
3031 #define __pyx_n_s_WRatio __pyx_mstate_global->__pyx_n_s_WRatio
3032 #define __pyx_n_s__10 __pyx_mstate_global->__pyx_n_s__10
3033 #define __pyx_n_s__8 __pyx_mstate_global->__pyx_n_s__8
3034 #define __pyx_n_s_array __pyx_mstate_global->__pyx_n_s_array
3035 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
3036 #define __pyx_n_s_cdist __pyx_mstate_global->__pyx_n_s_cdist
3037 #define __pyx_n_s_choices __pyx_mstate_global->__pyx_n_s_choices
3038 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
3039 #define __pyx_n_s_cpp_process_cdist __pyx_mstate_global->__pyx_n_s_cpp_process_cdist
3040 #define __pyx_kp_s_cpp_process_cdist_pyx __pyx_mstate_global->__pyx_kp_s_cpp_process_cdist_pyx
3041 #define __pyx_n_s_default_process __pyx_mstate_global->__pyx_n_s_default_process
3042 #define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype
3043 #define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty
3044 #define __pyx_n_s_float32 __pyx_mstate_global->__pyx_n_s_float32
3045 #define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64
3046 #define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get
3047 #define __pyx_n_s_hamming __pyx_mstate_global->__pyx_n_s_hamming
3048 #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
3049 #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
3050 #define __pyx_n_s_int16 __pyx_mstate_global->__pyx_n_s_int16
3051 #define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32
3052 #define __pyx_n_s_int64 __pyx_mstate_global->__pyx_n_s_int64
3053 #define __pyx_n_s_int8 __pyx_mstate_global->__pyx_n_s_int8
3054 #define __pyx_kp_u_invalid_dtype_use_np_int8_np_int __pyx_mstate_global->__pyx_kp_u_invalid_dtype_use_np_int8_np_int
3055 #define __pyx_kp_u_invalid_dtype_use_np_uint8_np_fl __pyx_mstate_global->__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl
3056 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
3057 #define __pyx_n_s_jaro_similarity __pyx_mstate_global->__pyx_n_s_jaro_similarity
3058 #define __pyx_n_s_jaro_winkler_similarity __pyx_mstate_global->__pyx_n_s_jaro_winkler_similarity
3059 #define __pyx_n_s_kwargs __pyx_mstate_global->__pyx_n_s_kwargs
3060 #define __pyx_n_s_levenshtein __pyx_mstate_global->__pyx_n_s_levenshtein
3061 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
3062 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
3063 #define __pyx_n_s_normalized_hamming __pyx_mstate_global->__pyx_n_s_normalized_hamming
3064 #define __pyx_n_s_normalized_levenshtein __pyx_mstate_global->__pyx_n_s_normalized_levenshtein
3065 #define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np
3066 #define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy
3067 #define __pyx_kp_u_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_u_numpy_core_multiarray_failed_to
3068 #define __pyx_kp_u_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_u_numpy_core_umath_failed_to_impor
3069 #define __pyx_n_s_partial_ratio __pyx_mstate_global->__pyx_n_s_partial_ratio
3070 #define __pyx_n_s_partial_token_ratio __pyx_mstate_global->__pyx_n_s_partial_token_ratio
3071 #define __pyx_n_s_partial_token_set_ratio __pyx_mstate_global->__pyx_n_s_partial_token_set_ratio
3072 #define __pyx_n_s_partial_token_sort_ratio __pyx_mstate_global->__pyx_n_s_partial_token_sort_ratio
3073 #define __pyx_n_u_prefix_weight __pyx_mstate_global->__pyx_n_u_prefix_weight
3074 #define __pyx_n_s_processor __pyx_mstate_global->__pyx_n_s_processor
3075 #define __pyx_n_u_processor __pyx_mstate_global->__pyx_n_u_processor
3076 #define __pyx_n_s_queries __pyx_mstate_global->__pyx_n_s_queries
3077 #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
3078 #define __pyx_n_s_rapidfuzz_fuzz __pyx_mstate_global->__pyx_n_s_rapidfuzz_fuzz
3079 #define __pyx_n_s_rapidfuzz_string_metric __pyx_mstate_global->__pyx_n_s_rapidfuzz_string_metric
3080 #define __pyx_n_s_rapidfuzz_utils __pyx_mstate_global->__pyx_n_s_rapidfuzz_utils
3081 #define __pyx_n_s_ratio __pyx_mstate_global->__pyx_n_s_ratio
3082 #define __pyx_n_s_score_cutoff __pyx_mstate_global->__pyx_n_s_score_cutoff
3083 #define __pyx_n_u_score_cutoff __pyx_mstate_global->__pyx_n_u_score_cutoff
3084 #define __pyx_kp_u_score_cutoff_has_to_be_in_the_ra __pyx_mstate_global->__pyx_kp_u_score_cutoff_has_to_be_in_the_ra
3085 #define __pyx_n_s_scorer __pyx_mstate_global->__pyx_n_s_scorer
3086 #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
3087 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
3088 #define __pyx_n_s_token_ratio __pyx_mstate_global->__pyx_n_s_token_ratio
3089 #define __pyx_n_s_token_set_ratio __pyx_mstate_global->__pyx_n_s_token_set_ratio
3090 #define __pyx_n_s_token_sort_ratio __pyx_mstate_global->__pyx_n_s_token_sort_ratio
3091 #define __pyx_n_s_typecode __pyx_mstate_global->__pyx_n_s_typecode
3092 #define __pyx_n_s_uint8 __pyx_mstate_global->__pyx_n_s_uint8
3093 #define __pyx_n_u_weights __pyx_mstate_global->__pyx_n_u_weights
3094 #define __pyx_n_s_workers __pyx_mstate_global->__pyx_n_s_workers
3095 #define __pyx_float_0_1 __pyx_mstate_global->__pyx_float_0_1
3096 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
3097 #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
3098 #define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_
3099 #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
3100 #define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3
3101 #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
3102 #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
3103 #define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7
3104 #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
3105 #define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5
3106 #endif
3107 /* #### Code section: module_code ### */
3108
3109 /* "cpp_process_cdist.pyx":48
3110 * np.import_array()
3111 *
3112 * cdef inline proc_string conv_sequence(seq) except *: # <<<<<<<<<<<<<<
3113 * if is_valid_string(seq):
3114 * return move(convert_string(seq))
3115 */
3116
__pyx_f_17cpp_process_cdist_conv_sequence(PyObject * __pyx_v_seq)3117 static CYTHON_INLINE proc_string __pyx_f_17cpp_process_cdist_conv_sequence(PyObject *__pyx_v_seq) {
3118 proc_string __pyx_r;
3119 __Pyx_TraceDeclarations
3120 __Pyx_RefNannyDeclarations
3121 int __pyx_t_1;
3122 int __pyx_t_2;
3123 PyObject *__pyx_t_3 = NULL;
3124 int __pyx_t_4;
3125 proc_string __pyx_t_5;
3126 int __pyx_lineno = 0;
3127 const char *__pyx_filename = NULL;
3128 int __pyx_clineno = 0;
3129 __Pyx_RefNannySetupContext("conv_sequence", 0);
3130 __Pyx_TraceCall("conv_sequence", __pyx_f[0], 48, 0, __PYX_ERR(0, 48, __pyx_L1_error));
3131
3132 /* "cpp_process_cdist.pyx":49
3133 *
3134 * cdef inline proc_string conv_sequence(seq) except *:
3135 * if is_valid_string(seq): # <<<<<<<<<<<<<<
3136 * return move(convert_string(seq))
3137 * elif isinstance(seq, array):
3138 */
3139 __Pyx_TraceLine(49,0,__PYX_ERR(0, 49, __pyx_L1_error))
3140 try {
3141 __pyx_t_1 = is_valid_string(__pyx_v_seq);
3142 } catch(...) {
3143 __Pyx_CppExn2PyErr();
3144 __PYX_ERR(0, 49, __pyx_L1_error)
3145 }
3146 __pyx_t_2 = (__pyx_t_1 != 0);
3147 if (__pyx_t_2) {
3148
3149 /* "cpp_process_cdist.pyx":50
3150 * cdef inline proc_string conv_sequence(seq) except *:
3151 * if is_valid_string(seq):
3152 * return move(convert_string(seq)) # <<<<<<<<<<<<<<
3153 * elif isinstance(seq, array):
3154 * return move(hash_array(seq))
3155 */
3156 __Pyx_TraceLine(50,0,__PYX_ERR(0, 50, __pyx_L1_error))
3157 __pyx_r = cython_std::move<proc_string>(convert_string(__pyx_v_seq));
3158 goto __pyx_L0;
3159
3160 /* "cpp_process_cdist.pyx":49
3161 *
3162 * cdef inline proc_string conv_sequence(seq) except *:
3163 * if is_valid_string(seq): # <<<<<<<<<<<<<<
3164 * return move(convert_string(seq))
3165 * elif isinstance(seq, array):
3166 */
3167 }
3168
3169 /* "cpp_process_cdist.pyx":51
3170 * if is_valid_string(seq):
3171 * return move(convert_string(seq))
3172 * elif isinstance(seq, array): # <<<<<<<<<<<<<<
3173 * return move(hash_array(seq))
3174 * else:
3175 */
3176 __Pyx_TraceLine(51,0,__PYX_ERR(0, 51, __pyx_L1_error))
3177 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
3178 __Pyx_GOTREF(__pyx_t_3);
3179 __pyx_t_2 = PyObject_IsInstance(__pyx_v_seq, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 51, __pyx_L1_error)
3180 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3181 __pyx_t_4 = (__pyx_t_2 != 0);
3182 if (__pyx_t_4) {
3183
3184 /* "cpp_process_cdist.pyx":52
3185 * return move(convert_string(seq))
3186 * elif isinstance(seq, array):
3187 * return move(hash_array(seq)) # <<<<<<<<<<<<<<
3188 * else:
3189 * return move(hash_sequence(seq))
3190 */
3191 __Pyx_TraceLine(52,0,__PYX_ERR(0, 52, __pyx_L1_error))
3192 __pyx_t_5 = __pyx_f_10cpp_common_hash_array(__pyx_v_seq); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error)
3193 __pyx_r = cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5));
3194 goto __pyx_L0;
3195
3196 /* "cpp_process_cdist.pyx":51
3197 * if is_valid_string(seq):
3198 * return move(convert_string(seq))
3199 * elif isinstance(seq, array): # <<<<<<<<<<<<<<
3200 * return move(hash_array(seq))
3201 * else:
3202 */
3203 }
3204
3205 /* "cpp_process_cdist.pyx":54
3206 * return move(hash_array(seq))
3207 * else:
3208 * return move(hash_sequence(seq)) # <<<<<<<<<<<<<<
3209 *
3210 * cdef extern from "rapidfuzz/details/types.hpp" namespace "rapidfuzz" nogil:
3211 */
3212 __Pyx_TraceLine(54,0,__PYX_ERR(0, 54, __pyx_L1_error))
3213 /*else*/ {
3214 __pyx_t_5 = __pyx_f_10cpp_common_hash_sequence(__pyx_v_seq); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
3215 __pyx_r = cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5));
3216 goto __pyx_L0;
3217 }
3218
3219 /* "cpp_process_cdist.pyx":48
3220 * np.import_array()
3221 *
3222 * cdef inline proc_string conv_sequence(seq) except *: # <<<<<<<<<<<<<<
3223 * if is_valid_string(seq):
3224 * return move(convert_string(seq))
3225 */
3226
3227 /* function exit code */
3228 __pyx_L1_error:;
3229 __Pyx_XDECREF(__pyx_t_3);
3230 __Pyx_AddTraceback("cpp_process_cdist.conv_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
3231 __Pyx_pretend_to_initialize(&__pyx_r);
3232 __pyx_L0:;
3233 __Pyx_TraceReturn(Py_None, 0);
3234 __Pyx_RefNannyFinishContext();
3235 return __pyx_r;
3236 }
3237
3238 /* "cpp_process_cdist.pyx":122
3239 * void set_score_similarity(np.PyArrayObject*, int, np.npy_intp, np.npy_intp, double)
3240 *
3241 * cdef KwargsContext LevenshteinKwargsInit(dict kwargs) except *: # <<<<<<<<<<<<<<
3242 * cdef KwargsContext context
3243 * cdef LevenshteinWeightTable* weights
3244 */
3245
__pyx_f_17cpp_process_cdist_LevenshteinKwargsInit(PyObject * __pyx_v_kwargs)3246 static KwargsContext __pyx_f_17cpp_process_cdist_LevenshteinKwargsInit(PyObject *__pyx_v_kwargs) {
3247 KwargsContext __pyx_v_context;
3248 struct rapidfuzz::LevenshteinWeightTable *__pyx_v_weights;
3249 size_t __pyx_v_insertion;
3250 size_t __pyx_v_deletion;
3251 size_t __pyx_v_substitution;
3252 KwargsContext __pyx_r;
3253 __Pyx_TraceDeclarations
3254 __Pyx_RefNannyDeclarations
3255 int __pyx_t_1;
3256 PyObject *__pyx_t_2 = NULL;
3257 PyObject *__pyx_t_3 = NULL;
3258 PyObject *__pyx_t_4 = NULL;
3259 PyObject *__pyx_t_5 = NULL;
3260 PyObject *__pyx_t_6 = NULL;
3261 PyObject *(*__pyx_t_7)(PyObject *);
3262 size_t __pyx_t_8;
3263 size_t __pyx_t_9;
3264 size_t __pyx_t_10;
3265 int __pyx_lineno = 0;
3266 const char *__pyx_filename = NULL;
3267 int __pyx_clineno = 0;
3268 __Pyx_RefNannySetupContext("LevenshteinKwargsInit", 0);
3269 __Pyx_TraceCall("LevenshteinKwargsInit", __pyx_f[0], 122, 0, __PYX_ERR(0, 122, __pyx_L1_error));
3270
3271 /* "cpp_process_cdist.pyx":126
3272 * cdef LevenshteinWeightTable* weights
3273 * cdef size_t insertion, deletion, substitution
3274 * weights = <LevenshteinWeightTable*>malloc(sizeof(LevenshteinWeightTable)) # <<<<<<<<<<<<<<
3275 *
3276 * if (NULL == weights):
3277 */
3278 __Pyx_TraceLine(126,0,__PYX_ERR(0, 126, __pyx_L1_error))
3279 __pyx_v_weights = ((struct rapidfuzz::LevenshteinWeightTable *)malloc((sizeof(struct rapidfuzz::LevenshteinWeightTable))));
3280
3281 /* "cpp_process_cdist.pyx":128
3282 * weights = <LevenshteinWeightTable*>malloc(sizeof(LevenshteinWeightTable))
3283 *
3284 * if (NULL == weights): # <<<<<<<<<<<<<<
3285 * raise MemoryError
3286 *
3287 */
3288 __Pyx_TraceLine(128,0,__PYX_ERR(0, 128, __pyx_L1_error))
3289 __pyx_t_1 = ((NULL == __pyx_v_weights) != 0);
3290 if (unlikely(__pyx_t_1)) {
3291
3292 /* "cpp_process_cdist.pyx":129
3293 *
3294 * if (NULL == weights):
3295 * raise MemoryError # <<<<<<<<<<<<<<
3296 *
3297 * insertion, deletion, substitution = kwargs.get("weights", (1, 1, 1))
3298 */
3299 __Pyx_TraceLine(129,0,__PYX_ERR(0, 129, __pyx_L1_error))
3300 PyErr_NoMemory(); __PYX_ERR(0, 129, __pyx_L1_error)
3301
3302 /* "cpp_process_cdist.pyx":128
3303 * weights = <LevenshteinWeightTable*>malloc(sizeof(LevenshteinWeightTable))
3304 *
3305 * if (NULL == weights): # <<<<<<<<<<<<<<
3306 * raise MemoryError
3307 *
3308 */
3309 }
3310
3311 /* "cpp_process_cdist.pyx":131
3312 * raise MemoryError
3313 *
3314 * insertion, deletion, substitution = kwargs.get("weights", (1, 1, 1)) # <<<<<<<<<<<<<<
3315 * dereference(weights).insert_cost = insertion
3316 * dereference(weights).delete_cost = deletion
3317 */
3318 __Pyx_TraceLine(131,0,__PYX_ERR(0, 131, __pyx_L1_error))
3319 if (unlikely(__pyx_v_kwargs == Py_None)) {
3320 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
3321 __PYX_ERR(0, 131, __pyx_L1_error)
3322 }
3323 __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_weights, __pyx_tuple_); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
3324 __Pyx_GOTREF(__pyx_t_2);
3325 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
3326 PyObject* sequence = __pyx_t_2;
3327 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3328 if (unlikely(size != 3)) {
3329 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
3330 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3331 __PYX_ERR(0, 131, __pyx_L1_error)
3332 }
3333 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3334 if (likely(PyTuple_CheckExact(sequence))) {
3335 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
3336 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
3337 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
3338 } else {
3339 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
3340 __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
3341 __pyx_t_5 = PyList_GET_ITEM(sequence, 2);
3342 }
3343 __Pyx_INCREF(__pyx_t_3);
3344 __Pyx_INCREF(__pyx_t_4);
3345 __Pyx_INCREF(__pyx_t_5);
3346 #else
3347 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error)
3348 __Pyx_GOTREF(__pyx_t_3);
3349 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error)
3350 __Pyx_GOTREF(__pyx_t_4);
3351 __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error)
3352 __Pyx_GOTREF(__pyx_t_5);
3353 #endif
3354 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3355 } else {
3356 Py_ssize_t index = -1;
3357 __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error)
3358 __Pyx_GOTREF(__pyx_t_6);
3359 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3360 __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
3361 index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
3362 __Pyx_GOTREF(__pyx_t_3);
3363 index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
3364 __Pyx_GOTREF(__pyx_t_4);
3365 index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
3366 __Pyx_GOTREF(__pyx_t_5);
3367 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
3368 __pyx_t_7 = NULL;
3369 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3370 goto __pyx_L5_unpacking_done;
3371 __pyx_L4_unpacking_failed:;
3372 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3373 __pyx_t_7 = NULL;
3374 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3375 __PYX_ERR(0, 131, __pyx_L1_error)
3376 __pyx_L5_unpacking_done:;
3377 }
3378 __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
3379 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3380 __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
3381 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3382 __pyx_t_10 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_10 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
3383 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3384 __pyx_v_insertion = __pyx_t_8;
3385 __pyx_v_deletion = __pyx_t_9;
3386 __pyx_v_substitution = __pyx_t_10;
3387
3388 /* "cpp_process_cdist.pyx":132
3389 *
3390 * insertion, deletion, substitution = kwargs.get("weights", (1, 1, 1))
3391 * dereference(weights).insert_cost = insertion # <<<<<<<<<<<<<<
3392 * dereference(weights).delete_cost = deletion
3393 * dereference(weights).replace_cost = substitution
3394 */
3395 __Pyx_TraceLine(132,0,__PYX_ERR(0, 132, __pyx_L1_error))
3396 (*__pyx_v_weights).insert_cost = __pyx_v_insertion;
3397
3398 /* "cpp_process_cdist.pyx":133
3399 * insertion, deletion, substitution = kwargs.get("weights", (1, 1, 1))
3400 * dereference(weights).insert_cost = insertion
3401 * dereference(weights).delete_cost = deletion # <<<<<<<<<<<<<<
3402 * dereference(weights).replace_cost = substitution
3403 * context.context = weights
3404 */
3405 __Pyx_TraceLine(133,0,__PYX_ERR(0, 133, __pyx_L1_error))
3406 (*__pyx_v_weights).delete_cost = __pyx_v_deletion;
3407
3408 /* "cpp_process_cdist.pyx":134
3409 * dereference(weights).insert_cost = insertion
3410 * dereference(weights).delete_cost = deletion
3411 * dereference(weights).replace_cost = substitution # <<<<<<<<<<<<<<
3412 * context.context = weights
3413 * context.deinit = free
3414 */
3415 __Pyx_TraceLine(134,0,__PYX_ERR(0, 134, __pyx_L1_error))
3416 (*__pyx_v_weights).replace_cost = __pyx_v_substitution;
3417
3418 /* "cpp_process_cdist.pyx":135
3419 * dereference(weights).delete_cost = deletion
3420 * dereference(weights).replace_cost = substitution
3421 * context.context = weights # <<<<<<<<<<<<<<
3422 * context.deinit = free
3423 *
3424 */
3425 __Pyx_TraceLine(135,0,__PYX_ERR(0, 135, __pyx_L1_error))
3426 __pyx_v_context.context = __pyx_v_weights;
3427
3428 /* "cpp_process_cdist.pyx":136
3429 * dereference(weights).replace_cost = substitution
3430 * context.context = weights
3431 * context.deinit = free # <<<<<<<<<<<<<<
3432 *
3433 * return move(context)
3434 */
3435 __Pyx_TraceLine(136,0,__PYX_ERR(0, 136, __pyx_L1_error))
3436 __pyx_v_context.deinit = free;
3437
3438 /* "cpp_process_cdist.pyx":138
3439 * context.deinit = free
3440 *
3441 * return move(context) # <<<<<<<<<<<<<<
3442 *
3443 * cdef inline ScorerFunctionTable CreateNormalizedLevenshteinFunctionTable():
3444 */
3445 __Pyx_TraceLine(138,0,__PYX_ERR(0, 138, __pyx_L1_error))
3446 __pyx_r = cython_std::move<KwargsContext>(__pyx_v_context);
3447 goto __pyx_L0;
3448
3449 /* "cpp_process_cdist.pyx":122
3450 * void set_score_similarity(np.PyArrayObject*, int, np.npy_intp, np.npy_intp, double)
3451 *
3452 * cdef KwargsContext LevenshteinKwargsInit(dict kwargs) except *: # <<<<<<<<<<<<<<
3453 * cdef KwargsContext context
3454 * cdef LevenshteinWeightTable* weights
3455 */
3456
3457 /* function exit code */
3458 __pyx_L1_error:;
3459 __Pyx_XDECREF(__pyx_t_2);
3460 __Pyx_XDECREF(__pyx_t_3);
3461 __Pyx_XDECREF(__pyx_t_4);
3462 __Pyx_XDECREF(__pyx_t_5);
3463 __Pyx_XDECREF(__pyx_t_6);
3464 __Pyx_AddTraceback("cpp_process_cdist.LevenshteinKwargsInit", __pyx_clineno, __pyx_lineno, __pyx_filename);
3465 __Pyx_pretend_to_initialize(&__pyx_r);
3466 __pyx_L0:;
3467 __Pyx_TraceReturn(Py_None, 0);
3468 __Pyx_RefNannyFinishContext();
3469 return __pyx_r;
3470 }
3471
3472 /* "cpp_process_cdist.pyx":140
3473 * return move(context)
3474 *
3475 * cdef inline ScorerFunctionTable CreateNormalizedLevenshteinFunctionTable(): # <<<<<<<<<<<<<<
3476 * cdef ScorerFunctionTable table
3477 * table.kwargs_init = &LevenshteinKwargsInit
3478 */
3479
__pyx_f_17cpp_process_cdist_CreateNormalizedLevenshteinFunctionTable(void)3480 static CYTHON_INLINE struct ScorerFunctionTable __pyx_f_17cpp_process_cdist_CreateNormalizedLevenshteinFunctionTable(void) {
3481 struct ScorerFunctionTable __pyx_v_table;
3482 struct ScorerFunctionTable __pyx_r;
3483 __Pyx_TraceDeclarations
3484 __Pyx_RefNannyDeclarations
3485 int __pyx_lineno = 0;
3486 const char *__pyx_filename = NULL;
3487 int __pyx_clineno = 0;
3488 __Pyx_RefNannySetupContext("CreateNormalizedLevenshteinFunctionTable", 0);
3489 __Pyx_TraceCall("CreateNormalizedLevenshteinFunctionTable", __pyx_f[0], 140, 0, __PYX_ERR(0, 140, __pyx_L1_error));
3490
3491 /* "cpp_process_cdist.pyx":142
3492 * cdef inline ScorerFunctionTable CreateNormalizedLevenshteinFunctionTable():
3493 * cdef ScorerFunctionTable table
3494 * table.kwargs_init = &LevenshteinKwargsInit # <<<<<<<<<<<<<<
3495 * table.init = cached_normalized_levenshtein_init
3496 * return table
3497 */
3498 __Pyx_TraceLine(142,0,__PYX_ERR(0, 142, __pyx_L1_error))
3499 __pyx_v_table.kwargs_init = (&__pyx_f_17cpp_process_cdist_LevenshteinKwargsInit);
3500
3501 /* "cpp_process_cdist.pyx":143
3502 * cdef ScorerFunctionTable table
3503 * table.kwargs_init = &LevenshteinKwargsInit
3504 * table.init = cached_normalized_levenshtein_init # <<<<<<<<<<<<<<
3505 * return table
3506 *
3507 */
3508 __Pyx_TraceLine(143,0,__PYX_ERR(0, 143, __pyx_L1_error))
3509 __pyx_v_table.init = cached_normalized_levenshtein_init;
3510
3511 /* "cpp_process_cdist.pyx":144
3512 * table.kwargs_init = &LevenshteinKwargsInit
3513 * table.init = cached_normalized_levenshtein_init
3514 * return table # <<<<<<<<<<<<<<
3515 *
3516 * cdef inline DistanceFunctionTable CreateLevenshteinFunctionTable():
3517 */
3518 __Pyx_TraceLine(144,0,__PYX_ERR(0, 144, __pyx_L1_error))
3519 __pyx_r = __pyx_v_table;
3520 goto __pyx_L0;
3521
3522 /* "cpp_process_cdist.pyx":140
3523 * return move(context)
3524 *
3525 * cdef inline ScorerFunctionTable CreateNormalizedLevenshteinFunctionTable(): # <<<<<<<<<<<<<<
3526 * cdef ScorerFunctionTable table
3527 * table.kwargs_init = &LevenshteinKwargsInit
3528 */
3529
3530 /* function exit code */
3531 __pyx_L1_error:;
3532 __Pyx_WriteUnraisable("cpp_process_cdist.CreateNormalizedLevenshteinFunctionTable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3533 __Pyx_pretend_to_initialize(&__pyx_r);
3534 __pyx_L0:;
3535 __Pyx_TraceReturn(Py_None, 0);
3536 __Pyx_RefNannyFinishContext();
3537 return __pyx_r;
3538 }
3539
3540 /* "cpp_process_cdist.pyx":146
3541 * return table
3542 *
3543 * cdef inline DistanceFunctionTable CreateLevenshteinFunctionTable(): # <<<<<<<<<<<<<<
3544 * cdef DistanceFunctionTable table
3545 * table.kwargs_init = &LevenshteinKwargsInit
3546 */
3547
__pyx_f_17cpp_process_cdist_CreateLevenshteinFunctionTable(void)3548 static CYTHON_INLINE struct DistanceFunctionTable __pyx_f_17cpp_process_cdist_CreateLevenshteinFunctionTable(void) {
3549 struct DistanceFunctionTable __pyx_v_table;
3550 struct DistanceFunctionTable __pyx_r;
3551 __Pyx_TraceDeclarations
3552 __Pyx_RefNannyDeclarations
3553 int __pyx_lineno = 0;
3554 const char *__pyx_filename = NULL;
3555 int __pyx_clineno = 0;
3556 __Pyx_RefNannySetupContext("CreateLevenshteinFunctionTable", 0);
3557 __Pyx_TraceCall("CreateLevenshteinFunctionTable", __pyx_f[0], 146, 0, __PYX_ERR(0, 146, __pyx_L1_error));
3558
3559 /* "cpp_process_cdist.pyx":148
3560 * cdef inline DistanceFunctionTable CreateLevenshteinFunctionTable():
3561 * cdef DistanceFunctionTable table
3562 * table.kwargs_init = &LevenshteinKwargsInit # <<<<<<<<<<<<<<
3563 * table.init = cached_levenshtein_init
3564 * return table
3565 */
3566 __Pyx_TraceLine(148,0,__PYX_ERR(0, 148, __pyx_L1_error))
3567 __pyx_v_table.kwargs_init = (&__pyx_f_17cpp_process_cdist_LevenshteinKwargsInit);
3568
3569 /* "cpp_process_cdist.pyx":149
3570 * cdef DistanceFunctionTable table
3571 * table.kwargs_init = &LevenshteinKwargsInit
3572 * table.init = cached_levenshtein_init # <<<<<<<<<<<<<<
3573 * return table
3574 *
3575 */
3576 __Pyx_TraceLine(149,0,__PYX_ERR(0, 149, __pyx_L1_error))
3577 __pyx_v_table.init = cached_levenshtein_init;
3578
3579 /* "cpp_process_cdist.pyx":150
3580 * table.kwargs_init = &LevenshteinKwargsInit
3581 * table.init = cached_levenshtein_init
3582 * return table # <<<<<<<<<<<<<<
3583 *
3584 * cdef KwargsContext JaroWinklerKwargsInit(dict kwargs) except *:
3585 */
3586 __Pyx_TraceLine(150,0,__PYX_ERR(0, 150, __pyx_L1_error))
3587 __pyx_r = __pyx_v_table;
3588 goto __pyx_L0;
3589
3590 /* "cpp_process_cdist.pyx":146
3591 * return table
3592 *
3593 * cdef inline DistanceFunctionTable CreateLevenshteinFunctionTable(): # <<<<<<<<<<<<<<
3594 * cdef DistanceFunctionTable table
3595 * table.kwargs_init = &LevenshteinKwargsInit
3596 */
3597
3598 /* function exit code */
3599 __pyx_L1_error:;
3600 __Pyx_WriteUnraisable("cpp_process_cdist.CreateLevenshteinFunctionTable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3601 __Pyx_pretend_to_initialize(&__pyx_r);
3602 __pyx_L0:;
3603 __Pyx_TraceReturn(Py_None, 0);
3604 __Pyx_RefNannyFinishContext();
3605 return __pyx_r;
3606 }
3607
3608 /* "cpp_process_cdist.pyx":152
3609 * return table
3610 *
3611 * cdef KwargsContext JaroWinklerKwargsInit(dict kwargs) except *: # <<<<<<<<<<<<<<
3612 * cdef KwargsContext context
3613 * cdef double* prefix_weight
3614 */
3615
__pyx_f_17cpp_process_cdist_JaroWinklerKwargsInit(PyObject * __pyx_v_kwargs)3616 static KwargsContext __pyx_f_17cpp_process_cdist_JaroWinklerKwargsInit(PyObject *__pyx_v_kwargs) {
3617 KwargsContext __pyx_v_context;
3618 double *__pyx_v_prefix_weight;
3619 KwargsContext __pyx_r;
3620 __Pyx_TraceDeclarations
3621 __Pyx_RefNannyDeclarations
3622 int __pyx_t_1;
3623 PyObject *__pyx_t_2 = NULL;
3624 double __pyx_t_3;
3625 int __pyx_lineno = 0;
3626 const char *__pyx_filename = NULL;
3627 int __pyx_clineno = 0;
3628 __Pyx_RefNannySetupContext("JaroWinklerKwargsInit", 0);
3629 __Pyx_TraceCall("JaroWinklerKwargsInit", __pyx_f[0], 152, 0, __PYX_ERR(0, 152, __pyx_L1_error));
3630
3631 /* "cpp_process_cdist.pyx":155
3632 * cdef KwargsContext context
3633 * cdef double* prefix_weight
3634 * prefix_weight = <double*>malloc(sizeof(double)) # <<<<<<<<<<<<<<
3635 *
3636 * if (NULL == prefix_weight):
3637 */
3638 __Pyx_TraceLine(155,0,__PYX_ERR(0, 155, __pyx_L1_error))
3639 __pyx_v_prefix_weight = ((double *)malloc((sizeof(double))));
3640
3641 /* "cpp_process_cdist.pyx":157
3642 * prefix_weight = <double*>malloc(sizeof(double))
3643 *
3644 * if (NULL == prefix_weight): # <<<<<<<<<<<<<<
3645 * raise MemoryError
3646 *
3647 */
3648 __Pyx_TraceLine(157,0,__PYX_ERR(0, 157, __pyx_L1_error))
3649 __pyx_t_1 = ((NULL == __pyx_v_prefix_weight) != 0);
3650 if (unlikely(__pyx_t_1)) {
3651
3652 /* "cpp_process_cdist.pyx":158
3653 *
3654 * if (NULL == prefix_weight):
3655 * raise MemoryError # <<<<<<<<<<<<<<
3656 *
3657 * prefix_weight[0] = kwargs.get("prefix_weight", 0.1)
3658 */
3659 __Pyx_TraceLine(158,0,__PYX_ERR(0, 158, __pyx_L1_error))
3660 PyErr_NoMemory(); __PYX_ERR(0, 158, __pyx_L1_error)
3661
3662 /* "cpp_process_cdist.pyx":157
3663 * prefix_weight = <double*>malloc(sizeof(double))
3664 *
3665 * if (NULL == prefix_weight): # <<<<<<<<<<<<<<
3666 * raise MemoryError
3667 *
3668 */
3669 }
3670
3671 /* "cpp_process_cdist.pyx":160
3672 * raise MemoryError
3673 *
3674 * prefix_weight[0] = kwargs.get("prefix_weight", 0.1) # <<<<<<<<<<<<<<
3675 * context.context = prefix_weight
3676 * context.deinit = free
3677 */
3678 __Pyx_TraceLine(160,0,__PYX_ERR(0, 160, __pyx_L1_error))
3679 if (unlikely(__pyx_v_kwargs == Py_None)) {
3680 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
3681 __PYX_ERR(0, 160, __pyx_L1_error)
3682 }
3683 __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_prefix_weight, __pyx_float_0_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
3684 __Pyx_GOTREF(__pyx_t_2);
3685 __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
3686 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3687 (__pyx_v_prefix_weight[0]) = __pyx_t_3;
3688
3689 /* "cpp_process_cdist.pyx":161
3690 *
3691 * prefix_weight[0] = kwargs.get("prefix_weight", 0.1)
3692 * context.context = prefix_weight # <<<<<<<<<<<<<<
3693 * context.deinit = free
3694 *
3695 */
3696 __Pyx_TraceLine(161,0,__PYX_ERR(0, 161, __pyx_L1_error))
3697 __pyx_v_context.context = __pyx_v_prefix_weight;
3698
3699 /* "cpp_process_cdist.pyx":162
3700 * prefix_weight[0] = kwargs.get("prefix_weight", 0.1)
3701 * context.context = prefix_weight
3702 * context.deinit = free # <<<<<<<<<<<<<<
3703 *
3704 * return move(context)
3705 */
3706 __Pyx_TraceLine(162,0,__PYX_ERR(0, 162, __pyx_L1_error))
3707 __pyx_v_context.deinit = free;
3708
3709 /* "cpp_process_cdist.pyx":164
3710 * context.deinit = free
3711 *
3712 * return move(context) # <<<<<<<<<<<<<<
3713 *
3714 * cdef inline ScorerFunctionTable CreateJaroWinklerSimilarityFunctionTable():
3715 */
3716 __Pyx_TraceLine(164,0,__PYX_ERR(0, 164, __pyx_L1_error))
3717 __pyx_r = cython_std::move<KwargsContext>(__pyx_v_context);
3718 goto __pyx_L0;
3719
3720 /* "cpp_process_cdist.pyx":152
3721 * return table
3722 *
3723 * cdef KwargsContext JaroWinklerKwargsInit(dict kwargs) except *: # <<<<<<<<<<<<<<
3724 * cdef KwargsContext context
3725 * cdef double* prefix_weight
3726 */
3727
3728 /* function exit code */
3729 __pyx_L1_error:;
3730 __Pyx_XDECREF(__pyx_t_2);
3731 __Pyx_AddTraceback("cpp_process_cdist.JaroWinklerKwargsInit", __pyx_clineno, __pyx_lineno, __pyx_filename);
3732 __Pyx_pretend_to_initialize(&__pyx_r);
3733 __pyx_L0:;
3734 __Pyx_TraceReturn(Py_None, 0);
3735 __Pyx_RefNannyFinishContext();
3736 return __pyx_r;
3737 }
3738
3739 /* "cpp_process_cdist.pyx":166
3740 * return move(context)
3741 *
3742 * cdef inline ScorerFunctionTable CreateJaroWinklerSimilarityFunctionTable(): # <<<<<<<<<<<<<<
3743 * cdef ScorerFunctionTable table
3744 * table.kwargs_init = &JaroWinklerKwargsInit
3745 */
3746
__pyx_f_17cpp_process_cdist_CreateJaroWinklerSimilarityFunctionTable(void)3747 static CYTHON_INLINE struct ScorerFunctionTable __pyx_f_17cpp_process_cdist_CreateJaroWinklerSimilarityFunctionTable(void) {
3748 struct ScorerFunctionTable __pyx_v_table;
3749 struct ScorerFunctionTable __pyx_r;
3750 __Pyx_TraceDeclarations
3751 __Pyx_RefNannyDeclarations
3752 int __pyx_lineno = 0;
3753 const char *__pyx_filename = NULL;
3754 int __pyx_clineno = 0;
3755 __Pyx_RefNannySetupContext("CreateJaroWinklerSimilarityFunctionTable", 0);
3756 __Pyx_TraceCall("CreateJaroWinklerSimilarityFunctionTable", __pyx_f[0], 166, 0, __PYX_ERR(0, 166, __pyx_L1_error));
3757
3758 /* "cpp_process_cdist.pyx":168
3759 * cdef inline ScorerFunctionTable CreateJaroWinklerSimilarityFunctionTable():
3760 * cdef ScorerFunctionTable table
3761 * table.kwargs_init = &JaroWinklerKwargsInit # <<<<<<<<<<<<<<
3762 * table.init = cached_jaro_winkler_similarity_init
3763 * return table
3764 */
3765 __Pyx_TraceLine(168,0,__PYX_ERR(0, 168, __pyx_L1_error))
3766 __pyx_v_table.kwargs_init = (&__pyx_f_17cpp_process_cdist_JaroWinklerKwargsInit);
3767
3768 /* "cpp_process_cdist.pyx":169
3769 * cdef ScorerFunctionTable table
3770 * table.kwargs_init = &JaroWinklerKwargsInit
3771 * table.init = cached_jaro_winkler_similarity_init # <<<<<<<<<<<<<<
3772 * return table
3773 *
3774 */
3775 __Pyx_TraceLine(169,0,__PYX_ERR(0, 169, __pyx_L1_error))
3776 __pyx_v_table.init = cached_jaro_winkler_similarity_init;
3777
3778 /* "cpp_process_cdist.pyx":170
3779 * table.kwargs_init = &JaroWinklerKwargsInit
3780 * table.init = cached_jaro_winkler_similarity_init
3781 * return table # <<<<<<<<<<<<<<
3782 *
3783 * cdef inline int IsIntegratedScorer(object scorer):
3784 */
3785 __Pyx_TraceLine(170,0,__PYX_ERR(0, 170, __pyx_L1_error))
3786 __pyx_r = __pyx_v_table;
3787 goto __pyx_L0;
3788
3789 /* "cpp_process_cdist.pyx":166
3790 * return move(context)
3791 *
3792 * cdef inline ScorerFunctionTable CreateJaroWinklerSimilarityFunctionTable(): # <<<<<<<<<<<<<<
3793 * cdef ScorerFunctionTable table
3794 * table.kwargs_init = &JaroWinklerKwargsInit
3795 */
3796
3797 /* function exit code */
3798 __pyx_L1_error:;
3799 __Pyx_WriteUnraisable("cpp_process_cdist.CreateJaroWinklerSimilarityFunctionTable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3800 __Pyx_pretend_to_initialize(&__pyx_r);
3801 __pyx_L0:;
3802 __Pyx_TraceReturn(Py_None, 0);
3803 __Pyx_RefNannyFinishContext();
3804 return __pyx_r;
3805 }
3806
3807 /* "cpp_process_cdist.pyx":172
3808 * return table
3809 *
3810 * cdef inline int IsIntegratedScorer(object scorer): # <<<<<<<<<<<<<<
3811 * return (
3812 * scorer is ratio or
3813 */
3814
__pyx_f_17cpp_process_cdist_IsIntegratedScorer(PyObject * __pyx_v_scorer)3815 static CYTHON_INLINE int __pyx_f_17cpp_process_cdist_IsIntegratedScorer(PyObject *__pyx_v_scorer) {
3816 int __pyx_r;
3817 __Pyx_TraceDeclarations
3818 __Pyx_RefNannyDeclarations
3819 int __pyx_t_1;
3820 PyObject *__pyx_t_2 = NULL;
3821 int __pyx_t_3;
3822 int __pyx_lineno = 0;
3823 const char *__pyx_filename = NULL;
3824 int __pyx_clineno = 0;
3825 __Pyx_RefNannySetupContext("IsIntegratedScorer", 0);
3826 __Pyx_TraceCall("IsIntegratedScorer", __pyx_f[0], 172, 0, __PYX_ERR(0, 172, __pyx_L1_error));
3827
3828 /* "cpp_process_cdist.pyx":174
3829 * cdef inline int IsIntegratedScorer(object scorer):
3830 * return (
3831 * scorer is ratio or # <<<<<<<<<<<<<<
3832 * scorer is partial_ratio or
3833 * scorer is token_sort_ratio or
3834 */
3835 __Pyx_TraceLine(174,0,__PYX_ERR(0, 174, __pyx_L1_error))
3836 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
3837 __Pyx_GOTREF(__pyx_t_2);
3838 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3839 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3840 if (!__pyx_t_3) {
3841 } else {
3842 __pyx_t_1 = __pyx_t_3;
3843 goto __pyx_L3_bool_binop_done;
3844 }
3845
3846 /* "cpp_process_cdist.pyx":175
3847 * return (
3848 * scorer is ratio or
3849 * scorer is partial_ratio or # <<<<<<<<<<<<<<
3850 * scorer is token_sort_ratio or
3851 * scorer is token_set_ratio or
3852 */
3853 __Pyx_TraceLine(175,0,__PYX_ERR(0, 175, __pyx_L1_error))
3854 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_partial_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
3855 __Pyx_GOTREF(__pyx_t_2);
3856 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3857 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3858 if (!__pyx_t_3) {
3859 } else {
3860 __pyx_t_1 = __pyx_t_3;
3861 goto __pyx_L3_bool_binop_done;
3862 }
3863
3864 /* "cpp_process_cdist.pyx":176
3865 * scorer is ratio or
3866 * scorer is partial_ratio or
3867 * scorer is token_sort_ratio or # <<<<<<<<<<<<<<
3868 * scorer is token_set_ratio or
3869 * scorer is token_ratio or
3870 */
3871 __Pyx_TraceLine(176,0,__PYX_ERR(0, 176, __pyx_L1_error))
3872 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_token_sort_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error)
3873 __Pyx_GOTREF(__pyx_t_2);
3874 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3875 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3876 if (!__pyx_t_3) {
3877 } else {
3878 __pyx_t_1 = __pyx_t_3;
3879 goto __pyx_L3_bool_binop_done;
3880 }
3881
3882 /* "cpp_process_cdist.pyx":177
3883 * scorer is partial_ratio or
3884 * scorer is token_sort_ratio or
3885 * scorer is token_set_ratio or # <<<<<<<<<<<<<<
3886 * scorer is token_ratio or
3887 * scorer is partial_token_sort_ratio or
3888 */
3889 __Pyx_TraceLine(177,0,__PYX_ERR(0, 177, __pyx_L1_error))
3890 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_token_set_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
3891 __Pyx_GOTREF(__pyx_t_2);
3892 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3893 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3894 if (!__pyx_t_3) {
3895 } else {
3896 __pyx_t_1 = __pyx_t_3;
3897 goto __pyx_L3_bool_binop_done;
3898 }
3899
3900 /* "cpp_process_cdist.pyx":178
3901 * scorer is token_sort_ratio or
3902 * scorer is token_set_ratio or
3903 * scorer is token_ratio or # <<<<<<<<<<<<<<
3904 * scorer is partial_token_sort_ratio or
3905 * scorer is partial_token_set_ratio or
3906 */
3907 __Pyx_TraceLine(178,0,__PYX_ERR(0, 178, __pyx_L1_error))
3908 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_token_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
3909 __Pyx_GOTREF(__pyx_t_2);
3910 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3911 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3912 if (!__pyx_t_3) {
3913 } else {
3914 __pyx_t_1 = __pyx_t_3;
3915 goto __pyx_L3_bool_binop_done;
3916 }
3917
3918 /* "cpp_process_cdist.pyx":179
3919 * scorer is token_set_ratio or
3920 * scorer is token_ratio or
3921 * scorer is partial_token_sort_ratio or # <<<<<<<<<<<<<<
3922 * scorer is partial_token_set_ratio or
3923 * scorer is partial_token_ratio or
3924 */
3925 __Pyx_TraceLine(179,0,__PYX_ERR(0, 179, __pyx_L1_error))
3926 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_partial_token_sort_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
3927 __Pyx_GOTREF(__pyx_t_2);
3928 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3929 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3930 if (!__pyx_t_3) {
3931 } else {
3932 __pyx_t_1 = __pyx_t_3;
3933 goto __pyx_L3_bool_binop_done;
3934 }
3935
3936 /* "cpp_process_cdist.pyx":180
3937 * scorer is token_ratio or
3938 * scorer is partial_token_sort_ratio or
3939 * scorer is partial_token_set_ratio or # <<<<<<<<<<<<<<
3940 * scorer is partial_token_ratio or
3941 * scorer is WRatio or
3942 */
3943 __Pyx_TraceLine(180,0,__PYX_ERR(0, 180, __pyx_L1_error))
3944 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_partial_token_set_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
3945 __Pyx_GOTREF(__pyx_t_2);
3946 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3947 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3948 if (!__pyx_t_3) {
3949 } else {
3950 __pyx_t_1 = __pyx_t_3;
3951 goto __pyx_L3_bool_binop_done;
3952 }
3953
3954 /* "cpp_process_cdist.pyx":181
3955 * scorer is partial_token_sort_ratio or
3956 * scorer is partial_token_set_ratio or
3957 * scorer is partial_token_ratio or # <<<<<<<<<<<<<<
3958 * scorer is WRatio or
3959 * scorer is QRatio or
3960 */
3961 __Pyx_TraceLine(181,0,__PYX_ERR(0, 181, __pyx_L1_error))
3962 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_partial_token_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
3963 __Pyx_GOTREF(__pyx_t_2);
3964 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3965 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3966 if (!__pyx_t_3) {
3967 } else {
3968 __pyx_t_1 = __pyx_t_3;
3969 goto __pyx_L3_bool_binop_done;
3970 }
3971
3972 /* "cpp_process_cdist.pyx":182
3973 * scorer is partial_token_set_ratio or
3974 * scorer is partial_token_ratio or
3975 * scorer is WRatio or # <<<<<<<<<<<<<<
3976 * scorer is QRatio or
3977 * scorer is normalized_levenshtein or
3978 */
3979 __Pyx_TraceLine(182,0,__PYX_ERR(0, 182, __pyx_L1_error))
3980 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
3981 __Pyx_GOTREF(__pyx_t_2);
3982 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
3983 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3984 if (!__pyx_t_3) {
3985 } else {
3986 __pyx_t_1 = __pyx_t_3;
3987 goto __pyx_L3_bool_binop_done;
3988 }
3989
3990 /* "cpp_process_cdist.pyx":183
3991 * scorer is partial_token_ratio or
3992 * scorer is WRatio or
3993 * scorer is QRatio or # <<<<<<<<<<<<<<
3994 * scorer is normalized_levenshtein or
3995 * scorer is normalized_hamming or
3996 */
3997 __Pyx_TraceLine(183,0,__PYX_ERR(0, 183, __pyx_L1_error))
3998 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_QRatio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
3999 __Pyx_GOTREF(__pyx_t_2);
4000 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4001 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4002 if (!__pyx_t_3) {
4003 } else {
4004 __pyx_t_1 = __pyx_t_3;
4005 goto __pyx_L3_bool_binop_done;
4006 }
4007
4008 /* "cpp_process_cdist.pyx":184
4009 * scorer is WRatio or
4010 * scorer is QRatio or
4011 * scorer is normalized_levenshtein or # <<<<<<<<<<<<<<
4012 * scorer is normalized_hamming or
4013 * scorer is jaro_similarity or
4014 */
4015 __Pyx_TraceLine(184,0,__PYX_ERR(0, 184, __pyx_L1_error))
4016 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_normalized_levenshtein); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
4017 __Pyx_GOTREF(__pyx_t_2);
4018 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4019 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4020 if (!__pyx_t_3) {
4021 } else {
4022 __pyx_t_1 = __pyx_t_3;
4023 goto __pyx_L3_bool_binop_done;
4024 }
4025
4026 /* "cpp_process_cdist.pyx":185
4027 * scorer is QRatio or
4028 * scorer is normalized_levenshtein or
4029 * scorer is normalized_hamming or # <<<<<<<<<<<<<<
4030 * scorer is jaro_similarity or
4031 * scorer is jaro_winkler_similarity
4032 */
4033 __Pyx_TraceLine(185,0,__PYX_ERR(0, 185, __pyx_L1_error))
4034 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_normalized_hamming); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
4035 __Pyx_GOTREF(__pyx_t_2);
4036 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4037 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4038 if (!__pyx_t_3) {
4039 } else {
4040 __pyx_t_1 = __pyx_t_3;
4041 goto __pyx_L3_bool_binop_done;
4042 }
4043
4044 /* "cpp_process_cdist.pyx":186
4045 * scorer is normalized_levenshtein or
4046 * scorer is normalized_hamming or
4047 * scorer is jaro_similarity or # <<<<<<<<<<<<<<
4048 * scorer is jaro_winkler_similarity
4049 * )
4050 */
4051 __Pyx_TraceLine(186,0,__PYX_ERR(0, 186, __pyx_L1_error))
4052 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_jaro_similarity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
4053 __Pyx_GOTREF(__pyx_t_2);
4054 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4055 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4056 if (!__pyx_t_3) {
4057 } else {
4058 __pyx_t_1 = __pyx_t_3;
4059 goto __pyx_L3_bool_binop_done;
4060 }
4061
4062 /* "cpp_process_cdist.pyx":187
4063 * scorer is normalized_hamming or
4064 * scorer is jaro_similarity or
4065 * scorer is jaro_winkler_similarity # <<<<<<<<<<<<<<
4066 * )
4067 *
4068 */
4069 __Pyx_TraceLine(187,0,__PYX_ERR(0, 187, __pyx_L1_error))
4070 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_jaro_winkler_similarity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
4071 __Pyx_GOTREF(__pyx_t_2);
4072 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4073 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4074 __pyx_t_1 = __pyx_t_3;
4075 __pyx_L3_bool_binop_done:;
4076 __pyx_r = __pyx_t_1;
4077 goto __pyx_L0;
4078
4079 /* "cpp_process_cdist.pyx":172
4080 * return table
4081 *
4082 * cdef inline int IsIntegratedScorer(object scorer): # <<<<<<<<<<<<<<
4083 * return (
4084 * scorer is ratio or
4085 */
4086
4087 /* function exit code */
4088 __pyx_L1_error:;
4089 __Pyx_XDECREF(__pyx_t_2);
4090 __Pyx_WriteUnraisable("cpp_process_cdist.IsIntegratedScorer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4091 __pyx_r = 0;
4092 __pyx_L0:;
4093 __Pyx_TraceReturn(Py_None, 0);
4094 __Pyx_RefNannyFinishContext();
4095 return __pyx_r;
4096 }
4097
4098 /* "cpp_process_cdist.pyx":190
4099 * )
4100 *
4101 * cdef inline int IsIntegratedDistance(object scorer): # <<<<<<<<<<<<<<
4102 * return (
4103 * scorer is levenshtein or
4104 */
4105
__pyx_f_17cpp_process_cdist_IsIntegratedDistance(PyObject * __pyx_v_scorer)4106 static CYTHON_INLINE int __pyx_f_17cpp_process_cdist_IsIntegratedDistance(PyObject *__pyx_v_scorer) {
4107 int __pyx_r;
4108 __Pyx_TraceDeclarations
4109 __Pyx_RefNannyDeclarations
4110 int __pyx_t_1;
4111 PyObject *__pyx_t_2 = NULL;
4112 int __pyx_t_3;
4113 int __pyx_lineno = 0;
4114 const char *__pyx_filename = NULL;
4115 int __pyx_clineno = 0;
4116 __Pyx_RefNannySetupContext("IsIntegratedDistance", 0);
4117 __Pyx_TraceCall("IsIntegratedDistance", __pyx_f[0], 190, 0, __PYX_ERR(0, 190, __pyx_L1_error));
4118
4119 /* "cpp_process_cdist.pyx":192
4120 * cdef inline int IsIntegratedDistance(object scorer):
4121 * return (
4122 * scorer is levenshtein or # <<<<<<<<<<<<<<
4123 * scorer is hamming
4124 * )
4125 */
4126 __Pyx_TraceLine(192,0,__PYX_ERR(0, 192, __pyx_L1_error))
4127 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_levenshtein); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
4128 __Pyx_GOTREF(__pyx_t_2);
4129 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4130 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4131 if (!__pyx_t_3) {
4132 } else {
4133 __pyx_t_1 = __pyx_t_3;
4134 goto __pyx_L3_bool_binop_done;
4135 }
4136
4137 /* "cpp_process_cdist.pyx":193
4138 * return (
4139 * scorer is levenshtein or
4140 * scorer is hamming # <<<<<<<<<<<<<<
4141 * )
4142 *
4143 */
4144 __Pyx_TraceLine(193,0,__PYX_ERR(0, 193, __pyx_L1_error))
4145 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_hamming); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
4146 __Pyx_GOTREF(__pyx_t_2);
4147 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_2);
4148 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4149 __pyx_t_1 = __pyx_t_3;
4150 __pyx_L3_bool_binop_done:;
4151 __pyx_r = __pyx_t_1;
4152 goto __pyx_L0;
4153
4154 /* "cpp_process_cdist.pyx":190
4155 * )
4156 *
4157 * cdef inline int IsIntegratedDistance(object scorer): # <<<<<<<<<<<<<<
4158 * return (
4159 * scorer is levenshtein or
4160 */
4161
4162 /* function exit code */
4163 __pyx_L1_error:;
4164 __Pyx_XDECREF(__pyx_t_2);
4165 __Pyx_WriteUnraisable("cpp_process_cdist.IsIntegratedDistance", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4166 __pyx_r = 0;
4167 __pyx_L0:;
4168 __Pyx_TraceReturn(Py_None, 0);
4169 __Pyx_RefNannyFinishContext();
4170 return __pyx_r;
4171 }
4172
4173 /* "cpp_process_cdist.pyx":196
4174 * )
4175 *
4176 * cdef inline ScorerFunctionTable CachedScorerInit(object scorer): # <<<<<<<<<<<<<<
4177 * cdef ScorerFunctionTable context
4178 *
4179 */
4180
__pyx_f_17cpp_process_cdist_CachedScorerInit(PyObject * __pyx_v_scorer)4181 static CYTHON_INLINE struct ScorerFunctionTable __pyx_f_17cpp_process_cdist_CachedScorerInit(PyObject *__pyx_v_scorer) {
4182 struct ScorerFunctionTable __pyx_v_context;
4183 struct ScorerFunctionTable __pyx_r;
4184 __Pyx_TraceDeclarations
4185 __Pyx_RefNannyDeclarations
4186 PyObject *__pyx_t_1 = NULL;
4187 int __pyx_t_2;
4188 int __pyx_t_3;
4189 struct ScorerFunctionTable __pyx_t_4;
4190 int __pyx_lineno = 0;
4191 const char *__pyx_filename = NULL;
4192 int __pyx_clineno = 0;
4193 __Pyx_RefNannySetupContext("CachedScorerInit", 0);
4194 __Pyx_TraceCall("CachedScorerInit", __pyx_f[0], 196, 0, __PYX_ERR(0, 196, __pyx_L1_error));
4195
4196 /* "cpp_process_cdist.pyx":199
4197 * cdef ScorerFunctionTable context
4198 *
4199 * if scorer is ratio: # <<<<<<<<<<<<<<
4200 * context = CreateRatioFunctionTable()
4201 * elif scorer is partial_ratio:
4202 */
4203 __Pyx_TraceLine(199,0,__PYX_ERR(0, 199, __pyx_L1_error))
4204 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
4205 __Pyx_GOTREF(__pyx_t_1);
4206 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4207 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4208 __pyx_t_3 = (__pyx_t_2 != 0);
4209 if (__pyx_t_3) {
4210
4211 /* "cpp_process_cdist.pyx":200
4212 *
4213 * if scorer is ratio:
4214 * context = CreateRatioFunctionTable() # <<<<<<<<<<<<<<
4215 * elif scorer is partial_ratio:
4216 * context = CreatePartialRatioFunctionTable()
4217 */
4218 __Pyx_TraceLine(200,0,__PYX_ERR(0, 200, __pyx_L1_error))
4219 try {
4220 __pyx_t_4 = CreateRatioFunctionTable();
4221 } catch(...) {
4222 __Pyx_CppExn2PyErr();
4223 __PYX_ERR(0, 200, __pyx_L1_error)
4224 }
4225 __pyx_v_context = __pyx_t_4;
4226
4227 /* "cpp_process_cdist.pyx":199
4228 * cdef ScorerFunctionTable context
4229 *
4230 * if scorer is ratio: # <<<<<<<<<<<<<<
4231 * context = CreateRatioFunctionTable()
4232 * elif scorer is partial_ratio:
4233 */
4234 goto __pyx_L3;
4235 }
4236
4237 /* "cpp_process_cdist.pyx":201
4238 * if scorer is ratio:
4239 * context = CreateRatioFunctionTable()
4240 * elif scorer is partial_ratio: # <<<<<<<<<<<<<<
4241 * context = CreatePartialRatioFunctionTable()
4242 * elif scorer is token_sort_ratio:
4243 */
4244 __Pyx_TraceLine(201,0,__PYX_ERR(0, 201, __pyx_L1_error))
4245 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_partial_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
4246 __Pyx_GOTREF(__pyx_t_1);
4247 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4248 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4249 __pyx_t_2 = (__pyx_t_3 != 0);
4250 if (__pyx_t_2) {
4251
4252 /* "cpp_process_cdist.pyx":202
4253 * context = CreateRatioFunctionTable()
4254 * elif scorer is partial_ratio:
4255 * context = CreatePartialRatioFunctionTable() # <<<<<<<<<<<<<<
4256 * elif scorer is token_sort_ratio:
4257 * context = CreateTokenSortRatioFunctionTable()
4258 */
4259 __Pyx_TraceLine(202,0,__PYX_ERR(0, 202, __pyx_L1_error))
4260 try {
4261 __pyx_t_4 = CreatePartialRatioFunctionTable();
4262 } catch(...) {
4263 __Pyx_CppExn2PyErr();
4264 __PYX_ERR(0, 202, __pyx_L1_error)
4265 }
4266 __pyx_v_context = __pyx_t_4;
4267
4268 /* "cpp_process_cdist.pyx":201
4269 * if scorer is ratio:
4270 * context = CreateRatioFunctionTable()
4271 * elif scorer is partial_ratio: # <<<<<<<<<<<<<<
4272 * context = CreatePartialRatioFunctionTable()
4273 * elif scorer is token_sort_ratio:
4274 */
4275 goto __pyx_L3;
4276 }
4277
4278 /* "cpp_process_cdist.pyx":203
4279 * elif scorer is partial_ratio:
4280 * context = CreatePartialRatioFunctionTable()
4281 * elif scorer is token_sort_ratio: # <<<<<<<<<<<<<<
4282 * context = CreateTokenSortRatioFunctionTable()
4283 * elif scorer is token_set_ratio:
4284 */
4285 __Pyx_TraceLine(203,0,__PYX_ERR(0, 203, __pyx_L1_error))
4286 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token_sort_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
4287 __Pyx_GOTREF(__pyx_t_1);
4288 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4289 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4290 __pyx_t_3 = (__pyx_t_2 != 0);
4291 if (__pyx_t_3) {
4292
4293 /* "cpp_process_cdist.pyx":204
4294 * context = CreatePartialRatioFunctionTable()
4295 * elif scorer is token_sort_ratio:
4296 * context = CreateTokenSortRatioFunctionTable() # <<<<<<<<<<<<<<
4297 * elif scorer is token_set_ratio:
4298 * context = CreateTokenSetRatioFunctionTable()
4299 */
4300 __Pyx_TraceLine(204,0,__PYX_ERR(0, 204, __pyx_L1_error))
4301 try {
4302 __pyx_t_4 = CreateTokenSortRatioFunctionTable();
4303 } catch(...) {
4304 __Pyx_CppExn2PyErr();
4305 __PYX_ERR(0, 204, __pyx_L1_error)
4306 }
4307 __pyx_v_context = __pyx_t_4;
4308
4309 /* "cpp_process_cdist.pyx":203
4310 * elif scorer is partial_ratio:
4311 * context = CreatePartialRatioFunctionTable()
4312 * elif scorer is token_sort_ratio: # <<<<<<<<<<<<<<
4313 * context = CreateTokenSortRatioFunctionTable()
4314 * elif scorer is token_set_ratio:
4315 */
4316 goto __pyx_L3;
4317 }
4318
4319 /* "cpp_process_cdist.pyx":205
4320 * elif scorer is token_sort_ratio:
4321 * context = CreateTokenSortRatioFunctionTable()
4322 * elif scorer is token_set_ratio: # <<<<<<<<<<<<<<
4323 * context = CreateTokenSetRatioFunctionTable()
4324 * elif scorer is token_ratio:
4325 */
4326 __Pyx_TraceLine(205,0,__PYX_ERR(0, 205, __pyx_L1_error))
4327 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token_set_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
4328 __Pyx_GOTREF(__pyx_t_1);
4329 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4330 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4331 __pyx_t_2 = (__pyx_t_3 != 0);
4332 if (__pyx_t_2) {
4333
4334 /* "cpp_process_cdist.pyx":206
4335 * context = CreateTokenSortRatioFunctionTable()
4336 * elif scorer is token_set_ratio:
4337 * context = CreateTokenSetRatioFunctionTable() # <<<<<<<<<<<<<<
4338 * elif scorer is token_ratio:
4339 * context = CreateTokenRatioFunctionTable()
4340 */
4341 __Pyx_TraceLine(206,0,__PYX_ERR(0, 206, __pyx_L1_error))
4342 try {
4343 __pyx_t_4 = CreateTokenSetRatioFunctionTable();
4344 } catch(...) {
4345 __Pyx_CppExn2PyErr();
4346 __PYX_ERR(0, 206, __pyx_L1_error)
4347 }
4348 __pyx_v_context = __pyx_t_4;
4349
4350 /* "cpp_process_cdist.pyx":205
4351 * elif scorer is token_sort_ratio:
4352 * context = CreateTokenSortRatioFunctionTable()
4353 * elif scorer is token_set_ratio: # <<<<<<<<<<<<<<
4354 * context = CreateTokenSetRatioFunctionTable()
4355 * elif scorer is token_ratio:
4356 */
4357 goto __pyx_L3;
4358 }
4359
4360 /* "cpp_process_cdist.pyx":207
4361 * elif scorer is token_set_ratio:
4362 * context = CreateTokenSetRatioFunctionTable()
4363 * elif scorer is token_ratio: # <<<<<<<<<<<<<<
4364 * context = CreateTokenRatioFunctionTable()
4365 * elif scorer is partial_token_sort_ratio:
4366 */
4367 __Pyx_TraceLine(207,0,__PYX_ERR(0, 207, __pyx_L1_error))
4368 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
4369 __Pyx_GOTREF(__pyx_t_1);
4370 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4371 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4372 __pyx_t_3 = (__pyx_t_2 != 0);
4373 if (__pyx_t_3) {
4374
4375 /* "cpp_process_cdist.pyx":208
4376 * context = CreateTokenSetRatioFunctionTable()
4377 * elif scorer is token_ratio:
4378 * context = CreateTokenRatioFunctionTable() # <<<<<<<<<<<<<<
4379 * elif scorer is partial_token_sort_ratio:
4380 * context = CreatePartialTokenSortRatioFunctionTable()
4381 */
4382 __Pyx_TraceLine(208,0,__PYX_ERR(0, 208, __pyx_L1_error))
4383 try {
4384 __pyx_t_4 = CreateTokenRatioFunctionTable();
4385 } catch(...) {
4386 __Pyx_CppExn2PyErr();
4387 __PYX_ERR(0, 208, __pyx_L1_error)
4388 }
4389 __pyx_v_context = __pyx_t_4;
4390
4391 /* "cpp_process_cdist.pyx":207
4392 * elif scorer is token_set_ratio:
4393 * context = CreateTokenSetRatioFunctionTable()
4394 * elif scorer is token_ratio: # <<<<<<<<<<<<<<
4395 * context = CreateTokenRatioFunctionTable()
4396 * elif scorer is partial_token_sort_ratio:
4397 */
4398 goto __pyx_L3;
4399 }
4400
4401 /* "cpp_process_cdist.pyx":209
4402 * elif scorer is token_ratio:
4403 * context = CreateTokenRatioFunctionTable()
4404 * elif scorer is partial_token_sort_ratio: # <<<<<<<<<<<<<<
4405 * context = CreatePartialTokenSortRatioFunctionTable()
4406 * elif scorer is partial_token_set_ratio:
4407 */
4408 __Pyx_TraceLine(209,0,__PYX_ERR(0, 209, __pyx_L1_error))
4409 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_partial_token_sort_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
4410 __Pyx_GOTREF(__pyx_t_1);
4411 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4412 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4413 __pyx_t_2 = (__pyx_t_3 != 0);
4414 if (__pyx_t_2) {
4415
4416 /* "cpp_process_cdist.pyx":210
4417 * context = CreateTokenRatioFunctionTable()
4418 * elif scorer is partial_token_sort_ratio:
4419 * context = CreatePartialTokenSortRatioFunctionTable() # <<<<<<<<<<<<<<
4420 * elif scorer is partial_token_set_ratio:
4421 * context = CreatePartialTokenSetRatioFunctionTable()
4422 */
4423 __Pyx_TraceLine(210,0,__PYX_ERR(0, 210, __pyx_L1_error))
4424 try {
4425 __pyx_t_4 = CreatePartialTokenSortRatioFunctionTable();
4426 } catch(...) {
4427 __Pyx_CppExn2PyErr();
4428 __PYX_ERR(0, 210, __pyx_L1_error)
4429 }
4430 __pyx_v_context = __pyx_t_4;
4431
4432 /* "cpp_process_cdist.pyx":209
4433 * elif scorer is token_ratio:
4434 * context = CreateTokenRatioFunctionTable()
4435 * elif scorer is partial_token_sort_ratio: # <<<<<<<<<<<<<<
4436 * context = CreatePartialTokenSortRatioFunctionTable()
4437 * elif scorer is partial_token_set_ratio:
4438 */
4439 goto __pyx_L3;
4440 }
4441
4442 /* "cpp_process_cdist.pyx":211
4443 * elif scorer is partial_token_sort_ratio:
4444 * context = CreatePartialTokenSortRatioFunctionTable()
4445 * elif scorer is partial_token_set_ratio: # <<<<<<<<<<<<<<
4446 * context = CreatePartialTokenSetRatioFunctionTable()
4447 * elif scorer is partial_token_ratio:
4448 */
4449 __Pyx_TraceLine(211,0,__PYX_ERR(0, 211, __pyx_L1_error))
4450 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_partial_token_set_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
4451 __Pyx_GOTREF(__pyx_t_1);
4452 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4453 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4454 __pyx_t_3 = (__pyx_t_2 != 0);
4455 if (__pyx_t_3) {
4456
4457 /* "cpp_process_cdist.pyx":212
4458 * context = CreatePartialTokenSortRatioFunctionTable()
4459 * elif scorer is partial_token_set_ratio:
4460 * context = CreatePartialTokenSetRatioFunctionTable() # <<<<<<<<<<<<<<
4461 * elif scorer is partial_token_ratio:
4462 * context = CreatePartialTokenRatioFunctionTable()
4463 */
4464 __Pyx_TraceLine(212,0,__PYX_ERR(0, 212, __pyx_L1_error))
4465 try {
4466 __pyx_t_4 = CreatePartialTokenSetRatioFunctionTable();
4467 } catch(...) {
4468 __Pyx_CppExn2PyErr();
4469 __PYX_ERR(0, 212, __pyx_L1_error)
4470 }
4471 __pyx_v_context = __pyx_t_4;
4472
4473 /* "cpp_process_cdist.pyx":211
4474 * elif scorer is partial_token_sort_ratio:
4475 * context = CreatePartialTokenSortRatioFunctionTable()
4476 * elif scorer is partial_token_set_ratio: # <<<<<<<<<<<<<<
4477 * context = CreatePartialTokenSetRatioFunctionTable()
4478 * elif scorer is partial_token_ratio:
4479 */
4480 goto __pyx_L3;
4481 }
4482
4483 /* "cpp_process_cdist.pyx":213
4484 * elif scorer is partial_token_set_ratio:
4485 * context = CreatePartialTokenSetRatioFunctionTable()
4486 * elif scorer is partial_token_ratio: # <<<<<<<<<<<<<<
4487 * context = CreatePartialTokenRatioFunctionTable()
4488 * elif scorer is WRatio:
4489 */
4490 __Pyx_TraceLine(213,0,__PYX_ERR(0, 213, __pyx_L1_error))
4491 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_partial_token_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
4492 __Pyx_GOTREF(__pyx_t_1);
4493 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4494 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4495 __pyx_t_2 = (__pyx_t_3 != 0);
4496 if (__pyx_t_2) {
4497
4498 /* "cpp_process_cdist.pyx":214
4499 * context = CreatePartialTokenSetRatioFunctionTable()
4500 * elif scorer is partial_token_ratio:
4501 * context = CreatePartialTokenRatioFunctionTable() # <<<<<<<<<<<<<<
4502 * elif scorer is WRatio:
4503 * context = CreateWRatioFunctionTable()
4504 */
4505 __Pyx_TraceLine(214,0,__PYX_ERR(0, 214, __pyx_L1_error))
4506 try {
4507 __pyx_t_4 = CreatePartialTokenRatioFunctionTable();
4508 } catch(...) {
4509 __Pyx_CppExn2PyErr();
4510 __PYX_ERR(0, 214, __pyx_L1_error)
4511 }
4512 __pyx_v_context = __pyx_t_4;
4513
4514 /* "cpp_process_cdist.pyx":213
4515 * elif scorer is partial_token_set_ratio:
4516 * context = CreatePartialTokenSetRatioFunctionTable()
4517 * elif scorer is partial_token_ratio: # <<<<<<<<<<<<<<
4518 * context = CreatePartialTokenRatioFunctionTable()
4519 * elif scorer is WRatio:
4520 */
4521 goto __pyx_L3;
4522 }
4523
4524 /* "cpp_process_cdist.pyx":215
4525 * elif scorer is partial_token_ratio:
4526 * context = CreatePartialTokenRatioFunctionTable()
4527 * elif scorer is WRatio: # <<<<<<<<<<<<<<
4528 * context = CreateWRatioFunctionTable()
4529 * elif scorer is QRatio:
4530 */
4531 __Pyx_TraceLine(215,0,__PYX_ERR(0, 215, __pyx_L1_error))
4532 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
4533 __Pyx_GOTREF(__pyx_t_1);
4534 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4535 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4536 __pyx_t_3 = (__pyx_t_2 != 0);
4537 if (__pyx_t_3) {
4538
4539 /* "cpp_process_cdist.pyx":216
4540 * context = CreatePartialTokenRatioFunctionTable()
4541 * elif scorer is WRatio:
4542 * context = CreateWRatioFunctionTable() # <<<<<<<<<<<<<<
4543 * elif scorer is QRatio:
4544 * context = CreateQRatioFunctionTable()
4545 */
4546 __Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
4547 try {
4548 __pyx_t_4 = CreateWRatioFunctionTable();
4549 } catch(...) {
4550 __Pyx_CppExn2PyErr();
4551 __PYX_ERR(0, 216, __pyx_L1_error)
4552 }
4553 __pyx_v_context = __pyx_t_4;
4554
4555 /* "cpp_process_cdist.pyx":215
4556 * elif scorer is partial_token_ratio:
4557 * context = CreatePartialTokenRatioFunctionTable()
4558 * elif scorer is WRatio: # <<<<<<<<<<<<<<
4559 * context = CreateWRatioFunctionTable()
4560 * elif scorer is QRatio:
4561 */
4562 goto __pyx_L3;
4563 }
4564
4565 /* "cpp_process_cdist.pyx":217
4566 * elif scorer is WRatio:
4567 * context = CreateWRatioFunctionTable()
4568 * elif scorer is QRatio: # <<<<<<<<<<<<<<
4569 * context = CreateQRatioFunctionTable()
4570 * elif scorer is normalized_levenshtein:
4571 */
4572 __Pyx_TraceLine(217,0,__PYX_ERR(0, 217, __pyx_L1_error))
4573 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_QRatio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
4574 __Pyx_GOTREF(__pyx_t_1);
4575 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4576 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4577 __pyx_t_2 = (__pyx_t_3 != 0);
4578 if (__pyx_t_2) {
4579
4580 /* "cpp_process_cdist.pyx":218
4581 * context = CreateWRatioFunctionTable()
4582 * elif scorer is QRatio:
4583 * context = CreateQRatioFunctionTable() # <<<<<<<<<<<<<<
4584 * elif scorer is normalized_levenshtein:
4585 * context = CreateNormalizedLevenshteinFunctionTable()
4586 */
4587 __Pyx_TraceLine(218,0,__PYX_ERR(0, 218, __pyx_L1_error))
4588 try {
4589 __pyx_t_4 = CreateQRatioFunctionTable();
4590 } catch(...) {
4591 __Pyx_CppExn2PyErr();
4592 __PYX_ERR(0, 218, __pyx_L1_error)
4593 }
4594 __pyx_v_context = __pyx_t_4;
4595
4596 /* "cpp_process_cdist.pyx":217
4597 * elif scorer is WRatio:
4598 * context = CreateWRatioFunctionTable()
4599 * elif scorer is QRatio: # <<<<<<<<<<<<<<
4600 * context = CreateQRatioFunctionTable()
4601 * elif scorer is normalized_levenshtein:
4602 */
4603 goto __pyx_L3;
4604 }
4605
4606 /* "cpp_process_cdist.pyx":219
4607 * elif scorer is QRatio:
4608 * context = CreateQRatioFunctionTable()
4609 * elif scorer is normalized_levenshtein: # <<<<<<<<<<<<<<
4610 * context = CreateNormalizedLevenshteinFunctionTable()
4611 * elif scorer is normalized_hamming:
4612 */
4613 __Pyx_TraceLine(219,0,__PYX_ERR(0, 219, __pyx_L1_error))
4614 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_normalized_levenshtein); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
4615 __Pyx_GOTREF(__pyx_t_1);
4616 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4617 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4618 __pyx_t_3 = (__pyx_t_2 != 0);
4619 if (__pyx_t_3) {
4620
4621 /* "cpp_process_cdist.pyx":220
4622 * context = CreateQRatioFunctionTable()
4623 * elif scorer is normalized_levenshtein:
4624 * context = CreateNormalizedLevenshteinFunctionTable() # <<<<<<<<<<<<<<
4625 * elif scorer is normalized_hamming:
4626 * context = CreateNormalizedHammingFunctionTable()
4627 */
4628 __Pyx_TraceLine(220,0,__PYX_ERR(0, 220, __pyx_L1_error))
4629 __pyx_v_context = __pyx_f_17cpp_process_cdist_CreateNormalizedLevenshteinFunctionTable();
4630
4631 /* "cpp_process_cdist.pyx":219
4632 * elif scorer is QRatio:
4633 * context = CreateQRatioFunctionTable()
4634 * elif scorer is normalized_levenshtein: # <<<<<<<<<<<<<<
4635 * context = CreateNormalizedLevenshteinFunctionTable()
4636 * elif scorer is normalized_hamming:
4637 */
4638 goto __pyx_L3;
4639 }
4640
4641 /* "cpp_process_cdist.pyx":221
4642 * elif scorer is normalized_levenshtein:
4643 * context = CreateNormalizedLevenshteinFunctionTable()
4644 * elif scorer is normalized_hamming: # <<<<<<<<<<<<<<
4645 * context = CreateNormalizedHammingFunctionTable()
4646 * elif scorer is jaro_similarity:
4647 */
4648 __Pyx_TraceLine(221,0,__PYX_ERR(0, 221, __pyx_L1_error))
4649 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_normalized_hamming); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
4650 __Pyx_GOTREF(__pyx_t_1);
4651 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4652 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4653 __pyx_t_2 = (__pyx_t_3 != 0);
4654 if (__pyx_t_2) {
4655
4656 /* "cpp_process_cdist.pyx":222
4657 * context = CreateNormalizedLevenshteinFunctionTable()
4658 * elif scorer is normalized_hamming:
4659 * context = CreateNormalizedHammingFunctionTable() # <<<<<<<<<<<<<<
4660 * elif scorer is jaro_similarity:
4661 * context = CreateJaroSimilarityFunctionTable()
4662 */
4663 __Pyx_TraceLine(222,0,__PYX_ERR(0, 222, __pyx_L1_error))
4664 __pyx_v_context = CreateNormalizedHammingFunctionTable();
4665
4666 /* "cpp_process_cdist.pyx":221
4667 * elif scorer is normalized_levenshtein:
4668 * context = CreateNormalizedLevenshteinFunctionTable()
4669 * elif scorer is normalized_hamming: # <<<<<<<<<<<<<<
4670 * context = CreateNormalizedHammingFunctionTable()
4671 * elif scorer is jaro_similarity:
4672 */
4673 goto __pyx_L3;
4674 }
4675
4676 /* "cpp_process_cdist.pyx":223
4677 * elif scorer is normalized_hamming:
4678 * context = CreateNormalizedHammingFunctionTable()
4679 * elif scorer is jaro_similarity: # <<<<<<<<<<<<<<
4680 * context = CreateJaroSimilarityFunctionTable()
4681 * elif scorer is jaro_winkler_similarity:
4682 */
4683 __Pyx_TraceLine(223,0,__PYX_ERR(0, 223, __pyx_L1_error))
4684 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_jaro_similarity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
4685 __Pyx_GOTREF(__pyx_t_1);
4686 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4687 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4688 __pyx_t_3 = (__pyx_t_2 != 0);
4689 if (__pyx_t_3) {
4690
4691 /* "cpp_process_cdist.pyx":224
4692 * context = CreateNormalizedHammingFunctionTable()
4693 * elif scorer is jaro_similarity:
4694 * context = CreateJaroSimilarityFunctionTable() # <<<<<<<<<<<<<<
4695 * elif scorer is jaro_winkler_similarity:
4696 * context = CreateJaroWinklerSimilarityFunctionTable()
4697 */
4698 __Pyx_TraceLine(224,0,__PYX_ERR(0, 224, __pyx_L1_error))
4699 __pyx_v_context = CreateJaroSimilarityFunctionTable();
4700
4701 /* "cpp_process_cdist.pyx":223
4702 * elif scorer is normalized_hamming:
4703 * context = CreateNormalizedHammingFunctionTable()
4704 * elif scorer is jaro_similarity: # <<<<<<<<<<<<<<
4705 * context = CreateJaroSimilarityFunctionTable()
4706 * elif scorer is jaro_winkler_similarity:
4707 */
4708 goto __pyx_L3;
4709 }
4710
4711 /* "cpp_process_cdist.pyx":225
4712 * elif scorer is jaro_similarity:
4713 * context = CreateJaroSimilarityFunctionTable()
4714 * elif scorer is jaro_winkler_similarity: # <<<<<<<<<<<<<<
4715 * context = CreateJaroWinklerSimilarityFunctionTable()
4716 *
4717 */
4718 __Pyx_TraceLine(225,0,__PYX_ERR(0, 225, __pyx_L1_error))
4719 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_jaro_winkler_similarity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
4720 __Pyx_GOTREF(__pyx_t_1);
4721 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4722 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4723 __pyx_t_2 = (__pyx_t_3 != 0);
4724 if (__pyx_t_2) {
4725
4726 /* "cpp_process_cdist.pyx":226
4727 * context = CreateJaroSimilarityFunctionTable()
4728 * elif scorer is jaro_winkler_similarity:
4729 * context = CreateJaroWinklerSimilarityFunctionTable() # <<<<<<<<<<<<<<
4730 *
4731 * return move(context)
4732 */
4733 __Pyx_TraceLine(226,0,__PYX_ERR(0, 226, __pyx_L1_error))
4734 __pyx_v_context = __pyx_f_17cpp_process_cdist_CreateJaroWinklerSimilarityFunctionTable();
4735
4736 /* "cpp_process_cdist.pyx":225
4737 * elif scorer is jaro_similarity:
4738 * context = CreateJaroSimilarityFunctionTable()
4739 * elif scorer is jaro_winkler_similarity: # <<<<<<<<<<<<<<
4740 * context = CreateJaroWinklerSimilarityFunctionTable()
4741 *
4742 */
4743 }
4744 __pyx_L3:;
4745
4746 /* "cpp_process_cdist.pyx":228
4747 * context = CreateJaroWinklerSimilarityFunctionTable()
4748 *
4749 * return move(context) # <<<<<<<<<<<<<<
4750 *
4751 * cdef inline DistanceFunctionTable CachedDistanceInit(object scorer):
4752 */
4753 __Pyx_TraceLine(228,0,__PYX_ERR(0, 228, __pyx_L1_error))
4754 __pyx_r = cython_std::move<struct ScorerFunctionTable>(__pyx_v_context);
4755 goto __pyx_L0;
4756
4757 /* "cpp_process_cdist.pyx":196
4758 * )
4759 *
4760 * cdef inline ScorerFunctionTable CachedScorerInit(object scorer): # <<<<<<<<<<<<<<
4761 * cdef ScorerFunctionTable context
4762 *
4763 */
4764
4765 /* function exit code */
4766 __pyx_L1_error:;
4767 __Pyx_XDECREF(__pyx_t_1);
4768 __Pyx_WriteUnraisable("cpp_process_cdist.CachedScorerInit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4769 __Pyx_pretend_to_initialize(&__pyx_r);
4770 __pyx_L0:;
4771 __Pyx_TraceReturn(Py_None, 0);
4772 __Pyx_RefNannyFinishContext();
4773 return __pyx_r;
4774 }
4775
4776 /* "cpp_process_cdist.pyx":230
4777 * return move(context)
4778 *
4779 * cdef inline DistanceFunctionTable CachedDistanceInit(object scorer): # <<<<<<<<<<<<<<
4780 * cdef DistanceFunctionTable table
4781 *
4782 */
4783
__pyx_f_17cpp_process_cdist_CachedDistanceInit(PyObject * __pyx_v_scorer)4784 static CYTHON_INLINE struct DistanceFunctionTable __pyx_f_17cpp_process_cdist_CachedDistanceInit(PyObject *__pyx_v_scorer) {
4785 struct DistanceFunctionTable __pyx_v_table;
4786 struct DistanceFunctionTable __pyx_r;
4787 __Pyx_TraceDeclarations
4788 __Pyx_RefNannyDeclarations
4789 PyObject *__pyx_t_1 = NULL;
4790 int __pyx_t_2;
4791 int __pyx_t_3;
4792 int __pyx_lineno = 0;
4793 const char *__pyx_filename = NULL;
4794 int __pyx_clineno = 0;
4795 __Pyx_RefNannySetupContext("CachedDistanceInit", 0);
4796 __Pyx_TraceCall("CachedDistanceInit", __pyx_f[0], 230, 0, __PYX_ERR(0, 230, __pyx_L1_error));
4797
4798 /* "cpp_process_cdist.pyx":233
4799 * cdef DistanceFunctionTable table
4800 *
4801 * if scorer is levenshtein: # <<<<<<<<<<<<<<
4802 * table = CreateLevenshteinFunctionTable()
4803 * elif scorer is hamming:
4804 */
4805 __Pyx_TraceLine(233,0,__PYX_ERR(0, 233, __pyx_L1_error))
4806 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_levenshtein); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error)
4807 __Pyx_GOTREF(__pyx_t_1);
4808 __pyx_t_2 = (__pyx_v_scorer == __pyx_t_1);
4809 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4810 __pyx_t_3 = (__pyx_t_2 != 0);
4811 if (__pyx_t_3) {
4812
4813 /* "cpp_process_cdist.pyx":234
4814 *
4815 * if scorer is levenshtein:
4816 * table = CreateLevenshteinFunctionTable() # <<<<<<<<<<<<<<
4817 * elif scorer is hamming:
4818 * table = CreateHammingFunctionTable()
4819 */
4820 __Pyx_TraceLine(234,0,__PYX_ERR(0, 234, __pyx_L1_error))
4821 __pyx_v_table = __pyx_f_17cpp_process_cdist_CreateLevenshteinFunctionTable();
4822
4823 /* "cpp_process_cdist.pyx":233
4824 * cdef DistanceFunctionTable table
4825 *
4826 * if scorer is levenshtein: # <<<<<<<<<<<<<<
4827 * table = CreateLevenshteinFunctionTable()
4828 * elif scorer is hamming:
4829 */
4830 goto __pyx_L3;
4831 }
4832
4833 /* "cpp_process_cdist.pyx":235
4834 * if scorer is levenshtein:
4835 * table = CreateLevenshteinFunctionTable()
4836 * elif scorer is hamming: # <<<<<<<<<<<<<<
4837 * table = CreateHammingFunctionTable()
4838 *
4839 */
4840 __Pyx_TraceLine(235,0,__PYX_ERR(0, 235, __pyx_L1_error))
4841 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_hamming); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
4842 __Pyx_GOTREF(__pyx_t_1);
4843 __pyx_t_3 = (__pyx_v_scorer == __pyx_t_1);
4844 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4845 __pyx_t_2 = (__pyx_t_3 != 0);
4846 if (__pyx_t_2) {
4847
4848 /* "cpp_process_cdist.pyx":236
4849 * table = CreateLevenshteinFunctionTable()
4850 * elif scorer is hamming:
4851 * table = CreateHammingFunctionTable() # <<<<<<<<<<<<<<
4852 *
4853 * return table
4854 */
4855 __Pyx_TraceLine(236,0,__PYX_ERR(0, 236, __pyx_L1_error))
4856 __pyx_v_table = CreateHammingFunctionTable();
4857
4858 /* "cpp_process_cdist.pyx":235
4859 * if scorer is levenshtein:
4860 * table = CreateLevenshteinFunctionTable()
4861 * elif scorer is hamming: # <<<<<<<<<<<<<<
4862 * table = CreateHammingFunctionTable()
4863 *
4864 */
4865 }
4866 __pyx_L3:;
4867
4868 /* "cpp_process_cdist.pyx":238
4869 * table = CreateHammingFunctionTable()
4870 *
4871 * return table # <<<<<<<<<<<<<<
4872 *
4873 * cdef int dtype_to_type_num_similarity(dtype) except -1:
4874 */
4875 __Pyx_TraceLine(238,0,__PYX_ERR(0, 238, __pyx_L1_error))
4876 __pyx_r = __pyx_v_table;
4877 goto __pyx_L0;
4878
4879 /* "cpp_process_cdist.pyx":230
4880 * return move(context)
4881 *
4882 * cdef inline DistanceFunctionTable CachedDistanceInit(object scorer): # <<<<<<<<<<<<<<
4883 * cdef DistanceFunctionTable table
4884 *
4885 */
4886
4887 /* function exit code */
4888 __pyx_L1_error:;
4889 __Pyx_XDECREF(__pyx_t_1);
4890 __Pyx_WriteUnraisable("cpp_process_cdist.CachedDistanceInit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4891 __Pyx_pretend_to_initialize(&__pyx_r);
4892 __pyx_L0:;
4893 __Pyx_TraceReturn(Py_None, 0);
4894 __Pyx_RefNannyFinishContext();
4895 return __pyx_r;
4896 }
4897
4898 /* "cpp_process_cdist.pyx":240
4899 * return table
4900 *
4901 * cdef int dtype_to_type_num_similarity(dtype) except -1: # <<<<<<<<<<<<<<
4902 * if dtype is None or dtype is np.uint8:
4903 * return np.NPY_UINT8
4904 */
4905
__pyx_f_17cpp_process_cdist_dtype_to_type_num_similarity(PyObject * __pyx_v_dtype)4906 static int __pyx_f_17cpp_process_cdist_dtype_to_type_num_similarity(PyObject *__pyx_v_dtype) {
4907 int __pyx_r;
4908 __Pyx_TraceDeclarations
4909 __Pyx_RefNannyDeclarations
4910 int __pyx_t_1;
4911 int __pyx_t_2;
4912 int __pyx_t_3;
4913 PyObject *__pyx_t_4 = NULL;
4914 PyObject *__pyx_t_5 = NULL;
4915 int __pyx_lineno = 0;
4916 const char *__pyx_filename = NULL;
4917 int __pyx_clineno = 0;
4918 __Pyx_RefNannySetupContext("dtype_to_type_num_similarity", 0);
4919 __Pyx_TraceCall("dtype_to_type_num_similarity", __pyx_f[0], 240, 0, __PYX_ERR(0, 240, __pyx_L1_error));
4920
4921 /* "cpp_process_cdist.pyx":241
4922 *
4923 * cdef int dtype_to_type_num_similarity(dtype) except -1:
4924 * if dtype is None or dtype is np.uint8: # <<<<<<<<<<<<<<
4925 * return np.NPY_UINT8
4926 * if dtype is np.float32:
4927 */
4928 __Pyx_TraceLine(241,0,__PYX_ERR(0, 241, __pyx_L1_error))
4929 __pyx_t_2 = (__pyx_v_dtype == Py_None);
4930 __pyx_t_3 = (__pyx_t_2 != 0);
4931 if (!__pyx_t_3) {
4932 } else {
4933 __pyx_t_1 = __pyx_t_3;
4934 goto __pyx_L4_bool_binop_done;
4935 }
4936 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
4937 __Pyx_GOTREF(__pyx_t_4);
4938 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
4939 __Pyx_GOTREF(__pyx_t_5);
4940 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4941 __pyx_t_3 = (__pyx_v_dtype == __pyx_t_5);
4942 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4943 __pyx_t_2 = (__pyx_t_3 != 0);
4944 __pyx_t_1 = __pyx_t_2;
4945 __pyx_L4_bool_binop_done:;
4946 if (__pyx_t_1) {
4947
4948 /* "cpp_process_cdist.pyx":242
4949 * cdef int dtype_to_type_num_similarity(dtype) except -1:
4950 * if dtype is None or dtype is np.uint8:
4951 * return np.NPY_UINT8 # <<<<<<<<<<<<<<
4952 * if dtype is np.float32:
4953 * return np.NPY_FLOAT32
4954 */
4955 __Pyx_TraceLine(242,0,__PYX_ERR(0, 242, __pyx_L1_error))
4956 __pyx_r = NPY_UINT8;
4957 goto __pyx_L0;
4958
4959 /* "cpp_process_cdist.pyx":241
4960 *
4961 * cdef int dtype_to_type_num_similarity(dtype) except -1:
4962 * if dtype is None or dtype is np.uint8: # <<<<<<<<<<<<<<
4963 * return np.NPY_UINT8
4964 * if dtype is np.float32:
4965 */
4966 }
4967
4968 /* "cpp_process_cdist.pyx":243
4969 * if dtype is None or dtype is np.uint8:
4970 * return np.NPY_UINT8
4971 * if dtype is np.float32: # <<<<<<<<<<<<<<
4972 * return np.NPY_FLOAT32
4973 * if dtype is np.float64:
4974 */
4975 __Pyx_TraceLine(243,0,__PYX_ERR(0, 243, __pyx_L1_error))
4976 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 243, __pyx_L1_error)
4977 __Pyx_GOTREF(__pyx_t_5);
4978 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error)
4979 __Pyx_GOTREF(__pyx_t_4);
4980 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4981 __pyx_t_1 = (__pyx_v_dtype == __pyx_t_4);
4982 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4983 __pyx_t_2 = (__pyx_t_1 != 0);
4984 if (__pyx_t_2) {
4985
4986 /* "cpp_process_cdist.pyx":244
4987 * return np.NPY_UINT8
4988 * if dtype is np.float32:
4989 * return np.NPY_FLOAT32 # <<<<<<<<<<<<<<
4990 * if dtype is np.float64:
4991 * return np.NPY_FLOAT64
4992 */
4993 __Pyx_TraceLine(244,0,__PYX_ERR(0, 244, __pyx_L1_error))
4994 __pyx_r = NPY_FLOAT32;
4995 goto __pyx_L0;
4996
4997 /* "cpp_process_cdist.pyx":243
4998 * if dtype is None or dtype is np.uint8:
4999 * return np.NPY_UINT8
5000 * if dtype is np.float32: # <<<<<<<<<<<<<<
5001 * return np.NPY_FLOAT32
5002 * if dtype is np.float64:
5003 */
5004 }
5005
5006 /* "cpp_process_cdist.pyx":245
5007 * if dtype is np.float32:
5008 * return np.NPY_FLOAT32
5009 * if dtype is np.float64: # <<<<<<<<<<<<<<
5010 * return np.NPY_FLOAT64
5011 *
5012 */
5013 __Pyx_TraceLine(245,0,__PYX_ERR(0, 245, __pyx_L1_error))
5014 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error)
5015 __Pyx_GOTREF(__pyx_t_4);
5016 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
5017 __Pyx_GOTREF(__pyx_t_5);
5018 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5019 __pyx_t_2 = (__pyx_v_dtype == __pyx_t_5);
5020 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5021 __pyx_t_1 = (__pyx_t_2 != 0);
5022 if (__pyx_t_1) {
5023
5024 /* "cpp_process_cdist.pyx":246
5025 * return np.NPY_FLOAT32
5026 * if dtype is np.float64:
5027 * return np.NPY_FLOAT64 # <<<<<<<<<<<<<<
5028 *
5029 * raise TypeError("invalid dtype (use np.uint8, np.float32 or np.float64)")
5030 */
5031 __Pyx_TraceLine(246,0,__PYX_ERR(0, 246, __pyx_L1_error))
5032 __pyx_r = NPY_FLOAT64;
5033 goto __pyx_L0;
5034
5035 /* "cpp_process_cdist.pyx":245
5036 * if dtype is np.float32:
5037 * return np.NPY_FLOAT32
5038 * if dtype is np.float64: # <<<<<<<<<<<<<<
5039 * return np.NPY_FLOAT64
5040 *
5041 */
5042 }
5043
5044 /* "cpp_process_cdist.pyx":248
5045 * return np.NPY_FLOAT64
5046 *
5047 * raise TypeError("invalid dtype (use np.uint8, np.float32 or np.float64)") # <<<<<<<<<<<<<<
5048 *
5049 * cdef int dtype_to_type_num_distance(dtype) except -1:
5050 */
5051 __Pyx_TraceLine(248,0,__PYX_ERR(0, 248, __pyx_L1_error))
5052 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error)
5053 __Pyx_GOTREF(__pyx_t_5);
5054 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
5055 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5056 __PYX_ERR(0, 248, __pyx_L1_error)
5057
5058 /* "cpp_process_cdist.pyx":240
5059 * return table
5060 *
5061 * cdef int dtype_to_type_num_similarity(dtype) except -1: # <<<<<<<<<<<<<<
5062 * if dtype is None or dtype is np.uint8:
5063 * return np.NPY_UINT8
5064 */
5065
5066 /* function exit code */
5067 __pyx_L1_error:;
5068 __Pyx_XDECREF(__pyx_t_4);
5069 __Pyx_XDECREF(__pyx_t_5);
5070 __Pyx_AddTraceback("cpp_process_cdist.dtype_to_type_num_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
5071 __pyx_r = -1;
5072 __pyx_L0:;
5073 __Pyx_TraceReturn(Py_None, 0);
5074 __Pyx_RefNannyFinishContext();
5075 return __pyx_r;
5076 }
5077
5078 /* "cpp_process_cdist.pyx":250
5079 * raise TypeError("invalid dtype (use np.uint8, np.float32 or np.float64)")
5080 *
5081 * cdef int dtype_to_type_num_distance(dtype) except -1: # <<<<<<<<<<<<<<
5082 * if dtype is None or dtype is np.int32:
5083 * return np.NPY_INT32
5084 */
5085
__pyx_f_17cpp_process_cdist_dtype_to_type_num_distance(PyObject * __pyx_v_dtype)5086 static int __pyx_f_17cpp_process_cdist_dtype_to_type_num_distance(PyObject *__pyx_v_dtype) {
5087 int __pyx_r;
5088 __Pyx_TraceDeclarations
5089 __Pyx_RefNannyDeclarations
5090 int __pyx_t_1;
5091 int __pyx_t_2;
5092 int __pyx_t_3;
5093 PyObject *__pyx_t_4 = NULL;
5094 PyObject *__pyx_t_5 = NULL;
5095 int __pyx_lineno = 0;
5096 const char *__pyx_filename = NULL;
5097 int __pyx_clineno = 0;
5098 __Pyx_RefNannySetupContext("dtype_to_type_num_distance", 0);
5099 __Pyx_TraceCall("dtype_to_type_num_distance", __pyx_f[0], 250, 0, __PYX_ERR(0, 250, __pyx_L1_error));
5100
5101 /* "cpp_process_cdist.pyx":251
5102 *
5103 * cdef int dtype_to_type_num_distance(dtype) except -1:
5104 * if dtype is None or dtype is np.int32: # <<<<<<<<<<<<<<
5105 * return np.NPY_INT32
5106 * if dtype is np.int8:
5107 */
5108 __Pyx_TraceLine(251,0,__PYX_ERR(0, 251, __pyx_L1_error))
5109 __pyx_t_2 = (__pyx_v_dtype == Py_None);
5110 __pyx_t_3 = (__pyx_t_2 != 0);
5111 if (!__pyx_t_3) {
5112 } else {
5113 __pyx_t_1 = __pyx_t_3;
5114 goto __pyx_L4_bool_binop_done;
5115 }
5116 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
5117 __Pyx_GOTREF(__pyx_t_4);
5118 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
5119 __Pyx_GOTREF(__pyx_t_5);
5120 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5121 __pyx_t_3 = (__pyx_v_dtype == __pyx_t_5);
5122 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5123 __pyx_t_2 = (__pyx_t_3 != 0);
5124 __pyx_t_1 = __pyx_t_2;
5125 __pyx_L4_bool_binop_done:;
5126 if (__pyx_t_1) {
5127
5128 /* "cpp_process_cdist.pyx":252
5129 * cdef int dtype_to_type_num_distance(dtype) except -1:
5130 * if dtype is None or dtype is np.int32:
5131 * return np.NPY_INT32 # <<<<<<<<<<<<<<
5132 * if dtype is np.int8:
5133 * return np.NPY_INT8
5134 */
5135 __Pyx_TraceLine(252,0,__PYX_ERR(0, 252, __pyx_L1_error))
5136 __pyx_r = NPY_INT32;
5137 goto __pyx_L0;
5138
5139 /* "cpp_process_cdist.pyx":251
5140 *
5141 * cdef int dtype_to_type_num_distance(dtype) except -1:
5142 * if dtype is None or dtype is np.int32: # <<<<<<<<<<<<<<
5143 * return np.NPY_INT32
5144 * if dtype is np.int8:
5145 */
5146 }
5147
5148 /* "cpp_process_cdist.pyx":253
5149 * if dtype is None or dtype is np.int32:
5150 * return np.NPY_INT32
5151 * if dtype is np.int8: # <<<<<<<<<<<<<<
5152 * return np.NPY_INT8
5153 * if dtype is np.int16:
5154 */
5155 __Pyx_TraceLine(253,0,__PYX_ERR(0, 253, __pyx_L1_error))
5156 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __pyx_L1_error)
5157 __Pyx_GOTREF(__pyx_t_5);
5158 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
5159 __Pyx_GOTREF(__pyx_t_4);
5160 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5161 __pyx_t_1 = (__pyx_v_dtype == __pyx_t_4);
5162 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5163 __pyx_t_2 = (__pyx_t_1 != 0);
5164 if (__pyx_t_2) {
5165
5166 /* "cpp_process_cdist.pyx":254
5167 * return np.NPY_INT32
5168 * if dtype is np.int8:
5169 * return np.NPY_INT8 # <<<<<<<<<<<<<<
5170 * if dtype is np.int16:
5171 * return np.NPY_INT16
5172 */
5173 __Pyx_TraceLine(254,0,__PYX_ERR(0, 254, __pyx_L1_error))
5174 __pyx_r = NPY_INT8;
5175 goto __pyx_L0;
5176
5177 /* "cpp_process_cdist.pyx":253
5178 * if dtype is None or dtype is np.int32:
5179 * return np.NPY_INT32
5180 * if dtype is np.int8: # <<<<<<<<<<<<<<
5181 * return np.NPY_INT8
5182 * if dtype is np.int16:
5183 */
5184 }
5185
5186 /* "cpp_process_cdist.pyx":255
5187 * if dtype is np.int8:
5188 * return np.NPY_INT8
5189 * if dtype is np.int16: # <<<<<<<<<<<<<<
5190 * return np.NPY_INT16
5191 * if dtype is np.int64:
5192 */
5193 __Pyx_TraceLine(255,0,__PYX_ERR(0, 255, __pyx_L1_error))
5194 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
5195 __Pyx_GOTREF(__pyx_t_4);
5196 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
5197 __Pyx_GOTREF(__pyx_t_5);
5198 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5199 __pyx_t_2 = (__pyx_v_dtype == __pyx_t_5);
5200 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5201 __pyx_t_1 = (__pyx_t_2 != 0);
5202 if (__pyx_t_1) {
5203
5204 /* "cpp_process_cdist.pyx":256
5205 * return np.NPY_INT8
5206 * if dtype is np.int16:
5207 * return np.NPY_INT16 # <<<<<<<<<<<<<<
5208 * if dtype is np.int64:
5209 * return np.NPY_INT64
5210 */
5211 __Pyx_TraceLine(256,0,__PYX_ERR(0, 256, __pyx_L1_error))
5212 __pyx_r = NPY_INT16;
5213 goto __pyx_L0;
5214
5215 /* "cpp_process_cdist.pyx":255
5216 * if dtype is np.int8:
5217 * return np.NPY_INT8
5218 * if dtype is np.int16: # <<<<<<<<<<<<<<
5219 * return np.NPY_INT16
5220 * if dtype is np.int64:
5221 */
5222 }
5223
5224 /* "cpp_process_cdist.pyx":257
5225 * if dtype is np.int16:
5226 * return np.NPY_INT16
5227 * if dtype is np.int64: # <<<<<<<<<<<<<<
5228 * return np.NPY_INT64
5229 *
5230 */
5231 __Pyx_TraceLine(257,0,__PYX_ERR(0, 257, __pyx_L1_error))
5232 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 257, __pyx_L1_error)
5233 __Pyx_GOTREF(__pyx_t_5);
5234 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
5235 __Pyx_GOTREF(__pyx_t_4);
5236 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5237 __pyx_t_1 = (__pyx_v_dtype == __pyx_t_4);
5238 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5239 __pyx_t_2 = (__pyx_t_1 != 0);
5240 if (__pyx_t_2) {
5241
5242 /* "cpp_process_cdist.pyx":258
5243 * return np.NPY_INT16
5244 * if dtype is np.int64:
5245 * return np.NPY_INT64 # <<<<<<<<<<<<<<
5246 *
5247 * raise TypeError("invalid dtype (use np.int8, np.int16, np.int32 or np.int64)")
5248 */
5249 __Pyx_TraceLine(258,0,__PYX_ERR(0, 258, __pyx_L1_error))
5250 __pyx_r = NPY_INT64;
5251 goto __pyx_L0;
5252
5253 /* "cpp_process_cdist.pyx":257
5254 * if dtype is np.int16:
5255 * return np.NPY_INT16
5256 * if dtype is np.int64: # <<<<<<<<<<<<<<
5257 * return np.NPY_INT64
5258 *
5259 */
5260 }
5261
5262 /* "cpp_process_cdist.pyx":260
5263 * return np.NPY_INT64
5264 *
5265 * raise TypeError("invalid dtype (use np.int8, np.int16, np.int32 or np.int64)") # <<<<<<<<<<<<<<
5266 *
5267 * cdef inline cdist_two_lists_similarity(
5268 */
5269 __Pyx_TraceLine(260,0,__PYX_ERR(0, 260, __pyx_L1_error))
5270 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
5271 __Pyx_GOTREF(__pyx_t_4);
5272 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5273 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5274 __PYX_ERR(0, 260, __pyx_L1_error)
5275
5276 /* "cpp_process_cdist.pyx":250
5277 * raise TypeError("invalid dtype (use np.uint8, np.float32 or np.float64)")
5278 *
5279 * cdef int dtype_to_type_num_distance(dtype) except -1: # <<<<<<<<<<<<<<
5280 * if dtype is None or dtype is np.int32:
5281 * return np.NPY_INT32
5282 */
5283
5284 /* function exit code */
5285 __pyx_L1_error:;
5286 __Pyx_XDECREF(__pyx_t_4);
5287 __Pyx_XDECREF(__pyx_t_5);
5288 __Pyx_AddTraceback("cpp_process_cdist.dtype_to_type_num_distance", __pyx_clineno, __pyx_lineno, __pyx_filename);
5289 __pyx_r = -1;
5290 __pyx_L0:;
5291 __Pyx_TraceReturn(Py_None, 0);
5292 __Pyx_RefNannyFinishContext();
5293 return __pyx_r;
5294 }
5295
5296 /* "cpp_process_cdist.pyx":262
5297 * raise TypeError("invalid dtype (use np.int8, np.int16, np.int32 or np.int64)")
5298 *
5299 * cdef inline cdist_two_lists_similarity( # <<<<<<<<<<<<<<
5300 * const vector[proc_string]& queries,
5301 * const vector[proc_string]& choices,
5302 */
5303
__pyx_f_17cpp_process_cdist_cdist_two_lists_similarity(std::vector<proc_string> const & __pyx_v_queries,std::vector<proc_string> const & __pyx_v_choices,PyObject * __pyx_v_scorer,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)5304 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_two_lists_similarity(std::vector<proc_string> const &__pyx_v_queries, std::vector<proc_string> const &__pyx_v_choices, PyObject *__pyx_v_scorer, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
5305 double __pyx_v_c_score_cutoff;
5306 struct ScorerFunctionTable __pyx_v_table;
5307 KwargsContext __pyx_v_kwargs_context;
5308 int __pyx_v_c_dtype;
5309 int __pyx_v_c_workers;
5310 PyObject *__pyx_r = NULL;
5311 __Pyx_TraceDeclarations
5312 __Pyx_RefNannyDeclarations
5313 int __pyx_t_1;
5314 int __pyx_t_2;
5315 KwargsContext __pyx_t_3;
5316 int __pyx_t_4;
5317 double __pyx_t_5;
5318 PyObject *__pyx_t_6 = NULL;
5319 int __pyx_lineno = 0;
5320 const char *__pyx_filename = NULL;
5321 int __pyx_clineno = 0;
5322 __Pyx_RefNannySetupContext("cdist_two_lists_similarity", 0);
5323 __Pyx_TraceCall("cdist_two_lists_similarity", __pyx_f[0], 262, 0, __PYX_ERR(0, 262, __pyx_L1_error));
5324
5325 /* "cpp_process_cdist.pyx":267
5326 * scorer, score_cutoff, dtype, workers, dict kwargs
5327 * ):
5328 * cdef double c_score_cutoff = 0 # <<<<<<<<<<<<<<
5329 * cdef ScorerFunctionTable table = CachedScorerInit(scorer)
5330 * cdef KwargsContext kwargs_context
5331 */
5332 __Pyx_TraceLine(267,0,__PYX_ERR(0, 267, __pyx_L1_error))
5333 __pyx_v_c_score_cutoff = 0.0;
5334
5335 /* "cpp_process_cdist.pyx":268
5336 * ):
5337 * cdef double c_score_cutoff = 0
5338 * cdef ScorerFunctionTable table = CachedScorerInit(scorer) # <<<<<<<<<<<<<<
5339 * cdef KwargsContext kwargs_context
5340 * cdef int c_dtype = dtype_to_type_num_similarity(dtype)
5341 */
5342 __Pyx_TraceLine(268,0,__PYX_ERR(0, 268, __pyx_L1_error))
5343 __pyx_v_table = __pyx_f_17cpp_process_cdist_CachedScorerInit(__pyx_v_scorer);
5344
5345 /* "cpp_process_cdist.pyx":270
5346 * cdef ScorerFunctionTable table = CachedScorerInit(scorer)
5347 * cdef KwargsContext kwargs_context
5348 * cdef int c_dtype = dtype_to_type_num_similarity(dtype) # <<<<<<<<<<<<<<
5349 * cdef int c_workers = workers
5350 *
5351 */
5352 __Pyx_TraceLine(270,0,__PYX_ERR(0, 270, __pyx_L1_error))
5353 __pyx_t_1 = __pyx_f_17cpp_process_cdist_dtype_to_type_num_similarity(__pyx_v_dtype); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 270, __pyx_L1_error)
5354 __pyx_v_c_dtype = __pyx_t_1;
5355
5356 /* "cpp_process_cdist.pyx":271
5357 * cdef KwargsContext kwargs_context
5358 * cdef int c_dtype = dtype_to_type_num_similarity(dtype)
5359 * cdef int c_workers = workers # <<<<<<<<<<<<<<
5360 *
5361 * if (NULL != table.kwargs_init):
5362 */
5363 __Pyx_TraceLine(271,0,__PYX_ERR(0, 271, __pyx_L1_error))
5364 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_workers); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error)
5365 __pyx_v_c_workers = __pyx_t_1;
5366
5367 /* "cpp_process_cdist.pyx":273
5368 * cdef int c_workers = workers
5369 *
5370 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
5371 * kwargs_context = table.kwargs_init(kwargs)
5372 *
5373 */
5374 __Pyx_TraceLine(273,0,__PYX_ERR(0, 273, __pyx_L1_error))
5375 __pyx_t_2 = ((NULL != __pyx_v_table.kwargs_init) != 0);
5376 if (__pyx_t_2) {
5377
5378 /* "cpp_process_cdist.pyx":274
5379 *
5380 * if (NULL != table.kwargs_init):
5381 * kwargs_context = table.kwargs_init(kwargs) # <<<<<<<<<<<<<<
5382 *
5383 * if score_cutoff is not None:
5384 */
5385 __Pyx_TraceLine(274,0,__PYX_ERR(0, 274, __pyx_L1_error))
5386 __pyx_t_3 = __pyx_v_table.kwargs_init(__pyx_v_kwargs); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
5387 __pyx_v_kwargs_context = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);
5388
5389 /* "cpp_process_cdist.pyx":273
5390 * cdef int c_workers = workers
5391 *
5392 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
5393 * kwargs_context = table.kwargs_init(kwargs)
5394 *
5395 */
5396 }
5397
5398 /* "cpp_process_cdist.pyx":276
5399 * kwargs_context = table.kwargs_init(kwargs)
5400 *
5401 * if score_cutoff is not None: # <<<<<<<<<<<<<<
5402 * c_score_cutoff = score_cutoff
5403 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5404 */
5405 __Pyx_TraceLine(276,0,__PYX_ERR(0, 276, __pyx_L1_error))
5406 __pyx_t_2 = (__pyx_v_score_cutoff != Py_None);
5407 __pyx_t_4 = (__pyx_t_2 != 0);
5408 if (__pyx_t_4) {
5409
5410 /* "cpp_process_cdist.pyx":277
5411 *
5412 * if score_cutoff is not None:
5413 * c_score_cutoff = score_cutoff # <<<<<<<<<<<<<<
5414 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5415 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5416 */
5417 __Pyx_TraceLine(277,0,__PYX_ERR(0, 277, __pyx_L1_error))
5418 __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 277, __pyx_L1_error)
5419 __pyx_v_c_score_cutoff = __pyx_t_5;
5420
5421 /* "cpp_process_cdist.pyx":276
5422 * kwargs_context = table.kwargs_init(kwargs)
5423 *
5424 * if score_cutoff is not None: # <<<<<<<<<<<<<<
5425 * c_score_cutoff = score_cutoff
5426 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5427 */
5428 }
5429
5430 /* "cpp_process_cdist.pyx":278
5431 * if score_cutoff is not None:
5432 * c_score_cutoff = score_cutoff
5433 * if c_score_cutoff < 0 or c_score_cutoff > 100: # <<<<<<<<<<<<<<
5434 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5435 *
5436 */
5437 __Pyx_TraceLine(278,0,__PYX_ERR(0, 278, __pyx_L1_error))
5438 __pyx_t_2 = ((__pyx_v_c_score_cutoff < 0.0) != 0);
5439 if (!__pyx_t_2) {
5440 } else {
5441 __pyx_t_4 = __pyx_t_2;
5442 goto __pyx_L6_bool_binop_done;
5443 }
5444 __pyx_t_2 = ((__pyx_v_c_score_cutoff > 100.0) != 0);
5445 __pyx_t_4 = __pyx_t_2;
5446 __pyx_L6_bool_binop_done:;
5447 if (unlikely(__pyx_t_4)) {
5448
5449 /* "cpp_process_cdist.pyx":279
5450 * c_score_cutoff = score_cutoff
5451 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5452 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0") # <<<<<<<<<<<<<<
5453 *
5454 * return cdist_two_lists_similarity_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_score_cutoff)
5455 */
5456 __Pyx_TraceLine(279,0,__PYX_ERR(0, 279, __pyx_L1_error))
5457 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 279, __pyx_L1_error)
5458 __Pyx_GOTREF(__pyx_t_6);
5459 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
5460 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5461 __PYX_ERR(0, 279, __pyx_L1_error)
5462
5463 /* "cpp_process_cdist.pyx":278
5464 * if score_cutoff is not None:
5465 * c_score_cutoff = score_cutoff
5466 * if c_score_cutoff < 0 or c_score_cutoff > 100: # <<<<<<<<<<<<<<
5467 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5468 *
5469 */
5470 }
5471
5472 /* "cpp_process_cdist.pyx":281
5473 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5474 *
5475 * return cdist_two_lists_similarity_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_score_cutoff) # <<<<<<<<<<<<<<
5476 *
5477 * cdef inline cdist_two_lists_distance(
5478 */
5479 __Pyx_TraceLine(281,0,__PYX_ERR(0, 281, __pyx_L1_error))
5480 __Pyx_XDECREF(__pyx_r);
5481 try {
5482 __pyx_t_6 = cdist_two_lists_similarity_impl(__pyx_v_kwargs_context, __pyx_v_table.init, __pyx_v_queries, __pyx_v_choices, __pyx_v_c_dtype, __pyx_v_c_workers, __pyx_v_c_score_cutoff);
5483 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error)
5484 } catch(...) {
5485 __Pyx_CppExn2PyErr();
5486 __PYX_ERR(0, 281, __pyx_L1_error)
5487 }
5488 __Pyx_GOTREF(__pyx_t_6);
5489 __pyx_r = __pyx_t_6;
5490 __pyx_t_6 = 0;
5491 goto __pyx_L0;
5492
5493 /* "cpp_process_cdist.pyx":262
5494 * raise TypeError("invalid dtype (use np.int8, np.int16, np.int32 or np.int64)")
5495 *
5496 * cdef inline cdist_two_lists_similarity( # <<<<<<<<<<<<<<
5497 * const vector[proc_string]& queries,
5498 * const vector[proc_string]& choices,
5499 */
5500
5501 /* function exit code */
5502 __pyx_L1_error:;
5503 __Pyx_XDECREF(__pyx_t_6);
5504 __Pyx_AddTraceback("cpp_process_cdist.cdist_two_lists_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
5505 __pyx_r = 0;
5506 __pyx_L0:;
5507 __Pyx_XGIVEREF(__pyx_r);
5508 __Pyx_TraceReturn(__pyx_r, 0);
5509 __Pyx_RefNannyFinishContext();
5510 return __pyx_r;
5511 }
5512
5513 /* "cpp_process_cdist.pyx":283
5514 * return cdist_two_lists_similarity_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_score_cutoff)
5515 *
5516 * cdef inline cdist_two_lists_distance( # <<<<<<<<<<<<<<
5517 * const vector[proc_string]& queries, const vector[proc_string]& choices,
5518 * scorer, score_cutoff, dtype, workers, dict kwargs
5519 */
5520
__pyx_f_17cpp_process_cdist_cdist_two_lists_distance(std::vector<proc_string> const & __pyx_v_queries,std::vector<proc_string> const & __pyx_v_choices,PyObject * __pyx_v_scorer,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)5521 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_two_lists_distance(std::vector<proc_string> const &__pyx_v_queries, std::vector<proc_string> const &__pyx_v_choices, PyObject *__pyx_v_scorer, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
5522 size_t __pyx_v_c_max;
5523 struct DistanceFunctionTable __pyx_v_table;
5524 KwargsContext __pyx_v_kwargs_context;
5525 int __pyx_v_c_dtype;
5526 int __pyx_v_c_workers;
5527 PyObject *__pyx_r = NULL;
5528 __Pyx_TraceDeclarations
5529 __Pyx_RefNannyDeclarations
5530 int __pyx_t_1;
5531 int __pyx_t_2;
5532 KwargsContext __pyx_t_3;
5533 int __pyx_t_4;
5534 int __pyx_t_5;
5535 PyObject *__pyx_t_6 = NULL;
5536 size_t __pyx_t_7;
5537 int __pyx_lineno = 0;
5538 const char *__pyx_filename = NULL;
5539 int __pyx_clineno = 0;
5540 __Pyx_RefNannySetupContext("cdist_two_lists_distance", 0);
5541 __Pyx_TraceCall("cdist_two_lists_distance", __pyx_f[0], 283, 0, __PYX_ERR(0, 283, __pyx_L1_error));
5542
5543 /* "cpp_process_cdist.pyx":287
5544 * scorer, score_cutoff, dtype, workers, dict kwargs
5545 * ):
5546 * cdef size_t c_max = <size_t>-1 # <<<<<<<<<<<<<<
5547 * cdef DistanceFunctionTable table = CachedDistanceInit(scorer)
5548 * cdef KwargsContext kwargs_context
5549 */
5550 __Pyx_TraceLine(287,0,__PYX_ERR(0, 287, __pyx_L1_error))
5551 __pyx_v_c_max = ((size_t)-1L);
5552
5553 /* "cpp_process_cdist.pyx":288
5554 * ):
5555 * cdef size_t c_max = <size_t>-1
5556 * cdef DistanceFunctionTable table = CachedDistanceInit(scorer) # <<<<<<<<<<<<<<
5557 * cdef KwargsContext kwargs_context
5558 * cdef int c_dtype = dtype_to_type_num_distance(dtype)
5559 */
5560 __Pyx_TraceLine(288,0,__PYX_ERR(0, 288, __pyx_L1_error))
5561 __pyx_v_table = __pyx_f_17cpp_process_cdist_CachedDistanceInit(__pyx_v_scorer);
5562
5563 /* "cpp_process_cdist.pyx":290
5564 * cdef DistanceFunctionTable table = CachedDistanceInit(scorer)
5565 * cdef KwargsContext kwargs_context
5566 * cdef int c_dtype = dtype_to_type_num_distance(dtype) # <<<<<<<<<<<<<<
5567 * cdef int c_workers = workers
5568 *
5569 */
5570 __Pyx_TraceLine(290,0,__PYX_ERR(0, 290, __pyx_L1_error))
5571 __pyx_t_1 = __pyx_f_17cpp_process_cdist_dtype_to_type_num_distance(__pyx_v_dtype); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 290, __pyx_L1_error)
5572 __pyx_v_c_dtype = __pyx_t_1;
5573
5574 /* "cpp_process_cdist.pyx":291
5575 * cdef KwargsContext kwargs_context
5576 * cdef int c_dtype = dtype_to_type_num_distance(dtype)
5577 * cdef int c_workers = workers # <<<<<<<<<<<<<<
5578 *
5579 * if (NULL != table.kwargs_init):
5580 */
5581 __Pyx_TraceLine(291,0,__PYX_ERR(0, 291, __pyx_L1_error))
5582 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_workers); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L1_error)
5583 __pyx_v_c_workers = __pyx_t_1;
5584
5585 /* "cpp_process_cdist.pyx":293
5586 * cdef int c_workers = workers
5587 *
5588 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
5589 * kwargs_context = table.kwargs_init(kwargs)
5590 *
5591 */
5592 __Pyx_TraceLine(293,0,__PYX_ERR(0, 293, __pyx_L1_error))
5593 __pyx_t_2 = ((NULL != __pyx_v_table.kwargs_init) != 0);
5594 if (__pyx_t_2) {
5595
5596 /* "cpp_process_cdist.pyx":294
5597 *
5598 * if (NULL != table.kwargs_init):
5599 * kwargs_context = table.kwargs_init(kwargs) # <<<<<<<<<<<<<<
5600 *
5601 * if score_cutoff is not None and score_cutoff != -1:
5602 */
5603 __Pyx_TraceLine(294,0,__PYX_ERR(0, 294, __pyx_L1_error))
5604 __pyx_t_3 = __pyx_v_table.kwargs_init(__pyx_v_kwargs); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
5605 __pyx_v_kwargs_context = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);
5606
5607 /* "cpp_process_cdist.pyx":293
5608 * cdef int c_workers = workers
5609 *
5610 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
5611 * kwargs_context = table.kwargs_init(kwargs)
5612 *
5613 */
5614 }
5615
5616 /* "cpp_process_cdist.pyx":296
5617 * kwargs_context = table.kwargs_init(kwargs)
5618 *
5619 * if score_cutoff is not None and score_cutoff != -1: # <<<<<<<<<<<<<<
5620 * c_max = score_cutoff
5621 *
5622 */
5623 __Pyx_TraceLine(296,0,__PYX_ERR(0, 296, __pyx_L1_error))
5624 __pyx_t_4 = (__pyx_v_score_cutoff != Py_None);
5625 __pyx_t_5 = (__pyx_t_4 != 0);
5626 if (__pyx_t_5) {
5627 } else {
5628 __pyx_t_2 = __pyx_t_5;
5629 goto __pyx_L5_bool_binop_done;
5630 }
5631 __pyx_t_6 = __Pyx_PyInt_NeObjC(__pyx_v_score_cutoff, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 296, __pyx_L1_error)
5632 __Pyx_GOTREF(__pyx_t_6);
5633 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 296, __pyx_L1_error)
5634 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5635 __pyx_t_2 = __pyx_t_5;
5636 __pyx_L5_bool_binop_done:;
5637 if (__pyx_t_2) {
5638
5639 /* "cpp_process_cdist.pyx":297
5640 *
5641 * if score_cutoff is not None and score_cutoff != -1:
5642 * c_max = score_cutoff # <<<<<<<<<<<<<<
5643 *
5644 * return cdist_two_lists_distance_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_max)
5645 */
5646 __Pyx_TraceLine(297,0,__PYX_ERR(0, 297, __pyx_L1_error))
5647 __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_v_score_cutoff); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 297, __pyx_L1_error)
5648 __pyx_v_c_max = __pyx_t_7;
5649
5650 /* "cpp_process_cdist.pyx":296
5651 * kwargs_context = table.kwargs_init(kwargs)
5652 *
5653 * if score_cutoff is not None and score_cutoff != -1: # <<<<<<<<<<<<<<
5654 * c_max = score_cutoff
5655 *
5656 */
5657 }
5658
5659 /* "cpp_process_cdist.pyx":299
5660 * c_max = score_cutoff
5661 *
5662 * return cdist_two_lists_distance_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_max) # <<<<<<<<<<<<<<
5663 *
5664 * @cython.boundscheck(False)
5665 */
5666 __Pyx_TraceLine(299,0,__PYX_ERR(0, 299, __pyx_L1_error))
5667 __Pyx_XDECREF(__pyx_r);
5668 try {
5669 __pyx_t_6 = cdist_two_lists_distance_impl(__pyx_v_kwargs_context, __pyx_v_table.init, __pyx_v_queries, __pyx_v_choices, __pyx_v_c_dtype, __pyx_v_c_workers, __pyx_v_c_max);
5670 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error)
5671 } catch(...) {
5672 __Pyx_CppExn2PyErr();
5673 __PYX_ERR(0, 299, __pyx_L1_error)
5674 }
5675 __Pyx_GOTREF(__pyx_t_6);
5676 __pyx_r = __pyx_t_6;
5677 __pyx_t_6 = 0;
5678 goto __pyx_L0;
5679
5680 /* "cpp_process_cdist.pyx":283
5681 * return cdist_two_lists_similarity_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_score_cutoff)
5682 *
5683 * cdef inline cdist_two_lists_distance( # <<<<<<<<<<<<<<
5684 * const vector[proc_string]& queries, const vector[proc_string]& choices,
5685 * scorer, score_cutoff, dtype, workers, dict kwargs
5686 */
5687
5688 /* function exit code */
5689 __pyx_L1_error:;
5690 __Pyx_XDECREF(__pyx_t_6);
5691 __Pyx_AddTraceback("cpp_process_cdist.cdist_two_lists_distance", __pyx_clineno, __pyx_lineno, __pyx_filename);
5692 __pyx_r = 0;
5693 __pyx_L0:;
5694 __Pyx_XGIVEREF(__pyx_r);
5695 __Pyx_TraceReturn(__pyx_r, 0);
5696 __Pyx_RefNannyFinishContext();
5697 return __pyx_r;
5698 }
5699
5700 /* "cpp_process_cdist.pyx":303
5701 * @cython.boundscheck(False)
5702 * @cython.wraparound(False)
5703 * cdef inline py_cdist_two_lists( # <<<<<<<<<<<<<<
5704 * const vector[PyObject*]& queries, const vector[PyObject*]& choices,
5705 * scorer, score_cutoff, dtype, dict kwargs
5706 */
5707
__pyx_f_17cpp_process_cdist_py_cdist_two_lists(std::vector<PyObject * > const & __pyx_v_queries,std::vector<PyObject * > const & __pyx_v_choices,PyObject * __pyx_v_scorer,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_kwargs)5708 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_py_cdist_two_lists(std::vector<PyObject *> const &__pyx_v_queries, std::vector<PyObject *> const &__pyx_v_choices, PyObject *__pyx_v_scorer, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_kwargs) {
5709 size_t __pyx_v_queries_len;
5710 size_t __pyx_v_choices_len;
5711 size_t __pyx_v_i;
5712 size_t __pyx_v_j;
5713 double __pyx_v_c_score_cutoff;
5714 int __pyx_v_c_dtype;
5715 double __pyx_v_score;
5716 PyObject *__pyx_v_matrix = NULL;
5717 PyObject *__pyx_r = NULL;
5718 __Pyx_TraceDeclarations
5719 __Pyx_RefNannyDeclarations
5720 int __pyx_t_1;
5721 PyObject *__pyx_t_2 = NULL;
5722 PyObject *__pyx_t_3 = NULL;
5723 PyObject *__pyx_t_4 = NULL;
5724 PyObject *__pyx_t_5 = NULL;
5725 int __pyx_t_6;
5726 int __pyx_t_7;
5727 double __pyx_t_8;
5728 size_t __pyx_t_9;
5729 size_t __pyx_t_10;
5730 size_t __pyx_t_11;
5731 size_t __pyx_t_12;
5732 size_t __pyx_t_13;
5733 size_t __pyx_t_14;
5734 PyObject *__pyx_t_15;
5735 PyObject *__pyx_t_16;
5736 int __pyx_lineno = 0;
5737 const char *__pyx_filename = NULL;
5738 int __pyx_clineno = 0;
5739 __Pyx_RefNannySetupContext("py_cdist_two_lists", 0);
5740 __Pyx_TraceCall("py_cdist_two_lists", __pyx_f[0], 303, 0, __PYX_ERR(0, 303, __pyx_L1_error));
5741
5742 /* "cpp_process_cdist.pyx":307
5743 * scorer, score_cutoff, dtype, dict kwargs
5744 * ):
5745 * cdef size_t queries_len = queries.size() # <<<<<<<<<<<<<<
5746 * cdef size_t choices_len = choices.size()
5747 * cdef size_t i, j
5748 */
5749 __Pyx_TraceLine(307,0,__PYX_ERR(0, 307, __pyx_L1_error))
5750 __pyx_v_queries_len = __pyx_v_queries.size();
5751
5752 /* "cpp_process_cdist.pyx":308
5753 * ):
5754 * cdef size_t queries_len = queries.size()
5755 * cdef size_t choices_len = choices.size() # <<<<<<<<<<<<<<
5756 * cdef size_t i, j
5757 * cdef double c_score_cutoff = 0
5758 */
5759 __Pyx_TraceLine(308,0,__PYX_ERR(0, 308, __pyx_L1_error))
5760 __pyx_v_choices_len = __pyx_v_choices.size();
5761
5762 /* "cpp_process_cdist.pyx":310
5763 * cdef size_t choices_len = choices.size()
5764 * cdef size_t i, j
5765 * cdef double c_score_cutoff = 0 # <<<<<<<<<<<<<<
5766 * cdef int c_dtype = dtype_to_type_num_similarity(dtype)
5767 * cdef double score
5768 */
5769 __Pyx_TraceLine(310,0,__PYX_ERR(0, 310, __pyx_L1_error))
5770 __pyx_v_c_score_cutoff = 0.0;
5771
5772 /* "cpp_process_cdist.pyx":311
5773 * cdef size_t i, j
5774 * cdef double c_score_cutoff = 0
5775 * cdef int c_dtype = dtype_to_type_num_similarity(dtype) # <<<<<<<<<<<<<<
5776 * cdef double score
5777 * matrix = np.empty((queries_len, choices_len), dtype=dtype)
5778 */
5779 __Pyx_TraceLine(311,0,__PYX_ERR(0, 311, __pyx_L1_error))
5780 __pyx_t_1 = __pyx_f_17cpp_process_cdist_dtype_to_type_num_similarity(__pyx_v_dtype); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 311, __pyx_L1_error)
5781 __pyx_v_c_dtype = __pyx_t_1;
5782
5783 /* "cpp_process_cdist.pyx":313
5784 * cdef int c_dtype = dtype_to_type_num_similarity(dtype)
5785 * cdef double score
5786 * matrix = np.empty((queries_len, choices_len), dtype=dtype) # <<<<<<<<<<<<<<
5787 *
5788 * if score_cutoff is not None:
5789 */
5790 __Pyx_TraceLine(313,0,__PYX_ERR(0, 313, __pyx_L1_error))
5791 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
5792 __Pyx_GOTREF(__pyx_t_2);
5793 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
5794 __Pyx_GOTREF(__pyx_t_3);
5795 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5796 __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_queries_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
5797 __Pyx_GOTREF(__pyx_t_2);
5798 __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_choices_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error)
5799 __Pyx_GOTREF(__pyx_t_4);
5800 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
5801 __Pyx_GOTREF(__pyx_t_5);
5802 __Pyx_GIVEREF(__pyx_t_2);
5803 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
5804 __Pyx_GIVEREF(__pyx_t_4);
5805 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
5806 __pyx_t_2 = 0;
5807 __pyx_t_4 = 0;
5808 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error)
5809 __Pyx_GOTREF(__pyx_t_4);
5810 __Pyx_GIVEREF(__pyx_t_5);
5811 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
5812 __pyx_t_5 = 0;
5813 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
5814 __Pyx_GOTREF(__pyx_t_5);
5815 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 313, __pyx_L1_error)
5816 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
5817 __Pyx_GOTREF(__pyx_t_2);
5818 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5819 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5820 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5821 __pyx_v_matrix = __pyx_t_2;
5822 __pyx_t_2 = 0;
5823
5824 /* "cpp_process_cdist.pyx":315
5825 * matrix = np.empty((queries_len, choices_len), dtype=dtype)
5826 *
5827 * if score_cutoff is not None: # <<<<<<<<<<<<<<
5828 * c_score_cutoff = score_cutoff
5829 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5830 */
5831 __Pyx_TraceLine(315,0,__PYX_ERR(0, 315, __pyx_L1_error))
5832 __pyx_t_6 = (__pyx_v_score_cutoff != Py_None);
5833 __pyx_t_7 = (__pyx_t_6 != 0);
5834 if (__pyx_t_7) {
5835
5836 /* "cpp_process_cdist.pyx":316
5837 *
5838 * if score_cutoff is not None:
5839 * c_score_cutoff = score_cutoff # <<<<<<<<<<<<<<
5840 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5841 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5842 */
5843 __Pyx_TraceLine(316,0,__PYX_ERR(0, 316, __pyx_L1_error))
5844 __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L1_error)
5845 __pyx_v_c_score_cutoff = __pyx_t_8;
5846
5847 /* "cpp_process_cdist.pyx":315
5848 * matrix = np.empty((queries_len, choices_len), dtype=dtype)
5849 *
5850 * if score_cutoff is not None: # <<<<<<<<<<<<<<
5851 * c_score_cutoff = score_cutoff
5852 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5853 */
5854 }
5855
5856 /* "cpp_process_cdist.pyx":317
5857 * if score_cutoff is not None:
5858 * c_score_cutoff = score_cutoff
5859 * if c_score_cutoff < 0 or c_score_cutoff > 100: # <<<<<<<<<<<<<<
5860 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5861 *
5862 */
5863 __Pyx_TraceLine(317,0,__PYX_ERR(0, 317, __pyx_L1_error))
5864 __pyx_t_6 = ((__pyx_v_c_score_cutoff < 0.0) != 0);
5865 if (!__pyx_t_6) {
5866 } else {
5867 __pyx_t_7 = __pyx_t_6;
5868 goto __pyx_L5_bool_binop_done;
5869 }
5870 __pyx_t_6 = ((__pyx_v_c_score_cutoff > 100.0) != 0);
5871 __pyx_t_7 = __pyx_t_6;
5872 __pyx_L5_bool_binop_done:;
5873 if (unlikely(__pyx_t_7)) {
5874
5875 /* "cpp_process_cdist.pyx":318
5876 * c_score_cutoff = score_cutoff
5877 * if c_score_cutoff < 0 or c_score_cutoff > 100:
5878 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0") # <<<<<<<<<<<<<<
5879 *
5880 * c_score_cutoff = floor(c_score_cutoff)
5881 */
5882 __Pyx_TraceLine(318,0,__PYX_ERR(0, 318, __pyx_L1_error))
5883 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error)
5884 __Pyx_GOTREF(__pyx_t_2);
5885 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5886 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5887 __PYX_ERR(0, 318, __pyx_L1_error)
5888
5889 /* "cpp_process_cdist.pyx":317
5890 * if score_cutoff is not None:
5891 * c_score_cutoff = score_cutoff
5892 * if c_score_cutoff < 0 or c_score_cutoff > 100: # <<<<<<<<<<<<<<
5893 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5894 *
5895 */
5896 }
5897
5898 /* "cpp_process_cdist.pyx":320
5899 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
5900 *
5901 * c_score_cutoff = floor(c_score_cutoff) # <<<<<<<<<<<<<<
5902 *
5903 * kwargs["processor"] = None
5904 */
5905 __Pyx_TraceLine(320,0,__PYX_ERR(0, 320, __pyx_L1_error))
5906 __pyx_v_c_score_cutoff = floor(__pyx_v_c_score_cutoff);
5907
5908 /* "cpp_process_cdist.pyx":322
5909 * c_score_cutoff = floor(c_score_cutoff)
5910 *
5911 * kwargs["processor"] = None # <<<<<<<<<<<<<<
5912 * kwargs["score_cutoff"] = c_score_cutoff
5913 *
5914 */
5915 __Pyx_TraceLine(322,0,__PYX_ERR(0, 322, __pyx_L1_error))
5916 if (unlikely(__pyx_v_kwargs == Py_None)) {
5917 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5918 __PYX_ERR(0, 322, __pyx_L1_error)
5919 }
5920 if (unlikely((PyDict_SetItem(__pyx_v_kwargs, __pyx_n_u_processor, Py_None) < 0))) __PYX_ERR(0, 322, __pyx_L1_error)
5921
5922 /* "cpp_process_cdist.pyx":323
5923 *
5924 * kwargs["processor"] = None
5925 * kwargs["score_cutoff"] = c_score_cutoff # <<<<<<<<<<<<<<
5926 *
5927 * for i in range(queries_len):
5928 */
5929 __Pyx_TraceLine(323,0,__PYX_ERR(0, 323, __pyx_L1_error))
5930 __pyx_t_2 = PyFloat_FromDouble(__pyx_v_c_score_cutoff); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
5931 __Pyx_GOTREF(__pyx_t_2);
5932 if (unlikely(__pyx_v_kwargs == Py_None)) {
5933 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5934 __PYX_ERR(0, 323, __pyx_L1_error)
5935 }
5936 if (unlikely((PyDict_SetItem(__pyx_v_kwargs, __pyx_n_u_score_cutoff, __pyx_t_2) < 0))) __PYX_ERR(0, 323, __pyx_L1_error)
5937 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5938
5939 /* "cpp_process_cdist.pyx":325
5940 * kwargs["score_cutoff"] = c_score_cutoff
5941 *
5942 * for i in range(queries_len): # <<<<<<<<<<<<<<
5943 * for j in range(choices_len):
5944 * score = <double>scorer(<object>queries[i], <object>choices[j],**kwargs)
5945 */
5946 __Pyx_TraceLine(325,0,__PYX_ERR(0, 325, __pyx_L1_error))
5947 __pyx_t_9 = __pyx_v_queries_len;
5948 __pyx_t_10 = __pyx_t_9;
5949 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5950 __pyx_v_i = __pyx_t_11;
5951
5952 /* "cpp_process_cdist.pyx":326
5953 *
5954 * for i in range(queries_len):
5955 * for j in range(choices_len): # <<<<<<<<<<<<<<
5956 * score = <double>scorer(<object>queries[i], <object>choices[j],**kwargs)
5957 * set_score_similarity(<np.PyArrayObject*>matrix, c_dtype, i, j, score)
5958 */
5959 __Pyx_TraceLine(326,0,__PYX_ERR(0, 326, __pyx_L1_error))
5960 __pyx_t_12 = __pyx_v_choices_len;
5961 __pyx_t_13 = __pyx_t_12;
5962 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5963 __pyx_v_j = __pyx_t_14;
5964
5965 /* "cpp_process_cdist.pyx":327
5966 * for i in range(queries_len):
5967 * for j in range(choices_len):
5968 * score = <double>scorer(<object>queries[i], <object>choices[j],**kwargs) # <<<<<<<<<<<<<<
5969 * set_score_similarity(<np.PyArrayObject*>matrix, c_dtype, i, j, score)
5970 *
5971 */
5972 __Pyx_TraceLine(327,0,__PYX_ERR(0, 327, __pyx_L1_error))
5973 __pyx_t_15 = (__pyx_v_queries[__pyx_v_i]);
5974 __pyx_t_16 = (__pyx_v_choices[__pyx_v_j]);
5975 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
5976 __Pyx_GOTREF(__pyx_t_2);
5977 __Pyx_INCREF(((PyObject *)__pyx_t_15));
5978 __Pyx_GIVEREF(((PyObject *)__pyx_t_15));
5979 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_15));
5980 __Pyx_INCREF(((PyObject *)__pyx_t_16));
5981 __Pyx_GIVEREF(((PyObject *)__pyx_t_16));
5982 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_16));
5983 if (unlikely(__pyx_v_kwargs == Py_None)) {
5984 PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
5985 __PYX_ERR(0, 327, __pyx_L1_error)
5986 }
5987 __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
5988 __Pyx_GOTREF(__pyx_t_5);
5989 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
5990 __Pyx_GOTREF(__pyx_t_4);
5991 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5992 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5993 __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L1_error)
5994 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5995 __pyx_v_score = ((double)__pyx_t_8);
5996
5997 /* "cpp_process_cdist.pyx":328
5998 * for j in range(choices_len):
5999 * score = <double>scorer(<object>queries[i], <object>choices[j],**kwargs)
6000 * set_score_similarity(<np.PyArrayObject*>matrix, c_dtype, i, j, score) # <<<<<<<<<<<<<<
6001 *
6002 * return matrix
6003 */
6004 __Pyx_TraceLine(328,0,__PYX_ERR(0, 328, __pyx_L1_error))
6005 set_score_similarity(((PyArrayObject *)__pyx_v_matrix), __pyx_v_c_dtype, __pyx_v_i, __pyx_v_j, __pyx_v_score);
6006 }
6007 }
6008
6009 /* "cpp_process_cdist.pyx":330
6010 * set_score_similarity(<np.PyArrayObject*>matrix, c_dtype, i, j, score)
6011 *
6012 * return matrix # <<<<<<<<<<<<<<
6013 *
6014 * cdef cdist_two_lists(queries, choices, scorer, processor, score_cutoff, dtype, workers, dict kwargs):
6015 */
6016 __Pyx_TraceLine(330,0,__PYX_ERR(0, 330, __pyx_L1_error))
6017 __Pyx_XDECREF(__pyx_r);
6018 __Pyx_INCREF(__pyx_v_matrix);
6019 __pyx_r = __pyx_v_matrix;
6020 goto __pyx_L0;
6021
6022 /* "cpp_process_cdist.pyx":303
6023 * @cython.boundscheck(False)
6024 * @cython.wraparound(False)
6025 * cdef inline py_cdist_two_lists( # <<<<<<<<<<<<<<
6026 * const vector[PyObject*]& queries, const vector[PyObject*]& choices,
6027 * scorer, score_cutoff, dtype, dict kwargs
6028 */
6029
6030 /* function exit code */
6031 __pyx_L1_error:;
6032 __Pyx_XDECREF(__pyx_t_2);
6033 __Pyx_XDECREF(__pyx_t_3);
6034 __Pyx_XDECREF(__pyx_t_4);
6035 __Pyx_XDECREF(__pyx_t_5);
6036 __Pyx_AddTraceback("cpp_process_cdist.py_cdist_two_lists", __pyx_clineno, __pyx_lineno, __pyx_filename);
6037 __pyx_r = 0;
6038 __pyx_L0:;
6039 __Pyx_XDECREF(__pyx_v_matrix);
6040 __Pyx_XGIVEREF(__pyx_r);
6041 __Pyx_TraceReturn(__pyx_r, 0);
6042 __Pyx_RefNannyFinishContext();
6043 return __pyx_r;
6044 }
6045
6046 /* "cpp_process_cdist.pyx":332
6047 * return matrix
6048 *
6049 * cdef cdist_two_lists(queries, choices, scorer, processor, score_cutoff, dtype, workers, dict kwargs): # <<<<<<<<<<<<<<
6050 * cdef vector[proc_string] proc_queries
6051 * cdef vector[proc_string] proc_choices
6052 */
6053
__pyx_f_17cpp_process_cdist_cdist_two_lists(PyObject * __pyx_v_queries,PyObject * __pyx_v_choices,PyObject * __pyx_v_scorer,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)6054 static PyObject *__pyx_f_17cpp_process_cdist_cdist_two_lists(PyObject *__pyx_v_queries, PyObject *__pyx_v_choices, PyObject *__pyx_v_scorer, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
6055 std::vector<proc_string> __pyx_v_proc_queries;
6056 std::vector<proc_string> __pyx_v_proc_choices;
6057 std::vector<PyObject *> __pyx_v_proc_py_queries;
6058 std::vector<PyObject *> __pyx_v_proc_py_choices;
6059 size_t __pyx_v_queries_len;
6060 size_t __pyx_v_choices_len;
6061 PyObject *__pyx_v_query = NULL;
6062 PyObject *__pyx_v_choice = NULL;
6063 PyObject *__pyx_v_proc_query = NULL;
6064 PyObject *__pyx_v_proc_choice = NULL;
6065 PyObject *__pyx_v_item;
6066 PyObject *__pyx_r = NULL;
6067 __Pyx_TraceDeclarations
6068 __Pyx_RefNannyDeclarations
6069 Py_ssize_t __pyx_t_1;
6070 int __pyx_t_2;
6071 int __pyx_t_3;
6072 PyObject *__pyx_t_4 = NULL;
6073 PyObject *(*__pyx_t_5)(PyObject *);
6074 PyObject *__pyx_t_6 = NULL;
6075 proc_string __pyx_t_7;
6076 int __pyx_t_8;
6077 PyObject *__pyx_t_9 = NULL;
6078 PyObject *__pyx_t_10 = NULL;
6079 int __pyx_t_11;
6080 proc_string __pyx_t_12;
6081 std::vector<PyObject *> ::iterator __pyx_t_13;
6082 PyObject *__pyx_t_14;
6083 int __pyx_t_15;
6084 char const *__pyx_t_16;
6085 PyObject *__pyx_t_17 = NULL;
6086 PyObject *__pyx_t_18 = NULL;
6087 PyObject *__pyx_t_19 = NULL;
6088 PyObject *__pyx_t_20 = NULL;
6089 PyObject *__pyx_t_21 = NULL;
6090 PyObject *__pyx_t_22 = NULL;
6091 int __pyx_lineno = 0;
6092 const char *__pyx_filename = NULL;
6093 int __pyx_clineno = 0;
6094 __Pyx_RefNannySetupContext("cdist_two_lists", 0);
6095 __Pyx_TraceCall("cdist_two_lists", __pyx_f[0], 332, 0, __PYX_ERR(0, 332, __pyx_L1_error));
6096 __Pyx_INCREF(__pyx_v_processor);
6097
6098 /* "cpp_process_cdist.pyx":337
6099 * cdef vector[PyObject*] proc_py_queries
6100 * cdef vector[PyObject*] proc_py_choices
6101 * cdef size_t queries_len = <size_t>len(queries) # <<<<<<<<<<<<<<
6102 * cdef size_t choices_len = <size_t>len(choices)
6103 *
6104 */
6105 __Pyx_TraceLine(337,0,__PYX_ERR(0, 337, __pyx_L1_error))
6106 __pyx_t_1 = PyObject_Length(__pyx_v_queries); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 337, __pyx_L1_error)
6107 __pyx_v_queries_len = ((size_t)__pyx_t_1);
6108
6109 /* "cpp_process_cdist.pyx":338
6110 * cdef vector[PyObject*] proc_py_choices
6111 * cdef size_t queries_len = <size_t>len(queries)
6112 * cdef size_t choices_len = <size_t>len(choices) # <<<<<<<<<<<<<<
6113 *
6114 * try:
6115 */
6116 __Pyx_TraceLine(338,0,__PYX_ERR(0, 338, __pyx_L1_error))
6117 __pyx_t_1 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 338, __pyx_L1_error)
6118 __pyx_v_choices_len = ((size_t)__pyx_t_1);
6119
6120 /* "cpp_process_cdist.pyx":340
6121 * cdef size_t choices_len = <size_t>len(choices)
6122 *
6123 * try: # <<<<<<<<<<<<<<
6124 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer):
6125 * proc_queries.reserve(queries_len)
6126 */
6127 __Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
6128 /*try:*/ {
6129
6130 /* "cpp_process_cdist.pyx":341
6131 *
6132 * try:
6133 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
6134 * proc_queries.reserve(queries_len)
6135 * proc_choices.reserve(choices_len)
6136 */
6137 __Pyx_TraceLine(341,0,__PYX_ERR(0, 341, __pyx_L4_error))
6138 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedScorer(__pyx_v_scorer) != 0);
6139 if (!__pyx_t_3) {
6140 } else {
6141 __pyx_t_2 = __pyx_t_3;
6142 goto __pyx_L7_bool_binop_done;
6143 }
6144 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedDistance(__pyx_v_scorer) != 0);
6145 __pyx_t_2 = __pyx_t_3;
6146 __pyx_L7_bool_binop_done:;
6147 if (__pyx_t_2) {
6148
6149 /* "cpp_process_cdist.pyx":342
6150 * try:
6151 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer):
6152 * proc_queries.reserve(queries_len) # <<<<<<<<<<<<<<
6153 * proc_choices.reserve(choices_len)
6154 *
6155 */
6156 __Pyx_TraceLine(342,0,__PYX_ERR(0, 342, __pyx_L4_error))
6157 try {
6158 __pyx_v_proc_queries.reserve(__pyx_v_queries_len);
6159 } catch(...) {
6160 __Pyx_CppExn2PyErr();
6161 __PYX_ERR(0, 342, __pyx_L4_error)
6162 }
6163
6164 /* "cpp_process_cdist.pyx":343
6165 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer):
6166 * proc_queries.reserve(queries_len)
6167 * proc_choices.reserve(choices_len) # <<<<<<<<<<<<<<
6168 *
6169 * # processor None/False
6170 */
6171 __Pyx_TraceLine(343,0,__PYX_ERR(0, 343, __pyx_L4_error))
6172 try {
6173 __pyx_v_proc_choices.reserve(__pyx_v_choices_len);
6174 } catch(...) {
6175 __Pyx_CppExn2PyErr();
6176 __PYX_ERR(0, 343, __pyx_L4_error)
6177 }
6178
6179 /* "cpp_process_cdist.pyx":346
6180 *
6181 * # processor None/False
6182 * if not processor: # <<<<<<<<<<<<<<
6183 * for query in queries:
6184 * proc_queries.push_back(move(conv_sequence(query)))
6185 */
6186 __Pyx_TraceLine(346,0,__PYX_ERR(0, 346, __pyx_L4_error))
6187 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 346, __pyx_L4_error)
6188 __pyx_t_3 = ((!__pyx_t_2) != 0);
6189 if (__pyx_t_3) {
6190
6191 /* "cpp_process_cdist.pyx":347
6192 * # processor None/False
6193 * if not processor:
6194 * for query in queries: # <<<<<<<<<<<<<<
6195 * proc_queries.push_back(move(conv_sequence(query)))
6196 *
6197 */
6198 __Pyx_TraceLine(347,0,__PYX_ERR(0, 347, __pyx_L4_error))
6199 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
6200 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
6201 __pyx_t_5 = NULL;
6202 } else {
6203 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L4_error)
6204 __Pyx_GOTREF(__pyx_t_4);
6205 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L4_error)
6206 }
6207 for (;;) {
6208 if (likely(!__pyx_t_5)) {
6209 if (likely(PyList_CheckExact(__pyx_t_4))) {
6210 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
6211 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6212 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 347, __pyx_L4_error)
6213 #else
6214 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L4_error)
6215 __Pyx_GOTREF(__pyx_t_6);
6216 #endif
6217 } else {
6218 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6219 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6220 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 347, __pyx_L4_error)
6221 #else
6222 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L4_error)
6223 __Pyx_GOTREF(__pyx_t_6);
6224 #endif
6225 }
6226 } else {
6227 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
6228 if (unlikely(!__pyx_t_6)) {
6229 PyObject* exc_type = PyErr_Occurred();
6230 if (exc_type) {
6231 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6232 else __PYX_ERR(0, 347, __pyx_L4_error)
6233 }
6234 break;
6235 }
6236 __Pyx_GOTREF(__pyx_t_6);
6237 }
6238 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
6239 __pyx_t_6 = 0;
6240
6241 /* "cpp_process_cdist.pyx":348
6242 * if not processor:
6243 * for query in queries:
6244 * proc_queries.push_back(move(conv_sequence(query))) # <<<<<<<<<<<<<<
6245 *
6246 * for choice in choices:
6247 */
6248 __Pyx_TraceLine(348,0,__PYX_ERR(0, 348, __pyx_L4_error))
6249 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_query); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L4_error)
6250 try {
6251 __pyx_v_proc_queries.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
6252 } catch(...) {
6253 __Pyx_CppExn2PyErr();
6254 __PYX_ERR(0, 348, __pyx_L4_error)
6255 }
6256
6257 /* "cpp_process_cdist.pyx":347
6258 * # processor None/False
6259 * if not processor:
6260 * for query in queries: # <<<<<<<<<<<<<<
6261 * proc_queries.push_back(move(conv_sequence(query)))
6262 *
6263 */
6264 __Pyx_TraceLine(347,0,__PYX_ERR(0, 347, __pyx_L4_error))
6265 }
6266 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6267
6268 /* "cpp_process_cdist.pyx":350
6269 * proc_queries.push_back(move(conv_sequence(query)))
6270 *
6271 * for choice in choices: # <<<<<<<<<<<<<<
6272 * proc_choices.push_back(move(conv_sequence(choice)))
6273 * # processor has to be called through python
6274 */
6275 __Pyx_TraceLine(350,0,__PYX_ERR(0, 350, __pyx_L4_error))
6276 if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) {
6277 __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
6278 __pyx_t_5 = NULL;
6279 } else {
6280 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L4_error)
6281 __Pyx_GOTREF(__pyx_t_4);
6282 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L4_error)
6283 }
6284 for (;;) {
6285 if (likely(!__pyx_t_5)) {
6286 if (likely(PyList_CheckExact(__pyx_t_4))) {
6287 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
6288 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6289 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 350, __pyx_L4_error)
6290 #else
6291 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 350, __pyx_L4_error)
6292 __Pyx_GOTREF(__pyx_t_6);
6293 #endif
6294 } else {
6295 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6296 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6297 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 350, __pyx_L4_error)
6298 #else
6299 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 350, __pyx_L4_error)
6300 __Pyx_GOTREF(__pyx_t_6);
6301 #endif
6302 }
6303 } else {
6304 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
6305 if (unlikely(!__pyx_t_6)) {
6306 PyObject* exc_type = PyErr_Occurred();
6307 if (exc_type) {
6308 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6309 else __PYX_ERR(0, 350, __pyx_L4_error)
6310 }
6311 break;
6312 }
6313 __Pyx_GOTREF(__pyx_t_6);
6314 }
6315 __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6);
6316 __pyx_t_6 = 0;
6317
6318 /* "cpp_process_cdist.pyx":351
6319 *
6320 * for choice in choices:
6321 * proc_choices.push_back(move(conv_sequence(choice))) # <<<<<<<<<<<<<<
6322 * # processor has to be called through python
6323 * elif processor is not default_process and callable(processor):
6324 */
6325 __Pyx_TraceLine(351,0,__PYX_ERR(0, 351, __pyx_L4_error))
6326 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_choice); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 351, __pyx_L4_error)
6327 try {
6328 __pyx_v_proc_choices.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
6329 } catch(...) {
6330 __Pyx_CppExn2PyErr();
6331 __PYX_ERR(0, 351, __pyx_L4_error)
6332 }
6333
6334 /* "cpp_process_cdist.pyx":350
6335 * proc_queries.push_back(move(conv_sequence(query)))
6336 *
6337 * for choice in choices: # <<<<<<<<<<<<<<
6338 * proc_choices.push_back(move(conv_sequence(choice)))
6339 * # processor has to be called through python
6340 */
6341 __Pyx_TraceLine(350,0,__PYX_ERR(0, 350, __pyx_L4_error))
6342 }
6343 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6344
6345 /* "cpp_process_cdist.pyx":346
6346 *
6347 * # processor None/False
6348 * if not processor: # <<<<<<<<<<<<<<
6349 * for query in queries:
6350 * proc_queries.push_back(move(conv_sequence(query)))
6351 */
6352 goto __pyx_L9;
6353 }
6354
6355 /* "cpp_process_cdist.pyx":353
6356 * proc_choices.push_back(move(conv_sequence(choice)))
6357 * # processor has to be called through python
6358 * elif processor is not default_process and callable(processor): # <<<<<<<<<<<<<<
6359 * proc_py_queries.reserve(queries_len)
6360 * for query in queries:
6361 */
6362 __Pyx_TraceLine(353,0,__PYX_ERR(0, 353, __pyx_L4_error))
6363 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L4_error)
6364 __Pyx_GOTREF(__pyx_t_4);
6365 __pyx_t_2 = (__pyx_v_processor != __pyx_t_4);
6366 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6367 __pyx_t_8 = (__pyx_t_2 != 0);
6368 if (__pyx_t_8) {
6369 } else {
6370 __pyx_t_3 = __pyx_t_8;
6371 goto __pyx_L14_bool_binop_done;
6372 }
6373 __pyx_t_8 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 353, __pyx_L4_error)
6374 __pyx_t_2 = (__pyx_t_8 != 0);
6375 __pyx_t_3 = __pyx_t_2;
6376 __pyx_L14_bool_binop_done:;
6377 if (__pyx_t_3) {
6378
6379 /* "cpp_process_cdist.pyx":354
6380 * # processor has to be called through python
6381 * elif processor is not default_process and callable(processor):
6382 * proc_py_queries.reserve(queries_len) # <<<<<<<<<<<<<<
6383 * for query in queries:
6384 * proc_query = processor(query)
6385 */
6386 __Pyx_TraceLine(354,0,__PYX_ERR(0, 354, __pyx_L4_error))
6387 try {
6388 __pyx_v_proc_py_queries.reserve(__pyx_v_queries_len);
6389 } catch(...) {
6390 __Pyx_CppExn2PyErr();
6391 __PYX_ERR(0, 354, __pyx_L4_error)
6392 }
6393
6394 /* "cpp_process_cdist.pyx":355
6395 * elif processor is not default_process and callable(processor):
6396 * proc_py_queries.reserve(queries_len)
6397 * for query in queries: # <<<<<<<<<<<<<<
6398 * proc_query = processor(query)
6399 * Py_INCREF(proc_query)
6400 */
6401 __Pyx_TraceLine(355,0,__PYX_ERR(0, 355, __pyx_L4_error))
6402 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
6403 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
6404 __pyx_t_5 = NULL;
6405 } else {
6406 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L4_error)
6407 __Pyx_GOTREF(__pyx_t_4);
6408 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __pyx_L4_error)
6409 }
6410 for (;;) {
6411 if (likely(!__pyx_t_5)) {
6412 if (likely(PyList_CheckExact(__pyx_t_4))) {
6413 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
6414 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6415 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 355, __pyx_L4_error)
6416 #else
6417 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L4_error)
6418 __Pyx_GOTREF(__pyx_t_6);
6419 #endif
6420 } else {
6421 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6422 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6423 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 355, __pyx_L4_error)
6424 #else
6425 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L4_error)
6426 __Pyx_GOTREF(__pyx_t_6);
6427 #endif
6428 }
6429 } else {
6430 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
6431 if (unlikely(!__pyx_t_6)) {
6432 PyObject* exc_type = PyErr_Occurred();
6433 if (exc_type) {
6434 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6435 else __PYX_ERR(0, 355, __pyx_L4_error)
6436 }
6437 break;
6438 }
6439 __Pyx_GOTREF(__pyx_t_6);
6440 }
6441 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
6442 __pyx_t_6 = 0;
6443
6444 /* "cpp_process_cdist.pyx":356
6445 * proc_py_queries.reserve(queries_len)
6446 * for query in queries:
6447 * proc_query = processor(query) # <<<<<<<<<<<<<<
6448 * Py_INCREF(proc_query)
6449 * proc_py_queries.push_back(<PyObject*>proc_query)
6450 */
6451 __Pyx_TraceLine(356,0,__PYX_ERR(0, 356, __pyx_L4_error))
6452 __Pyx_INCREF(__pyx_v_processor);
6453 __pyx_t_9 = __pyx_v_processor; __pyx_t_10 = NULL;
6454 __pyx_t_11 = 0;
6455 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6456 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
6457 if (likely(__pyx_t_10)) {
6458 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6459 __Pyx_INCREF(__pyx_t_10);
6460 __Pyx_INCREF(function);
6461 __Pyx_DECREF_SET(__pyx_t_9, function);
6462 __pyx_t_11 = 1;
6463 }
6464 }
6465 {
6466 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_query};
6467 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
6468 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6469 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L4_error)
6470 __Pyx_GOTREF(__pyx_t_6);
6471 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6472 }
6473 __Pyx_XDECREF_SET(__pyx_v_proc_query, __pyx_t_6);
6474 __pyx_t_6 = 0;
6475
6476 /* "cpp_process_cdist.pyx":357
6477 * for query in queries:
6478 * proc_query = processor(query)
6479 * Py_INCREF(proc_query) # <<<<<<<<<<<<<<
6480 * proc_py_queries.push_back(<PyObject*>proc_query)
6481 * proc_queries.push_back(move(conv_sequence(proc_query)))
6482 */
6483 __Pyx_TraceLine(357,0,__PYX_ERR(0, 357, __pyx_L4_error))
6484 Py_INCREF(__pyx_v_proc_query);
6485
6486 /* "cpp_process_cdist.pyx":358
6487 * proc_query = processor(query)
6488 * Py_INCREF(proc_query)
6489 * proc_py_queries.push_back(<PyObject*>proc_query) # <<<<<<<<<<<<<<
6490 * proc_queries.push_back(move(conv_sequence(proc_query)))
6491 *
6492 */
6493 __Pyx_TraceLine(358,0,__PYX_ERR(0, 358, __pyx_L4_error))
6494 try {
6495 __pyx_v_proc_py_queries.push_back(((PyObject *)__pyx_v_proc_query));
6496 } catch(...) {
6497 __Pyx_CppExn2PyErr();
6498 __PYX_ERR(0, 358, __pyx_L4_error)
6499 }
6500
6501 /* "cpp_process_cdist.pyx":359
6502 * Py_INCREF(proc_query)
6503 * proc_py_queries.push_back(<PyObject*>proc_query)
6504 * proc_queries.push_back(move(conv_sequence(proc_query))) # <<<<<<<<<<<<<<
6505 *
6506 * proc_py_choices.reserve(choices_len)
6507 */
6508 __Pyx_TraceLine(359,0,__PYX_ERR(0, 359, __pyx_L4_error))
6509 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_proc_query); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L4_error)
6510 try {
6511 __pyx_v_proc_queries.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
6512 } catch(...) {
6513 __Pyx_CppExn2PyErr();
6514 __PYX_ERR(0, 359, __pyx_L4_error)
6515 }
6516
6517 /* "cpp_process_cdist.pyx":355
6518 * elif processor is not default_process and callable(processor):
6519 * proc_py_queries.reserve(queries_len)
6520 * for query in queries: # <<<<<<<<<<<<<<
6521 * proc_query = processor(query)
6522 * Py_INCREF(proc_query)
6523 */
6524 __Pyx_TraceLine(355,0,__PYX_ERR(0, 355, __pyx_L4_error))
6525 }
6526 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6527
6528 /* "cpp_process_cdist.pyx":361
6529 * proc_queries.push_back(move(conv_sequence(proc_query)))
6530 *
6531 * proc_py_choices.reserve(choices_len) # <<<<<<<<<<<<<<
6532 * for choice in choices:
6533 * proc_choice = processor(choice)
6534 */
6535 __Pyx_TraceLine(361,0,__PYX_ERR(0, 361, __pyx_L4_error))
6536 try {
6537 __pyx_v_proc_py_choices.reserve(__pyx_v_choices_len);
6538 } catch(...) {
6539 __Pyx_CppExn2PyErr();
6540 __PYX_ERR(0, 361, __pyx_L4_error)
6541 }
6542
6543 /* "cpp_process_cdist.pyx":362
6544 *
6545 * proc_py_choices.reserve(choices_len)
6546 * for choice in choices: # <<<<<<<<<<<<<<
6547 * proc_choice = processor(choice)
6548 * Py_INCREF(proc_choice)
6549 */
6550 __Pyx_TraceLine(362,0,__PYX_ERR(0, 362, __pyx_L4_error))
6551 if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) {
6552 __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
6553 __pyx_t_5 = NULL;
6554 } else {
6555 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L4_error)
6556 __Pyx_GOTREF(__pyx_t_4);
6557 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L4_error)
6558 }
6559 for (;;) {
6560 if (likely(!__pyx_t_5)) {
6561 if (likely(PyList_CheckExact(__pyx_t_4))) {
6562 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
6563 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6564 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 362, __pyx_L4_error)
6565 #else
6566 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 362, __pyx_L4_error)
6567 __Pyx_GOTREF(__pyx_t_6);
6568 #endif
6569 } else {
6570 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6571 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6572 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 362, __pyx_L4_error)
6573 #else
6574 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 362, __pyx_L4_error)
6575 __Pyx_GOTREF(__pyx_t_6);
6576 #endif
6577 }
6578 } else {
6579 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
6580 if (unlikely(!__pyx_t_6)) {
6581 PyObject* exc_type = PyErr_Occurred();
6582 if (exc_type) {
6583 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6584 else __PYX_ERR(0, 362, __pyx_L4_error)
6585 }
6586 break;
6587 }
6588 __Pyx_GOTREF(__pyx_t_6);
6589 }
6590 __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6);
6591 __pyx_t_6 = 0;
6592
6593 /* "cpp_process_cdist.pyx":363
6594 * proc_py_choices.reserve(choices_len)
6595 * for choice in choices:
6596 * proc_choice = processor(choice) # <<<<<<<<<<<<<<
6597 * Py_INCREF(proc_choice)
6598 * proc_py_choices.push_back(<PyObject*>proc_choice)
6599 */
6600 __Pyx_TraceLine(363,0,__PYX_ERR(0, 363, __pyx_L4_error))
6601 __Pyx_INCREF(__pyx_v_processor);
6602 __pyx_t_9 = __pyx_v_processor; __pyx_t_10 = NULL;
6603 __pyx_t_11 = 0;
6604 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6605 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
6606 if (likely(__pyx_t_10)) {
6607 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6608 __Pyx_INCREF(__pyx_t_10);
6609 __Pyx_INCREF(function);
6610 __Pyx_DECREF_SET(__pyx_t_9, function);
6611 __pyx_t_11 = 1;
6612 }
6613 }
6614 {
6615 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_choice};
6616 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
6617 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6618 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L4_error)
6619 __Pyx_GOTREF(__pyx_t_6);
6620 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6621 }
6622 __Pyx_XDECREF_SET(__pyx_v_proc_choice, __pyx_t_6);
6623 __pyx_t_6 = 0;
6624
6625 /* "cpp_process_cdist.pyx":364
6626 * for choice in choices:
6627 * proc_choice = processor(choice)
6628 * Py_INCREF(proc_choice) # <<<<<<<<<<<<<<
6629 * proc_py_choices.push_back(<PyObject*>proc_choice)
6630 * proc_choices.push_back(move(conv_sequence(proc_choice)))
6631 */
6632 __Pyx_TraceLine(364,0,__PYX_ERR(0, 364, __pyx_L4_error))
6633 Py_INCREF(__pyx_v_proc_choice);
6634
6635 /* "cpp_process_cdist.pyx":365
6636 * proc_choice = processor(choice)
6637 * Py_INCREF(proc_choice)
6638 * proc_py_choices.push_back(<PyObject*>proc_choice) # <<<<<<<<<<<<<<
6639 * proc_choices.push_back(move(conv_sequence(proc_choice)))
6640 *
6641 */
6642 __Pyx_TraceLine(365,0,__PYX_ERR(0, 365, __pyx_L4_error))
6643 try {
6644 __pyx_v_proc_py_choices.push_back(((PyObject *)__pyx_v_proc_choice));
6645 } catch(...) {
6646 __Pyx_CppExn2PyErr();
6647 __PYX_ERR(0, 365, __pyx_L4_error)
6648 }
6649
6650 /* "cpp_process_cdist.pyx":366
6651 * Py_INCREF(proc_choice)
6652 * proc_py_choices.push_back(<PyObject*>proc_choice)
6653 * proc_choices.push_back(move(conv_sequence(proc_choice))) # <<<<<<<<<<<<<<
6654 *
6655 * # processor is True / default_process
6656 */
6657 __Pyx_TraceLine(366,0,__PYX_ERR(0, 366, __pyx_L4_error))
6658 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_proc_choice); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L4_error)
6659 try {
6660 __pyx_v_proc_choices.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
6661 } catch(...) {
6662 __Pyx_CppExn2PyErr();
6663 __PYX_ERR(0, 366, __pyx_L4_error)
6664 }
6665
6666 /* "cpp_process_cdist.pyx":362
6667 *
6668 * proc_py_choices.reserve(choices_len)
6669 * for choice in choices: # <<<<<<<<<<<<<<
6670 * proc_choice = processor(choice)
6671 * Py_INCREF(proc_choice)
6672 */
6673 __Pyx_TraceLine(362,0,__PYX_ERR(0, 362, __pyx_L4_error))
6674 }
6675 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6676
6677 /* "cpp_process_cdist.pyx":353
6678 * proc_choices.push_back(move(conv_sequence(choice)))
6679 * # processor has to be called through python
6680 * elif processor is not default_process and callable(processor): # <<<<<<<<<<<<<<
6681 * proc_py_queries.reserve(queries_len)
6682 * for query in queries:
6683 */
6684 goto __pyx_L9;
6685 }
6686
6687 /* "cpp_process_cdist.pyx":370
6688 * # processor is True / default_process
6689 * else:
6690 * for query in queries: # <<<<<<<<<<<<<<
6691 * proc_queries.push_back(
6692 * move(default_process_func(move(conv_sequence(query))))
6693 */
6694 __Pyx_TraceLine(370,0,__PYX_ERR(0, 370, __pyx_L4_error))
6695 /*else*/ {
6696 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
6697 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
6698 __pyx_t_5 = NULL;
6699 } else {
6700 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L4_error)
6701 __Pyx_GOTREF(__pyx_t_4);
6702 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L4_error)
6703 }
6704 for (;;) {
6705 if (likely(!__pyx_t_5)) {
6706 if (likely(PyList_CheckExact(__pyx_t_4))) {
6707 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
6708 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6709 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 370, __pyx_L4_error)
6710 #else
6711 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L4_error)
6712 __Pyx_GOTREF(__pyx_t_6);
6713 #endif
6714 } else {
6715 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6716 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6717 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 370, __pyx_L4_error)
6718 #else
6719 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L4_error)
6720 __Pyx_GOTREF(__pyx_t_6);
6721 #endif
6722 }
6723 } else {
6724 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
6725 if (unlikely(!__pyx_t_6)) {
6726 PyObject* exc_type = PyErr_Occurred();
6727 if (exc_type) {
6728 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6729 else __PYX_ERR(0, 370, __pyx_L4_error)
6730 }
6731 break;
6732 }
6733 __Pyx_GOTREF(__pyx_t_6);
6734 }
6735 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
6736 __pyx_t_6 = 0;
6737
6738 /* "cpp_process_cdist.pyx":372
6739 * for query in queries:
6740 * proc_queries.push_back(
6741 * move(default_process_func(move(conv_sequence(query)))) # <<<<<<<<<<<<<<
6742 * )
6743 *
6744 */
6745 __Pyx_TraceLine(372,0,__PYX_ERR(0, 372, __pyx_L4_error))
6746 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_query); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L4_error)
6747 try {
6748 __pyx_t_12 = default_process_func(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
6749 } catch(...) {
6750 __Pyx_CppExn2PyErr();
6751 __PYX_ERR(0, 372, __pyx_L4_error)
6752 }
6753
6754 /* "cpp_process_cdist.pyx":371
6755 * else:
6756 * for query in queries:
6757 * proc_queries.push_back( # <<<<<<<<<<<<<<
6758 * move(default_process_func(move(conv_sequence(query))))
6759 * )
6760 */
6761 __Pyx_TraceLine(371,0,__PYX_ERR(0, 371, __pyx_L4_error))
6762 try {
6763 __pyx_v_proc_queries.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_12)));
6764 } catch(...) {
6765 __Pyx_CppExn2PyErr();
6766 __PYX_ERR(0, 371, __pyx_L4_error)
6767 }
6768
6769 /* "cpp_process_cdist.pyx":370
6770 * # processor is True / default_process
6771 * else:
6772 * for query in queries: # <<<<<<<<<<<<<<
6773 * proc_queries.push_back(
6774 * move(default_process_func(move(conv_sequence(query))))
6775 */
6776 __Pyx_TraceLine(370,0,__PYX_ERR(0, 370, __pyx_L4_error))
6777 }
6778 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6779
6780 /* "cpp_process_cdist.pyx":375
6781 * )
6782 *
6783 * for choice in choices: # <<<<<<<<<<<<<<
6784 * proc_choices.push_back(
6785 * move(default_process_func(move(conv_sequence(choice))))
6786 */
6787 __Pyx_TraceLine(375,0,__PYX_ERR(0, 375, __pyx_L4_error))
6788 if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) {
6789 __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
6790 __pyx_t_5 = NULL;
6791 } else {
6792 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L4_error)
6793 __Pyx_GOTREF(__pyx_t_4);
6794 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L4_error)
6795 }
6796 for (;;) {
6797 if (likely(!__pyx_t_5)) {
6798 if (likely(PyList_CheckExact(__pyx_t_4))) {
6799 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
6800 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6801 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 375, __pyx_L4_error)
6802 #else
6803 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L4_error)
6804 __Pyx_GOTREF(__pyx_t_6);
6805 #endif
6806 } else {
6807 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6808 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6809 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 375, __pyx_L4_error)
6810 #else
6811 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L4_error)
6812 __Pyx_GOTREF(__pyx_t_6);
6813 #endif
6814 }
6815 } else {
6816 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
6817 if (unlikely(!__pyx_t_6)) {
6818 PyObject* exc_type = PyErr_Occurred();
6819 if (exc_type) {
6820 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6821 else __PYX_ERR(0, 375, __pyx_L4_error)
6822 }
6823 break;
6824 }
6825 __Pyx_GOTREF(__pyx_t_6);
6826 }
6827 __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6);
6828 __pyx_t_6 = 0;
6829
6830 /* "cpp_process_cdist.pyx":377
6831 * for choice in choices:
6832 * proc_choices.push_back(
6833 * move(default_process_func(move(conv_sequence(choice)))) # <<<<<<<<<<<<<<
6834 * )
6835 *
6836 */
6837 __Pyx_TraceLine(377,0,__PYX_ERR(0, 377, __pyx_L4_error))
6838 __pyx_t_12 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_choice); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L4_error)
6839 try {
6840 __pyx_t_7 = default_process_func(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_12)));
6841 } catch(...) {
6842 __Pyx_CppExn2PyErr();
6843 __PYX_ERR(0, 377, __pyx_L4_error)
6844 }
6845
6846 /* "cpp_process_cdist.pyx":376
6847 *
6848 * for choice in choices:
6849 * proc_choices.push_back( # <<<<<<<<<<<<<<
6850 * move(default_process_func(move(conv_sequence(choice))))
6851 * )
6852 */
6853 __Pyx_TraceLine(376,0,__PYX_ERR(0, 376, __pyx_L4_error))
6854 try {
6855 __pyx_v_proc_choices.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
6856 } catch(...) {
6857 __Pyx_CppExn2PyErr();
6858 __PYX_ERR(0, 376, __pyx_L4_error)
6859 }
6860
6861 /* "cpp_process_cdist.pyx":375
6862 * )
6863 *
6864 * for choice in choices: # <<<<<<<<<<<<<<
6865 * proc_choices.push_back(
6866 * move(default_process_func(move(conv_sequence(choice))))
6867 */
6868 __Pyx_TraceLine(375,0,__PYX_ERR(0, 375, __pyx_L4_error))
6869 }
6870 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6871 }
6872 __pyx_L9:;
6873
6874 /* "cpp_process_cdist.pyx":380
6875 * )
6876 *
6877 * if IsIntegratedScorer(scorer): # <<<<<<<<<<<<<<
6878 * return cdist_two_lists_similarity(proc_queries, proc_choices, scorer, score_cutoff, dtype, workers, kwargs)
6879 *
6880 */
6881 __Pyx_TraceLine(380,0,__PYX_ERR(0, 380, __pyx_L4_error))
6882 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedScorer(__pyx_v_scorer) != 0);
6883 if (__pyx_t_3) {
6884
6885 /* "cpp_process_cdist.pyx":381
6886 *
6887 * if IsIntegratedScorer(scorer):
6888 * return cdist_two_lists_similarity(proc_queries, proc_choices, scorer, score_cutoff, dtype, workers, kwargs) # <<<<<<<<<<<<<<
6889 *
6890 *
6891 */
6892 __Pyx_TraceLine(381,0,__PYX_ERR(0, 381, __pyx_L4_error))
6893 __Pyx_XDECREF(__pyx_r);
6894 __pyx_t_4 = __pyx_f_17cpp_process_cdist_cdist_two_lists_similarity(__pyx_v_proc_queries, __pyx_v_proc_choices, __pyx_v_scorer, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L4_error)
6895 __Pyx_GOTREF(__pyx_t_4);
6896 __pyx_r = __pyx_t_4;
6897 __pyx_t_4 = 0;
6898 goto __pyx_L3_return;
6899
6900 /* "cpp_process_cdist.pyx":380
6901 * )
6902 *
6903 * if IsIntegratedScorer(scorer): # <<<<<<<<<<<<<<
6904 * return cdist_two_lists_similarity(proc_queries, proc_choices, scorer, score_cutoff, dtype, workers, kwargs)
6905 *
6906 */
6907 }
6908
6909 /* "cpp_process_cdist.pyx":384
6910 *
6911 *
6912 * if IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
6913 * return cdist_two_lists_distance(proc_queries, proc_choices, scorer, score_cutoff, dtype, workers, kwargs)
6914 *
6915 */
6916 __Pyx_TraceLine(384,0,__PYX_ERR(0, 384, __pyx_L4_error))
6917 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedDistance(__pyx_v_scorer) != 0);
6918 if (__pyx_t_3) {
6919
6920 /* "cpp_process_cdist.pyx":385
6921 *
6922 * if IsIntegratedDistance(scorer):
6923 * return cdist_two_lists_distance(proc_queries, proc_choices, scorer, score_cutoff, dtype, workers, kwargs) # <<<<<<<<<<<<<<
6924 *
6925 * else:
6926 */
6927 __Pyx_TraceLine(385,0,__PYX_ERR(0, 385, __pyx_L4_error))
6928 __Pyx_XDECREF(__pyx_r);
6929 __pyx_t_4 = __pyx_f_17cpp_process_cdist_cdist_two_lists_distance(__pyx_v_proc_queries, __pyx_v_proc_choices, __pyx_v_scorer, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 385, __pyx_L4_error)
6930 __Pyx_GOTREF(__pyx_t_4);
6931 __pyx_r = __pyx_t_4;
6932 __pyx_t_4 = 0;
6933 goto __pyx_L3_return;
6934
6935 /* "cpp_process_cdist.pyx":384
6936 *
6937 *
6938 * if IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
6939 * return cdist_two_lists_distance(proc_queries, proc_choices, scorer, score_cutoff, dtype, workers, kwargs)
6940 *
6941 */
6942 }
6943
6944 /* "cpp_process_cdist.pyx":341
6945 *
6946 * try:
6947 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
6948 * proc_queries.reserve(queries_len)
6949 * proc_choices.reserve(choices_len)
6950 */
6951 goto __pyx_L6;
6952 }
6953
6954 /* "cpp_process_cdist.pyx":388
6955 *
6956 * else:
6957 * proc_py_queries.reserve(queries_len) # <<<<<<<<<<<<<<
6958 * proc_py_choices.reserve(choices_len)
6959 *
6960 */
6961 __Pyx_TraceLine(388,0,__PYX_ERR(0, 388, __pyx_L4_error))
6962 /*else*/ {
6963 try {
6964 __pyx_v_proc_py_queries.reserve(__pyx_v_queries_len);
6965 } catch(...) {
6966 __Pyx_CppExn2PyErr();
6967 __PYX_ERR(0, 388, __pyx_L4_error)
6968 }
6969
6970 /* "cpp_process_cdist.pyx":389
6971 * else:
6972 * proc_py_queries.reserve(queries_len)
6973 * proc_py_choices.reserve(choices_len) # <<<<<<<<<<<<<<
6974 *
6975 * # processor None/False
6976 */
6977 __Pyx_TraceLine(389,0,__PYX_ERR(0, 389, __pyx_L4_error))
6978 try {
6979 __pyx_v_proc_py_choices.reserve(__pyx_v_choices_len);
6980 } catch(...) {
6981 __Pyx_CppExn2PyErr();
6982 __PYX_ERR(0, 389, __pyx_L4_error)
6983 }
6984
6985 /* "cpp_process_cdist.pyx":392
6986 *
6987 * # processor None/False
6988 * if not processor: # <<<<<<<<<<<<<<
6989 * for query in queries:
6990 * Py_INCREF(query)
6991 */
6992 __Pyx_TraceLine(392,0,__PYX_ERR(0, 392, __pyx_L4_error))
6993 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 392, __pyx_L4_error)
6994 __pyx_t_2 = ((!__pyx_t_3) != 0);
6995 if (__pyx_t_2) {
6996
6997 /* "cpp_process_cdist.pyx":393
6998 * # processor None/False
6999 * if not processor:
7000 * for query in queries: # <<<<<<<<<<<<<<
7001 * Py_INCREF(query)
7002 * proc_py_queries.push_back(<PyObject*>query)
7003 */
7004 __Pyx_TraceLine(393,0,__PYX_ERR(0, 393, __pyx_L4_error))
7005 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
7006 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
7007 __pyx_t_5 = NULL;
7008 } else {
7009 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 393, __pyx_L4_error)
7010 __Pyx_GOTREF(__pyx_t_4);
7011 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L4_error)
7012 }
7013 for (;;) {
7014 if (likely(!__pyx_t_5)) {
7015 if (likely(PyList_CheckExact(__pyx_t_4))) {
7016 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
7017 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7018 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 393, __pyx_L4_error)
7019 #else
7020 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L4_error)
7021 __Pyx_GOTREF(__pyx_t_6);
7022 #endif
7023 } else {
7024 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
7025 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7026 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 393, __pyx_L4_error)
7027 #else
7028 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L4_error)
7029 __Pyx_GOTREF(__pyx_t_6);
7030 #endif
7031 }
7032 } else {
7033 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
7034 if (unlikely(!__pyx_t_6)) {
7035 PyObject* exc_type = PyErr_Occurred();
7036 if (exc_type) {
7037 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7038 else __PYX_ERR(0, 393, __pyx_L4_error)
7039 }
7040 break;
7041 }
7042 __Pyx_GOTREF(__pyx_t_6);
7043 }
7044 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
7045 __pyx_t_6 = 0;
7046
7047 /* "cpp_process_cdist.pyx":394
7048 * if not processor:
7049 * for query in queries:
7050 * Py_INCREF(query) # <<<<<<<<<<<<<<
7051 * proc_py_queries.push_back(<PyObject*>query)
7052 *
7053 */
7054 __Pyx_TraceLine(394,0,__PYX_ERR(0, 394, __pyx_L4_error))
7055 Py_INCREF(__pyx_v_query);
7056
7057 /* "cpp_process_cdist.pyx":395
7058 * for query in queries:
7059 * Py_INCREF(query)
7060 * proc_py_queries.push_back(<PyObject*>query) # <<<<<<<<<<<<<<
7061 *
7062 * for choice in choices:
7063 */
7064 __Pyx_TraceLine(395,0,__PYX_ERR(0, 395, __pyx_L4_error))
7065 try {
7066 __pyx_v_proc_py_queries.push_back(((PyObject *)__pyx_v_query));
7067 } catch(...) {
7068 __Pyx_CppExn2PyErr();
7069 __PYX_ERR(0, 395, __pyx_L4_error)
7070 }
7071
7072 /* "cpp_process_cdist.pyx":393
7073 * # processor None/False
7074 * if not processor:
7075 * for query in queries: # <<<<<<<<<<<<<<
7076 * Py_INCREF(query)
7077 * proc_py_queries.push_back(<PyObject*>query)
7078 */
7079 __Pyx_TraceLine(393,0,__PYX_ERR(0, 393, __pyx_L4_error))
7080 }
7081 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7082
7083 /* "cpp_process_cdist.pyx":397
7084 * proc_py_queries.push_back(<PyObject*>query)
7085 *
7086 * for choice in choices: # <<<<<<<<<<<<<<
7087 * Py_INCREF(choice)
7088 * proc_py_choices.push_back(<PyObject*>choice)
7089 */
7090 __Pyx_TraceLine(397,0,__PYX_ERR(0, 397, __pyx_L4_error))
7091 if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) {
7092 __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
7093 __pyx_t_5 = NULL;
7094 } else {
7095 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L4_error)
7096 __Pyx_GOTREF(__pyx_t_4);
7097 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 397, __pyx_L4_error)
7098 }
7099 for (;;) {
7100 if (likely(!__pyx_t_5)) {
7101 if (likely(PyList_CheckExact(__pyx_t_4))) {
7102 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
7103 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7104 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 397, __pyx_L4_error)
7105 #else
7106 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 397, __pyx_L4_error)
7107 __Pyx_GOTREF(__pyx_t_6);
7108 #endif
7109 } else {
7110 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
7111 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7112 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 397, __pyx_L4_error)
7113 #else
7114 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 397, __pyx_L4_error)
7115 __Pyx_GOTREF(__pyx_t_6);
7116 #endif
7117 }
7118 } else {
7119 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
7120 if (unlikely(!__pyx_t_6)) {
7121 PyObject* exc_type = PyErr_Occurred();
7122 if (exc_type) {
7123 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7124 else __PYX_ERR(0, 397, __pyx_L4_error)
7125 }
7126 break;
7127 }
7128 __Pyx_GOTREF(__pyx_t_6);
7129 }
7130 __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6);
7131 __pyx_t_6 = 0;
7132
7133 /* "cpp_process_cdist.pyx":398
7134 *
7135 * for choice in choices:
7136 * Py_INCREF(choice) # <<<<<<<<<<<<<<
7137 * proc_py_choices.push_back(<PyObject*>choice)
7138 * # processor has to be called through python
7139 */
7140 __Pyx_TraceLine(398,0,__PYX_ERR(0, 398, __pyx_L4_error))
7141 Py_INCREF(__pyx_v_choice);
7142
7143 /* "cpp_process_cdist.pyx":399
7144 * for choice in choices:
7145 * Py_INCREF(choice)
7146 * proc_py_choices.push_back(<PyObject*>choice) # <<<<<<<<<<<<<<
7147 * # processor has to be called through python
7148 * else:
7149 */
7150 __Pyx_TraceLine(399,0,__PYX_ERR(0, 399, __pyx_L4_error))
7151 try {
7152 __pyx_v_proc_py_choices.push_back(((PyObject *)__pyx_v_choice));
7153 } catch(...) {
7154 __Pyx_CppExn2PyErr();
7155 __PYX_ERR(0, 399, __pyx_L4_error)
7156 }
7157
7158 /* "cpp_process_cdist.pyx":397
7159 * proc_py_queries.push_back(<PyObject*>query)
7160 *
7161 * for choice in choices: # <<<<<<<<<<<<<<
7162 * Py_INCREF(choice)
7163 * proc_py_choices.push_back(<PyObject*>choice)
7164 */
7165 __Pyx_TraceLine(397,0,__PYX_ERR(0, 397, __pyx_L4_error))
7166 }
7167 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7168
7169 /* "cpp_process_cdist.pyx":392
7170 *
7171 * # processor None/False
7172 * if not processor: # <<<<<<<<<<<<<<
7173 * for query in queries:
7174 * Py_INCREF(query)
7175 */
7176 goto __pyx_L26;
7177 }
7178
7179 /* "cpp_process_cdist.pyx":402
7180 * # processor has to be called through python
7181 * else:
7182 * if not callable(processor): # <<<<<<<<<<<<<<
7183 * processor = default_process
7184 *
7185 */
7186 __Pyx_TraceLine(402,0,__PYX_ERR(0, 402, __pyx_L4_error))
7187 /*else*/ {
7188 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 402, __pyx_L4_error)
7189 __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
7190 if (__pyx_t_3) {
7191
7192 /* "cpp_process_cdist.pyx":403
7193 * else:
7194 * if not callable(processor):
7195 * processor = default_process # <<<<<<<<<<<<<<
7196 *
7197 * for query in queries:
7198 */
7199 __Pyx_TraceLine(403,0,__PYX_ERR(0, 403, __pyx_L4_error))
7200 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L4_error)
7201 __Pyx_GOTREF(__pyx_t_4);
7202 __Pyx_DECREF_SET(__pyx_v_processor, __pyx_t_4);
7203 __pyx_t_4 = 0;
7204
7205 /* "cpp_process_cdist.pyx":402
7206 * # processor has to be called through python
7207 * else:
7208 * if not callable(processor): # <<<<<<<<<<<<<<
7209 * processor = default_process
7210 *
7211 */
7212 }
7213
7214 /* "cpp_process_cdist.pyx":405
7215 * processor = default_process
7216 *
7217 * for query in queries: # <<<<<<<<<<<<<<
7218 * proc_query = processor(query)
7219 * Py_INCREF(proc_query)
7220 */
7221 __Pyx_TraceLine(405,0,__PYX_ERR(0, 405, __pyx_L4_error))
7222 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
7223 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
7224 __pyx_t_5 = NULL;
7225 } else {
7226 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L4_error)
7227 __Pyx_GOTREF(__pyx_t_4);
7228 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L4_error)
7229 }
7230 for (;;) {
7231 if (likely(!__pyx_t_5)) {
7232 if (likely(PyList_CheckExact(__pyx_t_4))) {
7233 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
7234 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7235 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 405, __pyx_L4_error)
7236 #else
7237 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 405, __pyx_L4_error)
7238 __Pyx_GOTREF(__pyx_t_6);
7239 #endif
7240 } else {
7241 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
7242 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7243 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 405, __pyx_L4_error)
7244 #else
7245 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 405, __pyx_L4_error)
7246 __Pyx_GOTREF(__pyx_t_6);
7247 #endif
7248 }
7249 } else {
7250 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
7251 if (unlikely(!__pyx_t_6)) {
7252 PyObject* exc_type = PyErr_Occurred();
7253 if (exc_type) {
7254 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7255 else __PYX_ERR(0, 405, __pyx_L4_error)
7256 }
7257 break;
7258 }
7259 __Pyx_GOTREF(__pyx_t_6);
7260 }
7261 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
7262 __pyx_t_6 = 0;
7263
7264 /* "cpp_process_cdist.pyx":406
7265 *
7266 * for query in queries:
7267 * proc_query = processor(query) # <<<<<<<<<<<<<<
7268 * Py_INCREF(proc_query)
7269 * proc_py_queries.push_back(<PyObject*>proc_query)
7270 */
7271 __Pyx_TraceLine(406,0,__PYX_ERR(0, 406, __pyx_L4_error))
7272 __Pyx_INCREF(__pyx_v_processor);
7273 __pyx_t_9 = __pyx_v_processor; __pyx_t_10 = NULL;
7274 __pyx_t_11 = 0;
7275 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
7276 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
7277 if (likely(__pyx_t_10)) {
7278 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
7279 __Pyx_INCREF(__pyx_t_10);
7280 __Pyx_INCREF(function);
7281 __Pyx_DECREF_SET(__pyx_t_9, function);
7282 __pyx_t_11 = 1;
7283 }
7284 }
7285 {
7286 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_query};
7287 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
7288 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7289 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L4_error)
7290 __Pyx_GOTREF(__pyx_t_6);
7291 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7292 }
7293 __Pyx_XDECREF_SET(__pyx_v_proc_query, __pyx_t_6);
7294 __pyx_t_6 = 0;
7295
7296 /* "cpp_process_cdist.pyx":407
7297 * for query in queries:
7298 * proc_query = processor(query)
7299 * Py_INCREF(proc_query) # <<<<<<<<<<<<<<
7300 * proc_py_queries.push_back(<PyObject*>proc_query)
7301 *
7302 */
7303 __Pyx_TraceLine(407,0,__PYX_ERR(0, 407, __pyx_L4_error))
7304 Py_INCREF(__pyx_v_proc_query);
7305
7306 /* "cpp_process_cdist.pyx":408
7307 * proc_query = processor(query)
7308 * Py_INCREF(proc_query)
7309 * proc_py_queries.push_back(<PyObject*>proc_query) # <<<<<<<<<<<<<<
7310 *
7311 * for choice in choices:
7312 */
7313 __Pyx_TraceLine(408,0,__PYX_ERR(0, 408, __pyx_L4_error))
7314 try {
7315 __pyx_v_proc_py_queries.push_back(((PyObject *)__pyx_v_proc_query));
7316 } catch(...) {
7317 __Pyx_CppExn2PyErr();
7318 __PYX_ERR(0, 408, __pyx_L4_error)
7319 }
7320
7321 /* "cpp_process_cdist.pyx":405
7322 * processor = default_process
7323 *
7324 * for query in queries: # <<<<<<<<<<<<<<
7325 * proc_query = processor(query)
7326 * Py_INCREF(proc_query)
7327 */
7328 __Pyx_TraceLine(405,0,__PYX_ERR(0, 405, __pyx_L4_error))
7329 }
7330 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7331
7332 /* "cpp_process_cdist.pyx":410
7333 * proc_py_queries.push_back(<PyObject*>proc_query)
7334 *
7335 * for choice in choices: # <<<<<<<<<<<<<<
7336 * proc_choice = processor(choice)
7337 * Py_INCREF(proc_choice)
7338 */
7339 __Pyx_TraceLine(410,0,__PYX_ERR(0, 410, __pyx_L4_error))
7340 if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) {
7341 __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
7342 __pyx_t_5 = NULL;
7343 } else {
7344 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __pyx_L4_error)
7345 __Pyx_GOTREF(__pyx_t_4);
7346 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 410, __pyx_L4_error)
7347 }
7348 for (;;) {
7349 if (likely(!__pyx_t_5)) {
7350 if (likely(PyList_CheckExact(__pyx_t_4))) {
7351 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
7352 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7353 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 410, __pyx_L4_error)
7354 #else
7355 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L4_error)
7356 __Pyx_GOTREF(__pyx_t_6);
7357 #endif
7358 } else {
7359 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
7360 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7361 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 410, __pyx_L4_error)
7362 #else
7363 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L4_error)
7364 __Pyx_GOTREF(__pyx_t_6);
7365 #endif
7366 }
7367 } else {
7368 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
7369 if (unlikely(!__pyx_t_6)) {
7370 PyObject* exc_type = PyErr_Occurred();
7371 if (exc_type) {
7372 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7373 else __PYX_ERR(0, 410, __pyx_L4_error)
7374 }
7375 break;
7376 }
7377 __Pyx_GOTREF(__pyx_t_6);
7378 }
7379 __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6);
7380 __pyx_t_6 = 0;
7381
7382 /* "cpp_process_cdist.pyx":411
7383 *
7384 * for choice in choices:
7385 * proc_choice = processor(choice) # <<<<<<<<<<<<<<
7386 * Py_INCREF(proc_choice)
7387 * proc_py_choices.push_back(<PyObject*>proc_choice)
7388 */
7389 __Pyx_TraceLine(411,0,__PYX_ERR(0, 411, __pyx_L4_error))
7390 __Pyx_INCREF(__pyx_v_processor);
7391 __pyx_t_9 = __pyx_v_processor; __pyx_t_10 = NULL;
7392 __pyx_t_11 = 0;
7393 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
7394 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
7395 if (likely(__pyx_t_10)) {
7396 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
7397 __Pyx_INCREF(__pyx_t_10);
7398 __Pyx_INCREF(function);
7399 __Pyx_DECREF_SET(__pyx_t_9, function);
7400 __pyx_t_11 = 1;
7401 }
7402 }
7403 {
7404 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_choice};
7405 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
7406 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7407 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L4_error)
7408 __Pyx_GOTREF(__pyx_t_6);
7409 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7410 }
7411 __Pyx_XDECREF_SET(__pyx_v_proc_choice, __pyx_t_6);
7412 __pyx_t_6 = 0;
7413
7414 /* "cpp_process_cdist.pyx":412
7415 * for choice in choices:
7416 * proc_choice = processor(choice)
7417 * Py_INCREF(proc_choice) # <<<<<<<<<<<<<<
7418 * proc_py_choices.push_back(<PyObject*>proc_choice)
7419 *
7420 */
7421 __Pyx_TraceLine(412,0,__PYX_ERR(0, 412, __pyx_L4_error))
7422 Py_INCREF(__pyx_v_proc_choice);
7423
7424 /* "cpp_process_cdist.pyx":413
7425 * proc_choice = processor(choice)
7426 * Py_INCREF(proc_choice)
7427 * proc_py_choices.push_back(<PyObject*>proc_choice) # <<<<<<<<<<<<<<
7428 *
7429 * return py_cdist_two_lists(proc_py_queries, proc_py_choices, scorer, score_cutoff, dtype, kwargs)
7430 */
7431 __Pyx_TraceLine(413,0,__PYX_ERR(0, 413, __pyx_L4_error))
7432 try {
7433 __pyx_v_proc_py_choices.push_back(((PyObject *)__pyx_v_proc_choice));
7434 } catch(...) {
7435 __Pyx_CppExn2PyErr();
7436 __PYX_ERR(0, 413, __pyx_L4_error)
7437 }
7438
7439 /* "cpp_process_cdist.pyx":410
7440 * proc_py_queries.push_back(<PyObject*>proc_query)
7441 *
7442 * for choice in choices: # <<<<<<<<<<<<<<
7443 * proc_choice = processor(choice)
7444 * Py_INCREF(proc_choice)
7445 */
7446 __Pyx_TraceLine(410,0,__PYX_ERR(0, 410, __pyx_L4_error))
7447 }
7448 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7449 }
7450 __pyx_L26:;
7451
7452 /* "cpp_process_cdist.pyx":415
7453 * proc_py_choices.push_back(<PyObject*>proc_choice)
7454 *
7455 * return py_cdist_two_lists(proc_py_queries, proc_py_choices, scorer, score_cutoff, dtype, kwargs) # <<<<<<<<<<<<<<
7456 *
7457 * finally:
7458 */
7459 __Pyx_TraceLine(415,0,__PYX_ERR(0, 415, __pyx_L4_error))
7460 __Pyx_XDECREF(__pyx_r);
7461 __pyx_t_4 = __pyx_f_17cpp_process_cdist_py_cdist_two_lists(__pyx_v_proc_py_queries, __pyx_v_proc_py_choices, __pyx_v_scorer, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L4_error)
7462 __Pyx_GOTREF(__pyx_t_4);
7463 __pyx_r = __pyx_t_4;
7464 __pyx_t_4 = 0;
7465 goto __pyx_L3_return;
7466 }
7467 __pyx_L6:;
7468 }
7469
7470 /* "cpp_process_cdist.pyx":419
7471 * finally:
7472 * # decref all reference counts
7473 * for item in proc_py_queries: # <<<<<<<<<<<<<<
7474 * Py_DECREF(<object>item)
7475 *
7476 */
7477 __Pyx_TraceLine(419,0,__PYX_ERR(0, 419, __pyx_L4_error))
7478 /*finally:*/ {
7479 /*normal exit:*/{
7480 __pyx_t_13 = __pyx_v_proc_py_queries.begin();
7481 for (;;) {
7482 if (!(__pyx_t_13 != __pyx_v_proc_py_queries.end())) break;
7483 __pyx_t_14 = *__pyx_t_13;
7484 ++__pyx_t_13;
7485 __pyx_v_item = __pyx_t_14;
7486
7487 /* "cpp_process_cdist.pyx":420
7488 * # decref all reference counts
7489 * for item in proc_py_queries:
7490 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
7491 *
7492 * for item in proc_py_choices:
7493 */
7494 __Pyx_TraceLine(420,0,__PYX_ERR(0, 420, __pyx_L1_error))
7495 Py_DECREF(((PyObject *)__pyx_v_item));
7496
7497 /* "cpp_process_cdist.pyx":419
7498 * finally:
7499 * # decref all reference counts
7500 * for item in proc_py_queries: # <<<<<<<<<<<<<<
7501 * Py_DECREF(<object>item)
7502 *
7503 */
7504 __Pyx_TraceLine(419,0,__PYX_ERR(0, 419, __pyx_L1_error))
7505 }
7506
7507 /* "cpp_process_cdist.pyx":422
7508 * Py_DECREF(<object>item)
7509 *
7510 * for item in proc_py_choices: # <<<<<<<<<<<<<<
7511 * Py_DECREF(<object>item)
7512 *
7513 */
7514 __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
7515 __pyx_t_13 = __pyx_v_proc_py_choices.begin();
7516 for (;;) {
7517 if (!(__pyx_t_13 != __pyx_v_proc_py_choices.end())) break;
7518 __pyx_t_14 = *__pyx_t_13;
7519 ++__pyx_t_13;
7520 __pyx_v_item = __pyx_t_14;
7521
7522 /* "cpp_process_cdist.pyx":423
7523 *
7524 * for item in proc_py_choices:
7525 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
7526 *
7527 * cdef inline cdist_single_list_similarity(
7528 */
7529 __Pyx_TraceLine(423,0,__PYX_ERR(0, 423, __pyx_L1_error))
7530 Py_DECREF(((PyObject *)__pyx_v_item));
7531
7532 /* "cpp_process_cdist.pyx":422
7533 * Py_DECREF(<object>item)
7534 *
7535 * for item in proc_py_choices: # <<<<<<<<<<<<<<
7536 * Py_DECREF(<object>item)
7537 *
7538 */
7539 __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
7540 }
7541 goto __pyx_L5;
7542 }
7543 __pyx_L4_error:;
7544 /*exception exit:*/{
7545 __Pyx_PyThreadState_declare
7546 __Pyx_PyThreadState_assign
7547 __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
7548 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7549 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7550 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7551 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7552 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
7553 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
7554 __Pyx_XGOTREF(__pyx_t_17);
7555 __Pyx_XGOTREF(__pyx_t_18);
7556 __Pyx_XGOTREF(__pyx_t_19);
7557 __Pyx_XGOTREF(__pyx_t_20);
7558 __Pyx_XGOTREF(__pyx_t_21);
7559 __Pyx_XGOTREF(__pyx_t_22);
7560 __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
7561 {
7562
7563 /* "cpp_process_cdist.pyx":419
7564 * finally:
7565 * # decref all reference counts
7566 * for item in proc_py_queries: # <<<<<<<<<<<<<<
7567 * Py_DECREF(<object>item)
7568 *
7569 */
7570 __Pyx_TraceLine(419,0,__PYX_ERR(0, 419, __pyx_L41_error))
7571 __pyx_t_13 = __pyx_v_proc_py_queries.begin();
7572 for (;;) {
7573 if (!(__pyx_t_13 != __pyx_v_proc_py_queries.end())) break;
7574 __pyx_t_14 = *__pyx_t_13;
7575 ++__pyx_t_13;
7576 __pyx_v_item = __pyx_t_14;
7577
7578 /* "cpp_process_cdist.pyx":420
7579 * # decref all reference counts
7580 * for item in proc_py_queries:
7581 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
7582 *
7583 * for item in proc_py_choices:
7584 */
7585 __Pyx_TraceLine(420,0,__PYX_ERR(0, 420, __pyx_L41_error))
7586 Py_DECREF(((PyObject *)__pyx_v_item));
7587
7588 /* "cpp_process_cdist.pyx":419
7589 * finally:
7590 * # decref all reference counts
7591 * for item in proc_py_queries: # <<<<<<<<<<<<<<
7592 * Py_DECREF(<object>item)
7593 *
7594 */
7595 __Pyx_TraceLine(419,0,__PYX_ERR(0, 419, __pyx_L41_error))
7596 }
7597
7598 /* "cpp_process_cdist.pyx":422
7599 * Py_DECREF(<object>item)
7600 *
7601 * for item in proc_py_choices: # <<<<<<<<<<<<<<
7602 * Py_DECREF(<object>item)
7603 *
7604 */
7605 __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L41_error))
7606 __pyx_t_13 = __pyx_v_proc_py_choices.begin();
7607 for (;;) {
7608 if (!(__pyx_t_13 != __pyx_v_proc_py_choices.end())) break;
7609 __pyx_t_14 = *__pyx_t_13;
7610 ++__pyx_t_13;
7611 __pyx_v_item = __pyx_t_14;
7612
7613 /* "cpp_process_cdist.pyx":423
7614 *
7615 * for item in proc_py_choices:
7616 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
7617 *
7618 * cdef inline cdist_single_list_similarity(
7619 */
7620 __Pyx_TraceLine(423,0,__PYX_ERR(0, 423, __pyx_L41_error))
7621 Py_DECREF(((PyObject *)__pyx_v_item));
7622
7623 /* "cpp_process_cdist.pyx":422
7624 * Py_DECREF(<object>item)
7625 *
7626 * for item in proc_py_choices: # <<<<<<<<<<<<<<
7627 * Py_DECREF(<object>item)
7628 *
7629 */
7630 __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L41_error))
7631 }
7632 }
7633 if (PY_MAJOR_VERSION >= 3) {
7634 __Pyx_XGIVEREF(__pyx_t_20);
7635 __Pyx_XGIVEREF(__pyx_t_21);
7636 __Pyx_XGIVEREF(__pyx_t_22);
7637 __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
7638 }
7639 __Pyx_XGIVEREF(__pyx_t_17);
7640 __Pyx_XGIVEREF(__pyx_t_18);
7641 __Pyx_XGIVEREF(__pyx_t_19);
7642 __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
7643 __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
7644 __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
7645 goto __pyx_L1_error;
7646 __pyx_L41_error:;
7647 if (PY_MAJOR_VERSION >= 3) {
7648 __Pyx_XGIVEREF(__pyx_t_20);
7649 __Pyx_XGIVEREF(__pyx_t_21);
7650 __Pyx_XGIVEREF(__pyx_t_22);
7651 __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
7652 }
7653 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
7654 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
7655 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7656 __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
7657 goto __pyx_L1_error;
7658 }
7659 __pyx_L3_return: {
7660 __pyx_t_22 = __pyx_r;
7661 __pyx_r = 0;
7662
7663 /* "cpp_process_cdist.pyx":419
7664 * finally:
7665 * # decref all reference counts
7666 * for item in proc_py_queries: # <<<<<<<<<<<<<<
7667 * Py_DECREF(<object>item)
7668 *
7669 */
7670 __Pyx_TraceLine(419,0,__PYX_ERR(0, 419, __pyx_L1_error))
7671 __pyx_t_13 = __pyx_v_proc_py_queries.begin();
7672 for (;;) {
7673 if (!(__pyx_t_13 != __pyx_v_proc_py_queries.end())) break;
7674 __pyx_t_14 = *__pyx_t_13;
7675 ++__pyx_t_13;
7676 __pyx_v_item = __pyx_t_14;
7677
7678 /* "cpp_process_cdist.pyx":420
7679 * # decref all reference counts
7680 * for item in proc_py_queries:
7681 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
7682 *
7683 * for item in proc_py_choices:
7684 */
7685 __Pyx_TraceLine(420,0,__PYX_ERR(0, 420, __pyx_L1_error))
7686 Py_DECREF(((PyObject *)__pyx_v_item));
7687
7688 /* "cpp_process_cdist.pyx":419
7689 * finally:
7690 * # decref all reference counts
7691 * for item in proc_py_queries: # <<<<<<<<<<<<<<
7692 * Py_DECREF(<object>item)
7693 *
7694 */
7695 __Pyx_TraceLine(419,0,__PYX_ERR(0, 419, __pyx_L1_error))
7696 }
7697
7698 /* "cpp_process_cdist.pyx":422
7699 * Py_DECREF(<object>item)
7700 *
7701 * for item in proc_py_choices: # <<<<<<<<<<<<<<
7702 * Py_DECREF(<object>item)
7703 *
7704 */
7705 __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
7706 __pyx_t_13 = __pyx_v_proc_py_choices.begin();
7707 for (;;) {
7708 if (!(__pyx_t_13 != __pyx_v_proc_py_choices.end())) break;
7709 __pyx_t_14 = *__pyx_t_13;
7710 ++__pyx_t_13;
7711 __pyx_v_item = __pyx_t_14;
7712
7713 /* "cpp_process_cdist.pyx":423
7714 *
7715 * for item in proc_py_choices:
7716 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
7717 *
7718 * cdef inline cdist_single_list_similarity(
7719 */
7720 __Pyx_TraceLine(423,0,__PYX_ERR(0, 423, __pyx_L1_error))
7721 Py_DECREF(((PyObject *)__pyx_v_item));
7722
7723 /* "cpp_process_cdist.pyx":422
7724 * Py_DECREF(<object>item)
7725 *
7726 * for item in proc_py_choices: # <<<<<<<<<<<<<<
7727 * Py_DECREF(<object>item)
7728 *
7729 */
7730 __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
7731 }
7732 __pyx_r = __pyx_t_22;
7733 __pyx_t_22 = 0;
7734 goto __pyx_L0;
7735 }
7736 __pyx_L5:;
7737 }
7738
7739 /* "cpp_process_cdist.pyx":332
7740 * return matrix
7741 *
7742 * cdef cdist_two_lists(queries, choices, scorer, processor, score_cutoff, dtype, workers, dict kwargs): # <<<<<<<<<<<<<<
7743 * cdef vector[proc_string] proc_queries
7744 * cdef vector[proc_string] proc_choices
7745 */
7746
7747 /* function exit code */
7748 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7749 goto __pyx_L0;
7750 __pyx_L1_error:;
7751 __Pyx_XDECREF(__pyx_t_4);
7752 __Pyx_XDECREF(__pyx_t_6);
7753 __Pyx_XDECREF(__pyx_t_9);
7754 __Pyx_XDECREF(__pyx_t_10);
7755 __Pyx_AddTraceback("cpp_process_cdist.cdist_two_lists", __pyx_clineno, __pyx_lineno, __pyx_filename);
7756 __pyx_r = 0;
7757 __pyx_L0:;
7758 __Pyx_XDECREF(__pyx_v_query);
7759 __Pyx_XDECREF(__pyx_v_choice);
7760 __Pyx_XDECREF(__pyx_v_proc_query);
7761 __Pyx_XDECREF(__pyx_v_proc_choice);
7762 __Pyx_XDECREF(__pyx_v_processor);
7763 __Pyx_XGIVEREF(__pyx_r);
7764 __Pyx_TraceReturn(__pyx_r, 0);
7765 __Pyx_RefNannyFinishContext();
7766 return __pyx_r;
7767 }
7768
7769 /* "cpp_process_cdist.pyx":425
7770 * Py_DECREF(<object>item)
7771 *
7772 * cdef inline cdist_single_list_similarity( # <<<<<<<<<<<<<<
7773 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
7774 * ):
7775 */
7776
__pyx_f_17cpp_process_cdist_cdist_single_list_similarity(std::vector<proc_string> const & __pyx_v_queries,PyObject * __pyx_v_scorer,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)7777 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_single_list_similarity(std::vector<proc_string> const &__pyx_v_queries, PyObject *__pyx_v_scorer, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
7778 double __pyx_v_c_score_cutoff;
7779 struct ScorerFunctionTable __pyx_v_table;
7780 KwargsContext __pyx_v_kwargs_context;
7781 int __pyx_v_c_dtype;
7782 int __pyx_v_c_workers;
7783 PyObject *__pyx_r = NULL;
7784 __Pyx_TraceDeclarations
7785 __Pyx_RefNannyDeclarations
7786 int __pyx_t_1;
7787 int __pyx_t_2;
7788 KwargsContext __pyx_t_3;
7789 int __pyx_t_4;
7790 double __pyx_t_5;
7791 PyObject *__pyx_t_6 = NULL;
7792 int __pyx_lineno = 0;
7793 const char *__pyx_filename = NULL;
7794 int __pyx_clineno = 0;
7795 __Pyx_RefNannySetupContext("cdist_single_list_similarity", 0);
7796 __Pyx_TraceCall("cdist_single_list_similarity", __pyx_f[0], 425, 0, __PYX_ERR(0, 425, __pyx_L1_error));
7797
7798 /* "cpp_process_cdist.pyx":428
7799 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
7800 * ):
7801 * cdef double c_score_cutoff = 0 # <<<<<<<<<<<<<<
7802 * cdef ScorerFunctionTable table = CachedScorerInit(scorer)
7803 * cdef KwargsContext kwargs_context
7804 */
7805 __Pyx_TraceLine(428,0,__PYX_ERR(0, 428, __pyx_L1_error))
7806 __pyx_v_c_score_cutoff = 0.0;
7807
7808 /* "cpp_process_cdist.pyx":429
7809 * ):
7810 * cdef double c_score_cutoff = 0
7811 * cdef ScorerFunctionTable table = CachedScorerInit(scorer) # <<<<<<<<<<<<<<
7812 * cdef KwargsContext kwargs_context
7813 * cdef int c_dtype = dtype_to_type_num_similarity(dtype)
7814 */
7815 __Pyx_TraceLine(429,0,__PYX_ERR(0, 429, __pyx_L1_error))
7816 __pyx_v_table = __pyx_f_17cpp_process_cdist_CachedScorerInit(__pyx_v_scorer);
7817
7818 /* "cpp_process_cdist.pyx":431
7819 * cdef ScorerFunctionTable table = CachedScorerInit(scorer)
7820 * cdef KwargsContext kwargs_context
7821 * cdef int c_dtype = dtype_to_type_num_similarity(dtype) # <<<<<<<<<<<<<<
7822 * cdef int c_workers = workers
7823 *
7824 */
7825 __Pyx_TraceLine(431,0,__PYX_ERR(0, 431, __pyx_L1_error))
7826 __pyx_t_1 = __pyx_f_17cpp_process_cdist_dtype_to_type_num_similarity(__pyx_v_dtype); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 431, __pyx_L1_error)
7827 __pyx_v_c_dtype = __pyx_t_1;
7828
7829 /* "cpp_process_cdist.pyx":432
7830 * cdef KwargsContext kwargs_context
7831 * cdef int c_dtype = dtype_to_type_num_similarity(dtype)
7832 * cdef int c_workers = workers # <<<<<<<<<<<<<<
7833 *
7834 * if (NULL != table.kwargs_init):
7835 */
7836 __Pyx_TraceLine(432,0,__PYX_ERR(0, 432, __pyx_L1_error))
7837 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_workers); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 432, __pyx_L1_error)
7838 __pyx_v_c_workers = __pyx_t_1;
7839
7840 /* "cpp_process_cdist.pyx":434
7841 * cdef int c_workers = workers
7842 *
7843 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
7844 * kwargs_context = table.kwargs_init(kwargs)
7845 *
7846 */
7847 __Pyx_TraceLine(434,0,__PYX_ERR(0, 434, __pyx_L1_error))
7848 __pyx_t_2 = ((NULL != __pyx_v_table.kwargs_init) != 0);
7849 if (__pyx_t_2) {
7850
7851 /* "cpp_process_cdist.pyx":435
7852 *
7853 * if (NULL != table.kwargs_init):
7854 * kwargs_context = table.kwargs_init(kwargs) # <<<<<<<<<<<<<<
7855 *
7856 * if score_cutoff is not None:
7857 */
7858 __Pyx_TraceLine(435,0,__PYX_ERR(0, 435, __pyx_L1_error))
7859 __pyx_t_3 = __pyx_v_table.kwargs_init(__pyx_v_kwargs); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 435, __pyx_L1_error)
7860 __pyx_v_kwargs_context = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);
7861
7862 /* "cpp_process_cdist.pyx":434
7863 * cdef int c_workers = workers
7864 *
7865 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
7866 * kwargs_context = table.kwargs_init(kwargs)
7867 *
7868 */
7869 }
7870
7871 /* "cpp_process_cdist.pyx":437
7872 * kwargs_context = table.kwargs_init(kwargs)
7873 *
7874 * if score_cutoff is not None: # <<<<<<<<<<<<<<
7875 * c_score_cutoff = score_cutoff
7876 * if c_score_cutoff < 0 or c_score_cutoff > 100:
7877 */
7878 __Pyx_TraceLine(437,0,__PYX_ERR(0, 437, __pyx_L1_error))
7879 __pyx_t_2 = (__pyx_v_score_cutoff != Py_None);
7880 __pyx_t_4 = (__pyx_t_2 != 0);
7881 if (__pyx_t_4) {
7882
7883 /* "cpp_process_cdist.pyx":438
7884 *
7885 * if score_cutoff is not None:
7886 * c_score_cutoff = score_cutoff # <<<<<<<<<<<<<<
7887 * if c_score_cutoff < 0 or c_score_cutoff > 100:
7888 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
7889 */
7890 __Pyx_TraceLine(438,0,__PYX_ERR(0, 438, __pyx_L1_error))
7891 __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 438, __pyx_L1_error)
7892 __pyx_v_c_score_cutoff = __pyx_t_5;
7893
7894 /* "cpp_process_cdist.pyx":437
7895 * kwargs_context = table.kwargs_init(kwargs)
7896 *
7897 * if score_cutoff is not None: # <<<<<<<<<<<<<<
7898 * c_score_cutoff = score_cutoff
7899 * if c_score_cutoff < 0 or c_score_cutoff > 100:
7900 */
7901 }
7902
7903 /* "cpp_process_cdist.pyx":439
7904 * if score_cutoff is not None:
7905 * c_score_cutoff = score_cutoff
7906 * if c_score_cutoff < 0 or c_score_cutoff > 100: # <<<<<<<<<<<<<<
7907 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
7908 *
7909 */
7910 __Pyx_TraceLine(439,0,__PYX_ERR(0, 439, __pyx_L1_error))
7911 __pyx_t_2 = ((__pyx_v_c_score_cutoff < 0.0) != 0);
7912 if (!__pyx_t_2) {
7913 } else {
7914 __pyx_t_4 = __pyx_t_2;
7915 goto __pyx_L6_bool_binop_done;
7916 }
7917 __pyx_t_2 = ((__pyx_v_c_score_cutoff > 100.0) != 0);
7918 __pyx_t_4 = __pyx_t_2;
7919 __pyx_L6_bool_binop_done:;
7920 if (unlikely(__pyx_t_4)) {
7921
7922 /* "cpp_process_cdist.pyx":440
7923 * c_score_cutoff = score_cutoff
7924 * if c_score_cutoff < 0 or c_score_cutoff > 100:
7925 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0") # <<<<<<<<<<<<<<
7926 *
7927 * return cdist_single_list_similarity_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_score_cutoff)
7928 */
7929 __Pyx_TraceLine(440,0,__PYX_ERR(0, 440, __pyx_L1_error))
7930 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error)
7931 __Pyx_GOTREF(__pyx_t_6);
7932 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
7933 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7934 __PYX_ERR(0, 440, __pyx_L1_error)
7935
7936 /* "cpp_process_cdist.pyx":439
7937 * if score_cutoff is not None:
7938 * c_score_cutoff = score_cutoff
7939 * if c_score_cutoff < 0 or c_score_cutoff > 100: # <<<<<<<<<<<<<<
7940 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
7941 *
7942 */
7943 }
7944
7945 /* "cpp_process_cdist.pyx":442
7946 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0")
7947 *
7948 * return cdist_single_list_similarity_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_score_cutoff) # <<<<<<<<<<<<<<
7949 *
7950 * cdef inline cdist_single_list_distance(
7951 */
7952 __Pyx_TraceLine(442,0,__PYX_ERR(0, 442, __pyx_L1_error))
7953 __Pyx_XDECREF(__pyx_r);
7954 try {
7955 __pyx_t_6 = cdist_single_list_similarity_impl(__pyx_v_kwargs_context, __pyx_v_table.init, __pyx_v_queries, __pyx_v_c_dtype, __pyx_v_c_workers, __pyx_v_c_score_cutoff);
7956 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L1_error)
7957 } catch(...) {
7958 __Pyx_CppExn2PyErr();
7959 __PYX_ERR(0, 442, __pyx_L1_error)
7960 }
7961 __Pyx_GOTREF(__pyx_t_6);
7962 __pyx_r = __pyx_t_6;
7963 __pyx_t_6 = 0;
7964 goto __pyx_L0;
7965
7966 /* "cpp_process_cdist.pyx":425
7967 * Py_DECREF(<object>item)
7968 *
7969 * cdef inline cdist_single_list_similarity( # <<<<<<<<<<<<<<
7970 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
7971 * ):
7972 */
7973
7974 /* function exit code */
7975 __pyx_L1_error:;
7976 __Pyx_XDECREF(__pyx_t_6);
7977 __Pyx_AddTraceback("cpp_process_cdist.cdist_single_list_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
7978 __pyx_r = 0;
7979 __pyx_L0:;
7980 __Pyx_XGIVEREF(__pyx_r);
7981 __Pyx_TraceReturn(__pyx_r, 0);
7982 __Pyx_RefNannyFinishContext();
7983 return __pyx_r;
7984 }
7985
7986 /* "cpp_process_cdist.pyx":444
7987 * return cdist_single_list_similarity_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_score_cutoff)
7988 *
7989 * cdef inline cdist_single_list_distance( # <<<<<<<<<<<<<<
7990 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
7991 * ):
7992 */
7993
__pyx_f_17cpp_process_cdist_cdist_single_list_distance(std::vector<proc_string> const & __pyx_v_queries,PyObject * __pyx_v_scorer,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)7994 static CYTHON_INLINE PyObject *__pyx_f_17cpp_process_cdist_cdist_single_list_distance(std::vector<proc_string> const &__pyx_v_queries, PyObject *__pyx_v_scorer, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
7995 size_t __pyx_v_c_max;
7996 struct DistanceFunctionTable __pyx_v_table;
7997 KwargsContext __pyx_v_kwargs_context;
7998 int __pyx_v_c_dtype;
7999 int __pyx_v_c_workers;
8000 PyObject *__pyx_r = NULL;
8001 __Pyx_TraceDeclarations
8002 __Pyx_RefNannyDeclarations
8003 int __pyx_t_1;
8004 int __pyx_t_2;
8005 KwargsContext __pyx_t_3;
8006 int __pyx_t_4;
8007 int __pyx_t_5;
8008 PyObject *__pyx_t_6 = NULL;
8009 size_t __pyx_t_7;
8010 int __pyx_lineno = 0;
8011 const char *__pyx_filename = NULL;
8012 int __pyx_clineno = 0;
8013 __Pyx_RefNannySetupContext("cdist_single_list_distance", 0);
8014 __Pyx_TraceCall("cdist_single_list_distance", __pyx_f[0], 444, 0, __PYX_ERR(0, 444, __pyx_L1_error));
8015
8016 /* "cpp_process_cdist.pyx":447
8017 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
8018 * ):
8019 * cdef size_t c_max = <size_t>-1 # <<<<<<<<<<<<<<
8020 * cdef DistanceFunctionTable table = CachedDistanceInit(scorer)
8021 * cdef KwargsContext kwargs_context
8022 */
8023 __Pyx_TraceLine(447,0,__PYX_ERR(0, 447, __pyx_L1_error))
8024 __pyx_v_c_max = ((size_t)-1L);
8025
8026 /* "cpp_process_cdist.pyx":448
8027 * ):
8028 * cdef size_t c_max = <size_t>-1
8029 * cdef DistanceFunctionTable table = CachedDistanceInit(scorer) # <<<<<<<<<<<<<<
8030 * cdef KwargsContext kwargs_context
8031 * cdef int c_dtype = dtype_to_type_num_distance(dtype)
8032 */
8033 __Pyx_TraceLine(448,0,__PYX_ERR(0, 448, __pyx_L1_error))
8034 __pyx_v_table = __pyx_f_17cpp_process_cdist_CachedDistanceInit(__pyx_v_scorer);
8035
8036 /* "cpp_process_cdist.pyx":450
8037 * cdef DistanceFunctionTable table = CachedDistanceInit(scorer)
8038 * cdef KwargsContext kwargs_context
8039 * cdef int c_dtype = dtype_to_type_num_distance(dtype) # <<<<<<<<<<<<<<
8040 * cdef int c_workers = workers
8041 *
8042 */
8043 __Pyx_TraceLine(450,0,__PYX_ERR(0, 450, __pyx_L1_error))
8044 __pyx_t_1 = __pyx_f_17cpp_process_cdist_dtype_to_type_num_distance(__pyx_v_dtype); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 450, __pyx_L1_error)
8045 __pyx_v_c_dtype = __pyx_t_1;
8046
8047 /* "cpp_process_cdist.pyx":451
8048 * cdef KwargsContext kwargs_context
8049 * cdef int c_dtype = dtype_to_type_num_distance(dtype)
8050 * cdef int c_workers = workers # <<<<<<<<<<<<<<
8051 *
8052 * if (NULL != table.kwargs_init):
8053 */
8054 __Pyx_TraceLine(451,0,__PYX_ERR(0, 451, __pyx_L1_error))
8055 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_workers); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 451, __pyx_L1_error)
8056 __pyx_v_c_workers = __pyx_t_1;
8057
8058 /* "cpp_process_cdist.pyx":453
8059 * cdef int c_workers = workers
8060 *
8061 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
8062 * kwargs_context = table.kwargs_init(kwargs)
8063 *
8064 */
8065 __Pyx_TraceLine(453,0,__PYX_ERR(0, 453, __pyx_L1_error))
8066 __pyx_t_2 = ((NULL != __pyx_v_table.kwargs_init) != 0);
8067 if (__pyx_t_2) {
8068
8069 /* "cpp_process_cdist.pyx":454
8070 *
8071 * if (NULL != table.kwargs_init):
8072 * kwargs_context = table.kwargs_init(kwargs) # <<<<<<<<<<<<<<
8073 *
8074 * if score_cutoff is not None and score_cutoff != -1:
8075 */
8076 __Pyx_TraceLine(454,0,__PYX_ERR(0, 454, __pyx_L1_error))
8077 __pyx_t_3 = __pyx_v_table.kwargs_init(__pyx_v_kwargs); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 454, __pyx_L1_error)
8078 __pyx_v_kwargs_context = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);
8079
8080 /* "cpp_process_cdist.pyx":453
8081 * cdef int c_workers = workers
8082 *
8083 * if (NULL != table.kwargs_init): # <<<<<<<<<<<<<<
8084 * kwargs_context = table.kwargs_init(kwargs)
8085 *
8086 */
8087 }
8088
8089 /* "cpp_process_cdist.pyx":456
8090 * kwargs_context = table.kwargs_init(kwargs)
8091 *
8092 * if score_cutoff is not None and score_cutoff != -1: # <<<<<<<<<<<<<<
8093 * c_max = score_cutoff
8094 *
8095 */
8096 __Pyx_TraceLine(456,0,__PYX_ERR(0, 456, __pyx_L1_error))
8097 __pyx_t_4 = (__pyx_v_score_cutoff != Py_None);
8098 __pyx_t_5 = (__pyx_t_4 != 0);
8099 if (__pyx_t_5) {
8100 } else {
8101 __pyx_t_2 = __pyx_t_5;
8102 goto __pyx_L5_bool_binop_done;
8103 }
8104 __pyx_t_6 = __Pyx_PyInt_NeObjC(__pyx_v_score_cutoff, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error)
8105 __Pyx_GOTREF(__pyx_t_6);
8106 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 456, __pyx_L1_error)
8107 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8108 __pyx_t_2 = __pyx_t_5;
8109 __pyx_L5_bool_binop_done:;
8110 if (__pyx_t_2) {
8111
8112 /* "cpp_process_cdist.pyx":457
8113 *
8114 * if score_cutoff is not None and score_cutoff != -1:
8115 * c_max = score_cutoff # <<<<<<<<<<<<<<
8116 *
8117 * return cdist_single_list_distance_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_max)
8118 */
8119 __Pyx_TraceLine(457,0,__PYX_ERR(0, 457, __pyx_L1_error))
8120 __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_v_score_cutoff); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 457, __pyx_L1_error)
8121 __pyx_v_c_max = __pyx_t_7;
8122
8123 /* "cpp_process_cdist.pyx":456
8124 * kwargs_context = table.kwargs_init(kwargs)
8125 *
8126 * if score_cutoff is not None and score_cutoff != -1: # <<<<<<<<<<<<<<
8127 * c_max = score_cutoff
8128 *
8129 */
8130 }
8131
8132 /* "cpp_process_cdist.pyx":459
8133 * c_max = score_cutoff
8134 *
8135 * return cdist_single_list_distance_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_max) # <<<<<<<<<<<<<<
8136 *
8137 *
8138 */
8139 __Pyx_TraceLine(459,0,__PYX_ERR(0, 459, __pyx_L1_error))
8140 __Pyx_XDECREF(__pyx_r);
8141 try {
8142 __pyx_t_6 = cdist_single_list_distance_impl(__pyx_v_kwargs_context, __pyx_v_table.init, __pyx_v_queries, __pyx_v_c_dtype, __pyx_v_c_workers, __pyx_v_c_max);
8143 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 459, __pyx_L1_error)
8144 } catch(...) {
8145 __Pyx_CppExn2PyErr();
8146 __PYX_ERR(0, 459, __pyx_L1_error)
8147 }
8148 __Pyx_GOTREF(__pyx_t_6);
8149 __pyx_r = __pyx_t_6;
8150 __pyx_t_6 = 0;
8151 goto __pyx_L0;
8152
8153 /* "cpp_process_cdist.pyx":444
8154 * return cdist_single_list_similarity_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_score_cutoff)
8155 *
8156 * cdef inline cdist_single_list_distance( # <<<<<<<<<<<<<<
8157 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
8158 * ):
8159 */
8160
8161 /* function exit code */
8162 __pyx_L1_error:;
8163 __Pyx_XDECREF(__pyx_t_6);
8164 __Pyx_AddTraceback("cpp_process_cdist.cdist_single_list_distance", __pyx_clineno, __pyx_lineno, __pyx_filename);
8165 __pyx_r = 0;
8166 __pyx_L0:;
8167 __Pyx_XGIVEREF(__pyx_r);
8168 __Pyx_TraceReturn(__pyx_r, 0);
8169 __Pyx_RefNannyFinishContext();
8170 return __pyx_r;
8171 }
8172
8173 /* "cpp_process_cdist.pyx":462
8174 *
8175 *
8176 * cdef cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, dict kwargs): # <<<<<<<<<<<<<<
8177 * cdef size_t queries_len = <size_t>len(queries)
8178 *
8179 */
8180
__pyx_f_17cpp_process_cdist_cdist_single_list(PyObject * __pyx_v_queries,PyObject * __pyx_v_scorer,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)8181 static PyObject *__pyx_f_17cpp_process_cdist_cdist_single_list(PyObject *__pyx_v_queries, PyObject *__pyx_v_scorer, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
8182 size_t __pyx_v_queries_len;
8183 std::vector<proc_string> __pyx_v_proc_queries;
8184 std::vector<PyObject *> __pyx_v_proc_py_queries;
8185 PyObject *__pyx_v_query = NULL;
8186 PyObject *__pyx_v_proc_query = NULL;
8187 PyObject *__pyx_v_item;
8188 PyObject *__pyx_r = NULL;
8189 __Pyx_TraceDeclarations
8190 __Pyx_RefNannyDeclarations
8191 Py_ssize_t __pyx_t_1;
8192 int __pyx_t_2;
8193 int __pyx_t_3;
8194 PyObject *__pyx_t_4 = NULL;
8195 PyObject *(*__pyx_t_5)(PyObject *);
8196 PyObject *__pyx_t_6 = NULL;
8197 proc_string __pyx_t_7;
8198 int __pyx_t_8;
8199 PyObject *__pyx_t_9 = NULL;
8200 PyObject *__pyx_t_10 = NULL;
8201 int __pyx_t_11;
8202 proc_string __pyx_t_12;
8203 std::vector<PyObject *> ::iterator __pyx_t_13;
8204 PyObject *__pyx_t_14;
8205 int __pyx_t_15;
8206 char const *__pyx_t_16;
8207 PyObject *__pyx_t_17 = NULL;
8208 PyObject *__pyx_t_18 = NULL;
8209 PyObject *__pyx_t_19 = NULL;
8210 PyObject *__pyx_t_20 = NULL;
8211 PyObject *__pyx_t_21 = NULL;
8212 PyObject *__pyx_t_22 = NULL;
8213 int __pyx_lineno = 0;
8214 const char *__pyx_filename = NULL;
8215 int __pyx_clineno = 0;
8216 __Pyx_RefNannySetupContext("cdist_single_list", 0);
8217 __Pyx_TraceCall("cdist_single_list", __pyx_f[0], 462, 0, __PYX_ERR(0, 462, __pyx_L1_error));
8218 __Pyx_INCREF(__pyx_v_processor);
8219
8220 /* "cpp_process_cdist.pyx":463
8221 *
8222 * cdef cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, dict kwargs):
8223 * cdef size_t queries_len = <size_t>len(queries) # <<<<<<<<<<<<<<
8224 *
8225 * cdef vector[proc_string] proc_queries
8226 */
8227 __Pyx_TraceLine(463,0,__PYX_ERR(0, 463, __pyx_L1_error))
8228 __pyx_t_1 = PyObject_Length(__pyx_v_queries); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 463, __pyx_L1_error)
8229 __pyx_v_queries_len = ((size_t)__pyx_t_1);
8230
8231 /* "cpp_process_cdist.pyx":468
8232 * cdef vector[PyObject*] proc_py_queries
8233 *
8234 * try: # <<<<<<<<<<<<<<
8235 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer):
8236 * proc_queries.reserve(queries_len)
8237 */
8238 __Pyx_TraceLine(468,0,__PYX_ERR(0, 468, __pyx_L1_error))
8239 /*try:*/ {
8240
8241 /* "cpp_process_cdist.pyx":469
8242 *
8243 * try:
8244 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
8245 * proc_queries.reserve(queries_len)
8246 *
8247 */
8248 __Pyx_TraceLine(469,0,__PYX_ERR(0, 469, __pyx_L4_error))
8249 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedScorer(__pyx_v_scorer) != 0);
8250 if (!__pyx_t_3) {
8251 } else {
8252 __pyx_t_2 = __pyx_t_3;
8253 goto __pyx_L7_bool_binop_done;
8254 }
8255 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedDistance(__pyx_v_scorer) != 0);
8256 __pyx_t_2 = __pyx_t_3;
8257 __pyx_L7_bool_binop_done:;
8258 if (__pyx_t_2) {
8259
8260 /* "cpp_process_cdist.pyx":470
8261 * try:
8262 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer):
8263 * proc_queries.reserve(queries_len) # <<<<<<<<<<<<<<
8264 *
8265 * # processor None/False
8266 */
8267 __Pyx_TraceLine(470,0,__PYX_ERR(0, 470, __pyx_L4_error))
8268 try {
8269 __pyx_v_proc_queries.reserve(__pyx_v_queries_len);
8270 } catch(...) {
8271 __Pyx_CppExn2PyErr();
8272 __PYX_ERR(0, 470, __pyx_L4_error)
8273 }
8274
8275 /* "cpp_process_cdist.pyx":473
8276 *
8277 * # processor None/False
8278 * if not processor: # <<<<<<<<<<<<<<
8279 * for query in queries:
8280 * proc_queries.push_back(move(conv_sequence(query)))
8281 */
8282 __Pyx_TraceLine(473,0,__PYX_ERR(0, 473, __pyx_L4_error))
8283 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 473, __pyx_L4_error)
8284 __pyx_t_3 = ((!__pyx_t_2) != 0);
8285 if (__pyx_t_3) {
8286
8287 /* "cpp_process_cdist.pyx":474
8288 * # processor None/False
8289 * if not processor:
8290 * for query in queries: # <<<<<<<<<<<<<<
8291 * proc_queries.push_back(move(conv_sequence(query)))
8292 * # processor has to be called through python
8293 */
8294 __Pyx_TraceLine(474,0,__PYX_ERR(0, 474, __pyx_L4_error))
8295 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
8296 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
8297 __pyx_t_5 = NULL;
8298 } else {
8299 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L4_error)
8300 __Pyx_GOTREF(__pyx_t_4);
8301 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 474, __pyx_L4_error)
8302 }
8303 for (;;) {
8304 if (likely(!__pyx_t_5)) {
8305 if (likely(PyList_CheckExact(__pyx_t_4))) {
8306 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
8307 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8308 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 474, __pyx_L4_error)
8309 #else
8310 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 474, __pyx_L4_error)
8311 __Pyx_GOTREF(__pyx_t_6);
8312 #endif
8313 } else {
8314 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8315 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8316 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 474, __pyx_L4_error)
8317 #else
8318 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 474, __pyx_L4_error)
8319 __Pyx_GOTREF(__pyx_t_6);
8320 #endif
8321 }
8322 } else {
8323 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
8324 if (unlikely(!__pyx_t_6)) {
8325 PyObject* exc_type = PyErr_Occurred();
8326 if (exc_type) {
8327 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8328 else __PYX_ERR(0, 474, __pyx_L4_error)
8329 }
8330 break;
8331 }
8332 __Pyx_GOTREF(__pyx_t_6);
8333 }
8334 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
8335 __pyx_t_6 = 0;
8336
8337 /* "cpp_process_cdist.pyx":475
8338 * if not processor:
8339 * for query in queries:
8340 * proc_queries.push_back(move(conv_sequence(query))) # <<<<<<<<<<<<<<
8341 * # processor has to be called through python
8342 * elif processor is not default_process and callable(processor):
8343 */
8344 __Pyx_TraceLine(475,0,__PYX_ERR(0, 475, __pyx_L4_error))
8345 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_query); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L4_error)
8346 try {
8347 __pyx_v_proc_queries.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
8348 } catch(...) {
8349 __Pyx_CppExn2PyErr();
8350 __PYX_ERR(0, 475, __pyx_L4_error)
8351 }
8352
8353 /* "cpp_process_cdist.pyx":474
8354 * # processor None/False
8355 * if not processor:
8356 * for query in queries: # <<<<<<<<<<<<<<
8357 * proc_queries.push_back(move(conv_sequence(query)))
8358 * # processor has to be called through python
8359 */
8360 __Pyx_TraceLine(474,0,__PYX_ERR(0, 474, __pyx_L4_error))
8361 }
8362 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8363
8364 /* "cpp_process_cdist.pyx":473
8365 *
8366 * # processor None/False
8367 * if not processor: # <<<<<<<<<<<<<<
8368 * for query in queries:
8369 * proc_queries.push_back(move(conv_sequence(query)))
8370 */
8371 goto __pyx_L9;
8372 }
8373
8374 /* "cpp_process_cdist.pyx":477
8375 * proc_queries.push_back(move(conv_sequence(query)))
8376 * # processor has to be called through python
8377 * elif processor is not default_process and callable(processor): # <<<<<<<<<<<<<<
8378 * proc_py_queries.reserve(queries_len)
8379 * for query in queries:
8380 */
8381 __Pyx_TraceLine(477,0,__PYX_ERR(0, 477, __pyx_L4_error))
8382 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L4_error)
8383 __Pyx_GOTREF(__pyx_t_4);
8384 __pyx_t_2 = (__pyx_v_processor != __pyx_t_4);
8385 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8386 __pyx_t_8 = (__pyx_t_2 != 0);
8387 if (__pyx_t_8) {
8388 } else {
8389 __pyx_t_3 = __pyx_t_8;
8390 goto __pyx_L12_bool_binop_done;
8391 }
8392 __pyx_t_8 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 477, __pyx_L4_error)
8393 __pyx_t_2 = (__pyx_t_8 != 0);
8394 __pyx_t_3 = __pyx_t_2;
8395 __pyx_L12_bool_binop_done:;
8396 if (__pyx_t_3) {
8397
8398 /* "cpp_process_cdist.pyx":478
8399 * # processor has to be called through python
8400 * elif processor is not default_process and callable(processor):
8401 * proc_py_queries.reserve(queries_len) # <<<<<<<<<<<<<<
8402 * for query in queries:
8403 * proc_query = processor(query)
8404 */
8405 __Pyx_TraceLine(478,0,__PYX_ERR(0, 478, __pyx_L4_error))
8406 try {
8407 __pyx_v_proc_py_queries.reserve(__pyx_v_queries_len);
8408 } catch(...) {
8409 __Pyx_CppExn2PyErr();
8410 __PYX_ERR(0, 478, __pyx_L4_error)
8411 }
8412
8413 /* "cpp_process_cdist.pyx":479
8414 * elif processor is not default_process and callable(processor):
8415 * proc_py_queries.reserve(queries_len)
8416 * for query in queries: # <<<<<<<<<<<<<<
8417 * proc_query = processor(query)
8418 * Py_INCREF(proc_query)
8419 */
8420 __Pyx_TraceLine(479,0,__PYX_ERR(0, 479, __pyx_L4_error))
8421 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
8422 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
8423 __pyx_t_5 = NULL;
8424 } else {
8425 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 479, __pyx_L4_error)
8426 __Pyx_GOTREF(__pyx_t_4);
8427 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 479, __pyx_L4_error)
8428 }
8429 for (;;) {
8430 if (likely(!__pyx_t_5)) {
8431 if (likely(PyList_CheckExact(__pyx_t_4))) {
8432 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
8433 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8434 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 479, __pyx_L4_error)
8435 #else
8436 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L4_error)
8437 __Pyx_GOTREF(__pyx_t_6);
8438 #endif
8439 } else {
8440 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8441 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8442 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 479, __pyx_L4_error)
8443 #else
8444 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L4_error)
8445 __Pyx_GOTREF(__pyx_t_6);
8446 #endif
8447 }
8448 } else {
8449 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
8450 if (unlikely(!__pyx_t_6)) {
8451 PyObject* exc_type = PyErr_Occurred();
8452 if (exc_type) {
8453 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8454 else __PYX_ERR(0, 479, __pyx_L4_error)
8455 }
8456 break;
8457 }
8458 __Pyx_GOTREF(__pyx_t_6);
8459 }
8460 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
8461 __pyx_t_6 = 0;
8462
8463 /* "cpp_process_cdist.pyx":480
8464 * proc_py_queries.reserve(queries_len)
8465 * for query in queries:
8466 * proc_query = processor(query) # <<<<<<<<<<<<<<
8467 * Py_INCREF(proc_query)
8468 * proc_py_queries.push_back(<PyObject*>proc_query)
8469 */
8470 __Pyx_TraceLine(480,0,__PYX_ERR(0, 480, __pyx_L4_error))
8471 __Pyx_INCREF(__pyx_v_processor);
8472 __pyx_t_9 = __pyx_v_processor; __pyx_t_10 = NULL;
8473 __pyx_t_11 = 0;
8474 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
8475 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
8476 if (likely(__pyx_t_10)) {
8477 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
8478 __Pyx_INCREF(__pyx_t_10);
8479 __Pyx_INCREF(function);
8480 __Pyx_DECREF_SET(__pyx_t_9, function);
8481 __pyx_t_11 = 1;
8482 }
8483 }
8484 {
8485 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_query};
8486 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
8487 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8488 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L4_error)
8489 __Pyx_GOTREF(__pyx_t_6);
8490 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
8491 }
8492 __Pyx_XDECREF_SET(__pyx_v_proc_query, __pyx_t_6);
8493 __pyx_t_6 = 0;
8494
8495 /* "cpp_process_cdist.pyx":481
8496 * for query in queries:
8497 * proc_query = processor(query)
8498 * Py_INCREF(proc_query) # <<<<<<<<<<<<<<
8499 * proc_py_queries.push_back(<PyObject*>proc_query)
8500 * proc_queries.push_back(move(conv_sequence(proc_query)))
8501 */
8502 __Pyx_TraceLine(481,0,__PYX_ERR(0, 481, __pyx_L4_error))
8503 Py_INCREF(__pyx_v_proc_query);
8504
8505 /* "cpp_process_cdist.pyx":482
8506 * proc_query = processor(query)
8507 * Py_INCREF(proc_query)
8508 * proc_py_queries.push_back(<PyObject*>proc_query) # <<<<<<<<<<<<<<
8509 * proc_queries.push_back(move(conv_sequence(proc_query)))
8510 *
8511 */
8512 __Pyx_TraceLine(482,0,__PYX_ERR(0, 482, __pyx_L4_error))
8513 try {
8514 __pyx_v_proc_py_queries.push_back(((PyObject *)__pyx_v_proc_query));
8515 } catch(...) {
8516 __Pyx_CppExn2PyErr();
8517 __PYX_ERR(0, 482, __pyx_L4_error)
8518 }
8519
8520 /* "cpp_process_cdist.pyx":483
8521 * Py_INCREF(proc_query)
8522 * proc_py_queries.push_back(<PyObject*>proc_query)
8523 * proc_queries.push_back(move(conv_sequence(proc_query))) # <<<<<<<<<<<<<<
8524 *
8525 * # processor is True / default_process
8526 */
8527 __Pyx_TraceLine(483,0,__PYX_ERR(0, 483, __pyx_L4_error))
8528 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_proc_query); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L4_error)
8529 try {
8530 __pyx_v_proc_queries.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
8531 } catch(...) {
8532 __Pyx_CppExn2PyErr();
8533 __PYX_ERR(0, 483, __pyx_L4_error)
8534 }
8535
8536 /* "cpp_process_cdist.pyx":479
8537 * elif processor is not default_process and callable(processor):
8538 * proc_py_queries.reserve(queries_len)
8539 * for query in queries: # <<<<<<<<<<<<<<
8540 * proc_query = processor(query)
8541 * Py_INCREF(proc_query)
8542 */
8543 __Pyx_TraceLine(479,0,__PYX_ERR(0, 479, __pyx_L4_error))
8544 }
8545 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8546
8547 /* "cpp_process_cdist.pyx":477
8548 * proc_queries.push_back(move(conv_sequence(query)))
8549 * # processor has to be called through python
8550 * elif processor is not default_process and callable(processor): # <<<<<<<<<<<<<<
8551 * proc_py_queries.reserve(queries_len)
8552 * for query in queries:
8553 */
8554 goto __pyx_L9;
8555 }
8556
8557 /* "cpp_process_cdist.pyx":487
8558 * # processor is True / default_process
8559 * else:
8560 * for query in queries: # <<<<<<<<<<<<<<
8561 * proc_queries.push_back(
8562 * move(default_process_func(move(conv_sequence(query))))
8563 */
8564 __Pyx_TraceLine(487,0,__PYX_ERR(0, 487, __pyx_L4_error))
8565 /*else*/ {
8566 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
8567 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
8568 __pyx_t_5 = NULL;
8569 } else {
8570 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L4_error)
8571 __Pyx_GOTREF(__pyx_t_4);
8572 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L4_error)
8573 }
8574 for (;;) {
8575 if (likely(!__pyx_t_5)) {
8576 if (likely(PyList_CheckExact(__pyx_t_4))) {
8577 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
8578 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8579 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 487, __pyx_L4_error)
8580 #else
8581 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L4_error)
8582 __Pyx_GOTREF(__pyx_t_6);
8583 #endif
8584 } else {
8585 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8586 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8587 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 487, __pyx_L4_error)
8588 #else
8589 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L4_error)
8590 __Pyx_GOTREF(__pyx_t_6);
8591 #endif
8592 }
8593 } else {
8594 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
8595 if (unlikely(!__pyx_t_6)) {
8596 PyObject* exc_type = PyErr_Occurred();
8597 if (exc_type) {
8598 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8599 else __PYX_ERR(0, 487, __pyx_L4_error)
8600 }
8601 break;
8602 }
8603 __Pyx_GOTREF(__pyx_t_6);
8604 }
8605 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
8606 __pyx_t_6 = 0;
8607
8608 /* "cpp_process_cdist.pyx":489
8609 * for query in queries:
8610 * proc_queries.push_back(
8611 * move(default_process_func(move(conv_sequence(query)))) # <<<<<<<<<<<<<<
8612 * )
8613 *
8614 */
8615 __Pyx_TraceLine(489,0,__PYX_ERR(0, 489, __pyx_L4_error))
8616 __pyx_t_7 = __pyx_f_17cpp_process_cdist_conv_sequence(__pyx_v_query); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L4_error)
8617 try {
8618 __pyx_t_12 = default_process_func(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7)));
8619 } catch(...) {
8620 __Pyx_CppExn2PyErr();
8621 __PYX_ERR(0, 489, __pyx_L4_error)
8622 }
8623
8624 /* "cpp_process_cdist.pyx":488
8625 * else:
8626 * for query in queries:
8627 * proc_queries.push_back( # <<<<<<<<<<<<<<
8628 * move(default_process_func(move(conv_sequence(query))))
8629 * )
8630 */
8631 __Pyx_TraceLine(488,0,__PYX_ERR(0, 488, __pyx_L4_error))
8632 try {
8633 __pyx_v_proc_queries.push_back(cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_12)));
8634 } catch(...) {
8635 __Pyx_CppExn2PyErr();
8636 __PYX_ERR(0, 488, __pyx_L4_error)
8637 }
8638
8639 /* "cpp_process_cdist.pyx":487
8640 * # processor is True / default_process
8641 * else:
8642 * for query in queries: # <<<<<<<<<<<<<<
8643 * proc_queries.push_back(
8644 * move(default_process_func(move(conv_sequence(query))))
8645 */
8646 __Pyx_TraceLine(487,0,__PYX_ERR(0, 487, __pyx_L4_error))
8647 }
8648 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8649 }
8650 __pyx_L9:;
8651
8652 /* "cpp_process_cdist.pyx":492
8653 * )
8654 *
8655 * if IsIntegratedScorer(scorer): # <<<<<<<<<<<<<<
8656 * return cdist_single_list_similarity(proc_queries, scorer, score_cutoff, dtype, workers, kwargs)
8657 *
8658 */
8659 __Pyx_TraceLine(492,0,__PYX_ERR(0, 492, __pyx_L4_error))
8660 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedScorer(__pyx_v_scorer) != 0);
8661 if (__pyx_t_3) {
8662
8663 /* "cpp_process_cdist.pyx":493
8664 *
8665 * if IsIntegratedScorer(scorer):
8666 * return cdist_single_list_similarity(proc_queries, scorer, score_cutoff, dtype, workers, kwargs) # <<<<<<<<<<<<<<
8667 *
8668 * if IsIntegratedDistance(scorer):
8669 */
8670 __Pyx_TraceLine(493,0,__PYX_ERR(0, 493, __pyx_L4_error))
8671 __Pyx_XDECREF(__pyx_r);
8672 __pyx_t_4 = __pyx_f_17cpp_process_cdist_cdist_single_list_similarity(__pyx_v_proc_queries, __pyx_v_scorer, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 493, __pyx_L4_error)
8673 __Pyx_GOTREF(__pyx_t_4);
8674 __pyx_r = __pyx_t_4;
8675 __pyx_t_4 = 0;
8676 goto __pyx_L3_return;
8677
8678 /* "cpp_process_cdist.pyx":492
8679 * )
8680 *
8681 * if IsIntegratedScorer(scorer): # <<<<<<<<<<<<<<
8682 * return cdist_single_list_similarity(proc_queries, scorer, score_cutoff, dtype, workers, kwargs)
8683 *
8684 */
8685 }
8686
8687 /* "cpp_process_cdist.pyx":495
8688 * return cdist_single_list_similarity(proc_queries, scorer, score_cutoff, dtype, workers, kwargs)
8689 *
8690 * if IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
8691 * return cdist_single_list_distance(proc_queries, scorer, score_cutoff, dtype, workers, kwargs)
8692 *
8693 */
8694 __Pyx_TraceLine(495,0,__PYX_ERR(0, 495, __pyx_L4_error))
8695 __pyx_t_3 = (__pyx_f_17cpp_process_cdist_IsIntegratedDistance(__pyx_v_scorer) != 0);
8696 if (__pyx_t_3) {
8697
8698 /* "cpp_process_cdist.pyx":496
8699 *
8700 * if IsIntegratedDistance(scorer):
8701 * return cdist_single_list_distance(proc_queries, scorer, score_cutoff, dtype, workers, kwargs) # <<<<<<<<<<<<<<
8702 *
8703 * else:
8704 */
8705 __Pyx_TraceLine(496,0,__PYX_ERR(0, 496, __pyx_L4_error))
8706 __Pyx_XDECREF(__pyx_r);
8707 __pyx_t_4 = __pyx_f_17cpp_process_cdist_cdist_single_list_distance(__pyx_v_proc_queries, __pyx_v_scorer, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 496, __pyx_L4_error)
8708 __Pyx_GOTREF(__pyx_t_4);
8709 __pyx_r = __pyx_t_4;
8710 __pyx_t_4 = 0;
8711 goto __pyx_L3_return;
8712
8713 /* "cpp_process_cdist.pyx":495
8714 * return cdist_single_list_similarity(proc_queries, scorer, score_cutoff, dtype, workers, kwargs)
8715 *
8716 * if IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
8717 * return cdist_single_list_distance(proc_queries, scorer, score_cutoff, dtype, workers, kwargs)
8718 *
8719 */
8720 }
8721
8722 /* "cpp_process_cdist.pyx":469
8723 *
8724 * try:
8725 * if IsIntegratedScorer(scorer) or IsIntegratedDistance(scorer): # <<<<<<<<<<<<<<
8726 * proc_queries.reserve(queries_len)
8727 *
8728 */
8729 goto __pyx_L6;
8730 }
8731
8732 /* "cpp_process_cdist.pyx":499
8733 *
8734 * else:
8735 * proc_py_queries.reserve(queries_len) # <<<<<<<<<<<<<<
8736 *
8737 * # processor None/False
8738 */
8739 __Pyx_TraceLine(499,0,__PYX_ERR(0, 499, __pyx_L4_error))
8740 /*else*/ {
8741 try {
8742 __pyx_v_proc_py_queries.reserve(__pyx_v_queries_len);
8743 } catch(...) {
8744 __Pyx_CppExn2PyErr();
8745 __PYX_ERR(0, 499, __pyx_L4_error)
8746 }
8747
8748 /* "cpp_process_cdist.pyx":502
8749 *
8750 * # processor None/False
8751 * if not processor: # <<<<<<<<<<<<<<
8752 * for query in queries:
8753 * Py_INCREF(query)
8754 */
8755 __Pyx_TraceLine(502,0,__PYX_ERR(0, 502, __pyx_L4_error))
8756 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 502, __pyx_L4_error)
8757 __pyx_t_2 = ((!__pyx_t_3) != 0);
8758 if (__pyx_t_2) {
8759
8760 /* "cpp_process_cdist.pyx":503
8761 * # processor None/False
8762 * if not processor:
8763 * for query in queries: # <<<<<<<<<<<<<<
8764 * Py_INCREF(query)
8765 * proc_py_queries.push_back(<PyObject*>query)
8766 */
8767 __Pyx_TraceLine(503,0,__PYX_ERR(0, 503, __pyx_L4_error))
8768 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
8769 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
8770 __pyx_t_5 = NULL;
8771 } else {
8772 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L4_error)
8773 __Pyx_GOTREF(__pyx_t_4);
8774 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 503, __pyx_L4_error)
8775 }
8776 for (;;) {
8777 if (likely(!__pyx_t_5)) {
8778 if (likely(PyList_CheckExact(__pyx_t_4))) {
8779 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
8780 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8781 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 503, __pyx_L4_error)
8782 #else
8783 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L4_error)
8784 __Pyx_GOTREF(__pyx_t_6);
8785 #endif
8786 } else {
8787 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8788 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8789 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 503, __pyx_L4_error)
8790 #else
8791 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L4_error)
8792 __Pyx_GOTREF(__pyx_t_6);
8793 #endif
8794 }
8795 } else {
8796 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
8797 if (unlikely(!__pyx_t_6)) {
8798 PyObject* exc_type = PyErr_Occurred();
8799 if (exc_type) {
8800 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8801 else __PYX_ERR(0, 503, __pyx_L4_error)
8802 }
8803 break;
8804 }
8805 __Pyx_GOTREF(__pyx_t_6);
8806 }
8807 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
8808 __pyx_t_6 = 0;
8809
8810 /* "cpp_process_cdist.pyx":504
8811 * if not processor:
8812 * for query in queries:
8813 * Py_INCREF(query) # <<<<<<<<<<<<<<
8814 * proc_py_queries.push_back(<PyObject*>query)
8815 * # processor has to be called through python
8816 */
8817 __Pyx_TraceLine(504,0,__PYX_ERR(0, 504, __pyx_L4_error))
8818 Py_INCREF(__pyx_v_query);
8819
8820 /* "cpp_process_cdist.pyx":505
8821 * for query in queries:
8822 * Py_INCREF(query)
8823 * proc_py_queries.push_back(<PyObject*>query) # <<<<<<<<<<<<<<
8824 * # processor has to be called through python
8825 * else:
8826 */
8827 __Pyx_TraceLine(505,0,__PYX_ERR(0, 505, __pyx_L4_error))
8828 try {
8829 __pyx_v_proc_py_queries.push_back(((PyObject *)__pyx_v_query));
8830 } catch(...) {
8831 __Pyx_CppExn2PyErr();
8832 __PYX_ERR(0, 505, __pyx_L4_error)
8833 }
8834
8835 /* "cpp_process_cdist.pyx":503
8836 * # processor None/False
8837 * if not processor:
8838 * for query in queries: # <<<<<<<<<<<<<<
8839 * Py_INCREF(query)
8840 * proc_py_queries.push_back(<PyObject*>query)
8841 */
8842 __Pyx_TraceLine(503,0,__PYX_ERR(0, 503, __pyx_L4_error))
8843 }
8844 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8845
8846 /* "cpp_process_cdist.pyx":502
8847 *
8848 * # processor None/False
8849 * if not processor: # <<<<<<<<<<<<<<
8850 * for query in queries:
8851 * Py_INCREF(query)
8852 */
8853 goto __pyx_L20;
8854 }
8855
8856 /* "cpp_process_cdist.pyx":508
8857 * # processor has to be called through python
8858 * else:
8859 * if not callable(processor): # <<<<<<<<<<<<<<
8860 * processor = default_process
8861 *
8862 */
8863 __Pyx_TraceLine(508,0,__PYX_ERR(0, 508, __pyx_L4_error))
8864 /*else*/ {
8865 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 508, __pyx_L4_error)
8866 __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
8867 if (__pyx_t_3) {
8868
8869 /* "cpp_process_cdist.pyx":509
8870 * else:
8871 * if not callable(processor):
8872 * processor = default_process # <<<<<<<<<<<<<<
8873 *
8874 * for query in queries:
8875 */
8876 __Pyx_TraceLine(509,0,__PYX_ERR(0, 509, __pyx_L4_error))
8877 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L4_error)
8878 __Pyx_GOTREF(__pyx_t_4);
8879 __Pyx_DECREF_SET(__pyx_v_processor, __pyx_t_4);
8880 __pyx_t_4 = 0;
8881
8882 /* "cpp_process_cdist.pyx":508
8883 * # processor has to be called through python
8884 * else:
8885 * if not callable(processor): # <<<<<<<<<<<<<<
8886 * processor = default_process
8887 *
8888 */
8889 }
8890
8891 /* "cpp_process_cdist.pyx":511
8892 * processor = default_process
8893 *
8894 * for query in queries: # <<<<<<<<<<<<<<
8895 * proc_query = processor(query)
8896 * Py_INCREF(proc_query)
8897 */
8898 __Pyx_TraceLine(511,0,__PYX_ERR(0, 511, __pyx_L4_error))
8899 if (likely(PyList_CheckExact(__pyx_v_queries)) || PyTuple_CheckExact(__pyx_v_queries)) {
8900 __pyx_t_4 = __pyx_v_queries; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
8901 __pyx_t_5 = NULL;
8902 } else {
8903 __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_queries); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 511, __pyx_L4_error)
8904 __Pyx_GOTREF(__pyx_t_4);
8905 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 511, __pyx_L4_error)
8906 }
8907 for (;;) {
8908 if (likely(!__pyx_t_5)) {
8909 if (likely(PyList_CheckExact(__pyx_t_4))) {
8910 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
8911 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8912 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 511, __pyx_L4_error)
8913 #else
8914 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L4_error)
8915 __Pyx_GOTREF(__pyx_t_6);
8916 #endif
8917 } else {
8918 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
8919 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8920 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 511, __pyx_L4_error)
8921 #else
8922 __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L4_error)
8923 __Pyx_GOTREF(__pyx_t_6);
8924 #endif
8925 }
8926 } else {
8927 __pyx_t_6 = __pyx_t_5(__pyx_t_4);
8928 if (unlikely(!__pyx_t_6)) {
8929 PyObject* exc_type = PyErr_Occurred();
8930 if (exc_type) {
8931 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8932 else __PYX_ERR(0, 511, __pyx_L4_error)
8933 }
8934 break;
8935 }
8936 __Pyx_GOTREF(__pyx_t_6);
8937 }
8938 __Pyx_XDECREF_SET(__pyx_v_query, __pyx_t_6);
8939 __pyx_t_6 = 0;
8940
8941 /* "cpp_process_cdist.pyx":512
8942 *
8943 * for query in queries:
8944 * proc_query = processor(query) # <<<<<<<<<<<<<<
8945 * Py_INCREF(proc_query)
8946 * proc_py_queries.push_back(<PyObject*>proc_query)
8947 */
8948 __Pyx_TraceLine(512,0,__PYX_ERR(0, 512, __pyx_L4_error))
8949 __Pyx_INCREF(__pyx_v_processor);
8950 __pyx_t_9 = __pyx_v_processor; __pyx_t_10 = NULL;
8951 __pyx_t_11 = 0;
8952 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
8953 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
8954 if (likely(__pyx_t_10)) {
8955 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
8956 __Pyx_INCREF(__pyx_t_10);
8957 __Pyx_INCREF(function);
8958 __Pyx_DECREF_SET(__pyx_t_9, function);
8959 __pyx_t_11 = 1;
8960 }
8961 }
8962 {
8963 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_query};
8964 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
8965 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8966 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 512, __pyx_L4_error)
8967 __Pyx_GOTREF(__pyx_t_6);
8968 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
8969 }
8970 __Pyx_XDECREF_SET(__pyx_v_proc_query, __pyx_t_6);
8971 __pyx_t_6 = 0;
8972
8973 /* "cpp_process_cdist.pyx":513
8974 * for query in queries:
8975 * proc_query = processor(query)
8976 * Py_INCREF(proc_query) # <<<<<<<<<<<<<<
8977 * proc_py_queries.push_back(<PyObject*>proc_query)
8978 *
8979 */
8980 __Pyx_TraceLine(513,0,__PYX_ERR(0, 513, __pyx_L4_error))
8981 Py_INCREF(__pyx_v_proc_query);
8982
8983 /* "cpp_process_cdist.pyx":514
8984 * proc_query = processor(query)
8985 * Py_INCREF(proc_query)
8986 * proc_py_queries.push_back(<PyObject*>proc_query) # <<<<<<<<<<<<<<
8987 *
8988 * # scorer(a, b) might not be equal to scorer(b, a)
8989 */
8990 __Pyx_TraceLine(514,0,__PYX_ERR(0, 514, __pyx_L4_error))
8991 try {
8992 __pyx_v_proc_py_queries.push_back(((PyObject *)__pyx_v_proc_query));
8993 } catch(...) {
8994 __Pyx_CppExn2PyErr();
8995 __PYX_ERR(0, 514, __pyx_L4_error)
8996 }
8997
8998 /* "cpp_process_cdist.pyx":511
8999 * processor = default_process
9000 *
9001 * for query in queries: # <<<<<<<<<<<<<<
9002 * proc_query = processor(query)
9003 * Py_INCREF(proc_query)
9004 */
9005 __Pyx_TraceLine(511,0,__PYX_ERR(0, 511, __pyx_L4_error))
9006 }
9007 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9008 }
9009 __pyx_L20:;
9010
9011 /* "cpp_process_cdist.pyx":517
9012 *
9013 * # scorer(a, b) might not be equal to scorer(b, a)
9014 * return py_cdist_two_lists(proc_py_queries, proc_py_queries, scorer, score_cutoff, dtype, kwargs) # <<<<<<<<<<<<<<
9015 *
9016 * finally:
9017 */
9018 __Pyx_TraceLine(517,0,__PYX_ERR(0, 517, __pyx_L4_error))
9019 __Pyx_XDECREF(__pyx_r);
9020 __pyx_t_4 = __pyx_f_17cpp_process_cdist_py_cdist_two_lists(__pyx_v_proc_py_queries, __pyx_v_proc_py_queries, __pyx_v_scorer, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 517, __pyx_L4_error)
9021 __Pyx_GOTREF(__pyx_t_4);
9022 __pyx_r = __pyx_t_4;
9023 __pyx_t_4 = 0;
9024 goto __pyx_L3_return;
9025 }
9026 __pyx_L6:;
9027 }
9028
9029 /* "cpp_process_cdist.pyx":521
9030 * finally:
9031 * # decref all reference counts
9032 * for item in proc_py_queries: # <<<<<<<<<<<<<<
9033 * Py_DECREF(<object>item)
9034 *
9035 */
9036 __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L4_error))
9037 /*finally:*/ {
9038 /*normal exit:*/{
9039 __pyx_t_13 = __pyx_v_proc_py_queries.begin();
9040 for (;;) {
9041 if (!(__pyx_t_13 != __pyx_v_proc_py_queries.end())) break;
9042 __pyx_t_14 = *__pyx_t_13;
9043 ++__pyx_t_13;
9044 __pyx_v_item = __pyx_t_14;
9045
9046 /* "cpp_process_cdist.pyx":522
9047 * # decref all reference counts
9048 * for item in proc_py_queries:
9049 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
9050 *
9051 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs):
9052 */
9053 __Pyx_TraceLine(522,0,__PYX_ERR(0, 522, __pyx_L1_error))
9054 Py_DECREF(((PyObject *)__pyx_v_item));
9055
9056 /* "cpp_process_cdist.pyx":521
9057 * finally:
9058 * # decref all reference counts
9059 * for item in proc_py_queries: # <<<<<<<<<<<<<<
9060 * Py_DECREF(<object>item)
9061 *
9062 */
9063 __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L1_error))
9064 }
9065 goto __pyx_L5;
9066 }
9067 __pyx_L4_error:;
9068 /*exception exit:*/{
9069 __Pyx_PyThreadState_declare
9070 __Pyx_PyThreadState_assign
9071 __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
9072 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9073 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9074 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9075 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9076 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
9077 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
9078 __Pyx_XGOTREF(__pyx_t_17);
9079 __Pyx_XGOTREF(__pyx_t_18);
9080 __Pyx_XGOTREF(__pyx_t_19);
9081 __Pyx_XGOTREF(__pyx_t_20);
9082 __Pyx_XGOTREF(__pyx_t_21);
9083 __Pyx_XGOTREF(__pyx_t_22);
9084 __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
9085 {
9086 __pyx_t_13 = __pyx_v_proc_py_queries.begin();
9087 for (;;) {
9088 if (!(__pyx_t_13 != __pyx_v_proc_py_queries.end())) break;
9089 __pyx_t_14 = *__pyx_t_13;
9090 ++__pyx_t_13;
9091 __pyx_v_item = __pyx_t_14;
9092
9093 /* "cpp_process_cdist.pyx":522
9094 * # decref all reference counts
9095 * for item in proc_py_queries:
9096 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
9097 *
9098 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs):
9099 */
9100 __Pyx_TraceLine(522,0,__PYX_ERR(0, 522, __pyx_L29_error))
9101 Py_DECREF(((PyObject *)__pyx_v_item));
9102
9103 /* "cpp_process_cdist.pyx":521
9104 * finally:
9105 * # decref all reference counts
9106 * for item in proc_py_queries: # <<<<<<<<<<<<<<
9107 * Py_DECREF(<object>item)
9108 *
9109 */
9110 __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L29_error))
9111 }
9112 }
9113 if (PY_MAJOR_VERSION >= 3) {
9114 __Pyx_XGIVEREF(__pyx_t_20);
9115 __Pyx_XGIVEREF(__pyx_t_21);
9116 __Pyx_XGIVEREF(__pyx_t_22);
9117 __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
9118 }
9119 __Pyx_XGIVEREF(__pyx_t_17);
9120 __Pyx_XGIVEREF(__pyx_t_18);
9121 __Pyx_XGIVEREF(__pyx_t_19);
9122 __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
9123 __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
9124 __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
9125 goto __pyx_L1_error;
9126 __pyx_L29_error:;
9127 if (PY_MAJOR_VERSION >= 3) {
9128 __Pyx_XGIVEREF(__pyx_t_20);
9129 __Pyx_XGIVEREF(__pyx_t_21);
9130 __Pyx_XGIVEREF(__pyx_t_22);
9131 __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
9132 }
9133 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
9134 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
9135 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
9136 __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
9137 goto __pyx_L1_error;
9138 }
9139 __pyx_L3_return: {
9140 __pyx_t_22 = __pyx_r;
9141 __pyx_r = 0;
9142 __pyx_t_13 = __pyx_v_proc_py_queries.begin();
9143 for (;;) {
9144 if (!(__pyx_t_13 != __pyx_v_proc_py_queries.end())) break;
9145 __pyx_t_14 = *__pyx_t_13;
9146 ++__pyx_t_13;
9147 __pyx_v_item = __pyx_t_14;
9148
9149 /* "cpp_process_cdist.pyx":522
9150 * # decref all reference counts
9151 * for item in proc_py_queries:
9152 * Py_DECREF(<object>item) # <<<<<<<<<<<<<<
9153 *
9154 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs):
9155 */
9156 __Pyx_TraceLine(522,0,__PYX_ERR(0, 522, __pyx_L1_error))
9157 Py_DECREF(((PyObject *)__pyx_v_item));
9158
9159 /* "cpp_process_cdist.pyx":521
9160 * finally:
9161 * # decref all reference counts
9162 * for item in proc_py_queries: # <<<<<<<<<<<<<<
9163 * Py_DECREF(<object>item)
9164 *
9165 */
9166 __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L1_error))
9167 }
9168 __pyx_r = __pyx_t_22;
9169 __pyx_t_22 = 0;
9170 goto __pyx_L0;
9171 }
9172 __pyx_L5:;
9173 }
9174
9175 /* "cpp_process_cdist.pyx":462
9176 *
9177 *
9178 * cdef cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, dict kwargs): # <<<<<<<<<<<<<<
9179 * cdef size_t queries_len = <size_t>len(queries)
9180 *
9181 */
9182
9183 /* function exit code */
9184 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9185 goto __pyx_L0;
9186 __pyx_L1_error:;
9187 __Pyx_XDECREF(__pyx_t_4);
9188 __Pyx_XDECREF(__pyx_t_6);
9189 __Pyx_XDECREF(__pyx_t_9);
9190 __Pyx_XDECREF(__pyx_t_10);
9191 __Pyx_AddTraceback("cpp_process_cdist.cdist_single_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
9192 __pyx_r = 0;
9193 __pyx_L0:;
9194 __Pyx_XDECREF(__pyx_v_query);
9195 __Pyx_XDECREF(__pyx_v_proc_query);
9196 __Pyx_XDECREF(__pyx_v_processor);
9197 __Pyx_XGIVEREF(__pyx_r);
9198 __Pyx_TraceReturn(__pyx_r, 0);
9199 __Pyx_RefNannyFinishContext();
9200 return __pyx_r;
9201 }
9202
9203 /* "cpp_process_cdist.pyx":524
9204 * Py_DECREF(<object>item)
9205 *
9206 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs): # <<<<<<<<<<<<<<
9207 * """
9208 * Compute distance/similarity between each pair of the two collections of inputs.
9209 */
9210
__pyx_pf_17cpp_process_cdist_2__defaults__(CYTHON_UNUSED PyObject * __pyx_self)9211 static PyObject *__pyx_pf_17cpp_process_cdist_2__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
9212 PyObject *__pyx_r = NULL;
9213 __Pyx_TraceDeclarations
9214 __Pyx_RefNannyDeclarations
9215 PyObject *__pyx_t_1 = NULL;
9216 PyObject *__pyx_t_2 = NULL;
9217 int __pyx_lineno = 0;
9218 const char *__pyx_filename = NULL;
9219 int __pyx_clineno = 0;
9220 __Pyx_RefNannySetupContext("__defaults__", 0);
9221 __Pyx_TraceCall("__defaults__", __pyx_f[0], 524, 0, __PYX_ERR(0, 524, __pyx_L1_error));
9222 __Pyx_XDECREF(__pyx_r);
9223 __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
9224 __Pyx_GOTREF(__pyx_t_1);
9225 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_scorer, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_scorer) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
9226 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
9227 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_score_cutoff, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
9228 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
9229 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_workers, ((PyObject *)__pyx_int_1)) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
9230 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error)
9231 __Pyx_GOTREF(__pyx_t_2);
9232 __Pyx_INCREF(Py_None);
9233 __Pyx_GIVEREF(Py_None);
9234 PyTuple_SET_ITEM(__pyx_t_2, 0, Py_None);
9235 __Pyx_GIVEREF(__pyx_t_1);
9236 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
9237 __pyx_t_1 = 0;
9238 __pyx_r = __pyx_t_2;
9239 __pyx_t_2 = 0;
9240 goto __pyx_L0;
9241
9242 /* function exit code */
9243 __pyx_L1_error:;
9244 __Pyx_XDECREF(__pyx_t_1);
9245 __Pyx_XDECREF(__pyx_t_2);
9246 __Pyx_AddTraceback("cpp_process_cdist.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9247 __pyx_r = NULL;
9248 __pyx_L0:;
9249 __Pyx_XGIVEREF(__pyx_r);
9250 __Pyx_TraceReturn(__pyx_r, 0);
9251 __Pyx_RefNannyFinishContext();
9252 return __pyx_r;
9253 }
9254
9255 /* Python wrapper */
9256 static PyObject *__pyx_pw_17cpp_process_cdist_1cdist(PyObject *__pyx_self,
9257 #if CYTHON_METH_FASTCALL
9258 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9259 #else
9260 PyObject *__pyx_args, PyObject *__pyx_kwds
9261 #endif
9262 ); /*proto*/
9263 PyDoc_STRVAR(__pyx_doc_17cpp_process_cdist_cdist, "\n Compute distance/similarity between each pair of the two collections of inputs.\n\n Parameters\n ----------\n queries : Collection[Sequence[Hashable]]\n list of all strings the queries\n choices : Collection[Sequence[Hashable]]\n list of all strings the query should be compared\n scorer : Callable, optional\n Optional callable that is used to calculate the matching score between\n the query and each choice. This can be any of the scorers included in RapidFuzz\n (both scorers that calculate the edit distance or the normalized edit distance).\n Custom functions are not supported so far!\n fuzz.ratio is used by default.\n processor : Callable, optional\n Optional callable that is used to preprocess the strings before\n comparing them. When processor is True ``utils.default_process``\n is used. Default is None, which deactivates this behaviour.\n score_cutoff : Any, optional\n Optional argument for a score threshold. When an edit distance is used this represents the maximum\n edit distance and matches with a `distance <= score_cutoff` are inserted as -1. When a\n normalized edit distance is used this represents the minimal similarity\n and matches with a `similarity >= score_cutoff` are inserted as 0.\n Default is None, which deactivates this behaviour.\n dtype : data-type, optional\n The desired data-type for the result array. Depending on the scorer type the following\n dtypes are supported:\n - similarity: np.uint8, np.float32, np.float64\n - distance: np.int8, np.int16, np.int32, np.int64\n If not given, then the type will be np.uint8 for similarities and np.int32 for distances.\n workers : int, optional\n The calculation is subdivided into workers sections and evaluated in parallel.\n Supply -1 to use all available CPU cores.\n This argument is only available for scorers whi""ch are part of rapidfuzz. For custom\n scorers this has not effect.\n **kwargs : Any, optional\n any other named parameters are passed to the scorer. This can be used to pass\n e.g. weights to string_metric.levenshtein\n\n Returns\n -------\n ndarray\n Returns a matrix of dtype with the distance/similarity between each pair\n of the two collections of inputs.\n ");
9264 static PyMethodDef __pyx_mdef_17cpp_process_cdist_1cdist = {"cdist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_process_cdist_1cdist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_process_cdist_cdist};
__pyx_pw_17cpp_process_cdist_1cdist(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)9265 static PyObject *__pyx_pw_17cpp_process_cdist_1cdist(PyObject *__pyx_self,
9266 #if CYTHON_METH_FASTCALL
9267 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9268 #else
9269 PyObject *__pyx_args, PyObject *__pyx_kwds
9270 #endif
9271 ) {
9272 PyObject *__pyx_v_queries = 0;
9273 PyObject *__pyx_v_choices = 0;
9274 PyObject *__pyx_v_scorer = 0;
9275 PyObject *__pyx_v_processor = 0;
9276 PyObject *__pyx_v_score_cutoff = 0;
9277 PyObject *__pyx_v_dtype = 0;
9278 PyObject *__pyx_v_workers = 0;
9279 PyObject *__pyx_v_kwargs = 0;
9280 #if !CYTHON_METH_FASTCALL
9281 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
9282 #endif
9283 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
9284 int __pyx_lineno = 0;
9285 const char *__pyx_filename = NULL;
9286 int __pyx_clineno = 0;
9287 PyObject *__pyx_r = 0;
9288 __Pyx_RefNannyDeclarations
9289 __Pyx_RefNannySetupContext("cdist (wrapper)", 0);
9290 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
9291 __Pyx_GOTREF(__pyx_v_kwargs);
9292 {
9293 #if CYTHON_USE_MODULE_STATE
9294 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_queries,&__pyx_n_s_choices,&__pyx_n_s_scorer,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,&__pyx_n_s_dtype,&__pyx_n_s_workers,0};
9295 #else
9296 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_queries,&__pyx_n_s_choices,&__pyx_n_s_scorer,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,&__pyx_n_s_dtype,&__pyx_n_s_workers,0};
9297 #endif
9298 PyObject* values[7] = {0,0,0,0,0,0,0};
9299 __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
9300 values[2] = __pyx_dynamic_args->__pyx_arg_scorer;
9301 values[3] = ((PyObject *)((PyObject *)Py_None));
9302 values[4] = ((PyObject *)((PyObject *)Py_None));
9303 values[5] = ((PyObject *)((PyObject *)Py_None));
9304 values[6] = ((PyObject *)((PyObject *)__pyx_int_1));
9305 if (__pyx_kwds) {
9306 Py_ssize_t kw_args;
9307 switch (__pyx_nargs) {
9308 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
9309 CYTHON_FALLTHROUGH;
9310 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9311 CYTHON_FALLTHROUGH;
9312 case 0: break;
9313 default: goto __pyx_L5_argtuple_error;
9314 }
9315 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
9316 switch (__pyx_nargs) {
9317 case 0:
9318 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_queries)) != 0)) kw_args--;
9319 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L3_error)
9320 else goto __pyx_L5_argtuple_error;
9321 CYTHON_FALLTHROUGH;
9322 case 1:
9323 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_choices)) != 0)) kw_args--;
9324 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L3_error)
9325 else {
9326 __Pyx_RaiseArgtupleInvalid("cdist", 1, 2, 2, 1); __PYX_ERR(0, 524, __pyx_L3_error)
9327 }
9328 }
9329 if (kw_args > 0 && (kw_args <= 5)) {
9330 Py_ssize_t index;
9331 for (index = 2; index < 7 && kw_args > 0; index++) {
9332 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
9333 if (value) { values[index] = value; kw_args--; }
9334 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L3_error)
9335 }
9336 }
9337 if (unlikely(kw_args > 0)) {
9338 const Py_ssize_t kwd_pos_args = __pyx_nargs;
9339 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "cdist") < 0)) __PYX_ERR(0, 524, __pyx_L3_error)
9340 }
9341 } else if (unlikely(__pyx_nargs != 2)) {
9342 goto __pyx_L5_argtuple_error;
9343 } else {
9344 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9345 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
9346 }
9347 __pyx_v_queries = values[0];
9348 __pyx_v_choices = values[1];
9349 __pyx_v_scorer = values[2];
9350 __pyx_v_processor = values[3];
9351 __pyx_v_score_cutoff = values[4];
9352 __pyx_v_dtype = values[5];
9353 __pyx_v_workers = values[6];
9354 }
9355 goto __pyx_L4_argument_unpacking_done;
9356 __pyx_L5_argtuple_error:;
9357 __Pyx_RaiseArgtupleInvalid("cdist", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 524, __pyx_L3_error)
9358 __pyx_L3_error:;
9359 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
9360 __Pyx_AddTraceback("cpp_process_cdist.cdist", __pyx_clineno, __pyx_lineno, __pyx_filename);
9361 __Pyx_RefNannyFinishContext();
9362 return NULL;
9363 __pyx_L4_argument_unpacking_done:;
9364 __pyx_r = __pyx_pf_17cpp_process_cdist_cdist(__pyx_self, __pyx_v_queries, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs);
9365
9366 /* function exit code */
9367 __Pyx_DECREF(__pyx_v_kwargs);
9368 __Pyx_RefNannyFinishContext();
9369 return __pyx_r;
9370 }
9371
__pyx_pf_17cpp_process_cdist_cdist(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_queries,PyObject * __pyx_v_choices,PyObject * __pyx_v_scorer,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff,PyObject * __pyx_v_dtype,PyObject * __pyx_v_workers,PyObject * __pyx_v_kwargs)9372 static PyObject *__pyx_pf_17cpp_process_cdist_cdist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_queries, PyObject *__pyx_v_choices, PyObject *__pyx_v_scorer, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff, PyObject *__pyx_v_dtype, PyObject *__pyx_v_workers, PyObject *__pyx_v_kwargs) {
9373 PyObject *__pyx_r = NULL;
9374 __Pyx_TraceDeclarations
9375 __Pyx_RefNannyDeclarations
9376 int __pyx_t_1;
9377 int __pyx_t_2;
9378 PyObject *__pyx_t_3 = NULL;
9379 int __pyx_lineno = 0;
9380 const char *__pyx_filename = NULL;
9381 int __pyx_clineno = 0;
9382 __Pyx_TraceFrameInit(__pyx_codeobj__5)
9383 __Pyx_RefNannySetupContext("cdist", 0);
9384 __Pyx_TraceCall("cdist", __pyx_f[0], 524, 0, __PYX_ERR(0, 524, __pyx_L1_error));
9385
9386 /* "cpp_process_cdist.pyx":571
9387 * of the two collections of inputs.
9388 * """
9389 * if queries is choices: # <<<<<<<<<<<<<<
9390 * return cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, kwargs)
9391 * else:
9392 */
9393 __Pyx_TraceLine(571,0,__PYX_ERR(0, 571, __pyx_L1_error))
9394 __pyx_t_1 = (__pyx_v_queries == __pyx_v_choices);
9395 __pyx_t_2 = (__pyx_t_1 != 0);
9396 if (__pyx_t_2) {
9397
9398 /* "cpp_process_cdist.pyx":572
9399 * """
9400 * if queries is choices:
9401 * return cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, kwargs) # <<<<<<<<<<<<<<
9402 * else:
9403 * return cdist_two_lists(queries, choices, scorer, processor, score_cutoff, dtype, workers, kwargs)
9404 */
9405 __Pyx_TraceLine(572,0,__PYX_ERR(0, 572, __pyx_L1_error))
9406 __Pyx_XDECREF(__pyx_r);
9407 __pyx_t_3 = __pyx_f_17cpp_process_cdist_cdist_single_list(__pyx_v_queries, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error)
9408 __Pyx_GOTREF(__pyx_t_3);
9409 __pyx_r = __pyx_t_3;
9410 __pyx_t_3 = 0;
9411 goto __pyx_L0;
9412
9413 /* "cpp_process_cdist.pyx":571
9414 * of the two collections of inputs.
9415 * """
9416 * if queries is choices: # <<<<<<<<<<<<<<
9417 * return cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, kwargs)
9418 * else:
9419 */
9420 }
9421
9422 /* "cpp_process_cdist.pyx":574
9423 * return cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, kwargs)
9424 * else:
9425 * return cdist_two_lists(queries, choices, scorer, processor, score_cutoff, dtype, workers, kwargs) # <<<<<<<<<<<<<<
9426 */
9427 __Pyx_TraceLine(574,0,__PYX_ERR(0, 574, __pyx_L1_error))
9428 /*else*/ {
9429 __Pyx_XDECREF(__pyx_r);
9430 __pyx_t_3 = __pyx_f_17cpp_process_cdist_cdist_two_lists(__pyx_v_queries, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_dtype, __pyx_v_workers, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
9431 __Pyx_GOTREF(__pyx_t_3);
9432 __pyx_r = __pyx_t_3;
9433 __pyx_t_3 = 0;
9434 goto __pyx_L0;
9435 }
9436
9437 /* "cpp_process_cdist.pyx":524
9438 * Py_DECREF(<object>item)
9439 *
9440 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs): # <<<<<<<<<<<<<<
9441 * """
9442 * Compute distance/similarity between each pair of the two collections of inputs.
9443 */
9444
9445 /* function exit code */
9446 __pyx_L1_error:;
9447 __Pyx_XDECREF(__pyx_t_3);
9448 __Pyx_AddTraceback("cpp_process_cdist.cdist", __pyx_clineno, __pyx_lineno, __pyx_filename);
9449 __pyx_r = NULL;
9450 __pyx_L0:;
9451 __Pyx_XGIVEREF(__pyx_r);
9452 __Pyx_TraceReturn(__pyx_r, 0);
9453 __Pyx_RefNannyFinishContext();
9454 return __pyx_r;
9455 }
9456
9457 /* "cpp_common.pxd":24
9458 * proc_string default_process_func(proc_string sentence) except +
9459 *
9460 * cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
9461 * # TODO on Cpython this does not require any copies
9462 * cdef proc_string s_proc
9463 */
9464
__pyx_f_10cpp_common_hash_array(PyObject * __pyx_v_arr)9465 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx_v_arr) {
9466 proc_string __pyx_v_s_proc;
9467 Py_UCS4 __pyx_v_typecode;
9468 size_t __pyx_v_i;
9469 CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
9470 proc_string __pyx_r;
9471 __Pyx_RefNannyDeclarations
9472 PyObject *__pyx_t_1 = NULL;
9473 Py_UCS4 __pyx_t_2;
9474 Py_ssize_t __pyx_t_3;
9475 int __pyx_t_4;
9476 PyObject *__pyx_t_5 = NULL;
9477 PyObject *__pyx_t_6 = NULL;
9478 PyObject *__pyx_t_7 = NULL;
9479 size_t __pyx_t_8;
9480 size_t __pyx_t_9;
9481 size_t __pyx_t_10;
9482 uint64_t __pyx_t_11;
9483 Py_hash_t __pyx_t_12;
9484 int __pyx_t_13;
9485 PyObject *__pyx_t_14 = NULL;
9486 PyObject *__pyx_t_15 = NULL;
9487 int __pyx_t_16;
9488 char const *__pyx_t_17;
9489 PyObject *__pyx_t_18 = NULL;
9490 PyObject *__pyx_t_19 = NULL;
9491 PyObject *__pyx_t_20 = NULL;
9492 PyObject *__pyx_t_21 = NULL;
9493 PyObject *__pyx_t_22 = NULL;
9494 PyObject *__pyx_t_23 = NULL;
9495 int __pyx_lineno = 0;
9496 const char *__pyx_filename = NULL;
9497 int __pyx_clineno = 0;
9498 __Pyx_RefNannySetupContext("hash_array", 0);
9499
9500 /* "cpp_common.pxd":27
9501 * # TODO on Cpython this does not require any copies
9502 * cdef proc_string s_proc
9503 * cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode # <<<<<<<<<<<<<<
9504 * s_proc.length = <size_t>len(arr)
9505 *
9506 */
9507 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 27, __pyx_L1_error)
9508 __Pyx_GOTREF(__pyx_t_1);
9509 __pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 27, __pyx_L1_error)
9510 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9511 __pyx_v_typecode = ((Py_UCS4)__pyx_t_2);
9512
9513 /* "cpp_common.pxd":28
9514 * cdef proc_string s_proc
9515 * cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode
9516 * s_proc.length = <size_t>len(arr) # <<<<<<<<<<<<<<
9517 *
9518 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
9519 */
9520 __pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 28, __pyx_L1_error)
9521 __pyx_v_s_proc.length = ((size_t)__pyx_t_3);
9522
9523 /* "cpp_common.pxd":30
9524 * s_proc.length = <size_t>len(arr)
9525 *
9526 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
9527 *
9528 * if s_proc.data == NULL:
9529 */
9530 __pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
9531
9532 /* "cpp_common.pxd":32
9533 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
9534 *
9535 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
9536 * raise MemoryError
9537 *
9538 */
9539 __pyx_t_4 = ((__pyx_v_s_proc.data == NULL) != 0);
9540 if (unlikely(__pyx_t_4)) {
9541
9542 /* "cpp_common.pxd":33
9543 *
9544 * if s_proc.data == NULL:
9545 * raise MemoryError # <<<<<<<<<<<<<<
9546 *
9547 * try:
9548 */
9549 PyErr_NoMemory(); __PYX_ERR(1, 33, __pyx_L1_error)
9550
9551 /* "cpp_common.pxd":32
9552 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
9553 *
9554 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
9555 * raise MemoryError
9556 *
9557 */
9558 }
9559
9560 /* "cpp_common.pxd":35
9561 * raise MemoryError
9562 *
9563 * try: # <<<<<<<<<<<<<<
9564 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
9565 * if typecode in {'b', 'B'}: # signed/unsigned char
9566 */
9567 {
9568 __Pyx_PyThreadState_declare
9569 __Pyx_PyThreadState_assign
9570 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
9571 __Pyx_XGOTREF(__pyx_t_5);
9572 __Pyx_XGOTREF(__pyx_t_6);
9573 __Pyx_XGOTREF(__pyx_t_7);
9574 /*try:*/ {
9575
9576 /* "cpp_common.pxd":37
9577 * try:
9578 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
9579 * if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
9580 * s_proc.kind = RAPIDFUZZ_UINT64
9581 * for i in range(s_proc.length):
9582 */
9583 switch (__pyx_v_typecode) {
9584 case 98:
9585 case 66:
9586
9587 /* "cpp_common.pxd":38
9588 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
9589 * if typecode in {'b', 'B'}: # signed/unsigned char
9590 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9591 * for i in range(s_proc.length):
9592 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9593 */
9594 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9595
9596 /* "cpp_common.pxd":39
9597 * if typecode in {'b', 'B'}: # signed/unsigned char
9598 * s_proc.kind = RAPIDFUZZ_UINT64
9599 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9600 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9601 * elif typecode == 'u': # 'u' wchar_t
9602 */
9603 __pyx_t_8 = __pyx_v_s_proc.length;
9604 __pyx_t_9 = __pyx_t_8;
9605 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9606 __pyx_v_i = __pyx_t_10;
9607
9608 /* "cpp_common.pxd":40
9609 * s_proc.kind = RAPIDFUZZ_UINT64
9610 * for i in range(s_proc.length):
9611 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
9612 * elif typecode == 'u': # 'u' wchar_t
9613 * s_proc.kind = RAPIDFUZZ_UINT64
9614 */
9615 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L4_error)
9616 __Pyx_GOTREF(__pyx_t_1);
9617 __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L4_error)
9618 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9619 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
9620 }
9621
9622 /* "cpp_common.pxd":37
9623 * try:
9624 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
9625 * if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
9626 * s_proc.kind = RAPIDFUZZ_UINT64
9627 * for i in range(s_proc.length):
9628 */
9629 break;
9630 case 0x75:
9631
9632 /* "cpp_common.pxd":42
9633 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9634 * elif typecode == 'u': # 'u' wchar_t
9635 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9636 * for i in range(s_proc.length):
9637 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
9638 */
9639 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9640
9641 /* "cpp_common.pxd":43
9642 * elif typecode == 'u': # 'u' wchar_t
9643 * s_proc.kind = RAPIDFUZZ_UINT64
9644 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9645 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
9646 * elif typecode in {'h', 'H'}: # signed/unsigned short
9647 */
9648 __pyx_t_8 = __pyx_v_s_proc.length;
9649 __pyx_t_9 = __pyx_t_8;
9650 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9651 __pyx_v_i = __pyx_t_10;
9652
9653 /* "cpp_common.pxd":44
9654 * s_proc.kind = RAPIDFUZZ_UINT64
9655 * for i in range(s_proc.length):
9656 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i] # <<<<<<<<<<<<<<
9657 * elif typecode in {'h', 'H'}: # signed/unsigned short
9658 * s_proc.kind = RAPIDFUZZ_UINT64
9659 */
9660 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L4_error)
9661 __Pyx_GOTREF(__pyx_t_1);
9662 __pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 44, __pyx_L4_error)
9663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9664 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_2));
9665 }
9666
9667 /* "cpp_common.pxd":41
9668 * for i in range(s_proc.length):
9669 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9670 * elif typecode == 'u': # 'u' wchar_t # <<<<<<<<<<<<<<
9671 * s_proc.kind = RAPIDFUZZ_UINT64
9672 * for i in range(s_proc.length):
9673 */
9674 break;
9675 case 0x68:
9676
9677 /* "cpp_common.pxd":45
9678 * for i in range(s_proc.length):
9679 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
9680 * elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
9681 * s_proc.kind = RAPIDFUZZ_UINT64
9682 * for i in range(s_proc.length):
9683 */
9684 case 72:
9685
9686 /* "cpp_common.pxd":46
9687 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
9688 * elif typecode in {'h', 'H'}: # signed/unsigned short
9689 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9690 * for i in range(s_proc.length):
9691 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9692 */
9693 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9694
9695 /* "cpp_common.pxd":47
9696 * elif typecode in {'h', 'H'}: # signed/unsigned short
9697 * s_proc.kind = RAPIDFUZZ_UINT64
9698 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9699 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9700 * elif typecode in {'i', 'I'}: # signed/unsigned int
9701 */
9702 __pyx_t_8 = __pyx_v_s_proc.length;
9703 __pyx_t_9 = __pyx_t_8;
9704 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9705 __pyx_v_i = __pyx_t_10;
9706
9707 /* "cpp_common.pxd":48
9708 * s_proc.kind = RAPIDFUZZ_UINT64
9709 * for i in range(s_proc.length):
9710 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
9711 * elif typecode in {'i', 'I'}: # signed/unsigned int
9712 * s_proc.kind = RAPIDFUZZ_UINT64
9713 */
9714 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L4_error)
9715 __Pyx_GOTREF(__pyx_t_1);
9716 __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L4_error)
9717 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9718 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
9719 }
9720
9721 /* "cpp_common.pxd":45
9722 * for i in range(s_proc.length):
9723 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
9724 * elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
9725 * s_proc.kind = RAPIDFUZZ_UINT64
9726 * for i in range(s_proc.length):
9727 */
9728 break;
9729 case 0x69:
9730
9731 /* "cpp_common.pxd":49
9732 * for i in range(s_proc.length):
9733 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9734 * elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
9735 * s_proc.kind = RAPIDFUZZ_UINT64
9736 * for i in range(s_proc.length):
9737 */
9738 case 73:
9739
9740 /* "cpp_common.pxd":50
9741 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9742 * elif typecode in {'i', 'I'}: # signed/unsigned int
9743 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9744 * for i in range(s_proc.length):
9745 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9746 */
9747 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9748
9749 /* "cpp_common.pxd":51
9750 * elif typecode in {'i', 'I'}: # signed/unsigned int
9751 * s_proc.kind = RAPIDFUZZ_UINT64
9752 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9753 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9754 * elif typecode in {'l', 'L'}: # signed/unsigned long
9755 */
9756 __pyx_t_8 = __pyx_v_s_proc.length;
9757 __pyx_t_9 = __pyx_t_8;
9758 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9759 __pyx_v_i = __pyx_t_10;
9760
9761 /* "cpp_common.pxd":52
9762 * s_proc.kind = RAPIDFUZZ_UINT64
9763 * for i in range(s_proc.length):
9764 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
9765 * elif typecode in {'l', 'L'}: # signed/unsigned long
9766 * s_proc.kind = RAPIDFUZZ_UINT64
9767 */
9768 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L4_error)
9769 __Pyx_GOTREF(__pyx_t_1);
9770 __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 52, __pyx_L4_error)
9771 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9772 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
9773 }
9774
9775 /* "cpp_common.pxd":49
9776 * for i in range(s_proc.length):
9777 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9778 * elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
9779 * s_proc.kind = RAPIDFUZZ_UINT64
9780 * for i in range(s_proc.length):
9781 */
9782 break;
9783 case 0x6C:
9784
9785 /* "cpp_common.pxd":53
9786 * for i in range(s_proc.length):
9787 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9788 * elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
9789 * s_proc.kind = RAPIDFUZZ_UINT64
9790 * for i in range(s_proc.length):
9791 */
9792 case 76:
9793
9794 /* "cpp_common.pxd":54
9795 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9796 * elif typecode in {'l', 'L'}: # signed/unsigned long
9797 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9798 * for i in range(s_proc.length):
9799 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9800 */
9801 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9802
9803 /* "cpp_common.pxd":55
9804 * elif typecode in {'l', 'L'}: # signed/unsigned long
9805 * s_proc.kind = RAPIDFUZZ_UINT64
9806 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9807 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9808 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
9809 */
9810 __pyx_t_8 = __pyx_v_s_proc.length;
9811 __pyx_t_9 = __pyx_t_8;
9812 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9813 __pyx_v_i = __pyx_t_10;
9814
9815 /* "cpp_common.pxd":56
9816 * s_proc.kind = RAPIDFUZZ_UINT64
9817 * for i in range(s_proc.length):
9818 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
9819 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
9820 * s_proc.kind = RAPIDFUZZ_UINT64
9821 */
9822 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L4_error)
9823 __Pyx_GOTREF(__pyx_t_1);
9824 __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 56, __pyx_L4_error)
9825 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9826 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
9827 }
9828
9829 /* "cpp_common.pxd":53
9830 * for i in range(s_proc.length):
9831 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9832 * elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
9833 * s_proc.kind = RAPIDFUZZ_UINT64
9834 * for i in range(s_proc.length):
9835 */
9836 break;
9837 case 0x71:
9838
9839 /* "cpp_common.pxd":57
9840 * for i in range(s_proc.length):
9841 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9842 * elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
9843 * s_proc.kind = RAPIDFUZZ_UINT64
9844 * for i in range(s_proc.length):
9845 */
9846 case 81:
9847
9848 /* "cpp_common.pxd":58
9849 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9850 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
9851 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9852 * for i in range(s_proc.length):
9853 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9854 */
9855 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9856
9857 /* "cpp_common.pxd":59
9858 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
9859 * s_proc.kind = RAPIDFUZZ_UINT64
9860 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9861 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9862 * else: # float/double are hashed
9863 */
9864 __pyx_t_8 = __pyx_v_s_proc.length;
9865 __pyx_t_9 = __pyx_t_8;
9866 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9867 __pyx_v_i = __pyx_t_10;
9868
9869 /* "cpp_common.pxd":60
9870 * s_proc.kind = RAPIDFUZZ_UINT64
9871 * for i in range(s_proc.length):
9872 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
9873 * else: # float/double are hashed
9874 * s_proc.kind = RAPIDFUZZ_UINT64
9875 */
9876 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 60, __pyx_L4_error)
9877 __Pyx_GOTREF(__pyx_t_1);
9878 __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L4_error)
9879 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9880 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
9881 }
9882
9883 /* "cpp_common.pxd":57
9884 * for i in range(s_proc.length):
9885 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9886 * elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
9887 * s_proc.kind = RAPIDFUZZ_UINT64
9888 * for i in range(s_proc.length):
9889 */
9890 break;
9891 default:
9892
9893 /* "cpp_common.pxd":62
9894 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
9895 * else: # float/double are hashed
9896 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
9897 * for i in range(s_proc.length):
9898 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
9899 */
9900 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
9901
9902 /* "cpp_common.pxd":63
9903 * else: # float/double are hashed
9904 * s_proc.kind = RAPIDFUZZ_UINT64
9905 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
9906 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
9907 * except Exception as e:
9908 */
9909 __pyx_t_8 = __pyx_v_s_proc.length;
9910 __pyx_t_9 = __pyx_t_8;
9911 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
9912 __pyx_v_i = __pyx_t_10;
9913
9914 /* "cpp_common.pxd":64
9915 * s_proc.kind = RAPIDFUZZ_UINT64
9916 * for i in range(s_proc.length):
9917 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i]) # <<<<<<<<<<<<<<
9918 * except Exception as e:
9919 * free(s_proc.data)
9920 */
9921 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L4_error)
9922 __Pyx_GOTREF(__pyx_t_1);
9923 __pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 64, __pyx_L4_error)
9924 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9925 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_12);
9926 }
9927 break;
9928 }
9929
9930 /* "cpp_common.pxd":35
9931 * raise MemoryError
9932 *
9933 * try: # <<<<<<<<<<<<<<
9934 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
9935 * if typecode in {'b', 'B'}: # signed/unsigned char
9936 */
9937 }
9938 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9939 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9940 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9941 goto __pyx_L9_try_end;
9942 __pyx_L4_error:;
9943 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9944
9945 /* "cpp_common.pxd":65
9946 * for i in range(s_proc.length):
9947 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
9948 * except Exception as e: # <<<<<<<<<<<<<<
9949 * free(s_proc.data)
9950 * s_proc.data = NULL
9951 */
9952 __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
9953 if (__pyx_t_13) {
9954 __Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
9955 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 65, __pyx_L6_except_error)
9956 __Pyx_GOTREF(__pyx_t_1);
9957 __Pyx_GOTREF(__pyx_t_14);
9958 __Pyx_GOTREF(__pyx_t_15);
9959 __Pyx_INCREF(__pyx_t_14);
9960 __pyx_v_e = __pyx_t_14;
9961 /*try:*/ {
9962
9963 /* "cpp_common.pxd":66
9964 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
9965 * except Exception as e:
9966 * free(s_proc.data) # <<<<<<<<<<<<<<
9967 * s_proc.data = NULL
9968 * raise
9969 */
9970 free(__pyx_v_s_proc.data);
9971
9972 /* "cpp_common.pxd":67
9973 * except Exception as e:
9974 * free(s_proc.data)
9975 * s_proc.data = NULL # <<<<<<<<<<<<<<
9976 * raise
9977 *
9978 */
9979 __pyx_v_s_proc.data = NULL;
9980
9981 /* "cpp_common.pxd":68
9982 * free(s_proc.data)
9983 * s_proc.data = NULL
9984 * raise # <<<<<<<<<<<<<<
9985 *
9986 * s_proc.allocated = True
9987 */
9988 __Pyx_GIVEREF(__pyx_t_1);
9989 __Pyx_GIVEREF(__pyx_t_14);
9990 __Pyx_XGIVEREF(__pyx_t_15);
9991 __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_14, __pyx_t_15);
9992 __pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
9993 __PYX_ERR(1, 68, __pyx_L29_error)
9994 }
9995
9996 /* "cpp_common.pxd":65
9997 * for i in range(s_proc.length):
9998 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
9999 * except Exception as e: # <<<<<<<<<<<<<<
10000 * free(s_proc.data)
10001 * s_proc.data = NULL
10002 */
10003 /*finally:*/ {
10004 __pyx_L29_error:;
10005 /*exception exit:*/{
10006 __Pyx_PyThreadState_declare
10007 __Pyx_PyThreadState_assign
10008 __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
10009 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
10010 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
10011 __Pyx_XGOTREF(__pyx_t_18);
10012 __Pyx_XGOTREF(__pyx_t_19);
10013 __Pyx_XGOTREF(__pyx_t_20);
10014 __Pyx_XGOTREF(__pyx_t_21);
10015 __Pyx_XGOTREF(__pyx_t_22);
10016 __Pyx_XGOTREF(__pyx_t_23);
10017 __pyx_t_13 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
10018 {
10019 __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
10020 }
10021 if (PY_MAJOR_VERSION >= 3) {
10022 __Pyx_XGIVEREF(__pyx_t_21);
10023 __Pyx_XGIVEREF(__pyx_t_22);
10024 __Pyx_XGIVEREF(__pyx_t_23);
10025 __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
10026 }
10027 __Pyx_XGIVEREF(__pyx_t_18);
10028 __Pyx_XGIVEREF(__pyx_t_19);
10029 __Pyx_XGIVEREF(__pyx_t_20);
10030 __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
10031 __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
10032 __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
10033 goto __pyx_L6_except_error;
10034 }
10035 }
10036 }
10037 goto __pyx_L6_except_error;
10038 __pyx_L6_except_error:;
10039
10040 /* "cpp_common.pxd":35
10041 * raise MemoryError
10042 *
10043 * try: # <<<<<<<<<<<<<<
10044 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
10045 * if typecode in {'b', 'B'}: # signed/unsigned char
10046 */
10047 __Pyx_XGIVEREF(__pyx_t_5);
10048 __Pyx_XGIVEREF(__pyx_t_6);
10049 __Pyx_XGIVEREF(__pyx_t_7);
10050 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
10051 goto __pyx_L1_error;
10052 __pyx_L9_try_end:;
10053 }
10054
10055 /* "cpp_common.pxd":70
10056 * raise
10057 *
10058 * s_proc.allocated = True # <<<<<<<<<<<<<<
10059 * return move(s_proc)
10060 *
10061 */
10062 __pyx_v_s_proc.allocated = 1;
10063
10064 /* "cpp_common.pxd":71
10065 *
10066 * s_proc.allocated = True
10067 * return move(s_proc) # <<<<<<<<<<<<<<
10068 *
10069 *
10070 */
10071 __pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
10072 goto __pyx_L0;
10073
10074 /* "cpp_common.pxd":24
10075 * proc_string default_process_func(proc_string sentence) except +
10076 *
10077 * cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
10078 * # TODO on Cpython this does not require any copies
10079 * cdef proc_string s_proc
10080 */
10081
10082 /* function exit code */
10083 __pyx_L1_error:;
10084 __Pyx_XDECREF(__pyx_t_1);
10085 __Pyx_XDECREF(__pyx_t_14);
10086 __Pyx_XDECREF(__pyx_t_15);
10087 __Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
10088 __Pyx_pretend_to_initialize(&__pyx_r);
10089 __pyx_L0:;
10090 __Pyx_XDECREF(__pyx_v_e);
10091 __Pyx_RefNannyFinishContext();
10092 return __pyx_r;
10093 }
10094
10095 /* "cpp_common.pxd":74
10096 *
10097 *
10098 * cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
10099 * cdef proc_string s_proc
10100 * s_proc.length = <size_t>len(seq)
10101 */
10102
__pyx_f_10cpp_common_hash_sequence(PyObject * __pyx_v_seq)10103 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__pyx_v_seq) {
10104 proc_string __pyx_v_s_proc;
10105 size_t __pyx_v_i;
10106 PyObject *__pyx_v_elem = NULL;
10107 CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
10108 proc_string __pyx_r;
10109 __Pyx_RefNannyDeclarations
10110 Py_ssize_t __pyx_t_1;
10111 int __pyx_t_2;
10112 PyObject *__pyx_t_3 = NULL;
10113 PyObject *__pyx_t_4 = NULL;
10114 PyObject *__pyx_t_5 = NULL;
10115 size_t __pyx_t_6;
10116 size_t __pyx_t_7;
10117 size_t __pyx_t_8;
10118 PyObject *__pyx_t_9 = NULL;
10119 int __pyx_t_10;
10120 int __pyx_t_11;
10121 Py_UCS4 __pyx_t_12;
10122 Py_hash_t __pyx_t_13;
10123 int __pyx_t_14;
10124 PyObject *__pyx_t_15 = NULL;
10125 PyObject *__pyx_t_16 = NULL;
10126 int __pyx_t_17;
10127 char const *__pyx_t_18;
10128 PyObject *__pyx_t_19 = NULL;
10129 PyObject *__pyx_t_20 = NULL;
10130 PyObject *__pyx_t_21 = NULL;
10131 PyObject *__pyx_t_22 = NULL;
10132 PyObject *__pyx_t_23 = NULL;
10133 PyObject *__pyx_t_24 = NULL;
10134 int __pyx_lineno = 0;
10135 const char *__pyx_filename = NULL;
10136 int __pyx_clineno = 0;
10137 __Pyx_RefNannySetupContext("hash_sequence", 0);
10138
10139 /* "cpp_common.pxd":76
10140 * cdef inline proc_string hash_sequence(seq) except *:
10141 * cdef proc_string s_proc
10142 * s_proc.length = <size_t>len(seq) # <<<<<<<<<<<<<<
10143 *
10144 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
10145 */
10146 __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 76, __pyx_L1_error)
10147 __pyx_v_s_proc.length = ((size_t)__pyx_t_1);
10148
10149 /* "cpp_common.pxd":78
10150 * s_proc.length = <size_t>len(seq)
10151 *
10152 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
10153 *
10154 * if s_proc.data == NULL:
10155 */
10156 __pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
10157
10158 /* "cpp_common.pxd":80
10159 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
10160 *
10161 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
10162 * raise MemoryError
10163 *
10164 */
10165 __pyx_t_2 = ((__pyx_v_s_proc.data == NULL) != 0);
10166 if (unlikely(__pyx_t_2)) {
10167
10168 /* "cpp_common.pxd":81
10169 *
10170 * if s_proc.data == NULL:
10171 * raise MemoryError # <<<<<<<<<<<<<<
10172 *
10173 * try:
10174 */
10175 PyErr_NoMemory(); __PYX_ERR(1, 81, __pyx_L1_error)
10176
10177 /* "cpp_common.pxd":80
10178 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
10179 *
10180 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
10181 * raise MemoryError
10182 *
10183 */
10184 }
10185
10186 /* "cpp_common.pxd":83
10187 * raise MemoryError
10188 *
10189 * try: # <<<<<<<<<<<<<<
10190 * s_proc.kind = RAPIDFUZZ_UINT64
10191 * for i in range(s_proc.length):
10192 */
10193 {
10194 __Pyx_PyThreadState_declare
10195 __Pyx_PyThreadState_assign
10196 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
10197 __Pyx_XGOTREF(__pyx_t_3);
10198 __Pyx_XGOTREF(__pyx_t_4);
10199 __Pyx_XGOTREF(__pyx_t_5);
10200 /*try:*/ {
10201
10202 /* "cpp_common.pxd":84
10203 *
10204 * try:
10205 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
10206 * for i in range(s_proc.length):
10207 * elem = seq[i]
10208 */
10209 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
10210
10211 /* "cpp_common.pxd":85
10212 * try:
10213 * s_proc.kind = RAPIDFUZZ_UINT64
10214 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
10215 * elem = seq[i]
10216 * # this is required so e.g. a list of char can be compared to a string
10217 */
10218 __pyx_t_6 = __pyx_v_s_proc.length;
10219 __pyx_t_7 = __pyx_t_6;
10220 for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
10221 __pyx_v_i = __pyx_t_8;
10222
10223 /* "cpp_common.pxd":86
10224 * s_proc.kind = RAPIDFUZZ_UINT64
10225 * for i in range(s_proc.length):
10226 * elem = seq[i] # <<<<<<<<<<<<<<
10227 * # this is required so e.g. a list of char can be compared to a string
10228 * if isinstance(elem, str) and len(elem) == 1:
10229 */
10230 __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 86, __pyx_L4_error)
10231 __Pyx_GOTREF(__pyx_t_9);
10232 __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_9);
10233 __pyx_t_9 = 0;
10234
10235 /* "cpp_common.pxd":88
10236 * elem = seq[i]
10237 * # this is required so e.g. a list of char can be compared to a string
10238 * if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
10239 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
10240 * else:
10241 */
10242 __pyx_t_10 = PyUnicode_Check(__pyx_v_elem);
10243 __pyx_t_11 = (__pyx_t_10 != 0);
10244 if (__pyx_t_11) {
10245 } else {
10246 __pyx_t_2 = __pyx_t_11;
10247 goto __pyx_L13_bool_binop_done;
10248 }
10249 __pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 88, __pyx_L4_error)
10250 __pyx_t_11 = ((__pyx_t_1 == 1) != 0);
10251 __pyx_t_2 = __pyx_t_11;
10252 __pyx_L13_bool_binop_done:;
10253 if (__pyx_t_2) {
10254
10255 /* "cpp_common.pxd":89
10256 * # this is required so e.g. a list of char can be compared to a string
10257 * if isinstance(elem, str) and len(elem) == 1:
10258 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem # <<<<<<<<<<<<<<
10259 * else:
10260 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
10261 */
10262 __pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L4_error)
10263 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_12));
10264
10265 /* "cpp_common.pxd":88
10266 * elem = seq[i]
10267 * # this is required so e.g. a list of char can be compared to a string
10268 * if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
10269 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
10270 * else:
10271 */
10272 goto __pyx_L12;
10273 }
10274
10275 /* "cpp_common.pxd":91
10276 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
10277 * else:
10278 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem) # <<<<<<<<<<<<<<
10279 * except Exception as e:
10280 * free(s_proc.data)
10281 */
10282 /*else*/ {
10283 __pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 91, __pyx_L4_error)
10284 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_13);
10285 }
10286 __pyx_L12:;
10287 }
10288
10289 /* "cpp_common.pxd":83
10290 * raise MemoryError
10291 *
10292 * try: # <<<<<<<<<<<<<<
10293 * s_proc.kind = RAPIDFUZZ_UINT64
10294 * for i in range(s_proc.length):
10295 */
10296 }
10297 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10298 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10299 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10300 goto __pyx_L9_try_end;
10301 __pyx_L4_error:;
10302 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
10303
10304 /* "cpp_common.pxd":92
10305 * else:
10306 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
10307 * except Exception as e: # <<<<<<<<<<<<<<
10308 * free(s_proc.data)
10309 * s_proc.data = NULL
10310 */
10311 __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10312 if (__pyx_t_14) {
10313 __Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
10314 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 92, __pyx_L6_except_error)
10315 __Pyx_GOTREF(__pyx_t_9);
10316 __Pyx_GOTREF(__pyx_t_15);
10317 __Pyx_GOTREF(__pyx_t_16);
10318 __Pyx_INCREF(__pyx_t_15);
10319 __pyx_v_e = __pyx_t_15;
10320 /*try:*/ {
10321
10322 /* "cpp_common.pxd":93
10323 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
10324 * except Exception as e:
10325 * free(s_proc.data) # <<<<<<<<<<<<<<
10326 * s_proc.data = NULL
10327 * raise
10328 */
10329 free(__pyx_v_s_proc.data);
10330
10331 /* "cpp_common.pxd":94
10332 * except Exception as e:
10333 * free(s_proc.data)
10334 * s_proc.data = NULL # <<<<<<<<<<<<<<
10335 * raise
10336 *
10337 */
10338 __pyx_v_s_proc.data = NULL;
10339
10340 /* "cpp_common.pxd":95
10341 * free(s_proc.data)
10342 * s_proc.data = NULL
10343 * raise # <<<<<<<<<<<<<<
10344 *
10345 * s_proc.allocated = True
10346 */
10347 __Pyx_GIVEREF(__pyx_t_9);
10348 __Pyx_GIVEREF(__pyx_t_15);
10349 __Pyx_XGIVEREF(__pyx_t_16);
10350 __Pyx_ErrRestoreWithState(__pyx_t_9, __pyx_t_15, __pyx_t_16);
10351 __pyx_t_9 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
10352 __PYX_ERR(1, 95, __pyx_L20_error)
10353 }
10354
10355 /* "cpp_common.pxd":92
10356 * else:
10357 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
10358 * except Exception as e: # <<<<<<<<<<<<<<
10359 * free(s_proc.data)
10360 * s_proc.data = NULL
10361 */
10362 /*finally:*/ {
10363 __pyx_L20_error:;
10364 /*exception exit:*/{
10365 __Pyx_PyThreadState_declare
10366 __Pyx_PyThreadState_assign
10367 __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
10368 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
10369 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
10370 __Pyx_XGOTREF(__pyx_t_19);
10371 __Pyx_XGOTREF(__pyx_t_20);
10372 __Pyx_XGOTREF(__pyx_t_21);
10373 __Pyx_XGOTREF(__pyx_t_22);
10374 __Pyx_XGOTREF(__pyx_t_23);
10375 __Pyx_XGOTREF(__pyx_t_24);
10376 __pyx_t_14 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
10377 {
10378 __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
10379 }
10380 if (PY_MAJOR_VERSION >= 3) {
10381 __Pyx_XGIVEREF(__pyx_t_22);
10382 __Pyx_XGIVEREF(__pyx_t_23);
10383 __Pyx_XGIVEREF(__pyx_t_24);
10384 __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
10385 }
10386 __Pyx_XGIVEREF(__pyx_t_19);
10387 __Pyx_XGIVEREF(__pyx_t_20);
10388 __Pyx_XGIVEREF(__pyx_t_21);
10389 __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
10390 __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
10391 __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
10392 goto __pyx_L6_except_error;
10393 }
10394 }
10395 }
10396 goto __pyx_L6_except_error;
10397 __pyx_L6_except_error:;
10398
10399 /* "cpp_common.pxd":83
10400 * raise MemoryError
10401 *
10402 * try: # <<<<<<<<<<<<<<
10403 * s_proc.kind = RAPIDFUZZ_UINT64
10404 * for i in range(s_proc.length):
10405 */
10406 __Pyx_XGIVEREF(__pyx_t_3);
10407 __Pyx_XGIVEREF(__pyx_t_4);
10408 __Pyx_XGIVEREF(__pyx_t_5);
10409 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10410 goto __pyx_L1_error;
10411 __pyx_L9_try_end:;
10412 }
10413
10414 /* "cpp_common.pxd":97
10415 * raise
10416 *
10417 * s_proc.allocated = True # <<<<<<<<<<<<<<
10418 * return move(s_proc)
10419 */
10420 __pyx_v_s_proc.allocated = 1;
10421
10422 /* "cpp_common.pxd":98
10423 *
10424 * s_proc.allocated = True
10425 * return move(s_proc) # <<<<<<<<<<<<<<
10426 */
10427 __pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
10428 goto __pyx_L0;
10429
10430 /* "cpp_common.pxd":74
10431 *
10432 *
10433 * cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
10434 * cdef proc_string s_proc
10435 * s_proc.length = <size_t>len(seq)
10436 */
10437
10438 /* function exit code */
10439 __pyx_L1_error:;
10440 __Pyx_XDECREF(__pyx_t_9);
10441 __Pyx_XDECREF(__pyx_t_15);
10442 __Pyx_XDECREF(__pyx_t_16);
10443 __Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
10444 __Pyx_pretend_to_initialize(&__pyx_r);
10445 __pyx_L0:;
10446 __Pyx_XDECREF(__pyx_v_elem);
10447 __Pyx_XDECREF(__pyx_v_e);
10448 __Pyx_RefNannyFinishContext();
10449 return __pyx_r;
10450 }
10451
10452 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":246
10453 *
10454 * @property
10455 * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<<
10456 * """Returns a borrowed reference to the object owning the data/memory.
10457 * """
10458 */
10459
__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject * __pyx_v_self)10460 static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) {
10461 PyObject *__pyx_r;
10462
10463 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":249
10464 * """Returns a borrowed reference to the object owning the data/memory.
10465 * """
10466 * return PyArray_BASE(self) # <<<<<<<<<<<<<<
10467 *
10468 * @property
10469 */
10470 __pyx_r = PyArray_BASE(__pyx_v_self);
10471 goto __pyx_L0;
10472
10473 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":246
10474 *
10475 * @property
10476 * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<<
10477 * """Returns a borrowed reference to the object owning the data/memory.
10478 * """
10479 */
10480
10481 /* function exit code */
10482 __pyx_L0:;
10483 return __pyx_r;
10484 }
10485
10486 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":252
10487 *
10488 * @property
10489 * cdef inline dtype descr(self): # <<<<<<<<<<<<<<
10490 * """Returns an owned reference to the dtype of the array.
10491 * """
10492 */
10493
__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject * __pyx_v_self)10494 static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) {
10495 PyArray_Descr *__pyx_r = NULL;
10496 __Pyx_RefNannyDeclarations
10497 PyArray_Descr *__pyx_t_1;
10498 __Pyx_RefNannySetupContext("descr", 0);
10499
10500 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":255
10501 * """Returns an owned reference to the dtype of the array.
10502 * """
10503 * return <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
10504 *
10505 * @property
10506 */
10507 __Pyx_XDECREF((PyObject *)__pyx_r);
10508 __pyx_t_1 = PyArray_DESCR(__pyx_v_self);
10509 __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1));
10510 __pyx_r = ((PyArray_Descr *)__pyx_t_1);
10511 goto __pyx_L0;
10512
10513 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":252
10514 *
10515 * @property
10516 * cdef inline dtype descr(self): # <<<<<<<<<<<<<<
10517 * """Returns an owned reference to the dtype of the array.
10518 * """
10519 */
10520
10521 /* function exit code */
10522 __pyx_L0:;
10523 __Pyx_XGIVEREF((PyObject *)__pyx_r);
10524 __Pyx_RefNannyFinishContext();
10525 return __pyx_r;
10526 }
10527
10528 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":258
10529 *
10530 * @property
10531 * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<<
10532 * """Returns the number of dimensions in the array.
10533 * """
10534 */
10535
__pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject * __pyx_v_self)10536 static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) {
10537 int __pyx_r;
10538
10539 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":261
10540 * """Returns the number of dimensions in the array.
10541 * """
10542 * return PyArray_NDIM(self) # <<<<<<<<<<<<<<
10543 *
10544 * @property
10545 */
10546 __pyx_r = PyArray_NDIM(__pyx_v_self);
10547 goto __pyx_L0;
10548
10549 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":258
10550 *
10551 * @property
10552 * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<<
10553 * """Returns the number of dimensions in the array.
10554 * """
10555 */
10556
10557 /* function exit code */
10558 __pyx_L0:;
10559 return __pyx_r;
10560 }
10561
10562 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":264
10563 *
10564 * @property
10565 * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<<
10566 * """Returns a pointer to the dimensions/shape of the array.
10567 * The number of elements matches the number of dimensions of the array (ndim).
10568 */
10569
__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject * __pyx_v_self)10570 static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) {
10571 npy_intp *__pyx_r;
10572
10573 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":269
10574 * Can return NULL for 0-dimensional arrays.
10575 * """
10576 * return PyArray_DIMS(self) # <<<<<<<<<<<<<<
10577 *
10578 * @property
10579 */
10580 __pyx_r = PyArray_DIMS(__pyx_v_self);
10581 goto __pyx_L0;
10582
10583 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":264
10584 *
10585 * @property
10586 * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<<
10587 * """Returns a pointer to the dimensions/shape of the array.
10588 * The number of elements matches the number of dimensions of the array (ndim).
10589 */
10590
10591 /* function exit code */
10592 __pyx_L0:;
10593 return __pyx_r;
10594 }
10595
10596 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":272
10597 *
10598 * @property
10599 * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<<
10600 * """Returns a pointer to the strides of the array.
10601 * The number of elements matches the number of dimensions of the array (ndim).
10602 */
10603
__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject * __pyx_v_self)10604 static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) {
10605 npy_intp *__pyx_r;
10606
10607 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":276
10608 * The number of elements matches the number of dimensions of the array (ndim).
10609 * """
10610 * return PyArray_STRIDES(self) # <<<<<<<<<<<<<<
10611 *
10612 * @property
10613 */
10614 __pyx_r = PyArray_STRIDES(__pyx_v_self);
10615 goto __pyx_L0;
10616
10617 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":272
10618 *
10619 * @property
10620 * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<<
10621 * """Returns a pointer to the strides of the array.
10622 * The number of elements matches the number of dimensions of the array (ndim).
10623 */
10624
10625 /* function exit code */
10626 __pyx_L0:;
10627 return __pyx_r;
10628 }
10629
10630 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":279
10631 *
10632 * @property
10633 * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<<
10634 * """Returns the total size (in number of elements) of the array.
10635 * """
10636 */
10637
__pyx_f_5numpy_7ndarray_4size_size(PyArrayObject * __pyx_v_self)10638 static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) {
10639 npy_intp __pyx_r;
10640
10641 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":282
10642 * """Returns the total size (in number of elements) of the array.
10643 * """
10644 * return PyArray_SIZE(self) # <<<<<<<<<<<<<<
10645 *
10646 * @property
10647 */
10648 __pyx_r = PyArray_SIZE(__pyx_v_self);
10649 goto __pyx_L0;
10650
10651 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":279
10652 *
10653 * @property
10654 * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<<
10655 * """Returns the total size (in number of elements) of the array.
10656 * """
10657 */
10658
10659 /* function exit code */
10660 __pyx_L0:;
10661 return __pyx_r;
10662 }
10663
10664 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":285
10665 *
10666 * @property
10667 * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<<
10668 * """The pointer to the data buffer as a char*.
10669 * This is provided for legacy reasons to avoid direct struct field access.
10670 */
10671
__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject * __pyx_v_self)10672 static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) {
10673 char *__pyx_r;
10674
10675 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":291
10676 * of `PyArray_DATA()` instead, which returns a 'void*'.
10677 * """
10678 * return PyArray_BYTES(self) # <<<<<<<<<<<<<<
10679 *
10680 * ctypedef unsigned char npy_bool
10681 */
10682 __pyx_r = PyArray_BYTES(__pyx_v_self);
10683 goto __pyx_L0;
10684
10685 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":285
10686 *
10687 * @property
10688 * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<<
10689 * """The pointer to the data buffer as a char*.
10690 * This is provided for legacy reasons to avoid direct struct field access.
10691 */
10692
10693 /* function exit code */
10694 __pyx_L0:;
10695 return __pyx_r;
10696 }
10697
10698 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":777
10699 * ctypedef npy_cdouble complex_t
10700 *
10701 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
10702 * return PyArray_MultiIterNew(1, <void*>a)
10703 *
10704 */
10705
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)10706 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
10707 PyObject *__pyx_r = NULL;
10708 __Pyx_RefNannyDeclarations
10709 PyObject *__pyx_t_1 = NULL;
10710 int __pyx_lineno = 0;
10711 const char *__pyx_filename = NULL;
10712 int __pyx_clineno = 0;
10713 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
10714
10715 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":778
10716 *
10717 * cdef inline object PyArray_MultiIterNew1(a):
10718 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
10719 *
10720 * cdef inline object PyArray_MultiIterNew2(a, b):
10721 */
10722 __Pyx_XDECREF(__pyx_r);
10723 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 778, __pyx_L1_error)
10724 __Pyx_GOTREF(__pyx_t_1);
10725 __pyx_r = __pyx_t_1;
10726 __pyx_t_1 = 0;
10727 goto __pyx_L0;
10728
10729 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":777
10730 * ctypedef npy_cdouble complex_t
10731 *
10732 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
10733 * return PyArray_MultiIterNew(1, <void*>a)
10734 *
10735 */
10736
10737 /* function exit code */
10738 __pyx_L1_error:;
10739 __Pyx_XDECREF(__pyx_t_1);
10740 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
10741 __pyx_r = 0;
10742 __pyx_L0:;
10743 __Pyx_XGIVEREF(__pyx_r);
10744 __Pyx_RefNannyFinishContext();
10745 return __pyx_r;
10746 }
10747
10748 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":780
10749 * return PyArray_MultiIterNew(1, <void*>a)
10750 *
10751 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
10752 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
10753 *
10754 */
10755
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)10756 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
10757 PyObject *__pyx_r = NULL;
10758 __Pyx_RefNannyDeclarations
10759 PyObject *__pyx_t_1 = NULL;
10760 int __pyx_lineno = 0;
10761 const char *__pyx_filename = NULL;
10762 int __pyx_clineno = 0;
10763 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
10764
10765 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":781
10766 *
10767 * cdef inline object PyArray_MultiIterNew2(a, b):
10768 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
10769 *
10770 * cdef inline object PyArray_MultiIterNew3(a, b, c):
10771 */
10772 __Pyx_XDECREF(__pyx_r);
10773 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 781, __pyx_L1_error)
10774 __Pyx_GOTREF(__pyx_t_1);
10775 __pyx_r = __pyx_t_1;
10776 __pyx_t_1 = 0;
10777 goto __pyx_L0;
10778
10779 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":780
10780 * return PyArray_MultiIterNew(1, <void*>a)
10781 *
10782 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
10783 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
10784 *
10785 */
10786
10787 /* function exit code */
10788 __pyx_L1_error:;
10789 __Pyx_XDECREF(__pyx_t_1);
10790 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
10791 __pyx_r = 0;
10792 __pyx_L0:;
10793 __Pyx_XGIVEREF(__pyx_r);
10794 __Pyx_RefNannyFinishContext();
10795 return __pyx_r;
10796 }
10797
10798 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":783
10799 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
10800 *
10801 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
10802 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
10803 *
10804 */
10805
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)10806 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
10807 PyObject *__pyx_r = NULL;
10808 __Pyx_RefNannyDeclarations
10809 PyObject *__pyx_t_1 = NULL;
10810 int __pyx_lineno = 0;
10811 const char *__pyx_filename = NULL;
10812 int __pyx_clineno = 0;
10813 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
10814
10815 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":784
10816 *
10817 * cdef inline object PyArray_MultiIterNew3(a, b, c):
10818 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
10819 *
10820 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
10821 */
10822 __Pyx_XDECREF(__pyx_r);
10823 __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 784, __pyx_L1_error)
10824 __Pyx_GOTREF(__pyx_t_1);
10825 __pyx_r = __pyx_t_1;
10826 __pyx_t_1 = 0;
10827 goto __pyx_L0;
10828
10829 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":783
10830 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
10831 *
10832 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
10833 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
10834 *
10835 */
10836
10837 /* function exit code */
10838 __pyx_L1_error:;
10839 __Pyx_XDECREF(__pyx_t_1);
10840 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
10841 __pyx_r = 0;
10842 __pyx_L0:;
10843 __Pyx_XGIVEREF(__pyx_r);
10844 __Pyx_RefNannyFinishContext();
10845 return __pyx_r;
10846 }
10847
10848 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":786
10849 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
10850 *
10851 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
10852 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
10853 *
10854 */
10855
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)10856 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
10857 PyObject *__pyx_r = NULL;
10858 __Pyx_RefNannyDeclarations
10859 PyObject *__pyx_t_1 = NULL;
10860 int __pyx_lineno = 0;
10861 const char *__pyx_filename = NULL;
10862 int __pyx_clineno = 0;
10863 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
10864
10865 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":787
10866 *
10867 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
10868 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
10869 *
10870 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
10871 */
10872 __Pyx_XDECREF(__pyx_r);
10873 __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 787, __pyx_L1_error)
10874 __Pyx_GOTREF(__pyx_t_1);
10875 __pyx_r = __pyx_t_1;
10876 __pyx_t_1 = 0;
10877 goto __pyx_L0;
10878
10879 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":786
10880 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
10881 *
10882 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
10883 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
10884 *
10885 */
10886
10887 /* function exit code */
10888 __pyx_L1_error:;
10889 __Pyx_XDECREF(__pyx_t_1);
10890 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
10891 __pyx_r = 0;
10892 __pyx_L0:;
10893 __Pyx_XGIVEREF(__pyx_r);
10894 __Pyx_RefNannyFinishContext();
10895 return __pyx_r;
10896 }
10897
10898 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":789
10899 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
10900 *
10901 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
10902 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
10903 *
10904 */
10905
__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d,PyObject * __pyx_v_e)10906 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
10907 PyObject *__pyx_r = NULL;
10908 __Pyx_RefNannyDeclarations
10909 PyObject *__pyx_t_1 = NULL;
10910 int __pyx_lineno = 0;
10911 const char *__pyx_filename = NULL;
10912 int __pyx_clineno = 0;
10913 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
10914
10915 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":790
10916 *
10917 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
10918 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
10919 *
10920 * cdef inline tuple PyDataType_SHAPE(dtype d):
10921 */
10922 __Pyx_XDECREF(__pyx_r);
10923 __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 790, __pyx_L1_error)
10924 __Pyx_GOTREF(__pyx_t_1);
10925 __pyx_r = __pyx_t_1;
10926 __pyx_t_1 = 0;
10927 goto __pyx_L0;
10928
10929 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":789
10930 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
10931 *
10932 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
10933 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
10934 *
10935 */
10936
10937 /* function exit code */
10938 __pyx_L1_error:;
10939 __Pyx_XDECREF(__pyx_t_1);
10940 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
10941 __pyx_r = 0;
10942 __pyx_L0:;
10943 __Pyx_XGIVEREF(__pyx_r);
10944 __Pyx_RefNannyFinishContext();
10945 return __pyx_r;
10946 }
10947
10948 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":792
10949 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
10950 *
10951 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
10952 * if PyDataType_HASSUBARRAY(d):
10953 * return <tuple>d.subarray.shape
10954 */
10955
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)10956 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
10957 PyObject *__pyx_r = NULL;
10958 __Pyx_RefNannyDeclarations
10959 int __pyx_t_1;
10960 __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
10961
10962 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":793
10963 *
10964 * cdef inline tuple PyDataType_SHAPE(dtype d):
10965 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
10966 * return <tuple>d.subarray.shape
10967 * else:
10968 */
10969 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
10970 if (__pyx_t_1) {
10971
10972 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":794
10973 * cdef inline tuple PyDataType_SHAPE(dtype d):
10974 * if PyDataType_HASSUBARRAY(d):
10975 * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
10976 * else:
10977 * return ()
10978 */
10979 __Pyx_XDECREF(__pyx_r);
10980 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
10981 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
10982 goto __pyx_L0;
10983
10984 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":793
10985 *
10986 * cdef inline tuple PyDataType_SHAPE(dtype d):
10987 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
10988 * return <tuple>d.subarray.shape
10989 * else:
10990 */
10991 }
10992
10993 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":796
10994 * return <tuple>d.subarray.shape
10995 * else:
10996 * return () # <<<<<<<<<<<<<<
10997 *
10998 *
10999 */
11000 /*else*/ {
11001 __Pyx_XDECREF(__pyx_r);
11002 __Pyx_INCREF(__pyx_empty_tuple);
11003 __pyx_r = __pyx_empty_tuple;
11004 goto __pyx_L0;
11005 }
11006
11007 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":792
11008 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
11009 *
11010 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
11011 * if PyDataType_HASSUBARRAY(d):
11012 * return <tuple>d.subarray.shape
11013 */
11014
11015 /* function exit code */
11016 __pyx_L0:;
11017 __Pyx_XGIVEREF(__pyx_r);
11018 __Pyx_RefNannyFinishContext();
11019 return __pyx_r;
11020 }
11021
11022 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":973
11023 * int _import_umath() except -1
11024 *
11025 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
11026 * Py_INCREF(base) # important to do this before stealing the reference below!
11027 * PyArray_SetBaseObject(arr, base)
11028 */
11029
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)11030 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
11031 __Pyx_RefNannyDeclarations
11032 __Pyx_RefNannySetupContext("set_array_base", 0);
11033
11034 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":974
11035 *
11036 * cdef inline void set_array_base(ndarray arr, object base):
11037 * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
11038 * PyArray_SetBaseObject(arr, base)
11039 *
11040 */
11041 Py_INCREF(__pyx_v_base);
11042
11043 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":975
11044 * cdef inline void set_array_base(ndarray arr, object base):
11045 * Py_INCREF(base) # important to do this before stealing the reference below!
11046 * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
11047 *
11048 * cdef inline object get_array_base(ndarray arr):
11049 */
11050 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
11051
11052 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":973
11053 * int _import_umath() except -1
11054 *
11055 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
11056 * Py_INCREF(base) # important to do this before stealing the reference below!
11057 * PyArray_SetBaseObject(arr, base)
11058 */
11059
11060 /* function exit code */
11061 __Pyx_RefNannyFinishContext();
11062 }
11063
11064 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":977
11065 * PyArray_SetBaseObject(arr, base)
11066 *
11067 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
11068 * base = PyArray_BASE(arr)
11069 * if base is NULL:
11070 */
11071
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)11072 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
11073 PyObject *__pyx_v_base;
11074 PyObject *__pyx_r = NULL;
11075 __Pyx_RefNannyDeclarations
11076 int __pyx_t_1;
11077 __Pyx_RefNannySetupContext("get_array_base", 0);
11078
11079 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":978
11080 *
11081 * cdef inline object get_array_base(ndarray arr):
11082 * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
11083 * if base is NULL:
11084 * return None
11085 */
11086 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
11087
11088 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":979
11089 * cdef inline object get_array_base(ndarray arr):
11090 * base = PyArray_BASE(arr)
11091 * if base is NULL: # <<<<<<<<<<<<<<
11092 * return None
11093 * return <object>base
11094 */
11095 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
11096 if (__pyx_t_1) {
11097
11098 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":980
11099 * base = PyArray_BASE(arr)
11100 * if base is NULL:
11101 * return None # <<<<<<<<<<<<<<
11102 * return <object>base
11103 *
11104 */
11105 __Pyx_XDECREF(__pyx_r);
11106 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11107 goto __pyx_L0;
11108
11109 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":979
11110 * cdef inline object get_array_base(ndarray arr):
11111 * base = PyArray_BASE(arr)
11112 * if base is NULL: # <<<<<<<<<<<<<<
11113 * return None
11114 * return <object>base
11115 */
11116 }
11117
11118 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":981
11119 * if base is NULL:
11120 * return None
11121 * return <object>base # <<<<<<<<<<<<<<
11122 *
11123 * # Versions of the import_* functions which are more suitable for
11124 */
11125 __Pyx_XDECREF(__pyx_r);
11126 __Pyx_INCREF(((PyObject *)__pyx_v_base));
11127 __pyx_r = ((PyObject *)__pyx_v_base);
11128 goto __pyx_L0;
11129
11130 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":977
11131 * PyArray_SetBaseObject(arr, base)
11132 *
11133 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
11134 * base = PyArray_BASE(arr)
11135 * if base is NULL:
11136 */
11137
11138 /* function exit code */
11139 __pyx_L0:;
11140 __Pyx_XGIVEREF(__pyx_r);
11141 __Pyx_RefNannyFinishContext();
11142 return __pyx_r;
11143 }
11144
11145 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":985
11146 * # Versions of the import_* functions which are more suitable for
11147 * # Cython code.
11148 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
11149 * try:
11150 * __pyx_import_array()
11151 */
11152
__pyx_f_5numpy_import_array(void)11153 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
11154 int __pyx_r;
11155 __Pyx_RefNannyDeclarations
11156 PyObject *__pyx_t_1 = NULL;
11157 PyObject *__pyx_t_2 = NULL;
11158 PyObject *__pyx_t_3 = NULL;
11159 int __pyx_t_4;
11160 PyObject *__pyx_t_5 = NULL;
11161 PyObject *__pyx_t_6 = NULL;
11162 PyObject *__pyx_t_7 = NULL;
11163 PyObject *__pyx_t_8 = NULL;
11164 int __pyx_lineno = 0;
11165 const char *__pyx_filename = NULL;
11166 int __pyx_clineno = 0;
11167 __Pyx_RefNannySetupContext("import_array", 0);
11168
11169 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":986
11170 * # Cython code.
11171 * cdef inline int import_array() except -1:
11172 * try: # <<<<<<<<<<<<<<
11173 * __pyx_import_array()
11174 * except Exception:
11175 */
11176 {
11177 __Pyx_PyThreadState_declare
11178 __Pyx_PyThreadState_assign
11179 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
11180 __Pyx_XGOTREF(__pyx_t_1);
11181 __Pyx_XGOTREF(__pyx_t_2);
11182 __Pyx_XGOTREF(__pyx_t_3);
11183 /*try:*/ {
11184
11185 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":987
11186 * cdef inline int import_array() except -1:
11187 * try:
11188 * __pyx_import_array() # <<<<<<<<<<<<<<
11189 * except Exception:
11190 * raise ImportError("numpy.core.multiarray failed to import")
11191 */
11192 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error)
11193
11194 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":986
11195 * # Cython code.
11196 * cdef inline int import_array() except -1:
11197 * try: # <<<<<<<<<<<<<<
11198 * __pyx_import_array()
11199 * except Exception:
11200 */
11201 }
11202 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11203 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11204 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11205 goto __pyx_L8_try_end;
11206 __pyx_L3_error:;
11207
11208 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":988
11209 * try:
11210 * __pyx_import_array()
11211 * except Exception: # <<<<<<<<<<<<<<
11212 * raise ImportError("numpy.core.multiarray failed to import")
11213 *
11214 */
11215 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
11216 if (__pyx_t_4) {
11217 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
11218 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error)
11219 __Pyx_GOTREF(__pyx_t_5);
11220 __Pyx_GOTREF(__pyx_t_6);
11221 __Pyx_GOTREF(__pyx_t_7);
11222
11223 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":989
11224 * __pyx_import_array()
11225 * except Exception:
11226 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
11227 *
11228 * cdef inline int import_umath() except -1:
11229 */
11230 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error)
11231 __Pyx_GOTREF(__pyx_t_8);
11232 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
11233 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11234 __PYX_ERR(2, 989, __pyx_L5_except_error)
11235 }
11236 goto __pyx_L5_except_error;
11237 __pyx_L5_except_error:;
11238
11239 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":986
11240 * # Cython code.
11241 * cdef inline int import_array() except -1:
11242 * try: # <<<<<<<<<<<<<<
11243 * __pyx_import_array()
11244 * except Exception:
11245 */
11246 __Pyx_XGIVEREF(__pyx_t_1);
11247 __Pyx_XGIVEREF(__pyx_t_2);
11248 __Pyx_XGIVEREF(__pyx_t_3);
11249 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
11250 goto __pyx_L1_error;
11251 __pyx_L8_try_end:;
11252 }
11253
11254 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":985
11255 * # Versions of the import_* functions which are more suitable for
11256 * # Cython code.
11257 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
11258 * try:
11259 * __pyx_import_array()
11260 */
11261
11262 /* function exit code */
11263 __pyx_r = 0;
11264 goto __pyx_L0;
11265 __pyx_L1_error:;
11266 __Pyx_XDECREF(__pyx_t_5);
11267 __Pyx_XDECREF(__pyx_t_6);
11268 __Pyx_XDECREF(__pyx_t_7);
11269 __Pyx_XDECREF(__pyx_t_8);
11270 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
11271 __pyx_r = -1;
11272 __pyx_L0:;
11273 __Pyx_RefNannyFinishContext();
11274 return __pyx_r;
11275 }
11276
11277 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":991
11278 * raise ImportError("numpy.core.multiarray failed to import")
11279 *
11280 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
11281 * try:
11282 * _import_umath()
11283 */
11284
__pyx_f_5numpy_import_umath(void)11285 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
11286 int __pyx_r;
11287 __Pyx_RefNannyDeclarations
11288 PyObject *__pyx_t_1 = NULL;
11289 PyObject *__pyx_t_2 = NULL;
11290 PyObject *__pyx_t_3 = NULL;
11291 int __pyx_t_4;
11292 PyObject *__pyx_t_5 = NULL;
11293 PyObject *__pyx_t_6 = NULL;
11294 PyObject *__pyx_t_7 = NULL;
11295 PyObject *__pyx_t_8 = NULL;
11296 int __pyx_lineno = 0;
11297 const char *__pyx_filename = NULL;
11298 int __pyx_clineno = 0;
11299 __Pyx_RefNannySetupContext("import_umath", 0);
11300
11301 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":992
11302 *
11303 * cdef inline int import_umath() except -1:
11304 * try: # <<<<<<<<<<<<<<
11305 * _import_umath()
11306 * except Exception:
11307 */
11308 {
11309 __Pyx_PyThreadState_declare
11310 __Pyx_PyThreadState_assign
11311 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
11312 __Pyx_XGOTREF(__pyx_t_1);
11313 __Pyx_XGOTREF(__pyx_t_2);
11314 __Pyx_XGOTREF(__pyx_t_3);
11315 /*try:*/ {
11316
11317 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":993
11318 * cdef inline int import_umath() except -1:
11319 * try:
11320 * _import_umath() # <<<<<<<<<<<<<<
11321 * except Exception:
11322 * raise ImportError("numpy.core.umath failed to import")
11323 */
11324 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error)
11325
11326 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":992
11327 *
11328 * cdef inline int import_umath() except -1:
11329 * try: # <<<<<<<<<<<<<<
11330 * _import_umath()
11331 * except Exception:
11332 */
11333 }
11334 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11335 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11336 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11337 goto __pyx_L8_try_end;
11338 __pyx_L3_error:;
11339
11340 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":994
11341 * try:
11342 * _import_umath()
11343 * except Exception: # <<<<<<<<<<<<<<
11344 * raise ImportError("numpy.core.umath failed to import")
11345 *
11346 */
11347 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
11348 if (__pyx_t_4) {
11349 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
11350 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error)
11351 __Pyx_GOTREF(__pyx_t_5);
11352 __Pyx_GOTREF(__pyx_t_6);
11353 __Pyx_GOTREF(__pyx_t_7);
11354
11355 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":995
11356 * _import_umath()
11357 * except Exception:
11358 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
11359 *
11360 * cdef inline int import_ufunc() except -1:
11361 */
11362 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error)
11363 __Pyx_GOTREF(__pyx_t_8);
11364 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
11365 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11366 __PYX_ERR(2, 995, __pyx_L5_except_error)
11367 }
11368 goto __pyx_L5_except_error;
11369 __pyx_L5_except_error:;
11370
11371 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":992
11372 *
11373 * cdef inline int import_umath() except -1:
11374 * try: # <<<<<<<<<<<<<<
11375 * _import_umath()
11376 * except Exception:
11377 */
11378 __Pyx_XGIVEREF(__pyx_t_1);
11379 __Pyx_XGIVEREF(__pyx_t_2);
11380 __Pyx_XGIVEREF(__pyx_t_3);
11381 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
11382 goto __pyx_L1_error;
11383 __pyx_L8_try_end:;
11384 }
11385
11386 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":991
11387 * raise ImportError("numpy.core.multiarray failed to import")
11388 *
11389 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
11390 * try:
11391 * _import_umath()
11392 */
11393
11394 /* function exit code */
11395 __pyx_r = 0;
11396 goto __pyx_L0;
11397 __pyx_L1_error:;
11398 __Pyx_XDECREF(__pyx_t_5);
11399 __Pyx_XDECREF(__pyx_t_6);
11400 __Pyx_XDECREF(__pyx_t_7);
11401 __Pyx_XDECREF(__pyx_t_8);
11402 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
11403 __pyx_r = -1;
11404 __pyx_L0:;
11405 __Pyx_RefNannyFinishContext();
11406 return __pyx_r;
11407 }
11408
11409 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":997
11410 * raise ImportError("numpy.core.umath failed to import")
11411 *
11412 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
11413 * try:
11414 * _import_umath()
11415 */
11416
__pyx_f_5numpy_import_ufunc(void)11417 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
11418 int __pyx_r;
11419 __Pyx_RefNannyDeclarations
11420 PyObject *__pyx_t_1 = NULL;
11421 PyObject *__pyx_t_2 = NULL;
11422 PyObject *__pyx_t_3 = NULL;
11423 int __pyx_t_4;
11424 PyObject *__pyx_t_5 = NULL;
11425 PyObject *__pyx_t_6 = NULL;
11426 PyObject *__pyx_t_7 = NULL;
11427 PyObject *__pyx_t_8 = NULL;
11428 int __pyx_lineno = 0;
11429 const char *__pyx_filename = NULL;
11430 int __pyx_clineno = 0;
11431 __Pyx_RefNannySetupContext("import_ufunc", 0);
11432
11433 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":998
11434 *
11435 * cdef inline int import_ufunc() except -1:
11436 * try: # <<<<<<<<<<<<<<
11437 * _import_umath()
11438 * except Exception:
11439 */
11440 {
11441 __Pyx_PyThreadState_declare
11442 __Pyx_PyThreadState_assign
11443 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
11444 __Pyx_XGOTREF(__pyx_t_1);
11445 __Pyx_XGOTREF(__pyx_t_2);
11446 __Pyx_XGOTREF(__pyx_t_3);
11447 /*try:*/ {
11448
11449 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":999
11450 * cdef inline int import_ufunc() except -1:
11451 * try:
11452 * _import_umath() # <<<<<<<<<<<<<<
11453 * except Exception:
11454 * raise ImportError("numpy.core.umath failed to import")
11455 */
11456 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 999, __pyx_L3_error)
11457
11458 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":998
11459 *
11460 * cdef inline int import_ufunc() except -1:
11461 * try: # <<<<<<<<<<<<<<
11462 * _import_umath()
11463 * except Exception:
11464 */
11465 }
11466 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11467 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11468 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11469 goto __pyx_L8_try_end;
11470 __pyx_L3_error:;
11471
11472 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1000
11473 * try:
11474 * _import_umath()
11475 * except Exception: # <<<<<<<<<<<<<<
11476 * raise ImportError("numpy.core.umath failed to import")
11477 *
11478 */
11479 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
11480 if (__pyx_t_4) {
11481 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11482 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1000, __pyx_L5_except_error)
11483 __Pyx_GOTREF(__pyx_t_5);
11484 __Pyx_GOTREF(__pyx_t_6);
11485 __Pyx_GOTREF(__pyx_t_7);
11486
11487 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1001
11488 * _import_umath()
11489 * except Exception:
11490 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
11491 *
11492 *
11493 */
11494 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1001, __pyx_L5_except_error)
11495 __Pyx_GOTREF(__pyx_t_8);
11496 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
11497 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11498 __PYX_ERR(2, 1001, __pyx_L5_except_error)
11499 }
11500 goto __pyx_L5_except_error;
11501 __pyx_L5_except_error:;
11502
11503 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":998
11504 *
11505 * cdef inline int import_ufunc() except -1:
11506 * try: # <<<<<<<<<<<<<<
11507 * _import_umath()
11508 * except Exception:
11509 */
11510 __Pyx_XGIVEREF(__pyx_t_1);
11511 __Pyx_XGIVEREF(__pyx_t_2);
11512 __Pyx_XGIVEREF(__pyx_t_3);
11513 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
11514 goto __pyx_L1_error;
11515 __pyx_L8_try_end:;
11516 }
11517
11518 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":997
11519 * raise ImportError("numpy.core.umath failed to import")
11520 *
11521 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
11522 * try:
11523 * _import_umath()
11524 */
11525
11526 /* function exit code */
11527 __pyx_r = 0;
11528 goto __pyx_L0;
11529 __pyx_L1_error:;
11530 __Pyx_XDECREF(__pyx_t_5);
11531 __Pyx_XDECREF(__pyx_t_6);
11532 __Pyx_XDECREF(__pyx_t_7);
11533 __Pyx_XDECREF(__pyx_t_8);
11534 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11535 __pyx_r = -1;
11536 __pyx_L0:;
11537 __Pyx_RefNannyFinishContext();
11538 return __pyx_r;
11539 }
11540
11541 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1004
11542 *
11543 *
11544 * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
11545 * """
11546 * Cython equivalent of `isinstance(obj, np.timedelta64)`
11547 */
11548
__pyx_f_5numpy_is_timedelta64_object(PyObject * __pyx_v_obj)11549 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
11550 int __pyx_r;
11551 __Pyx_RefNannyDeclarations
11552 __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
11553
11554 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1016
11555 * bool
11556 * """
11557 * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
11558 *
11559 *
11560 */
11561 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
11562 goto __pyx_L0;
11563
11564 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1004
11565 *
11566 *
11567 * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
11568 * """
11569 * Cython equivalent of `isinstance(obj, np.timedelta64)`
11570 */
11571
11572 /* function exit code */
11573 __pyx_L0:;
11574 __Pyx_RefNannyFinishContext();
11575 return __pyx_r;
11576 }
11577
11578 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1019
11579 *
11580 *
11581 * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
11582 * """
11583 * Cython equivalent of `isinstance(obj, np.datetime64)`
11584 */
11585
__pyx_f_5numpy_is_datetime64_object(PyObject * __pyx_v_obj)11586 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
11587 int __pyx_r;
11588 __Pyx_RefNannyDeclarations
11589 __Pyx_RefNannySetupContext("is_datetime64_object", 0);
11590
11591 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1031
11592 * bool
11593 * """
11594 * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
11595 *
11596 *
11597 */
11598 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
11599 goto __pyx_L0;
11600
11601 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1019
11602 *
11603 *
11604 * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
11605 * """
11606 * Cython equivalent of `isinstance(obj, np.datetime64)`
11607 */
11608
11609 /* function exit code */
11610 __pyx_L0:;
11611 __Pyx_RefNannyFinishContext();
11612 return __pyx_r;
11613 }
11614
11615 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1034
11616 *
11617 *
11618 * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
11619 * """
11620 * returns the int64 value underlying scalar numpy datetime64 object
11621 */
11622
__pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_v_obj)11623 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
11624 npy_datetime __pyx_r;
11625
11626 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1041
11627 * also needed. That can be found using `get_datetime64_unit`.
11628 * """
11629 * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
11630 *
11631 *
11632 */
11633 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
11634 goto __pyx_L0;
11635
11636 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1034
11637 *
11638 *
11639 * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
11640 * """
11641 * returns the int64 value underlying scalar numpy datetime64 object
11642 */
11643
11644 /* function exit code */
11645 __pyx_L0:;
11646 return __pyx_r;
11647 }
11648
11649 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1044
11650 *
11651 *
11652 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
11653 * """
11654 * returns the int64 value underlying scalar numpy timedelta64 object
11655 */
11656
__pyx_f_5numpy_get_timedelta64_value(PyObject * __pyx_v_obj)11657 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
11658 npy_timedelta __pyx_r;
11659
11660 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1048
11661 * returns the int64 value underlying scalar numpy timedelta64 object
11662 * """
11663 * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
11664 *
11665 *
11666 */
11667 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
11668 goto __pyx_L0;
11669
11670 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1044
11671 *
11672 *
11673 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
11674 * """
11675 * returns the int64 value underlying scalar numpy timedelta64 object
11676 */
11677
11678 /* function exit code */
11679 __pyx_L0:;
11680 return __pyx_r;
11681 }
11682
11683 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1051
11684 *
11685 *
11686 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
11687 * """
11688 * returns the unit part of the dtype for a numpy datetime64 object.
11689 */
11690
__pyx_f_5numpy_get_datetime64_unit(PyObject * __pyx_v_obj)11691 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
11692 NPY_DATETIMEUNIT __pyx_r;
11693
11694 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1055
11695 * returns the unit part of the dtype for a numpy datetime64 object.
11696 * """
11697 * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
11698 */
11699 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
11700 goto __pyx_L0;
11701
11702 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1051
11703 *
11704 *
11705 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
11706 * """
11707 * returns the unit part of the dtype for a numpy datetime64 object.
11708 */
11709
11710 /* function exit code */
11711 __pyx_L0:;
11712 return __pyx_r;
11713 }
11714
11715 static PyMethodDef __pyx_methods[] = {
11716 {0, 0, 0, 0}
11717 };
11718 #ifndef CYTHON_SMALL_CODE
11719 #if defined(__clang__)
11720 #define CYTHON_SMALL_CODE
11721 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
11722 #define CYTHON_SMALL_CODE __attribute__((cold))
11723 #else
11724 #define CYTHON_SMALL_CODE
11725 #endif
11726 #endif
11727 /* #### Code section: pystring_table ### */
11728
11729 static __Pyx_StringTabEntry __pyx_string_tab[] = {
11730 #if CYTHON_USE_MODULE_STATE
11731 {0, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
11732 {0, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
11733 {0, __pyx_k_QRatio, sizeof(__pyx_k_QRatio), 0, 0, 1, 1},
11734 {0, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
11735 {0, __pyx_k_WRatio, sizeof(__pyx_k_WRatio), 0, 0, 1, 1},
11736 {0, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 1},
11737 {0, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1},
11738 {0, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
11739 {0, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
11740 {0, __pyx_k_cdist, sizeof(__pyx_k_cdist), 0, 0, 1, 1},
11741 {0, __pyx_k_choices, sizeof(__pyx_k_choices), 0, 0, 1, 1},
11742 {0, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
11743 {0, __pyx_k_cpp_process_cdist, sizeof(__pyx_k_cpp_process_cdist), 0, 0, 1, 1},
11744 {0, __pyx_k_cpp_process_cdist_pyx, sizeof(__pyx_k_cpp_process_cdist_pyx), 0, 0, 1, 0},
11745 {0, __pyx_k_default_process, sizeof(__pyx_k_default_process), 0, 0, 1, 1},
11746 {0, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
11747 {0, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
11748 {0, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
11749 {0, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
11750 {0, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
11751 {0, __pyx_k_hamming, sizeof(__pyx_k_hamming), 0, 0, 1, 1},
11752 {0, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11753 {0, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
11754 {0, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1},
11755 {0, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
11756 {0, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
11757 {0, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
11758 {0, __pyx_k_invalid_dtype_use_np_int8_np_int, sizeof(__pyx_k_invalid_dtype_use_np_int8_np_int), 0, 1, 0, 0},
11759 {0, __pyx_k_invalid_dtype_use_np_uint8_np_fl, sizeof(__pyx_k_invalid_dtype_use_np_uint8_np_fl), 0, 1, 0, 0},
11760 {0, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
11761 {0, __pyx_k_jaro_similarity, sizeof(__pyx_k_jaro_similarity), 0, 0, 1, 1},
11762 {0, __pyx_k_jaro_winkler_similarity, sizeof(__pyx_k_jaro_winkler_similarity), 0, 0, 1, 1},
11763 {0, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
11764 {0, __pyx_k_levenshtein, sizeof(__pyx_k_levenshtein), 0, 0, 1, 1},
11765 {0, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11766 {0, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
11767 {0, __pyx_k_normalized_hamming, sizeof(__pyx_k_normalized_hamming), 0, 0, 1, 1},
11768 {0, __pyx_k_normalized_levenshtein, sizeof(__pyx_k_normalized_levenshtein), 0, 0, 1, 1},
11769 {0, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
11770 {0, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
11771 {0, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
11772 {0, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
11773 {0, __pyx_k_partial_ratio, sizeof(__pyx_k_partial_ratio), 0, 0, 1, 1},
11774 {0, __pyx_k_partial_token_ratio, sizeof(__pyx_k_partial_token_ratio), 0, 0, 1, 1},
11775 {0, __pyx_k_partial_token_set_ratio, sizeof(__pyx_k_partial_token_set_ratio), 0, 0, 1, 1},
11776 {0, __pyx_k_partial_token_sort_ratio, sizeof(__pyx_k_partial_token_sort_ratio), 0, 0, 1, 1},
11777 {0, __pyx_k_prefix_weight, sizeof(__pyx_k_prefix_weight), 0, 1, 0, 1},
11778 {0, __pyx_k_processor, sizeof(__pyx_k_processor), 0, 0, 1, 1},
11779 {0, __pyx_k_processor, sizeof(__pyx_k_processor), 0, 1, 0, 1},
11780 {0, __pyx_k_queries, sizeof(__pyx_k_queries), 0, 0, 1, 1},
11781 {0, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
11782 {0, __pyx_k_rapidfuzz_fuzz, sizeof(__pyx_k_rapidfuzz_fuzz), 0, 0, 1, 1},
11783 {0, __pyx_k_rapidfuzz_string_metric, sizeof(__pyx_k_rapidfuzz_string_metric), 0, 0, 1, 1},
11784 {0, __pyx_k_rapidfuzz_utils, sizeof(__pyx_k_rapidfuzz_utils), 0, 0, 1, 1},
11785 {0, __pyx_k_ratio, sizeof(__pyx_k_ratio), 0, 0, 1, 1},
11786 {0, __pyx_k_score_cutoff, sizeof(__pyx_k_score_cutoff), 0, 0, 1, 1},
11787 {0, __pyx_k_score_cutoff, sizeof(__pyx_k_score_cutoff), 0, 1, 0, 1},
11788 {0, __pyx_k_score_cutoff_has_to_be_in_the_ra, sizeof(__pyx_k_score_cutoff_has_to_be_in_the_ra), 0, 1, 0, 0},
11789 {0, __pyx_k_scorer, sizeof(__pyx_k_scorer), 0, 0, 1, 1},
11790 {0, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
11791 {0, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11792 {0, __pyx_k_token_ratio, sizeof(__pyx_k_token_ratio), 0, 0, 1, 1},
11793 {0, __pyx_k_token_set_ratio, sizeof(__pyx_k_token_set_ratio), 0, 0, 1, 1},
11794 {0, __pyx_k_token_sort_ratio, sizeof(__pyx_k_token_sort_ratio), 0, 0, 1, 1},
11795 {0, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
11796 {0, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
11797 {0, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 1, 0, 1},
11798 {0, __pyx_k_workers, sizeof(__pyx_k_workers), 0, 0, 1, 1},
11799 #else
11800 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
11801 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
11802 {&__pyx_n_s_QRatio, __pyx_k_QRatio, sizeof(__pyx_k_QRatio), 0, 0, 1, 1},
11803 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
11804 {&__pyx_n_s_WRatio, __pyx_k_WRatio, sizeof(__pyx_k_WRatio), 0, 0, 1, 1},
11805 {&__pyx_n_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 1},
11806 {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1},
11807 {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
11808 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
11809 {&__pyx_n_s_cdist, __pyx_k_cdist, sizeof(__pyx_k_cdist), 0, 0, 1, 1},
11810 {&__pyx_n_s_choices, __pyx_k_choices, sizeof(__pyx_k_choices), 0, 0, 1, 1},
11811 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
11812 {&__pyx_n_s_cpp_process_cdist, __pyx_k_cpp_process_cdist, sizeof(__pyx_k_cpp_process_cdist), 0, 0, 1, 1},
11813 {&__pyx_kp_s_cpp_process_cdist_pyx, __pyx_k_cpp_process_cdist_pyx, sizeof(__pyx_k_cpp_process_cdist_pyx), 0, 0, 1, 0},
11814 {&__pyx_n_s_default_process, __pyx_k_default_process, sizeof(__pyx_k_default_process), 0, 0, 1, 1},
11815 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
11816 {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
11817 {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
11818 {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
11819 {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
11820 {&__pyx_n_s_hamming, __pyx_k_hamming, sizeof(__pyx_k_hamming), 0, 0, 1, 1},
11821 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11822 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
11823 {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1},
11824 {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
11825 {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
11826 {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
11827 {&__pyx_kp_u_invalid_dtype_use_np_int8_np_int, __pyx_k_invalid_dtype_use_np_int8_np_int, sizeof(__pyx_k_invalid_dtype_use_np_int8_np_int), 0, 1, 0, 0},
11828 {&__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl, __pyx_k_invalid_dtype_use_np_uint8_np_fl, sizeof(__pyx_k_invalid_dtype_use_np_uint8_np_fl), 0, 1, 0, 0},
11829 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
11830 {&__pyx_n_s_jaro_similarity, __pyx_k_jaro_similarity, sizeof(__pyx_k_jaro_similarity), 0, 0, 1, 1},
11831 {&__pyx_n_s_jaro_winkler_similarity, __pyx_k_jaro_winkler_similarity, sizeof(__pyx_k_jaro_winkler_similarity), 0, 0, 1, 1},
11832 {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
11833 {&__pyx_n_s_levenshtein, __pyx_k_levenshtein, sizeof(__pyx_k_levenshtein), 0, 0, 1, 1},
11834 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11835 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
11836 {&__pyx_n_s_normalized_hamming, __pyx_k_normalized_hamming, sizeof(__pyx_k_normalized_hamming), 0, 0, 1, 1},
11837 {&__pyx_n_s_normalized_levenshtein, __pyx_k_normalized_levenshtein, sizeof(__pyx_k_normalized_levenshtein), 0, 0, 1, 1},
11838 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
11839 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
11840 {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
11841 {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
11842 {&__pyx_n_s_partial_ratio, __pyx_k_partial_ratio, sizeof(__pyx_k_partial_ratio), 0, 0, 1, 1},
11843 {&__pyx_n_s_partial_token_ratio, __pyx_k_partial_token_ratio, sizeof(__pyx_k_partial_token_ratio), 0, 0, 1, 1},
11844 {&__pyx_n_s_partial_token_set_ratio, __pyx_k_partial_token_set_ratio, sizeof(__pyx_k_partial_token_set_ratio), 0, 0, 1, 1},
11845 {&__pyx_n_s_partial_token_sort_ratio, __pyx_k_partial_token_sort_ratio, sizeof(__pyx_k_partial_token_sort_ratio), 0, 0, 1, 1},
11846 {&__pyx_n_u_prefix_weight, __pyx_k_prefix_weight, sizeof(__pyx_k_prefix_weight), 0, 1, 0, 1},
11847 {&__pyx_n_s_processor, __pyx_k_processor, sizeof(__pyx_k_processor), 0, 0, 1, 1},
11848 {&__pyx_n_u_processor, __pyx_k_processor, sizeof(__pyx_k_processor), 0, 1, 0, 1},
11849 {&__pyx_n_s_queries, __pyx_k_queries, sizeof(__pyx_k_queries), 0, 0, 1, 1},
11850 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
11851 {&__pyx_n_s_rapidfuzz_fuzz, __pyx_k_rapidfuzz_fuzz, sizeof(__pyx_k_rapidfuzz_fuzz), 0, 0, 1, 1},
11852 {&__pyx_n_s_rapidfuzz_string_metric, __pyx_k_rapidfuzz_string_metric, sizeof(__pyx_k_rapidfuzz_string_metric), 0, 0, 1, 1},
11853 {&__pyx_n_s_rapidfuzz_utils, __pyx_k_rapidfuzz_utils, sizeof(__pyx_k_rapidfuzz_utils), 0, 0, 1, 1},
11854 {&__pyx_n_s_ratio, __pyx_k_ratio, sizeof(__pyx_k_ratio), 0, 0, 1, 1},
11855 {&__pyx_n_s_score_cutoff, __pyx_k_score_cutoff, sizeof(__pyx_k_score_cutoff), 0, 0, 1, 1},
11856 {&__pyx_n_u_score_cutoff, __pyx_k_score_cutoff, sizeof(__pyx_k_score_cutoff), 0, 1, 0, 1},
11857 {&__pyx_kp_u_score_cutoff_has_to_be_in_the_ra, __pyx_k_score_cutoff_has_to_be_in_the_ra, sizeof(__pyx_k_score_cutoff_has_to_be_in_the_ra), 0, 1, 0, 0},
11858 {&__pyx_n_s_scorer, __pyx_k_scorer, sizeof(__pyx_k_scorer), 0, 0, 1, 1},
11859 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
11860 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11861 {&__pyx_n_s_token_ratio, __pyx_k_token_ratio, sizeof(__pyx_k_token_ratio), 0, 0, 1, 1},
11862 {&__pyx_n_s_token_set_ratio, __pyx_k_token_set_ratio, sizeof(__pyx_k_token_set_ratio), 0, 0, 1, 1},
11863 {&__pyx_n_s_token_sort_ratio, __pyx_k_token_sort_ratio, sizeof(__pyx_k_token_sort_ratio), 0, 0, 1, 1},
11864 {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
11865 {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
11866 {&__pyx_n_u_weights, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 1, 0, 1},
11867 {&__pyx_n_s_workers, __pyx_k_workers, sizeof(__pyx_k_workers), 0, 0, 1, 1},
11868 #endif
11869 {0, 0, 0, 0, 0, 0, 0}
11870 };
11871 /* #### Code section: cached_builtins ### */
__Pyx_InitCachedBuiltins(void)11872 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
11873 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 129, __pyx_L1_error)
11874 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 248, __pyx_L1_error)
11875 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 325, __pyx_L1_error)
11876 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 989, __pyx_L1_error)
11877 return 0;
11878 __pyx_L1_error:;
11879 return -1;
11880 }
11881 /* #### Code section: cached_constants ### */
11882
__Pyx_InitCachedConstants(void)11883 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
11884 __Pyx_RefNannyDeclarations
11885 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11886
11887 /* "cpp_process_cdist.pyx":131
11888 * raise MemoryError
11889 *
11890 * insertion, deletion, substitution = kwargs.get("weights", (1, 1, 1)) # <<<<<<<<<<<<<<
11891 * dereference(weights).insert_cost = insertion
11892 * dereference(weights).delete_cost = deletion
11893 */
11894 __pyx_tuple_ = PyTuple_Pack(3, __pyx_int_1, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 131, __pyx_L1_error)
11895 __Pyx_GOTREF(__pyx_tuple_);
11896 __Pyx_GIVEREF(__pyx_tuple_);
11897
11898 /* "cpp_process_cdist.pyx":248
11899 * return np.NPY_FLOAT64
11900 *
11901 * raise TypeError("invalid dtype (use np.uint8, np.float32 or np.float64)") # <<<<<<<<<<<<<<
11902 *
11903 * cdef int dtype_to_type_num_distance(dtype) except -1:
11904 */
11905 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_invalid_dtype_use_np_uint8_np_fl); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 248, __pyx_L1_error)
11906 __Pyx_GOTREF(__pyx_tuple__2);
11907 __Pyx_GIVEREF(__pyx_tuple__2);
11908
11909 /* "cpp_process_cdist.pyx":260
11910 * return np.NPY_INT64
11911 *
11912 * raise TypeError("invalid dtype (use np.int8, np.int16, np.int32 or np.int64)") # <<<<<<<<<<<<<<
11913 *
11914 * cdef inline cdist_two_lists_similarity(
11915 */
11916 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_invalid_dtype_use_np_int8_np_int); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 260, __pyx_L1_error)
11917 __Pyx_GOTREF(__pyx_tuple__3);
11918 __Pyx_GIVEREF(__pyx_tuple__3);
11919
11920 /* "cpp_process_cdist.pyx":279
11921 * c_score_cutoff = score_cutoff
11922 * if c_score_cutoff < 0 or c_score_cutoff > 100:
11923 * raise TypeError("score_cutoff has to be in the range of 0.0 - 100.0") # <<<<<<<<<<<<<<
11924 *
11925 * return cdist_two_lists_similarity_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_score_cutoff)
11926 */
11927 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_score_cutoff_has_to_be_in_the_ra); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 279, __pyx_L1_error)
11928 __Pyx_GOTREF(__pyx_tuple__4);
11929 __Pyx_GIVEREF(__pyx_tuple__4);
11930
11931 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":989
11932 * __pyx_import_array()
11933 * except Exception:
11934 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
11935 *
11936 * cdef inline int import_umath() except -1:
11937 */
11938 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 989, __pyx_L1_error)
11939 __Pyx_GOTREF(__pyx_tuple__6);
11940 __Pyx_GIVEREF(__pyx_tuple__6);
11941
11942 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":995
11943 * _import_umath()
11944 * except Exception:
11945 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
11946 *
11947 * cdef inline int import_ufunc() except -1:
11948 */
11949 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 995, __pyx_L1_error)
11950 __Pyx_GOTREF(__pyx_tuple__7);
11951 __Pyx_GIVEREF(__pyx_tuple__7);
11952
11953 /* "cpp_process_cdist.pyx":524
11954 * Py_DECREF(<object>item)
11955 *
11956 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs): # <<<<<<<<<<<<<<
11957 * """
11958 * Compute distance/similarity between each pair of the two collections of inputs.
11959 */
11960 __pyx_tuple__9 = PyTuple_Pack(8, __pyx_n_s_queries, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_dtype, __pyx_n_s_workers, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 524, __pyx_L1_error)
11961 __Pyx_GOTREF(__pyx_tuple__9);
11962 __Pyx_GIVEREF(__pyx_tuple__9);
11963 __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_process_cdist_pyx, __pyx_n_s_cdist, 524, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 524, __pyx_L1_error)
11964 __Pyx_RefNannyFinishContext();
11965 return 0;
11966 __pyx_L1_error:;
11967 __Pyx_RefNannyFinishContext();
11968 return -1;
11969 }
11970 /* #### Code section: init_globals ### */
11971
__Pyx_InitGlobals(void)11972 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
11973 __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
11974 __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get;
11975 #if CYTHON_USE_MODULE_STATE
11976 if (__Pyx_InitString(__pyx_string_tab[0], &__pyx_n_s_ImportError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11977 if (__Pyx_InitString(__pyx_string_tab[1], &__pyx_n_s_MemoryError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11978 if (__Pyx_InitString(__pyx_string_tab[2], &__pyx_n_s_QRatio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11979 if (__Pyx_InitString(__pyx_string_tab[3], &__pyx_n_s_TypeError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11980 if (__Pyx_InitString(__pyx_string_tab[4], &__pyx_n_s_WRatio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11981 if (__Pyx_InitString(__pyx_string_tab[5], &__pyx_n_s__10) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11982 if (__Pyx_InitString(__pyx_string_tab[6], &__pyx_n_s__8) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11983 if (__Pyx_InitString(__pyx_string_tab[7], &__pyx_n_s_array) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11984 if (__Pyx_InitString(__pyx_string_tab[8], &__pyx_n_s_asyncio_coroutines) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11985 if (__Pyx_InitString(__pyx_string_tab[9], &__pyx_n_s_cdist) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11986 if (__Pyx_InitString(__pyx_string_tab[10], &__pyx_n_s_choices) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11987 if (__Pyx_InitString(__pyx_string_tab[11], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11988 if (__Pyx_InitString(__pyx_string_tab[12], &__pyx_n_s_cpp_process_cdist) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11989 if (__Pyx_InitString(__pyx_string_tab[13], &__pyx_kp_s_cpp_process_cdist_pyx) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11990 if (__Pyx_InitString(__pyx_string_tab[14], &__pyx_n_s_default_process) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11991 if (__Pyx_InitString(__pyx_string_tab[15], &__pyx_n_s_dtype) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11992 if (__Pyx_InitString(__pyx_string_tab[16], &__pyx_n_s_empty) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11993 if (__Pyx_InitString(__pyx_string_tab[17], &__pyx_n_s_float32) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11994 if (__Pyx_InitString(__pyx_string_tab[18], &__pyx_n_s_float64) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11995 if (__Pyx_InitString(__pyx_string_tab[19], &__pyx_n_s_get) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11996 if (__Pyx_InitString(__pyx_string_tab[20], &__pyx_n_s_hamming) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11997 if (__Pyx_InitString(__pyx_string_tab[21], &__pyx_n_s_import) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11998 if (__Pyx_InitString(__pyx_string_tab[22], &__pyx_n_s_initializing) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11999 if (__Pyx_InitString(__pyx_string_tab[23], &__pyx_n_s_int16) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12000 if (__Pyx_InitString(__pyx_string_tab[24], &__pyx_n_s_int32) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12001 if (__Pyx_InitString(__pyx_string_tab[25], &__pyx_n_s_int64) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12002 if (__Pyx_InitString(__pyx_string_tab[26], &__pyx_n_s_int8) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12003 if (__Pyx_InitString(__pyx_string_tab[27], &__pyx_kp_u_invalid_dtype_use_np_int8_np_int) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12004 if (__Pyx_InitString(__pyx_string_tab[28], &__pyx_kp_u_invalid_dtype_use_np_uint8_np_fl) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12005 if (__Pyx_InitString(__pyx_string_tab[29], &__pyx_n_s_is_coroutine) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12006 if (__Pyx_InitString(__pyx_string_tab[30], &__pyx_n_s_jaro_similarity) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12007 if (__Pyx_InitString(__pyx_string_tab[31], &__pyx_n_s_jaro_winkler_similarity) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12008 if (__Pyx_InitString(__pyx_string_tab[32], &__pyx_n_s_kwargs) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12009 if (__Pyx_InitString(__pyx_string_tab[33], &__pyx_n_s_levenshtein) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12010 if (__Pyx_InitString(__pyx_string_tab[34], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12011 if (__Pyx_InitString(__pyx_string_tab[35], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12012 if (__Pyx_InitString(__pyx_string_tab[36], &__pyx_n_s_normalized_hamming) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12013 if (__Pyx_InitString(__pyx_string_tab[37], &__pyx_n_s_normalized_levenshtein) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12014 if (__Pyx_InitString(__pyx_string_tab[38], &__pyx_n_s_np) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12015 if (__Pyx_InitString(__pyx_string_tab[39], &__pyx_n_s_numpy) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12016 if (__Pyx_InitString(__pyx_string_tab[40], &__pyx_kp_u_numpy_core_multiarray_failed_to) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12017 if (__Pyx_InitString(__pyx_string_tab[41], &__pyx_kp_u_numpy_core_umath_failed_to_impor) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12018 if (__Pyx_InitString(__pyx_string_tab[42], &__pyx_n_s_partial_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12019 if (__Pyx_InitString(__pyx_string_tab[43], &__pyx_n_s_partial_token_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12020 if (__Pyx_InitString(__pyx_string_tab[44], &__pyx_n_s_partial_token_set_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12021 if (__Pyx_InitString(__pyx_string_tab[45], &__pyx_n_s_partial_token_sort_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12022 if (__Pyx_InitString(__pyx_string_tab[46], &__pyx_n_u_prefix_weight) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12023 if (__Pyx_InitString(__pyx_string_tab[47], &__pyx_n_s_processor) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12024 if (__Pyx_InitString(__pyx_string_tab[48], &__pyx_n_u_processor) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12025 if (__Pyx_InitString(__pyx_string_tab[49], &__pyx_n_s_queries) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12026 if (__Pyx_InitString(__pyx_string_tab[50], &__pyx_n_s_range) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12027 if (__Pyx_InitString(__pyx_string_tab[51], &__pyx_n_s_rapidfuzz_fuzz) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12028 if (__Pyx_InitString(__pyx_string_tab[52], &__pyx_n_s_rapidfuzz_string_metric) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12029 if (__Pyx_InitString(__pyx_string_tab[53], &__pyx_n_s_rapidfuzz_utils) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12030 if (__Pyx_InitString(__pyx_string_tab[54], &__pyx_n_s_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12031 if (__Pyx_InitString(__pyx_string_tab[55], &__pyx_n_s_score_cutoff) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12032 if (__Pyx_InitString(__pyx_string_tab[56], &__pyx_n_u_score_cutoff) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12033 if (__Pyx_InitString(__pyx_string_tab[57], &__pyx_kp_u_score_cutoff_has_to_be_in_the_ra) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12034 if (__Pyx_InitString(__pyx_string_tab[58], &__pyx_n_s_scorer) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12035 if (__Pyx_InitString(__pyx_string_tab[59], &__pyx_n_s_spec) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12036 if (__Pyx_InitString(__pyx_string_tab[60], &__pyx_n_s_test) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12037 if (__Pyx_InitString(__pyx_string_tab[61], &__pyx_n_s_token_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12038 if (__Pyx_InitString(__pyx_string_tab[62], &__pyx_n_s_token_set_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12039 if (__Pyx_InitString(__pyx_string_tab[63], &__pyx_n_s_token_sort_ratio) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12040 if (__Pyx_InitString(__pyx_string_tab[64], &__pyx_n_s_typecode) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12041 if (__Pyx_InitString(__pyx_string_tab[65], &__pyx_n_s_uint8) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12042 if (__Pyx_InitString(__pyx_string_tab[66], &__pyx_n_u_weights) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12043 if (__Pyx_InitString(__pyx_string_tab[67], &__pyx_n_s_workers) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12044 #endif
12045 #if !CYTHON_USE_MODULE_STATE
12046 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12047 #endif
12048 __pyx_float_0_1 = PyFloat_FromDouble(0.1); if (unlikely(!__pyx_float_0_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12049 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12050 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12051 return 0;
12052 __pyx_L1_error:;
12053 return -1;
12054 }
12055 /* #### Code section: init_module ### */
12056
12057 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
12058 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
12059 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
12060 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
12061 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
12062 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
12063 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
12064
__Pyx_modinit_global_init_code(void)12065 static int __Pyx_modinit_global_init_code(void) {
12066 __Pyx_RefNannyDeclarations
12067 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
12068 /*--- Global init code ---*/
12069 __Pyx_RefNannyFinishContext();
12070 return 0;
12071 }
12072
__Pyx_modinit_variable_export_code(void)12073 static int __Pyx_modinit_variable_export_code(void) {
12074 __Pyx_RefNannyDeclarations
12075 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
12076 /*--- Variable export code ---*/
12077 __Pyx_RefNannyFinishContext();
12078 return 0;
12079 }
12080
__Pyx_modinit_function_export_code(void)12081 static int __Pyx_modinit_function_export_code(void) {
12082 __Pyx_RefNannyDeclarations
12083 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
12084 /*--- Function export code ---*/
12085 __Pyx_RefNannyFinishContext();
12086 return 0;
12087 }
12088
__Pyx_modinit_type_init_code(void)12089 static int __Pyx_modinit_type_init_code(void) {
12090 __Pyx_RefNannyDeclarations
12091 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
12092 /*--- Type init code ---*/
12093 __Pyx_RefNannyFinishContext();
12094 return 0;
12095 }
12096
__Pyx_modinit_type_import_code(void)12097 static int __Pyx_modinit_type_import_code(void) {
12098 __Pyx_RefNannyDeclarations
12099 PyObject *__pyx_t_1 = NULL;
12100 int __pyx_lineno = 0;
12101 const char *__pyx_filename = NULL;
12102 int __pyx_clineno = 0;
12103 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
12104 /*--- Type import code ---*/
12105 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
12106 __Pyx_GOTREF(__pyx_t_1);
12107 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
12108 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
12109 sizeof(PyTypeObject),
12110 #elif CYTHON_COMPILING_IN_LIMITED_API
12111 sizeof(PyTypeObject),
12112 #else
12113 sizeof(PyHeapTypeObject),
12114 #endif
12115 __Pyx_ImportType_CheckSize_Warn);
12116 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
12117 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12118 __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 203, __pyx_L1_error)
12119 __Pyx_GOTREF(__pyx_t_1);
12120 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
12121 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 203, __pyx_L1_error)
12122 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
12123 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 226, __pyx_L1_error)
12124 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
12125 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 230, __pyx_L1_error)
12126 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
12127 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 239, __pyx_L1_error)
12128 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12129 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 813, __pyx_L1_error)
12130 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12131 if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 815, __pyx_L1_error)
12132 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12133 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 817, __pyx_L1_error)
12134 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12135 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 819, __pyx_L1_error)
12136 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12137 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 821, __pyx_L1_error)
12138 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12139 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 823, __pyx_L1_error)
12140 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12141 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 825, __pyx_L1_error)
12142 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12143 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 827, __pyx_L1_error)
12144 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12145 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 829, __pyx_L1_error)
12146 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
12147 if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 831, __pyx_L1_error)
12148 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
12149 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 869, __pyx_L1_error)
12150 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12151 __Pyx_RefNannyFinishContext();
12152 return 0;
12153 __pyx_L1_error:;
12154 __Pyx_XDECREF(__pyx_t_1);
12155 __Pyx_RefNannyFinishContext();
12156 return -1;
12157 }
12158
__Pyx_modinit_variable_import_code(void)12159 static int __Pyx_modinit_variable_import_code(void) {
12160 __Pyx_RefNannyDeclarations
12161 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
12162 /*--- Variable import code ---*/
12163 __Pyx_RefNannyFinishContext();
12164 return 0;
12165 }
12166
__Pyx_modinit_function_import_code(void)12167 static int __Pyx_modinit_function_import_code(void) {
12168 __Pyx_RefNannyDeclarations
12169 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
12170 /*--- Function import code ---*/
12171 __Pyx_RefNannyFinishContext();
12172 return 0;
12173 }
12174
12175
12176 #if PY_MAJOR_VERSION >= 3
12177 #if CYTHON_PEP489_MULTI_PHASE_INIT
12178 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
12179 static int __pyx_pymod_exec_cpp_process_cdist(PyObject* module); /*proto*/
12180 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
12181 {Py_mod_create, (void*)__pyx_pymod_create},
12182 {Py_mod_exec, (void*)__pyx_pymod_exec_cpp_process_cdist},
12183 {0, NULL}
12184 };
12185 #endif
12186
12187 #ifdef __cplusplus
12188 namespace {
12189 struct PyModuleDef __pyx_moduledef =
12190 #else
12191 static struct PyModuleDef __pyx_moduledef =
12192 #endif
12193 {
12194 PyModuleDef_HEAD_INIT,
12195 "cpp_process_cdist",
12196 0, /* m_doc */
12197 #if CYTHON_PEP489_MULTI_PHASE_INIT
12198 0, /* m_size */
12199 #elif CYTHON_USE_MODULE_STATE
12200 sizeof(__pyx_mstate), /* m_size */
12201 #else
12202 -1, /* m_size */
12203 #endif
12204 __pyx_methods /* m_methods */,
12205 #if CYTHON_PEP489_MULTI_PHASE_INIT
12206 __pyx_moduledef_slots, /* m_slots */
12207 #else
12208 NULL, /* m_reload */
12209 #endif
12210 #if CYTHON_USE_MODULE_STATE
12211 __pyx_m_traverse, /* m_traverse */
12212 __pyx_m_clear, /* m_clear */
12213 NULL /* m_free */
12214 #else
12215 NULL, /* m_traverse */
12216 NULL, /* m_clear */
12217 NULL /* m_free */
12218 #endif
12219 };
12220 #ifdef __cplusplus
12221 } /* anonymous namespace */
12222 #endif
12223 #endif
12224
12225 #ifndef CYTHON_NO_PYINIT_EXPORT
12226 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
12227 #elif PY_MAJOR_VERSION < 3
12228 #ifdef __cplusplus
12229 #define __Pyx_PyMODINIT_FUNC extern "C" void
12230 #else
12231 #define __Pyx_PyMODINIT_FUNC void
12232 #endif
12233 #else
12234 #ifdef __cplusplus
12235 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
12236 #else
12237 #define __Pyx_PyMODINIT_FUNC PyObject *
12238 #endif
12239 #endif
12240
12241
12242 #if PY_MAJOR_VERSION < 3
12243 __Pyx_PyMODINIT_FUNC initcpp_process_cdist(void) CYTHON_SMALL_CODE; /*proto*/
initcpp_process_cdist(void)12244 __Pyx_PyMODINIT_FUNC initcpp_process_cdist(void)
12245 #else
12246 __Pyx_PyMODINIT_FUNC PyInit_cpp_process_cdist(void) CYTHON_SMALL_CODE; /*proto*/
12247 __Pyx_PyMODINIT_FUNC PyInit_cpp_process_cdist(void)
12248 #if CYTHON_PEP489_MULTI_PHASE_INIT
12249 {
12250 return PyModuleDef_Init(&__pyx_moduledef);
12251 }
12252 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
12253 #if PY_VERSION_HEX >= 0x030700A1
12254 static PY_INT64_T main_interpreter_id = -1;
12255 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
12256 if (main_interpreter_id == -1) {
12257 main_interpreter_id = current_id;
12258 return (unlikely(current_id == -1)) ? -1 : 0;
12259 } else if (unlikely(main_interpreter_id != current_id))
12260 #else
12261 static PyInterpreterState *main_interpreter = NULL;
12262 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
12263 if (!main_interpreter) {
12264 main_interpreter = current_interpreter;
12265 } else if (unlikely(main_interpreter != current_interpreter))
12266 #endif
12267 {
12268 PyErr_SetString(
12269 PyExc_ImportError,
12270 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
12271 return -1;
12272 }
12273 return 0;
12274 }
12275 #if CYTHON_COMPILING_IN_LIMITED_API
12276 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
12277 #else
12278 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
12279 #endif
12280 {
12281 PyObject *value = PyObject_GetAttrString(spec, from_name);
12282 int result = 0;
12283 if (likely(value)) {
12284 if (allow_none || value != Py_None) {
12285 #if CYTHON_COMPILING_IN_LIMITED_API
12286 result = PyModule_AddObject(module, to_name, value);
12287 #else
12288 result = PyDict_SetItemString(moddict, to_name, value);
12289 #endif
12290 }
12291 Py_DECREF(value);
12292 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
12293 PyErr_Clear();
12294 } else {
12295 result = -1;
12296 }
12297 return result;
12298 }
12299 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
12300 PyObject *module = NULL, *moddict, *modname;
12301 CYTHON_UNUSED_VAR(def);
12302 if (__Pyx_check_single_interpreter())
12303 return NULL;
12304 if (__pyx_m)
12305 return __Pyx_NewRef(__pyx_m);
12306 modname = PyObject_GetAttrString(spec, "name");
12307 if (unlikely(!modname)) goto bad;
12308 module = PyModule_NewObject(modname);
12309 Py_DECREF(modname);
12310 if (unlikely(!module)) goto bad;
12311 #if CYTHON_COMPILING_IN_LIMITED_API
12312 moddict = module;
12313 #else
12314 moddict = PyModule_GetDict(module);
12315 if (unlikely(!moddict)) goto bad;
12316 #endif
12317 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
12318 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
12319 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
12320 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
12321 return module;
12322 bad:
12323 Py_XDECREF(module);
12324 return NULL;
12325 }
12326
12327
12328 static CYTHON_SMALL_CODE int __pyx_pymod_exec_cpp_process_cdist(PyObject *__pyx_pyinit_module)
12329 #endif
12330 #endif
12331 {
12332 __Pyx_TraceDeclarations
12333 PyObject *__pyx_t_1 = NULL;
12334 PyObject *__pyx_t_2 = NULL;
12335 int __pyx_t_3;
12336 int __pyx_lineno = 0;
12337 const char *__pyx_filename = NULL;
12338 int __pyx_clineno = 0;
12339 __Pyx_RefNannyDeclarations
12340 #if CYTHON_PEP489_MULTI_PHASE_INIT
12341 if (__pyx_m) {
12342 if (__pyx_m == __pyx_pyinit_module) return 0;
12343 PyErr_SetString(PyExc_RuntimeError, "Module 'cpp_process_cdist' has already been imported. Re-initialisation is not supported.");
12344 return -1;
12345 }
12346 #elif PY_MAJOR_VERSION >= 3
12347 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
12348 #endif
12349 /*--- Module creation code ---*/
12350 #if CYTHON_PEP489_MULTI_PHASE_INIT
12351 __pyx_m = __pyx_pyinit_module;
12352 Py_INCREF(__pyx_m);
12353 #else
12354 #if PY_MAJOR_VERSION < 3
12355 __pyx_m = Py_InitModule4("cpp_process_cdist", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
12356 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
12357 #elif CYTHON_COMPILING_IN_LIMITED_API
12358 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12359 __Pyx_GOTREF(__pyx_t_1);
12360 if (unlikely((PyState_AddModule(__pyx_t_1, &__pyx_moduledef) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
12361 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12362 #else
12363 __pyx_m = PyModule_Create(&__pyx_moduledef);
12364 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
12365 #endif
12366 #endif
12367 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
12368 Py_INCREF(__pyx_d);
12369 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
12370 Py_INCREF(__pyx_b);
12371 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
12372 Py_INCREF(__pyx_cython_runtime);
12373 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12374 #if CYTHON_REFNANNY
12375 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
12376 if (!__Pyx_RefNanny) {
12377 PyErr_Clear();
12378 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
12379 if (!__Pyx_RefNanny)
12380 Py_FatalError("failed to import 'refnanny' module");
12381 }
12382 #endif
12383 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cpp_process_cdist(void)", 0);
12384 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12385 #ifdef __Pxy_PyFrame_Initialize_Offsets
12386 __Pxy_PyFrame_Initialize_Offsets();
12387 #endif
12388 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
12389 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
12390 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
12391 #ifdef __Pyx_CyFunction_USED
12392 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12393 #endif
12394 #ifdef __Pyx_FusedFunction_USED
12395 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12396 #endif
12397 #ifdef __Pyx_Coroutine_USED
12398 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12399 #endif
12400 #ifdef __Pyx_Generator_USED
12401 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12402 #endif
12403 #ifdef __Pyx_AsyncGen_USED
12404 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12405 #endif
12406 #ifdef __Pyx_StopAsyncIteration_USED
12407 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12408 #endif
12409 /*--- Library function declarations ---*/
12410 /*--- Threads initialization code ---*/
12411 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
12412 PyEval_InitThreads();
12413 #endif
12414 /*--- Initialize various global constants etc. ---*/
12415 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12416 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
12417 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12418 #endif
12419 if (__pyx_module_is_main_cpp_process_cdist) {
12420 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12421 }
12422 #if PY_MAJOR_VERSION >= 3
12423 {
12424 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
12425 if (!PyDict_GetItemString(modules, "cpp_process_cdist")) {
12426 if (unlikely((PyDict_SetItemString(modules, "cpp_process_cdist", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
12427 }
12428 }
12429 #endif
12430 /*--- Builtin init code ---*/
12431 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12432 /*--- Constants init code ---*/
12433 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12434 /*--- Global type/function init code ---*/
12435 (void)__Pyx_modinit_global_init_code();
12436 (void)__Pyx_modinit_variable_export_code();
12437 (void)__Pyx_modinit_function_export_code();
12438 (void)__Pyx_modinit_type_init_code();
12439 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
12440 (void)__Pyx_modinit_variable_import_code();
12441 (void)__Pyx_modinit_function_import_code();
12442 /*--- Execution code ---*/
12443 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
12444 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12445 #endif
12446 __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_cpp_process_cdist(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
12447
12448 /* "cpp_process_cdist.pyx":4
12449 * # cython: language_level=3, binding=True, linetrace=True
12450 *
12451 * from rapidfuzz.utils import default_process # <<<<<<<<<<<<<<
12452 *
12453 * from rapidfuzz.string_metric import (
12454 */
12455 __Pyx_TraceLine(4,0,__PYX_ERR(0, 4, __pyx_L1_error))
12456 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
12457 __Pyx_GOTREF(__pyx_t_1);
12458 __Pyx_INCREF(__pyx_n_s_default_process);
12459 __Pyx_GIVEREF(__pyx_n_s_default_process);
12460 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_default_process);
12461 __pyx_t_2 = __Pyx_Import(__pyx_n_s_rapidfuzz_utils, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
12462 __Pyx_GOTREF(__pyx_t_2);
12463 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12464 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
12465 __Pyx_GOTREF(__pyx_t_1);
12466 if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_process, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
12467 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12468 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12469
12470 /* "cpp_process_cdist.pyx":7
12471 *
12472 * from rapidfuzz.string_metric import (
12473 * levenshtein, # <<<<<<<<<<<<<<
12474 * normalized_levenshtein,
12475 * hamming,
12476 */
12477 __Pyx_TraceLine(7,0,__PYX_ERR(0, 7, __pyx_L1_error))
12478 __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
12479 __Pyx_GOTREF(__pyx_t_2);
12480 __Pyx_INCREF(__pyx_n_s_levenshtein);
12481 __Pyx_GIVEREF(__pyx_n_s_levenshtein);
12482 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_levenshtein);
12483 __Pyx_INCREF(__pyx_n_s_normalized_levenshtein);
12484 __Pyx_GIVEREF(__pyx_n_s_normalized_levenshtein);
12485 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_normalized_levenshtein);
12486 __Pyx_INCREF(__pyx_n_s_hamming);
12487 __Pyx_GIVEREF(__pyx_n_s_hamming);
12488 PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_hamming);
12489 __Pyx_INCREF(__pyx_n_s_normalized_hamming);
12490 __Pyx_GIVEREF(__pyx_n_s_normalized_hamming);
12491 PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_normalized_hamming);
12492 __Pyx_INCREF(__pyx_n_s_jaro_similarity);
12493 __Pyx_GIVEREF(__pyx_n_s_jaro_similarity);
12494 PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_jaro_similarity);
12495 __Pyx_INCREF(__pyx_n_s_jaro_winkler_similarity);
12496 __Pyx_GIVEREF(__pyx_n_s_jaro_winkler_similarity);
12497 PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_jaro_winkler_similarity);
12498
12499 /* "cpp_process_cdist.pyx":6
12500 * from rapidfuzz.utils import default_process
12501 *
12502 * from rapidfuzz.string_metric import ( # <<<<<<<<<<<<<<
12503 * levenshtein,
12504 * normalized_levenshtein,
12505 */
12506 __Pyx_TraceLine(6,0,__PYX_ERR(0, 6, __pyx_L1_error))
12507 __pyx_t_1 = __Pyx_Import(__pyx_n_s_rapidfuzz_string_metric, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
12508 __Pyx_GOTREF(__pyx_t_1);
12509 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12510 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_levenshtein); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
12511 __Pyx_GOTREF(__pyx_t_2);
12512 if (PyDict_SetItem(__pyx_d, __pyx_n_s_levenshtein, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
12513 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12514 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_normalized_levenshtein); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
12515 __Pyx_GOTREF(__pyx_t_2);
12516 if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalized_levenshtein, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
12517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12518 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_hamming); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
12519 __Pyx_GOTREF(__pyx_t_2);
12520 if (PyDict_SetItem(__pyx_d, __pyx_n_s_hamming, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
12521 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12522 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_normalized_hamming); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
12523 __Pyx_GOTREF(__pyx_t_2);
12524 if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalized_hamming, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
12525 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12526 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_jaro_similarity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
12527 __Pyx_GOTREF(__pyx_t_2);
12528 if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaro_similarity, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
12529 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12530 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_jaro_winkler_similarity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
12531 __Pyx_GOTREF(__pyx_t_2);
12532 if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaro_winkler_similarity, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
12533 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12534 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12535
12536 /* "cpp_process_cdist.pyx":16
12537 *
12538 * from rapidfuzz.fuzz import (
12539 * ratio, # <<<<<<<<<<<<<<
12540 * partial_ratio,
12541 * token_sort_ratio,
12542 */
12543 __Pyx_TraceLine(16,0,__PYX_ERR(0, 16, __pyx_L1_error))
12544 __pyx_t_1 = PyList_New(10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
12545 __Pyx_GOTREF(__pyx_t_1);
12546 __Pyx_INCREF(__pyx_n_s_ratio);
12547 __Pyx_GIVEREF(__pyx_n_s_ratio);
12548 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ratio);
12549 __Pyx_INCREF(__pyx_n_s_partial_ratio);
12550 __Pyx_GIVEREF(__pyx_n_s_partial_ratio);
12551 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_partial_ratio);
12552 __Pyx_INCREF(__pyx_n_s_token_sort_ratio);
12553 __Pyx_GIVEREF(__pyx_n_s_token_sort_ratio);
12554 PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_token_sort_ratio);
12555 __Pyx_INCREF(__pyx_n_s_token_set_ratio);
12556 __Pyx_GIVEREF(__pyx_n_s_token_set_ratio);
12557 PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_token_set_ratio);
12558 __Pyx_INCREF(__pyx_n_s_token_ratio);
12559 __Pyx_GIVEREF(__pyx_n_s_token_ratio);
12560 PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_token_ratio);
12561 __Pyx_INCREF(__pyx_n_s_partial_token_sort_ratio);
12562 __Pyx_GIVEREF(__pyx_n_s_partial_token_sort_ratio);
12563 PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_partial_token_sort_ratio);
12564 __Pyx_INCREF(__pyx_n_s_partial_token_set_ratio);
12565 __Pyx_GIVEREF(__pyx_n_s_partial_token_set_ratio);
12566 PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_partial_token_set_ratio);
12567 __Pyx_INCREF(__pyx_n_s_partial_token_ratio);
12568 __Pyx_GIVEREF(__pyx_n_s_partial_token_ratio);
12569 PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_partial_token_ratio);
12570 __Pyx_INCREF(__pyx_n_s_QRatio);
12571 __Pyx_GIVEREF(__pyx_n_s_QRatio);
12572 PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_QRatio);
12573 __Pyx_INCREF(__pyx_n_s_WRatio);
12574 __Pyx_GIVEREF(__pyx_n_s_WRatio);
12575 PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_s_WRatio);
12576
12577 /* "cpp_process_cdist.pyx":15
12578 * )
12579 *
12580 * from rapidfuzz.fuzz import ( # <<<<<<<<<<<<<<
12581 * ratio,
12582 * partial_ratio,
12583 */
12584 __Pyx_TraceLine(15,0,__PYX_ERR(0, 15, __pyx_L1_error))
12585 __pyx_t_2 = __Pyx_Import(__pyx_n_s_rapidfuzz_fuzz, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
12586 __Pyx_GOTREF(__pyx_t_2);
12587 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12588 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12589 __Pyx_GOTREF(__pyx_t_1);
12590 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
12591 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12592 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_partial_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12593 __Pyx_GOTREF(__pyx_t_1);
12594 if (PyDict_SetItem(__pyx_d, __pyx_n_s_partial_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
12595 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12596 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_token_sort_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12597 __Pyx_GOTREF(__pyx_t_1);
12598 if (PyDict_SetItem(__pyx_d, __pyx_n_s_token_sort_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
12599 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12600 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_token_set_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12601 __Pyx_GOTREF(__pyx_t_1);
12602 if (PyDict_SetItem(__pyx_d, __pyx_n_s_token_set_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
12603 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12604 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_token_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12605 __Pyx_GOTREF(__pyx_t_1);
12606 if (PyDict_SetItem(__pyx_d, __pyx_n_s_token_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
12607 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12608 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_partial_token_sort_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12609 __Pyx_GOTREF(__pyx_t_1);
12610 if (PyDict_SetItem(__pyx_d, __pyx_n_s_partial_token_sort_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
12611 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12612 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_partial_token_set_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12613 __Pyx_GOTREF(__pyx_t_1);
12614 if (PyDict_SetItem(__pyx_d, __pyx_n_s_partial_token_set_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
12615 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12616 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_partial_token_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12617 __Pyx_GOTREF(__pyx_t_1);
12618 if (PyDict_SetItem(__pyx_d, __pyx_n_s_partial_token_ratio, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
12619 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12620 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_QRatio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12621 __Pyx_GOTREF(__pyx_t_1);
12622 if (PyDict_SetItem(__pyx_d, __pyx_n_s_QRatio, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
12623 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12624 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
12625 __Pyx_GOTREF(__pyx_t_1);
12626 if (PyDict_SetItem(__pyx_d, __pyx_n_s_WRatio, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
12627 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12628 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12629
12630 /* "cpp_process_cdist.pyx":39
12631 * from cpp_common cimport proc_string, is_valid_string, convert_string, hash_array, hash_sequence, default_process_func
12632 *
12633 * from array import array # <<<<<<<<<<<<<<
12634 * from libc.stdlib cimport malloc, free
12635 *
12636 */
12637 __Pyx_TraceLine(39,0,__PYX_ERR(0, 39, __pyx_L1_error))
12638 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
12639 __Pyx_GOTREF(__pyx_t_2);
12640 __Pyx_INCREF(__pyx_n_s_array);
12641 __Pyx_GIVEREF(__pyx_n_s_array);
12642 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_array);
12643 __pyx_t_1 = __Pyx_Import(__pyx_n_s_array, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
12644 __Pyx_GOTREF(__pyx_t_1);
12645 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12646 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
12647 __Pyx_GOTREF(__pyx_t_2);
12648 if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_2) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
12649 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12650 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12651
12652 /* "cpp_process_cdist.pyx":42
12653 * from libc.stdlib cimport malloc, free
12654 *
12655 * import numpy as np # <<<<<<<<<<<<<<
12656 * cimport numpy as np
12657 * cimport cython
12658 */
12659 __Pyx_TraceLine(42,0,__PYX_ERR(0, 42, __pyx_L1_error))
12660 __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
12661 __Pyx_GOTREF(__pyx_t_1);
12662 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
12663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12664
12665 /* "cpp_process_cdist.pyx":46
12666 * cimport cython
12667 *
12668 * np.import_array() # <<<<<<<<<<<<<<
12669 *
12670 * cdef inline proc_string conv_sequence(seq) except *:
12671 */
12672 __Pyx_TraceLine(46,0,__PYX_ERR(0, 46, __pyx_L1_error))
12673 __pyx_t_3 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 46, __pyx_L1_error)
12674
12675 /* "cpp_process_cdist.pyx":48
12676 * np.import_array()
12677 *
12678 * cdef inline proc_string conv_sequence(seq) except *: # <<<<<<<<<<<<<<
12679 * if is_valid_string(seq):
12680 * return move(convert_string(seq))
12681 */
12682 __Pyx_TraceLine(48,0,__PYX_ERR(0, 48, __pyx_L1_error))
12683
12684
12685 /* "cpp_process_cdist.pyx":122
12686 * void set_score_similarity(np.PyArrayObject*, int, np.npy_intp, np.npy_intp, double)
12687 *
12688 * cdef KwargsContext LevenshteinKwargsInit(dict kwargs) except *: # <<<<<<<<<<<<<<
12689 * cdef KwargsContext context
12690 * cdef LevenshteinWeightTable* weights
12691 */
12692 __Pyx_TraceLine(122,0,__PYX_ERR(0, 122, __pyx_L1_error))
12693
12694
12695 /* "cpp_process_cdist.pyx":140
12696 * return move(context)
12697 *
12698 * cdef inline ScorerFunctionTable CreateNormalizedLevenshteinFunctionTable(): # <<<<<<<<<<<<<<
12699 * cdef ScorerFunctionTable table
12700 * table.kwargs_init = &LevenshteinKwargsInit
12701 */
12702 __Pyx_TraceLine(140,0,__PYX_ERR(0, 140, __pyx_L1_error))
12703
12704
12705 /* "cpp_process_cdist.pyx":146
12706 * return table
12707 *
12708 * cdef inline DistanceFunctionTable CreateLevenshteinFunctionTable(): # <<<<<<<<<<<<<<
12709 * cdef DistanceFunctionTable table
12710 * table.kwargs_init = &LevenshteinKwargsInit
12711 */
12712 __Pyx_TraceLine(146,0,__PYX_ERR(0, 146, __pyx_L1_error))
12713
12714
12715 /* "cpp_process_cdist.pyx":152
12716 * return table
12717 *
12718 * cdef KwargsContext JaroWinklerKwargsInit(dict kwargs) except *: # <<<<<<<<<<<<<<
12719 * cdef KwargsContext context
12720 * cdef double* prefix_weight
12721 */
12722 __Pyx_TraceLine(152,0,__PYX_ERR(0, 152, __pyx_L1_error))
12723
12724
12725 /* "cpp_process_cdist.pyx":166
12726 * return move(context)
12727 *
12728 * cdef inline ScorerFunctionTable CreateJaroWinklerSimilarityFunctionTable(): # <<<<<<<<<<<<<<
12729 * cdef ScorerFunctionTable table
12730 * table.kwargs_init = &JaroWinklerKwargsInit
12731 */
12732 __Pyx_TraceLine(166,0,__PYX_ERR(0, 166, __pyx_L1_error))
12733
12734
12735 /* "cpp_process_cdist.pyx":172
12736 * return table
12737 *
12738 * cdef inline int IsIntegratedScorer(object scorer): # <<<<<<<<<<<<<<
12739 * return (
12740 * scorer is ratio or
12741 */
12742 __Pyx_TraceLine(172,0,__PYX_ERR(0, 172, __pyx_L1_error))
12743
12744
12745 /* "cpp_process_cdist.pyx":190
12746 * )
12747 *
12748 * cdef inline int IsIntegratedDistance(object scorer): # <<<<<<<<<<<<<<
12749 * return (
12750 * scorer is levenshtein or
12751 */
12752 __Pyx_TraceLine(190,0,__PYX_ERR(0, 190, __pyx_L1_error))
12753
12754
12755 /* "cpp_process_cdist.pyx":196
12756 * )
12757 *
12758 * cdef inline ScorerFunctionTable CachedScorerInit(object scorer): # <<<<<<<<<<<<<<
12759 * cdef ScorerFunctionTable context
12760 *
12761 */
12762 __Pyx_TraceLine(196,0,__PYX_ERR(0, 196, __pyx_L1_error))
12763
12764
12765 /* "cpp_process_cdist.pyx":230
12766 * return move(context)
12767 *
12768 * cdef inline DistanceFunctionTable CachedDistanceInit(object scorer): # <<<<<<<<<<<<<<
12769 * cdef DistanceFunctionTable table
12770 *
12771 */
12772 __Pyx_TraceLine(230,0,__PYX_ERR(0, 230, __pyx_L1_error))
12773
12774
12775 /* "cpp_process_cdist.pyx":240
12776 * return table
12777 *
12778 * cdef int dtype_to_type_num_similarity(dtype) except -1: # <<<<<<<<<<<<<<
12779 * if dtype is None or dtype is np.uint8:
12780 * return np.NPY_UINT8
12781 */
12782 __Pyx_TraceLine(240,0,__PYX_ERR(0, 240, __pyx_L1_error))
12783
12784
12785 /* "cpp_process_cdist.pyx":250
12786 * raise TypeError("invalid dtype (use np.uint8, np.float32 or np.float64)")
12787 *
12788 * cdef int dtype_to_type_num_distance(dtype) except -1: # <<<<<<<<<<<<<<
12789 * if dtype is None or dtype is np.int32:
12790 * return np.NPY_INT32
12791 */
12792 __Pyx_TraceLine(250,0,__PYX_ERR(0, 250, __pyx_L1_error))
12793
12794
12795 /* "cpp_process_cdist.pyx":262
12796 * raise TypeError("invalid dtype (use np.int8, np.int16, np.int32 or np.int64)")
12797 *
12798 * cdef inline cdist_two_lists_similarity( # <<<<<<<<<<<<<<
12799 * const vector[proc_string]& queries,
12800 * const vector[proc_string]& choices,
12801 */
12802 __Pyx_TraceLine(262,0,__PYX_ERR(0, 262, __pyx_L1_error))
12803
12804
12805 /* "cpp_process_cdist.pyx":283
12806 * return cdist_two_lists_similarity_impl(kwargs_context, table.init, queries, choices, c_dtype, c_workers, c_score_cutoff)
12807 *
12808 * cdef inline cdist_two_lists_distance( # <<<<<<<<<<<<<<
12809 * const vector[proc_string]& queries, const vector[proc_string]& choices,
12810 * scorer, score_cutoff, dtype, workers, dict kwargs
12811 */
12812 __Pyx_TraceLine(283,0,__PYX_ERR(0, 283, __pyx_L1_error))
12813
12814
12815 /* "cpp_process_cdist.pyx":303
12816 * @cython.boundscheck(False)
12817 * @cython.wraparound(False)
12818 * cdef inline py_cdist_two_lists( # <<<<<<<<<<<<<<
12819 * const vector[PyObject*]& queries, const vector[PyObject*]& choices,
12820 * scorer, score_cutoff, dtype, dict kwargs
12821 */
12822 __Pyx_TraceLine(303,0,__PYX_ERR(0, 303, __pyx_L1_error))
12823
12824
12825 /* "cpp_process_cdist.pyx":332
12826 * return matrix
12827 *
12828 * cdef cdist_two_lists(queries, choices, scorer, processor, score_cutoff, dtype, workers, dict kwargs): # <<<<<<<<<<<<<<
12829 * cdef vector[proc_string] proc_queries
12830 * cdef vector[proc_string] proc_choices
12831 */
12832 __Pyx_TraceLine(332,0,__PYX_ERR(0, 332, __pyx_L1_error))
12833
12834
12835 /* "cpp_process_cdist.pyx":425
12836 * Py_DECREF(<object>item)
12837 *
12838 * cdef inline cdist_single_list_similarity( # <<<<<<<<<<<<<<
12839 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
12840 * ):
12841 */
12842 __Pyx_TraceLine(425,0,__PYX_ERR(0, 425, __pyx_L1_error))
12843
12844
12845 /* "cpp_process_cdist.pyx":444
12846 * return cdist_single_list_similarity_impl(kwargs_context, table.init, queries, c_dtype, c_workers, c_score_cutoff)
12847 *
12848 * cdef inline cdist_single_list_distance( # <<<<<<<<<<<<<<
12849 * const vector[proc_string]& queries, scorer, score_cutoff, dtype, workers, dict kwargs
12850 * ):
12851 */
12852 __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
12853
12854
12855 /* "cpp_process_cdist.pyx":462
12856 *
12857 *
12858 * cdef cdist_single_list(queries, scorer, processor, score_cutoff, dtype, workers, dict kwargs): # <<<<<<<<<<<<<<
12859 * cdef size_t queries_len = <size_t>len(queries)
12860 *
12861 */
12862 __Pyx_TraceLine(462,0,__PYX_ERR(0, 462, __pyx_L1_error))
12863
12864
12865 /* "cpp_process_cdist.pyx":524
12866 * Py_DECREF(<object>item)
12867 *
12868 * def cdist(queries, choices, *, scorer=ratio, processor=None, score_cutoff=None, dtype=None, workers=1, **kwargs): # <<<<<<<<<<<<<<
12869 * """
12870 * Compute distance/similarity between each pair of the two collections of inputs.
12871 */
12872 __Pyx_TraceLine(524,0,__PYX_ERR(0, 524, __pyx_L1_error))
12873 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_process_cdist_1cdist, 0, __pyx_n_s_cdist, NULL, __pyx_n_s_cpp_process_cdist, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
12874 __Pyx_GOTREF(__pyx_t_1);
12875 if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 524, __pyx_L1_error)
12876 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error)
12877 __Pyx_GOTREF(__pyx_t_2);
12878 __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_1)->__pyx_arg_scorer = __pyx_t_2;
12879 __Pyx_GIVEREF(__pyx_t_2);
12880 __pyx_t_2 = 0;
12881 __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_17cpp_process_cdist_2__defaults__);
12882 if (PyDict_SetItem(__pyx_d, __pyx_n_s_cdist, __pyx_t_1) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
12883 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12884
12885 /* "cpp_process_cdist.pyx":1
12886 * # distutils: language=c++ # <<<<<<<<<<<<<<
12887 * # cython: language_level=3, binding=True, linetrace=True
12888 *
12889 */
12890 __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
12891 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12892 __Pyx_GOTREF(__pyx_t_1);
12893 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
12894 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12895
12896 /* "../../../../usr/lib64/python3.9/site-packages/numpy/__init__.cython-30.pxd":1051
12897 *
12898 *
12899 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
12900 * """
12901 * returns the unit part of the dtype for a numpy datetime64 object.
12902 */
12903 __Pyx_TraceReturn(Py_None, 0);
12904
12905 /*--- Wrapped vars code ---*/
12906
12907 goto __pyx_L0;
12908 __pyx_L1_error:;
12909 __Pyx_XDECREF(__pyx_t_1);
12910 __Pyx_XDECREF(__pyx_t_2);
12911 if (__pyx_m) {
12912 if (__pyx_d) {
12913 __Pyx_AddTraceback("init cpp_process_cdist", __pyx_clineno, __pyx_lineno, __pyx_filename);
12914 }
12915 #if !CYTHON_COMPILING_IN_LIMITED_API
12916 Py_CLEAR(__pyx_m);
12917 #endif
12918 } else if (!PyErr_Occurred()) {
12919 PyErr_SetString(PyExc_ImportError, "init cpp_process_cdist");
12920 }
12921 __pyx_L0:;
12922 __Pyx_RefNannyFinishContext();
12923 #if CYTHON_PEP489_MULTI_PHASE_INIT
12924 return (__pyx_m != NULL) ? 0 : -1;
12925 #elif PY_MAJOR_VERSION >= 3
12926 return __pyx_m;
12927 #else
12928 return;
12929 #endif
12930 }
12931 /* #### Code section: cleanup_globals ### */
12932 /* #### Code section: cleanup_module ### */
12933 /* #### Code section: main_method ### */
12934 /* #### Code section: utility_code_pragmas ### */
12935 #if _MSC_VER
12936 #pragma warning( push )
12937 #pragma warning( disable : 4127 )
12938 #endif
12939
12940
12941
12942 /* #### Code section: utility_code_def ### */
12943
12944 /* --- Runtime support code --- */
12945 /* Refnanny */
12946 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)12947 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
12948 PyObject *m = NULL, *p = NULL;
12949 void *r = NULL;
12950 m = PyImport_ImportModule(modname);
12951 if (!m) goto end;
12952 p = PyObject_GetAttrString(m, "RefNannyAPI");
12953 if (!p) goto end;
12954 r = PyLong_AsVoidPtr(p);
12955 end:
12956 Py_XDECREF(p);
12957 Py_XDECREF(m);
12958 return (__Pyx_RefNannyAPIStruct *)r;
12959 }
12960 #endif
12961
12962 /* PyErrExceptionMatches */
12963 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)12964 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
12965 Py_ssize_t i, n;
12966 n = PyTuple_GET_SIZE(tuple);
12967 #if PY_MAJOR_VERSION >= 3
12968 for (i=0; i<n; i++) {
12969 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
12970 }
12971 #endif
12972 for (i=0; i<n; i++) {
12973 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
12974 }
12975 return 0;
12976 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)12977 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
12978 PyObject *exc_type = tstate->curexc_type;
12979 if (exc_type == err) return 1;
12980 if (unlikely(!exc_type)) return 0;
12981 if (unlikely(PyTuple_Check(err)))
12982 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
12983 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
12984 }
12985 #endif
12986
12987 /* PyErrFetchRestore */
12988 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)12989 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12990 PyObject *tmp_type, *tmp_value, *tmp_tb;
12991 tmp_type = tstate->curexc_type;
12992 tmp_value = tstate->curexc_value;
12993 tmp_tb = tstate->curexc_traceback;
12994 tstate->curexc_type = type;
12995 tstate->curexc_value = value;
12996 tstate->curexc_traceback = tb;
12997 Py_XDECREF(tmp_type);
12998 Py_XDECREF(tmp_value);
12999 Py_XDECREF(tmp_tb);
13000 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)13001 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
13002 *type = tstate->curexc_type;
13003 *value = tstate->curexc_value;
13004 *tb = tstate->curexc_traceback;
13005 tstate->curexc_type = 0;
13006 tstate->curexc_value = 0;
13007 tstate->curexc_traceback = 0;
13008 }
13009 #endif
13010
13011 /* PyObjectGetAttrStr */
13012 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)13013 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
13014 PyTypeObject* tp = Py_TYPE(obj);
13015 if (likely(tp->tp_getattro))
13016 return tp->tp_getattro(obj, attr_name);
13017 #if PY_MAJOR_VERSION < 3
13018 if (likely(tp->tp_getattr))
13019 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
13020 #endif
13021 return PyObject_GetAttr(obj, attr_name);
13022 }
13023 #endif
13024
13025 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)13026 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
13027 __Pyx_PyThreadState_declare
13028 __Pyx_PyThreadState_assign
13029 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
13030 __Pyx_PyErr_Clear();
13031 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)13032 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
13033 PyObject *result;
13034 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
13035 PyTypeObject* tp = Py_TYPE(obj);
13036 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
13037 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
13038 }
13039 #endif
13040 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
13041 if (unlikely(!result)) {
13042 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
13043 }
13044 return result;
13045 }
13046
13047 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)13048 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
13049 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
13050 if (unlikely(!result) && !PyErr_Occurred()) {
13051 PyErr_Format(PyExc_NameError,
13052 #if PY_MAJOR_VERSION >= 3
13053 "name '%U' is not defined", name);
13054 #else
13055 "name '%.200s' is not defined", PyString_AS_STRING(name));
13056 #endif
13057 }
13058 return result;
13059 }
13060
13061 /* Profile */
13062 #if CYTHON_PROFILE
__Pyx_TraceSetupAndCall(PyCodeObject ** code,PyFrameObject ** frame,PyThreadState * tstate,const char * funcname,const char * srcfile,int firstlineno)13063 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
13064 PyFrameObject** frame,
13065 PyThreadState* tstate,
13066 const char *funcname,
13067 const char *srcfile,
13068 int firstlineno) {
13069 PyObject *type, *value, *traceback;
13070 int retval;
13071 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
13072 if (*code == NULL) {
13073 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
13074 if (*code == NULL) return 0;
13075 }
13076 *frame = PyFrame_New(
13077 tstate, /*PyThreadState *tstate*/
13078 *code, /*PyCodeObject *code*/
13079 __pyx_d, /*PyObject *globals*/
13080 0 /*PyObject *locals*/
13081 );
13082 if (*frame == NULL) return 0;
13083 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
13084 Py_INCREF(Py_None);
13085 (*frame)->f_trace = Py_None;
13086 }
13087 #if PY_VERSION_HEX < 0x030400B1
13088 } else {
13089 (*frame)->f_tstate = tstate;
13090 #endif
13091 }
13092 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
13093 retval = 1;
13094 tstate->tracing++;
13095 __Pyx_SetTracing(tstate, 0);
13096 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
13097 #if CYTHON_TRACE
13098 if (tstate->c_tracefunc)
13099 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
13100 if (retval && tstate->c_profilefunc)
13101 #endif
13102 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
13103 __Pyx_SetTracing(tstate, (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)));
13104 tstate->tracing--;
13105 if (retval) {
13106 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
13107 return __Pyx_IsTracing(tstate, 0, 0) && retval;
13108 } else {
13109 Py_XDECREF(type);
13110 Py_XDECREF(value);
13111 Py_XDECREF(traceback);
13112 return -1;
13113 }
13114 }
__Pyx_createFrameCodeObject(const char * funcname,const char * srcfile,int firstlineno)13115 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
13116 PyCodeObject *py_code = 0;
13117 #if PY_MAJOR_VERSION >= 3
13118 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
13119 if (likely(py_code)) {
13120 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
13121 }
13122 #else
13123 PyObject *py_srcfile = 0;
13124 PyObject *py_funcname = 0;
13125 py_funcname = PyString_FromString(funcname);
13126 if (unlikely(!py_funcname)) goto bad;
13127 py_srcfile = PyString_FromString(srcfile);
13128 if (unlikely(!py_srcfile)) goto bad;
13129 py_code = PyCode_New(
13130 0,
13131 0,
13132 0,
13133 CO_OPTIMIZED | CO_NEWLOCALS,
13134 __pyx_empty_bytes, /*PyObject *code,*/
13135 __pyx_empty_tuple, /*PyObject *consts,*/
13136 __pyx_empty_tuple, /*PyObject *names,*/
13137 __pyx_empty_tuple, /*PyObject *varnames,*/
13138 __pyx_empty_tuple, /*PyObject *freevars,*/
13139 __pyx_empty_tuple, /*PyObject *cellvars,*/
13140 py_srcfile, /*PyObject *filename,*/
13141 py_funcname, /*PyObject *name,*/
13142 firstlineno,
13143 __pyx_empty_bytes /*PyObject *lnotab*/
13144 );
13145 bad:
13146 Py_XDECREF(py_srcfile);
13147 Py_XDECREF(py_funcname);
13148 #endif
13149 return py_code;
13150 }
13151 #endif
13152
13153 /* PyDictVersioning */
13154 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)13155 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
13156 PyObject *dict = Py_TYPE(obj)->tp_dict;
13157 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
13158 }
__Pyx_get_object_dict_version(PyObject * obj)13159 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
13160 PyObject **dictptr = NULL;
13161 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
13162 if (offset) {
13163 #if CYTHON_COMPILING_IN_CPYTHON
13164 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
13165 #else
13166 dictptr = _PyObject_GetDictPtr(obj);
13167 #endif
13168 }
13169 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
13170 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)13171 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
13172 PyObject *dict = Py_TYPE(obj)->tp_dict;
13173 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
13174 return 0;
13175 return obj_dict_version == __Pyx_get_object_dict_version(obj);
13176 }
13177 #endif
13178
13179 /* GetModuleGlobalName */
13180 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)13181 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
13182 #else
13183 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
13184 #endif
13185 {
13186 PyObject *result;
13187 #if !CYTHON_AVOID_BORROWED_REFS
13188 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
13189 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
13190 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13191 if (likely(result)) {
13192 return __Pyx_NewRef(result);
13193 } else if (unlikely(PyErr_Occurred())) {
13194 return NULL;
13195 }
13196 #elif CYTHON_COMPILING_IN_LIMITED_API
13197 if (unlikely(!__pyx_m)) {
13198 return NULL;
13199 }
13200 result = PyObject_GetAttr(__pyx_m, name);
13201 if (likely(result)) {
13202 return result;
13203 }
13204 #else
13205 result = PyDict_GetItem(__pyx_d, name);
13206 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13207 if (likely(result)) {
13208 return __Pyx_NewRef(result);
13209 }
13210 #endif
13211 #else
13212 result = PyObject_GetItem(__pyx_d, name);
13213 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13214 if (likely(result)) {
13215 return __Pyx_NewRef(result);
13216 }
13217 PyErr_Clear();
13218 #endif
13219 return __Pyx_GetBuiltinName(name);
13220 }
13221
13222 /* PyObjectCall */
13223 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)13224 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13225 PyObject *result;
13226 ternaryfunc call = Py_TYPE(func)->tp_call;
13227 if (unlikely(!call))
13228 return PyObject_Call(func, arg, kw);
13229 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13230 return NULL;
13231 result = (*call)(func, arg, kw);
13232 Py_LeaveRecursiveCall();
13233 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13234 PyErr_SetString(
13235 PyExc_SystemError,
13236 "NULL result without error in PyObject_Call");
13237 }
13238 return result;
13239 }
13240 #endif
13241
13242 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)13243 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
13244 PyObject *method;
13245 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
13246 if (unlikely(!method))
13247 return -1;
13248 target->method = method;
13249 #if CYTHON_COMPILING_IN_CPYTHON
13250 #if PY_MAJOR_VERSION >= 3
13251 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
13252 #endif
13253 {
13254 PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
13255 target->func = descr->d_method->ml_meth;
13256 target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
13257 }
13258 #endif
13259 return 0;
13260 }
13261
13262 /* CallUnboundCMethod1 */
13263 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg)13264 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
13265 if (likely(cfunc->func)) {
13266 int flag = cfunc->flag;
13267 if (flag == METH_O) {
13268 return (*(cfunc->func))(self, arg);
13269 } else if ((PY_VERSION_HEX >= 0x030600B1) && flag == METH_FASTCALL) {
13270 if ((PY_VERSION_HEX >= 0x030700A0)) {
13271 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
13272 } else {
13273 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
13274 }
13275 } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) {
13276 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
13277 }
13278 }
13279 return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
13280 }
13281 #endif
__Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg)13282 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
13283 PyObject *args, *result = NULL;
13284 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
13285 #if CYTHON_COMPILING_IN_CPYTHON
13286 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
13287 args = PyTuple_New(1);
13288 if (unlikely(!args)) goto bad;
13289 Py_INCREF(arg);
13290 PyTuple_SET_ITEM(args, 0, arg);
13291 if (cfunc->flag & METH_KEYWORDS)
13292 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
13293 else
13294 result = (*cfunc->func)(self, args);
13295 } else {
13296 args = PyTuple_New(2);
13297 if (unlikely(!args)) goto bad;
13298 Py_INCREF(self);
13299 PyTuple_SET_ITEM(args, 0, self);
13300 Py_INCREF(arg);
13301 PyTuple_SET_ITEM(args, 1, arg);
13302 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
13303 }
13304 #else
13305 args = PyTuple_Pack(2, self, arg);
13306 if (unlikely(!args)) goto bad;
13307 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
13308 #endif
13309 bad:
13310 Py_XDECREF(args);
13311 return result;
13312 }
13313
13314 /* CallUnboundCMethod2 */
13315 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg1,PyObject * arg2)13316 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
13317 if (likely(cfunc->func)) {
13318 PyObject *args[2] = {arg1, arg2};
13319 if (cfunc->flag == METH_FASTCALL) {
13320 #if PY_VERSION_HEX >= 0x030700A0
13321 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
13322 #else
13323 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
13324 #endif
13325 }
13326 #if PY_VERSION_HEX >= 0x030700A0
13327 if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
13328 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
13329 #endif
13330 }
13331 return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
13332 }
13333 #endif
__Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg1,PyObject * arg2)13334 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
13335 PyObject *args, *result = NULL;
13336 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
13337 #if CYTHON_COMPILING_IN_CPYTHON
13338 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
13339 args = PyTuple_New(2);
13340 if (unlikely(!args)) goto bad;
13341 Py_INCREF(arg1);
13342 PyTuple_SET_ITEM(args, 0, arg1);
13343 Py_INCREF(arg2);
13344 PyTuple_SET_ITEM(args, 1, arg2);
13345 if (cfunc->flag & METH_KEYWORDS)
13346 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
13347 else
13348 result = (*cfunc->func)(self, args);
13349 } else {
13350 args = PyTuple_New(3);
13351 if (unlikely(!args)) goto bad;
13352 Py_INCREF(self);
13353 PyTuple_SET_ITEM(args, 0, self);
13354 Py_INCREF(arg1);
13355 PyTuple_SET_ITEM(args, 1, arg1);
13356 Py_INCREF(arg2);
13357 PyTuple_SET_ITEM(args, 2, arg2);
13358 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
13359 }
13360 #else
13361 args = PyTuple_Pack(3, self, arg1, arg2);
13362 if (unlikely(!args)) goto bad;
13363 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
13364 #endif
13365 bad:
13366 Py_XDECREF(args);
13367 return result;
13368 }
13369
13370 /* dict_getitem_default */
__Pyx_PyDict_GetItemDefault(PyObject * d,PyObject * key,PyObject * default_value)13371 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
13372 PyObject* value;
13373 #if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
13374 value = PyDict_GetItemWithError(d, key);
13375 if (unlikely(!value)) {
13376 if (unlikely(PyErr_Occurred()))
13377 return NULL;
13378 value = default_value;
13379 }
13380 Py_INCREF(value);
13381 if ((1));
13382 #else
13383 if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
13384 value = PyDict_GetItem(d, key);
13385 if (unlikely(!value)) {
13386 value = default_value;
13387 }
13388 Py_INCREF(value);
13389 }
13390 #endif
13391 else {
13392 if (default_value == Py_None)
13393 value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
13394 else
13395 value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
13396 }
13397 return value;
13398 }
13399
13400 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)13401 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
13402 PyErr_Format(PyExc_ValueError,
13403 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
13404 }
13405
13406 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)13407 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
13408 PyErr_Format(PyExc_ValueError,
13409 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
13410 index, (index == 1) ? "" : "s");
13411 }
13412
13413 /* IterFinish */
__Pyx_IterFinish(void)13414 static CYTHON_INLINE int __Pyx_IterFinish(void) {
13415 #if CYTHON_FAST_THREAD_STATE
13416 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13417 PyObject* exc_type = tstate->curexc_type;
13418 if (unlikely(exc_type)) {
13419 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
13420 PyObject *exc_value, *exc_tb;
13421 exc_value = tstate->curexc_value;
13422 exc_tb = tstate->curexc_traceback;
13423 tstate->curexc_type = 0;
13424 tstate->curexc_value = 0;
13425 tstate->curexc_traceback = 0;
13426 Py_DECREF(exc_type);
13427 Py_XDECREF(exc_value);
13428 Py_XDECREF(exc_tb);
13429 return 0;
13430 } else {
13431 return -1;
13432 }
13433 }
13434 return 0;
13435 #else
13436 if (unlikely(PyErr_Occurred())) {
13437 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
13438 PyErr_Clear();
13439 return 0;
13440 } else {
13441 return -1;
13442 }
13443 }
13444 return 0;
13445 #endif
13446 }
13447
13448 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)13449 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
13450 if (unlikely(retval)) {
13451 Py_DECREF(retval);
13452 __Pyx_RaiseTooManyValuesError(expected);
13453 return -1;
13454 } else {
13455 return __Pyx_IterFinish();
13456 }
13457 return 0;
13458 }
13459
13460 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,int clineno,int lineno,const char * filename,int full_traceback,int nogil)13461 static void __Pyx_WriteUnraisable(const char *name, int clineno,
13462 int lineno, const char *filename,
13463 int full_traceback, int nogil) {
13464 PyObject *old_exc, *old_val, *old_tb;
13465 PyObject *ctx;
13466 __Pyx_PyThreadState_declare
13467 #ifdef WITH_THREAD
13468 PyGILState_STATE state;
13469 if (nogil)
13470 state = PyGILState_Ensure();
13471 #ifdef _MSC_VER
13472 else state = (PyGILState_STATE)-1;
13473 #endif
13474 #endif
13475 CYTHON_UNUSED_VAR(clineno);
13476 CYTHON_UNUSED_VAR(lineno);
13477 CYTHON_UNUSED_VAR(filename);
13478 CYTHON_MAYBE_UNUSED_VAR(nogil);
13479 __Pyx_PyThreadState_assign
13480 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
13481 if (full_traceback) {
13482 Py_XINCREF(old_exc);
13483 Py_XINCREF(old_val);
13484 Py_XINCREF(old_tb);
13485 __Pyx_ErrRestore(old_exc, old_val, old_tb);
13486 PyErr_PrintEx(1);
13487 }
13488 #if PY_MAJOR_VERSION < 3
13489 ctx = PyString_FromString(name);
13490 #else
13491 ctx = PyUnicode_FromString(name);
13492 #endif
13493 __Pyx_ErrRestore(old_exc, old_val, old_tb);
13494 if (!ctx) {
13495 PyErr_WriteUnraisable(Py_None);
13496 } else {
13497 PyErr_WriteUnraisable(ctx);
13498 Py_DECREF(ctx);
13499 }
13500 #ifdef WITH_THREAD
13501 if (nogil)
13502 PyGILState_Release(state);
13503 #endif
13504 }
13505
13506 /* RaiseException */
13507 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)13508 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
13509 __Pyx_PyThreadState_declare
13510 CYTHON_UNUSED_VAR(cause);
13511 Py_XINCREF(type);
13512 if (!value || value == Py_None)
13513 value = NULL;
13514 else
13515 Py_INCREF(value);
13516 if (!tb || tb == Py_None)
13517 tb = NULL;
13518 else {
13519 Py_INCREF(tb);
13520 if (!PyTraceBack_Check(tb)) {
13521 PyErr_SetString(PyExc_TypeError,
13522 "raise: arg 3 must be a traceback or None");
13523 goto raise_error;
13524 }
13525 }
13526 if (PyType_Check(type)) {
13527 #if CYTHON_COMPILING_IN_PYPY
13528 if (!value) {
13529 Py_INCREF(Py_None);
13530 value = Py_None;
13531 }
13532 #endif
13533 PyErr_NormalizeException(&type, &value, &tb);
13534 } else {
13535 if (value) {
13536 PyErr_SetString(PyExc_TypeError,
13537 "instance exception may not have a separate value");
13538 goto raise_error;
13539 }
13540 value = type;
13541 type = (PyObject*) Py_TYPE(type);
13542 Py_INCREF(type);
13543 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
13544 PyErr_SetString(PyExc_TypeError,
13545 "raise: exception class must be a subclass of BaseException");
13546 goto raise_error;
13547 }
13548 }
13549 __Pyx_PyThreadState_assign
13550 __Pyx_ErrRestore(type, value, tb);
13551 return;
13552 raise_error:
13553 Py_XDECREF(value);
13554 Py_XDECREF(type);
13555 Py_XDECREF(tb);
13556 return;
13557 }
13558 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)13559 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
13560 PyObject* owned_instance = NULL;
13561 if (tb == Py_None) {
13562 tb = 0;
13563 } else if (tb && !PyTraceBack_Check(tb)) {
13564 PyErr_SetString(PyExc_TypeError,
13565 "raise: arg 3 must be a traceback or None");
13566 goto bad;
13567 }
13568 if (value == Py_None)
13569 value = 0;
13570 if (PyExceptionInstance_Check(type)) {
13571 if (value) {
13572 PyErr_SetString(PyExc_TypeError,
13573 "instance exception may not have a separate value");
13574 goto bad;
13575 }
13576 value = type;
13577 type = (PyObject*) Py_TYPE(value);
13578 } else if (PyExceptionClass_Check(type)) {
13579 PyObject *instance_class = NULL;
13580 if (value && PyExceptionInstance_Check(value)) {
13581 instance_class = (PyObject*) Py_TYPE(value);
13582 if (instance_class != type) {
13583 int is_subclass = PyObject_IsSubclass(instance_class, type);
13584 if (!is_subclass) {
13585 instance_class = NULL;
13586 } else if (unlikely(is_subclass == -1)) {
13587 goto bad;
13588 } else {
13589 type = instance_class;
13590 }
13591 }
13592 }
13593 if (!instance_class) {
13594 PyObject *args;
13595 if (!value)
13596 args = PyTuple_New(0);
13597 else if (PyTuple_Check(value)) {
13598 Py_INCREF(value);
13599 args = value;
13600 } else
13601 args = PyTuple_Pack(1, value);
13602 if (!args)
13603 goto bad;
13604 owned_instance = PyObject_Call(type, args, NULL);
13605 Py_DECREF(args);
13606 if (!owned_instance)
13607 goto bad;
13608 value = owned_instance;
13609 if (!PyExceptionInstance_Check(value)) {
13610 PyErr_Format(PyExc_TypeError,
13611 "calling %R should have returned an instance of "
13612 "BaseException, not %R",
13613 type, Py_TYPE(value));
13614 goto bad;
13615 }
13616 }
13617 } else {
13618 PyErr_SetString(PyExc_TypeError,
13619 "raise: exception class must be a subclass of BaseException");
13620 goto bad;
13621 }
13622 if (cause) {
13623 PyObject *fixed_cause;
13624 if (cause == Py_None) {
13625 fixed_cause = NULL;
13626 } else if (PyExceptionClass_Check(cause)) {
13627 fixed_cause = PyObject_CallObject(cause, NULL);
13628 if (fixed_cause == NULL)
13629 goto bad;
13630 } else if (PyExceptionInstance_Check(cause)) {
13631 fixed_cause = cause;
13632 Py_INCREF(fixed_cause);
13633 } else {
13634 PyErr_SetString(PyExc_TypeError,
13635 "exception causes must derive from "
13636 "BaseException");
13637 goto bad;
13638 }
13639 PyException_SetCause(value, fixed_cause);
13640 }
13641 PyErr_SetObject(type, value);
13642 if (tb) {
13643 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
13644 PyObject *tmp_type, *tmp_value, *tmp_tb;
13645 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
13646 Py_INCREF(tb);
13647 PyErr_Restore(tmp_type, tmp_value, tb);
13648 Py_XDECREF(tmp_tb);
13649 #else
13650 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13651 PyObject* tmp_tb = tstate->curexc_traceback;
13652 if (tb != tmp_tb) {
13653 Py_INCREF(tb);
13654 tstate->curexc_traceback = tb;
13655 Py_XDECREF(tmp_tb);
13656 }
13657 #endif
13658 }
13659 bad:
13660 Py_XDECREF(owned_instance);
13661 return;
13662 }
13663 #endif
13664
13665 /* PyIntCompare */
__Pyx_PyInt_NeObjC(PyObject * op1,PyObject * op2,long intval,long inplace)13666 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
13667 CYTHON_MAYBE_UNUSED_VAR(intval);
13668 CYTHON_UNUSED_VAR(inplace);
13669 if (op1 == op2) {
13670 Py_RETURN_FALSE;
13671 }
13672 #if PY_MAJOR_VERSION < 3
13673 if (likely(PyInt_CheckExact(op1))) {
13674 const long b = intval;
13675 long a = PyInt_AS_LONG(op1);
13676 if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13677 }
13678 #endif
13679 #if CYTHON_USE_PYLONG_INTERNALS
13680 if (likely(PyLong_CheckExact(op1))) {
13681 int unequal;
13682 unsigned long uintval;
13683 Py_ssize_t size = Py_SIZE(op1);
13684 const digit* digits = ((PyLongObject*)op1)->ob_digit;
13685 if (intval == 0) {
13686 if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13687 } else if (intval < 0) {
13688 if (size >= 0)
13689 Py_RETURN_TRUE;
13690 intval = -intval;
13691 size = -size;
13692 } else {
13693 if (size <= 0)
13694 Py_RETURN_TRUE;
13695 }
13696 uintval = (unsigned long) intval;
13697 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
13698 if (uintval >> (PyLong_SHIFT * 4)) {
13699 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13700 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13701 } else
13702 #endif
13703 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
13704 if (uintval >> (PyLong_SHIFT * 3)) {
13705 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13706 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13707 } else
13708 #endif
13709 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
13710 if (uintval >> (PyLong_SHIFT * 2)) {
13711 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13712 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13713 } else
13714 #endif
13715 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
13716 if (uintval >> (PyLong_SHIFT * 1)) {
13717 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13718 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13719 } else
13720 #endif
13721 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
13722 if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13723 }
13724 #endif
13725 if (PyFloat_CheckExact(op1)) {
13726 const long b = intval;
13727 #if CYTHON_COMPILING_IN_LIMITED_API
13728 double a = __pyx_PyFloat_AsDouble(op1);
13729 #else
13730 double a = PyFloat_AS_DOUBLE(op1);
13731 #endif
13732 if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13733 }
13734 return (
13735 PyObject_RichCompare(op1, op2, Py_NE));
13736 }
13737
13738 /* PyFunctionFastCall */
13739 #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)13740 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
13741 PyObject *globals) {
13742 PyFrameObject *f;
13743 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13744 PyObject **fastlocals;
13745 Py_ssize_t i;
13746 PyObject *result;
13747 assert(globals != NULL);
13748 /* XXX Perhaps we should create a specialized
13749 PyFrame_New() that doesn't take locals, but does
13750 take builtins without sanity checking them.
13751 */
13752 assert(tstate != NULL);
13753 f = PyFrame_New(tstate, co, globals, NULL);
13754 if (f == NULL) {
13755 return NULL;
13756 }
13757 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
13758 for (i = 0; i < na; i++) {
13759 Py_INCREF(*args);
13760 fastlocals[i] = *args++;
13761 }
13762 result = PyEval_EvalFrameEx(f,0);
13763 ++tstate->recursion_depth;
13764 Py_DECREF(f);
13765 --tstate->recursion_depth;
13766 return result;
13767 }
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)13768 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
13769 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
13770 PyObject *globals = PyFunction_GET_GLOBALS(func);
13771 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
13772 PyObject *closure;
13773 #if PY_MAJOR_VERSION >= 3
13774 PyObject *kwdefs;
13775 #endif
13776 PyObject *kwtuple, **k;
13777 PyObject **d;
13778 Py_ssize_t nd;
13779 Py_ssize_t nk;
13780 PyObject *result;
13781 assert(kwargs == NULL || PyDict_Check(kwargs));
13782 nk = kwargs ? PyDict_Size(kwargs) : 0;
13783 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
13784 return NULL;
13785 }
13786 if (
13787 #if PY_MAJOR_VERSION >= 3
13788 co->co_kwonlyargcount == 0 &&
13789 #endif
13790 likely(kwargs == NULL || nk == 0) &&
13791 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
13792 if (argdefs == NULL && co->co_argcount == nargs) {
13793 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
13794 goto done;
13795 }
13796 else if (nargs == 0 && argdefs != NULL
13797 && co->co_argcount == Py_SIZE(argdefs)) {
13798 /* function called with no arguments, but all parameters have
13799 a default value: use default values as arguments .*/
13800 args = &PyTuple_GET_ITEM(argdefs, 0);
13801 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
13802 goto done;
13803 }
13804 }
13805 if (kwargs != NULL) {
13806 Py_ssize_t pos, i;
13807 kwtuple = PyTuple_New(2 * nk);
13808 if (kwtuple == NULL) {
13809 result = NULL;
13810 goto done;
13811 }
13812 k = &PyTuple_GET_ITEM(kwtuple, 0);
13813 pos = i = 0;
13814 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
13815 Py_INCREF(k[i]);
13816 Py_INCREF(k[i+1]);
13817 i += 2;
13818 }
13819 nk = i / 2;
13820 }
13821 else {
13822 kwtuple = NULL;
13823 k = NULL;
13824 }
13825 closure = PyFunction_GET_CLOSURE(func);
13826 #if PY_MAJOR_VERSION >= 3
13827 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
13828 #endif
13829 if (argdefs != NULL) {
13830 d = &PyTuple_GET_ITEM(argdefs, 0);
13831 nd = Py_SIZE(argdefs);
13832 }
13833 else {
13834 d = NULL;
13835 nd = 0;
13836 }
13837 #if PY_MAJOR_VERSION >= 3
13838 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
13839 args, (int)nargs,
13840 k, (int)nk,
13841 d, (int)nd, kwdefs, closure);
13842 #else
13843 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
13844 args, (int)nargs,
13845 k, (int)nk,
13846 d, (int)nd, closure);
13847 #endif
13848 Py_XDECREF(kwtuple);
13849 done:
13850 Py_LeaveRecursiveCall();
13851 return result;
13852 }
13853 #endif
13854
13855 /* PyObjectCallMethO */
13856 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)13857 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
13858 PyObject *self, *result;
13859 PyCFunction cfunc;
13860 cfunc = PyCFunction_GET_FUNCTION(func);
13861 self = PyCFunction_GET_SELF(func);
13862 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13863 return NULL;
13864 result = cfunc(self, arg);
13865 Py_LeaveRecursiveCall();
13866 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13867 PyErr_SetString(
13868 PyExc_SystemError,
13869 "NULL result without error in PyObject_Call");
13870 }
13871 return result;
13872 }
13873 #endif
13874
13875 /* PyObjectFastCall */
__Pyx_PyObject_FastCall_fallback(PyObject * func,PyObject ** args,size_t nargs,PyObject * kwargs)13876 static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
13877 PyObject *argstuple;
13878 PyObject *result;
13879 size_t i;
13880 argstuple = PyTuple_New((Py_ssize_t)nargs);
13881 if (unlikely(!argstuple)) return NULL;
13882 for (i = 0; i < nargs; i++) {
13883 Py_INCREF(args[i]);
13884 PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]);
13885 }
13886 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
13887 Py_DECREF(argstuple);
13888 return result;
13889 }
__Pyx_PyObject_FastCallDict(PyObject * func,PyObject ** args,size_t _nargs,PyObject * kwargs)13890 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
13891 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
13892 #if CYTHON_COMPILING_IN_CPYTHON
13893 if (nargs == 0 && kwargs == NULL) {
13894 #ifdef __Pyx_CyFunction_USED
13895 if (__Pyx_IsCyOrPyCFunction(func))
13896 #else
13897 if (PyCFunction_Check(func))
13898 #endif
13899 {
13900 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
13901 return __Pyx_PyObject_CallMethO(func, NULL);
13902 }
13903 }
13904 }
13905 else if (nargs == 1 && kwargs == NULL) {
13906 if (PyCFunction_Check(func))
13907 {
13908 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
13909 return __Pyx_PyObject_CallMethO(func, args[0]);
13910 }
13911 }
13912 }
13913 #endif
13914 #if PY_VERSION_HEX < 0x030800B1
13915 #if CYTHON_FAST_PYCCALL
13916 if (PyCFunction_Check(func)) {
13917 if (kwargs) {
13918 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
13919 } else {
13920 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
13921 }
13922 }
13923 #if PY_VERSION_HEX >= 0x030700A1
13924 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
13925 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
13926 }
13927 #endif
13928 #endif
13929 #if CYTHON_FAST_PYCALL
13930 if (PyFunction_Check(func)) {
13931 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
13932 }
13933 #endif
13934 #endif
13935 #if CYTHON_VECTORCALL
13936 vectorcallfunc f = _PyVectorcall_Function(func);
13937 if (f) {
13938 return f(func, args, (size_t)nargs, kwargs);
13939 }
13940 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
13941 if (__Pyx_CyFunction_CheckExact(func)) {
13942 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
13943 if (f) return f(func, args, (size_t)nargs, kwargs);
13944 }
13945 #endif
13946 if (nargs == 0) {
13947 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
13948 }
13949 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
13950 }
13951
13952 /* GetException */
13953 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)13954 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
13955 #else
13956 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
13957 #endif
13958 {
13959 PyObject *local_type, *local_value, *local_tb;
13960 #if CYTHON_FAST_THREAD_STATE
13961 PyObject *tmp_type, *tmp_value, *tmp_tb;
13962 local_type = tstate->curexc_type;
13963 local_value = tstate->curexc_value;
13964 local_tb = tstate->curexc_traceback;
13965 tstate->curexc_type = 0;
13966 tstate->curexc_value = 0;
13967 tstate->curexc_traceback = 0;
13968 #else
13969 PyErr_Fetch(&local_type, &local_value, &local_tb);
13970 #endif
13971 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
13972 #if CYTHON_FAST_THREAD_STATE
13973 if (unlikely(tstate->curexc_type))
13974 #else
13975 if (unlikely(PyErr_Occurred()))
13976 #endif
13977 goto bad;
13978 #if PY_MAJOR_VERSION >= 3
13979 if (local_tb) {
13980 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
13981 goto bad;
13982 }
13983 #endif
13984 Py_XINCREF(local_tb);
13985 Py_XINCREF(local_type);
13986 Py_XINCREF(local_value);
13987 *type = local_type;
13988 *value = local_value;
13989 *tb = local_tb;
13990 #if CYTHON_FAST_THREAD_STATE
13991 #if CYTHON_USE_EXC_INFO_STACK
13992 {
13993 _PyErr_StackItem *exc_info = tstate->exc_info;
13994 tmp_type = exc_info->exc_type;
13995 tmp_value = exc_info->exc_value;
13996 tmp_tb = exc_info->exc_traceback;
13997 exc_info->exc_type = local_type;
13998 exc_info->exc_value = local_value;
13999 exc_info->exc_traceback = local_tb;
14000 }
14001 #else
14002 tmp_type = tstate->exc_type;
14003 tmp_value = tstate->exc_value;
14004 tmp_tb = tstate->exc_traceback;
14005 tstate->exc_type = local_type;
14006 tstate->exc_value = local_value;
14007 tstate->exc_traceback = local_tb;
14008 #endif
14009 Py_XDECREF(tmp_type);
14010 Py_XDECREF(tmp_value);
14011 Py_XDECREF(tmp_tb);
14012 #else
14013 PyErr_SetExcInfo(local_type, local_value, local_tb);
14014 #endif
14015 return 0;
14016 bad:
14017 *type = 0;
14018 *value = 0;
14019 *tb = 0;
14020 Py_XDECREF(local_type);
14021 Py_XDECREF(local_value);
14022 Py_XDECREF(local_tb);
14023 return -1;
14024 }
14025
14026 /* SwapException */
14027 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14028 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14029 PyObject *tmp_type, *tmp_value, *tmp_tb;
14030 #if CYTHON_USE_EXC_INFO_STACK
14031 _PyErr_StackItem *exc_info = tstate->exc_info;
14032 tmp_type = exc_info->exc_type;
14033 tmp_value = exc_info->exc_value;
14034 tmp_tb = exc_info->exc_traceback;
14035 exc_info->exc_type = *type;
14036 exc_info->exc_value = *value;
14037 exc_info->exc_traceback = *tb;
14038 #else
14039 tmp_type = tstate->exc_type;
14040 tmp_value = tstate->exc_value;
14041 tmp_tb = tstate->exc_traceback;
14042 tstate->exc_type = *type;
14043 tstate->exc_value = *value;
14044 tstate->exc_traceback = *tb;
14045 #endif
14046 *type = tmp_type;
14047 *value = tmp_value;
14048 *tb = tmp_tb;
14049 }
14050 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)14051 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
14052 PyObject *tmp_type, *tmp_value, *tmp_tb;
14053 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
14054 PyErr_SetExcInfo(*type, *value, *tb);
14055 *type = tmp_type;
14056 *value = tmp_value;
14057 *tb = tmp_tb;
14058 }
14059 #endif
14060
14061 /* GetTopmostException */
14062 #if CYTHON_USE_EXC_INFO_STACK
14063 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)14064 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
14065 {
14066 _PyErr_StackItem *exc_info = tstate->exc_info;
14067 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
14068 exc_info->previous_item != NULL)
14069 {
14070 exc_info = exc_info->previous_item;
14071 }
14072 return exc_info;
14073 }
14074 #endif
14075
14076 /* SaveResetException */
14077 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14078 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14079 #if CYTHON_USE_EXC_INFO_STACK
14080 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
14081 *type = exc_info->exc_type;
14082 *value = exc_info->exc_value;
14083 *tb = exc_info->exc_traceback;
14084 #else
14085 *type = tstate->exc_type;
14086 *value = tstate->exc_value;
14087 *tb = tstate->exc_traceback;
14088 #endif
14089 Py_XINCREF(*type);
14090 Py_XINCREF(*value);
14091 Py_XINCREF(*tb);
14092 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)14093 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14094 PyObject *tmp_type, *tmp_value, *tmp_tb;
14095 #if CYTHON_USE_EXC_INFO_STACK
14096 _PyErr_StackItem *exc_info = tstate->exc_info;
14097 tmp_type = exc_info->exc_type;
14098 tmp_value = exc_info->exc_value;
14099 tmp_tb = exc_info->exc_traceback;
14100 exc_info->exc_type = type;
14101 exc_info->exc_value = value;
14102 exc_info->exc_traceback = tb;
14103 #else
14104 tmp_type = tstate->exc_type;
14105 tmp_value = tstate->exc_value;
14106 tmp_tb = tstate->exc_traceback;
14107 tstate->exc_type = type;
14108 tstate->exc_value = value;
14109 tstate->exc_traceback = tb;
14110 #endif
14111 Py_XDECREF(tmp_type);
14112 Py_XDECREF(tmp_value);
14113 Py_XDECREF(tmp_tb);
14114 }
14115 #endif
14116
14117 /* TupleAndListFromArray */
14118 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_copy_object_array(PyObject * const * CYTHON_RESTRICT src,PyObject ** CYTHON_RESTRICT dest,Py_ssize_t length)14119 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
14120 PyObject *v;
14121 Py_ssize_t i;
14122 for (i = 0; i < length; i++) {
14123 v = dest[i] = src[i];
14124 Py_INCREF(v);
14125 }
14126 }
14127 static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject * const * src,Py_ssize_t n)14128 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
14129 {
14130 PyObject *res;
14131 if (n <= 0) {
14132 Py_INCREF(__pyx_empty_tuple);
14133 return __pyx_empty_tuple;
14134 }
14135 res = PyTuple_New(n);
14136 if (unlikely(res == NULL)) return NULL;
14137 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
14138 return res;
14139 }
14140 static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject * const * src,Py_ssize_t n)14141 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
14142 {
14143 PyObject *res;
14144 if (n <= 0) {
14145 return PyList_New(0);
14146 }
14147 res = PyList_New(n);
14148 if (unlikely(res == NULL)) return NULL;
14149 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
14150 return res;
14151 }
14152 #endif
14153
14154 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)14155 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
14156 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
14157 return PyObject_RichCompareBool(s1, s2, equals);
14158 #else
14159 if (s1 == s2) {
14160 return (equals == Py_EQ);
14161 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
14162 const char *ps1, *ps2;
14163 Py_ssize_t length = PyBytes_GET_SIZE(s1);
14164 if (length != PyBytes_GET_SIZE(s2))
14165 return (equals == Py_NE);
14166 ps1 = PyBytes_AS_STRING(s1);
14167 ps2 = PyBytes_AS_STRING(s2);
14168 if (ps1[0] != ps2[0]) {
14169 return (equals == Py_NE);
14170 } else if (length == 1) {
14171 return (equals == Py_EQ);
14172 } else {
14173 int result;
14174 #if CYTHON_USE_UNICODE_INTERNALS
14175 Py_hash_t hash1, hash2;
14176 hash1 = ((PyBytesObject*)s1)->ob_shash;
14177 hash2 = ((PyBytesObject*)s2)->ob_shash;
14178 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
14179 return (equals == Py_NE);
14180 }
14181 #endif
14182 result = memcmp(ps1, ps2, (size_t)length);
14183 return (equals == Py_EQ) ? (result == 0) : (result != 0);
14184 }
14185 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
14186 return (equals == Py_NE);
14187 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
14188 return (equals == Py_NE);
14189 } else {
14190 int result;
14191 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14192 if (!py_result)
14193 return -1;
14194 result = __Pyx_PyObject_IsTrue(py_result);
14195 Py_DECREF(py_result);
14196 return result;
14197 }
14198 #endif
14199 }
14200
14201 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)14202 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
14203 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
14204 return PyObject_RichCompareBool(s1, s2, equals);
14205 #else
14206 #if PY_MAJOR_VERSION < 3
14207 PyObject* owned_ref = NULL;
14208 #endif
14209 int s1_is_unicode, s2_is_unicode;
14210 if (s1 == s2) {
14211 goto return_eq;
14212 }
14213 s1_is_unicode = PyUnicode_CheckExact(s1);
14214 s2_is_unicode = PyUnicode_CheckExact(s2);
14215 #if PY_MAJOR_VERSION < 3
14216 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
14217 owned_ref = PyUnicode_FromObject(s2);
14218 if (unlikely(!owned_ref))
14219 return -1;
14220 s2 = owned_ref;
14221 s2_is_unicode = 1;
14222 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
14223 owned_ref = PyUnicode_FromObject(s1);
14224 if (unlikely(!owned_ref))
14225 return -1;
14226 s1 = owned_ref;
14227 s1_is_unicode = 1;
14228 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
14229 return __Pyx_PyBytes_Equals(s1, s2, equals);
14230 }
14231 #endif
14232 if (s1_is_unicode & s2_is_unicode) {
14233 Py_ssize_t length;
14234 int kind;
14235 void *data1, *data2;
14236 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
14237 return -1;
14238 length = __Pyx_PyUnicode_GET_LENGTH(s1);
14239 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
14240 goto return_ne;
14241 }
14242 #if CYTHON_USE_UNICODE_INTERNALS
14243 {
14244 Py_hash_t hash1, hash2;
14245 #if CYTHON_PEP393_ENABLED
14246 hash1 = ((PyASCIIObject*)s1)->hash;
14247 hash2 = ((PyASCIIObject*)s2)->hash;
14248 #else
14249 hash1 = ((PyUnicodeObject*)s1)->hash;
14250 hash2 = ((PyUnicodeObject*)s2)->hash;
14251 #endif
14252 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
14253 goto return_ne;
14254 }
14255 }
14256 #endif
14257 kind = __Pyx_PyUnicode_KIND(s1);
14258 if (kind != __Pyx_PyUnicode_KIND(s2)) {
14259 goto return_ne;
14260 }
14261 data1 = __Pyx_PyUnicode_DATA(s1);
14262 data2 = __Pyx_PyUnicode_DATA(s2);
14263 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
14264 goto return_ne;
14265 } else if (length == 1) {
14266 goto return_eq;
14267 } else {
14268 int result = memcmp(data1, data2, (size_t)(length * kind));
14269 #if PY_MAJOR_VERSION < 3
14270 Py_XDECREF(owned_ref);
14271 #endif
14272 return (equals == Py_EQ) ? (result == 0) : (result != 0);
14273 }
14274 } else if ((s1 == Py_None) & s2_is_unicode) {
14275 goto return_ne;
14276 } else if ((s2 == Py_None) & s1_is_unicode) {
14277 goto return_ne;
14278 } else {
14279 int result;
14280 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14281 #if PY_MAJOR_VERSION < 3
14282 Py_XDECREF(owned_ref);
14283 #endif
14284 if (!py_result)
14285 return -1;
14286 result = __Pyx_PyObject_IsTrue(py_result);
14287 Py_DECREF(py_result);
14288 return result;
14289 }
14290 return_eq:
14291 #if PY_MAJOR_VERSION < 3
14292 Py_XDECREF(owned_ref);
14293 #endif
14294 return (equals == Py_EQ);
14295 return_ne:
14296 #if PY_MAJOR_VERSION < 3
14297 Py_XDECREF(owned_ref);
14298 #endif
14299 return (equals == Py_NE);
14300 #endif
14301 }
14302
14303 /* fastcall */
14304 #if CYTHON_METH_FASTCALL
__Pyx_GetKwValue_FASTCALL(PyObject * kwnames,PyObject * const * kwvalues,PyObject * s)14305 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
14306 {
14307 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
14308 for (i = 0; i < n; i++)
14309 {
14310 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
14311 }
14312 for (i = 0; i < n; i++)
14313 {
14314 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
14315 if (unlikely(eq != 0)) {
14316 if (unlikely(eq < 0)) return NULL; // error
14317 return kwvalues[i];
14318 }
14319 }
14320 return NULL; // not found (no exception set)
14321 }
14322 #endif
14323
14324 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)14325 static void __Pyx_RaiseArgtupleInvalid(
14326 const char* func_name,
14327 int exact,
14328 Py_ssize_t num_min,
14329 Py_ssize_t num_max,
14330 Py_ssize_t num_found)
14331 {
14332 Py_ssize_t num_expected;
14333 const char *more_or_less;
14334 if (num_found < num_min) {
14335 num_expected = num_min;
14336 more_or_less = "at least";
14337 } else {
14338 num_expected = num_max;
14339 more_or_less = "at most";
14340 }
14341 if (exact) {
14342 more_or_less = "exactly";
14343 }
14344 PyErr_Format(PyExc_TypeError,
14345 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
14346 func_name, more_or_less, num_expected,
14347 (num_expected == 1) ? "" : "s", num_found);
14348 }
14349
14350 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)14351 static void __Pyx_RaiseDoubleKeywordsError(
14352 const char* func_name,
14353 PyObject* kw_name)
14354 {
14355 PyErr_Format(PyExc_TypeError,
14356 #if PY_MAJOR_VERSION >= 3
14357 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
14358 #else
14359 "%s() got multiple values for keyword argument '%s'", func_name,
14360 PyString_AsString(kw_name));
14361 #endif
14362 }
14363
14364 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject * const * kwvalues,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)14365 static int __Pyx_ParseOptionalKeywords(
14366 PyObject *kwds,
14367 PyObject *const *kwvalues,
14368 PyObject **argnames[],
14369 PyObject *kwds2,
14370 PyObject *values[],
14371 Py_ssize_t num_pos_args,
14372 const char* function_name)
14373 {
14374 PyObject *key = 0, *value = 0;
14375 Py_ssize_t pos = 0;
14376 PyObject*** name;
14377 PyObject*** first_kw_arg = argnames + num_pos_args;
14378 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
14379 while (1) {
14380 if (kwds_is_tuple) {
14381 if (pos >= PyTuple_GET_SIZE(kwds)) break;
14382 key = PyTuple_GET_ITEM(kwds, pos);
14383 value = kwvalues[pos];
14384 pos++;
14385 }
14386 else
14387 {
14388 if (!PyDict_Next(kwds, &pos, &key, &value)) break;
14389 }
14390 name = first_kw_arg;
14391 while (*name && (**name != key)) name++;
14392 if (*name) {
14393 values[name-argnames] = value;
14394 continue;
14395 }
14396 name = first_kw_arg;
14397 #if PY_MAJOR_VERSION < 3
14398 if (likely(PyString_Check(key))) {
14399 while (*name) {
14400 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
14401 && _PyString_Eq(**name, key)) {
14402 values[name-argnames] = value;
14403 break;
14404 }
14405 name++;
14406 }
14407 if (*name) continue;
14408 else {
14409 PyObject*** argname = argnames;
14410 while (argname != first_kw_arg) {
14411 if ((**argname == key) || (
14412 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
14413 && _PyString_Eq(**argname, key))) {
14414 goto arg_passed_twice;
14415 }
14416 argname++;
14417 }
14418 }
14419 } else
14420 #endif
14421 if (likely(PyUnicode_Check(key))) {
14422 while (*name) {
14423 int cmp = (
14424 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
14425 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
14426 #endif
14427 PyUnicode_Compare(**name, key)
14428 );
14429 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
14430 if (cmp == 0) {
14431 values[name-argnames] = value;
14432 break;
14433 }
14434 name++;
14435 }
14436 if (*name) continue;
14437 else {
14438 PyObject*** argname = argnames;
14439 while (argname != first_kw_arg) {
14440 int cmp = (**argname == key) ? 0 :
14441 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
14442 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
14443 #endif
14444 PyUnicode_Compare(**argname, key);
14445 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
14446 if (cmp == 0) goto arg_passed_twice;
14447 argname++;
14448 }
14449 }
14450 } else
14451 goto invalid_keyword_type;
14452 if (kwds2) {
14453 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
14454 } else {
14455 goto invalid_keyword;
14456 }
14457 }
14458 return 0;
14459 arg_passed_twice:
14460 __Pyx_RaiseDoubleKeywordsError(function_name, key);
14461 goto bad;
14462 invalid_keyword_type:
14463 PyErr_Format(PyExc_TypeError,
14464 "%.200s() keywords must be strings", function_name);
14465 goto bad;
14466 invalid_keyword:
14467 #if PY_MAJOR_VERSION < 3
14468 PyErr_Format(PyExc_TypeError,
14469 "%.200s() got an unexpected keyword argument '%.200s'",
14470 function_name, PyString_AsString(key));
14471 #else
14472 PyErr_Format(PyExc_TypeError,
14473 "%s() got an unexpected keyword argument '%U'",
14474 function_name, key);
14475 #endif
14476 bad:
14477 return -1;
14478 }
14479
14480 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)14481 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
14482 PyObject *r;
14483 if (unlikely(!j)) return NULL;
14484 r = PyObject_GetItem(o, j);
14485 Py_DECREF(j);
14486 return r;
14487 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)14488 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
14489 CYTHON_NCP_UNUSED int wraparound,
14490 CYTHON_NCP_UNUSED int boundscheck) {
14491 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14492 Py_ssize_t wrapped_i = i;
14493 if (wraparound & unlikely(i < 0)) {
14494 wrapped_i += PyList_GET_SIZE(o);
14495 }
14496 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
14497 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
14498 Py_INCREF(r);
14499 return r;
14500 }
14501 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14502 #else
14503 return PySequence_GetItem(o, i);
14504 #endif
14505 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)14506 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
14507 CYTHON_NCP_UNUSED int wraparound,
14508 CYTHON_NCP_UNUSED int boundscheck) {
14509 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14510 Py_ssize_t wrapped_i = i;
14511 if (wraparound & unlikely(i < 0)) {
14512 wrapped_i += PyTuple_GET_SIZE(o);
14513 }
14514 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
14515 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
14516 Py_INCREF(r);
14517 return r;
14518 }
14519 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14520 #else
14521 return PySequence_GetItem(o, i);
14522 #endif
14523 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)14524 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
14525 CYTHON_NCP_UNUSED int wraparound,
14526 CYTHON_NCP_UNUSED int boundscheck) {
14527 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
14528 if (is_list || PyList_CheckExact(o)) {
14529 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
14530 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
14531 PyObject *r = PyList_GET_ITEM(o, n);
14532 Py_INCREF(r);
14533 return r;
14534 }
14535 }
14536 else if (PyTuple_CheckExact(o)) {
14537 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
14538 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
14539 PyObject *r = PyTuple_GET_ITEM(o, n);
14540 Py_INCREF(r);
14541 return r;
14542 }
14543 } else {
14544 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
14545 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
14546 if (mm && mm->mp_subscript) {
14547 PyObject *r, *key = PyInt_FromSsize_t(i);
14548 if (unlikely(!key)) return NULL;
14549 r = mm->mp_subscript(o, key);
14550 Py_DECREF(key);
14551 return r;
14552 }
14553 if (likely(sm && sm->sq_item)) {
14554 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
14555 Py_ssize_t l = sm->sq_length(o);
14556 if (likely(l >= 0)) {
14557 i += l;
14558 } else {
14559 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
14560 return NULL;
14561 PyErr_Clear();
14562 }
14563 }
14564 return sm->sq_item(o, i);
14565 }
14566 }
14567 #else
14568 if (is_list || PySequence_Check(o)) {
14569 return PySequence_GetItem(o, i);
14570 }
14571 #endif
14572 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14573 }
14574
14575 /* TypeImport */
14576 #ifndef __PYX_HAVE_RT_ImportType
14577 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)14578 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
14579 size_t size, enum __Pyx_ImportType_CheckSize check_size)
14580 {
14581 PyObject *result = 0;
14582 char warning[200];
14583 Py_ssize_t basicsize;
14584 #if CYTHON_COMPILING_IN_LIMITED_API
14585 PyObject *py_basicsize;
14586 #endif
14587 result = PyObject_GetAttrString(module, class_name);
14588 if (!result)
14589 goto bad;
14590 if (!PyType_Check(result)) {
14591 PyErr_Format(PyExc_TypeError,
14592 "%.200s.%.200s is not a type object",
14593 module_name, class_name);
14594 goto bad;
14595 }
14596 #if !CYTHON_COMPILING_IN_LIMITED_API
14597 basicsize = ((PyTypeObject *)result)->tp_basicsize;
14598 #else
14599 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
14600 if (!py_basicsize)
14601 goto bad;
14602 basicsize = PyLong_AsSsize_t(py_basicsize);
14603 Py_DECREF(py_basicsize);
14604 py_basicsize = 0;
14605 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
14606 goto bad;
14607 #endif
14608 if ((size_t)basicsize < size) {
14609 PyErr_Format(PyExc_ValueError,
14610 "%.200s.%.200s size changed, may indicate binary incompatibility. "
14611 "Expected %zd from C header, got %zd from PyObject",
14612 module_name, class_name, size, basicsize);
14613 goto bad;
14614 }
14615 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
14616 PyErr_Format(PyExc_ValueError,
14617 "%.200s.%.200s size changed, may indicate binary incompatibility. "
14618 "Expected %zd from C header, got %zd from PyObject",
14619 module_name, class_name, size, basicsize);
14620 goto bad;
14621 }
14622 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
14623 PyOS_snprintf(warning, sizeof(warning),
14624 "%s.%s size changed, may indicate binary incompatibility. "
14625 "Expected %zd from C header, got %zd from PyObject",
14626 module_name, class_name, size, basicsize);
14627 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
14628 }
14629 return (PyTypeObject *)result;
14630 bad:
14631 Py_XDECREF(result);
14632 return NULL;
14633 }
14634 #endif
14635
14636 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)14637 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
14638 PyObject *module = 0;
14639 PyObject *empty_dict = 0;
14640 PyObject *empty_list = 0;
14641 #if PY_MAJOR_VERSION < 3
14642 PyObject *py_import;
14643 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
14644 if (unlikely(!py_import))
14645 goto bad;
14646 if (!from_list) {
14647 empty_list = PyList_New(0);
14648 if (unlikely(!empty_list))
14649 goto bad;
14650 from_list = empty_list;
14651 }
14652 #endif
14653 empty_dict = PyDict_New();
14654 if (unlikely(!empty_dict))
14655 goto bad;
14656 {
14657 #if PY_MAJOR_VERSION >= 3
14658 if (level == -1) {
14659 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
14660 #if CYTHON_COMPILING_IN_LIMITED_API
14661 module = PyImport_ImportModuleLevelObject(
14662 name, empty_dict, empty_dict, from_list, 1);
14663 #else
14664 module = PyImport_ImportModuleLevelObject(
14665 name, __pyx_d, empty_dict, from_list, 1);
14666 #endif
14667 if (unlikely(!module)) {
14668 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
14669 goto bad;
14670 PyErr_Clear();
14671 }
14672 }
14673 level = 0;
14674 }
14675 #endif
14676 if (!module) {
14677 #if PY_MAJOR_VERSION < 3
14678 PyObject *py_level = PyInt_FromLong(level);
14679 if (unlikely(!py_level))
14680 goto bad;
14681 module = PyObject_CallFunctionObjArgs(py_import,
14682 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
14683 Py_DECREF(py_level);
14684 #else
14685 #if CYTHON_COMPILING_IN_LIMITED_API
14686 module = PyImport_ImportModuleLevelObject(
14687 name, empty_dict, empty_dict, from_list, level);
14688 #else
14689 module = PyImport_ImportModuleLevelObject(
14690 name, __pyx_d, empty_dict, from_list, level);
14691 #endif
14692 #endif
14693 }
14694 }
14695 bad:
14696 Py_XDECREF(empty_dict);
14697 Py_XDECREF(empty_list);
14698 #if PY_MAJOR_VERSION < 3
14699 Py_XDECREF(py_import);
14700 #endif
14701 return module;
14702 }
14703
14704 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)14705 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
14706 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
14707 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
14708 PyErr_Format(PyExc_ImportError,
14709 #if PY_MAJOR_VERSION < 3
14710 "cannot import name %.230s", PyString_AS_STRING(name));
14711 #else
14712 "cannot import name %S", name);
14713 #endif
14714 }
14715 return value;
14716 }
14717
14718 /* ImportDottedModule */
14719 #if PY_MAJOR_VERSION >= 3
__Pyx__ImportDottedModule_Error(PyObject * name,PyObject * parts_tuple,Py_ssize_t count)14720 static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
14721 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
14722 if (unlikely(PyErr_Occurred())) {
14723 PyErr_Clear();
14724 }
14725 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
14726 partial_name = name;
14727 } else {
14728 slice = PySequence_GetSlice(parts_tuple, 0, count);
14729 if (unlikely(!slice))
14730 goto bad;
14731 sep = PyUnicode_FromStringAndSize(".", 1);
14732 if (unlikely(!sep))
14733 goto bad;
14734 partial_name = PyUnicode_Join(sep, slice);
14735 }
14736 PyErr_Format(
14737 #if PY_MAJOR_VERSION < 3
14738 PyExc_ImportError,
14739 "No module named '%s'", PyString_AS_STRING(partial_name));
14740 #else
14741 #if PY_VERSION_HEX >= 0x030600B1
14742 PyExc_ModuleNotFoundError,
14743 #else
14744 PyExc_ImportError,
14745 #endif
14746 "No module named '%U'", partial_name);
14747 #endif
14748 bad:
14749 Py_XDECREF(sep);
14750 Py_XDECREF(slice);
14751 Py_XDECREF(partial_name);
14752 return NULL;
14753 }
14754 #endif
14755 #if PY_MAJOR_VERSION >= 3
__Pyx__ImportDottedModule_Lookup(PyObject * name)14756 static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
14757 PyObject *imported_module;
14758 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
14759 PyObject *modules = PyImport_GetModuleDict();
14760 if (unlikely(!modules))
14761 return NULL;
14762 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
14763 Py_XINCREF(imported_module);
14764 #else
14765 imported_module = PyImport_GetModule(name);
14766 #endif
14767 return imported_module;
14768 }
14769 #endif
__Pyx__ImportDottedModule(PyObject * name,PyObject * parts_tuple)14770 static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
14771 #if PY_MAJOR_VERSION < 3
14772 PyObject *module, *from_list, *star = __pyx_n_s__8;
14773 CYTHON_UNUSED_VAR(parts_tuple);
14774 from_list = PyList_New(1);
14775 if (unlikely(!from_list))
14776 return NULL;
14777 Py_INCREF(star);
14778 PyList_SET_ITEM(from_list, 0, star);
14779 module = __Pyx_Import(name, from_list, 0);
14780 Py_DECREF(from_list);
14781 return module;
14782 #else
14783 Py_ssize_t i, nparts;
14784 PyObject *imported_module;
14785 PyObject *module = __Pyx_Import(name, NULL, 0);
14786 if (!parts_tuple || unlikely(!module))
14787 return module;
14788 imported_module = __Pyx__ImportDottedModule_Lookup(name);
14789 if (likely(imported_module)) {
14790 Py_DECREF(module);
14791 return imported_module;
14792 }
14793 PyErr_Clear();
14794 nparts = PyTuple_GET_SIZE(parts_tuple);
14795 for (i=1; i < nparts && module; i++) {
14796 PyObject *part, *submodule;
14797 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14798 part = PyTuple_GET_ITEM(parts_tuple, i);
14799 #else
14800 part = PySequence_ITEM(parts_tuple, i);
14801 #endif
14802 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
14803 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
14804 Py_DECREF(part);
14805 #endif
14806 Py_DECREF(module);
14807 module = submodule;
14808 }
14809 if (likely(module))
14810 return module;
14811 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
14812 #endif
14813 }
__Pyx_ImportDottedModule(PyObject * name,PyObject * parts_tuple)14814 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
14815 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
14816 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
14817 if (likely(module)) {
14818 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
14819 if (likely(spec)) {
14820 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
14821 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
14822 Py_DECREF(spec);
14823 spec = NULL;
14824 }
14825 Py_XDECREF(unsafe);
14826 }
14827 if (likely(!spec)) {
14828 PyErr_Clear();
14829 return module;
14830 }
14831 Py_DECREF(spec);
14832 Py_DECREF(module);
14833 } else if (PyErr_Occurred()) {
14834 PyErr_Clear();
14835 }
14836 #endif
14837 return __Pyx__ImportDottedModule(name, parts_tuple);
14838 }
14839
14840 /* FixUpExtensionType */
14841 #if CYTHON_USE_TYPE_SPECS
__Pyx_fix_up_extension_type_from_spec(PyType_Spec * spec,PyTypeObject * type)14842 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
14843 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
14844 (void) spec;
14845 (void) type;
14846 #else
14847 const PyType_Slot *slot = spec->slots;
14848 while (slot && slot->slot && slot->slot != Py_tp_members)
14849 slot++;
14850 if (slot && slot->slot == Py_tp_members) {
14851 int changed = 0;
14852 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
14853 const
14854 #endif
14855 PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
14856 while (memb && memb->name) {
14857 if (memb->name[0] == '_' && memb->name[1] == '_') {
14858 #if PY_VERSION_HEX < 0x030900b1
14859 if (strcmp(memb->name, "__weaklistoffset__") == 0) {
14860 assert(memb->type == T_PYSSIZET);
14861 assert(memb->flags == READONLY);
14862 type->tp_weaklistoffset = memb->offset;
14863 changed = 1;
14864 }
14865 else if (strcmp(memb->name, "__dictoffset__") == 0) {
14866 assert(memb->type == T_PYSSIZET);
14867 assert(memb->flags == READONLY);
14868 type->tp_dictoffset = memb->offset;
14869 changed = 1;
14870 }
14871 #if CYTHON_METH_FASTCALL
14872 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
14873 assert(memb->type == T_PYSSIZET);
14874 assert(memb->flags == READONLY);
14875 #if PY_VERSION_HEX >= 0x030800b4
14876 type->tp_vectorcall_offset = memb->offset;
14877 #else
14878 type->tp_print = (printfunc) memb->offset;
14879 #endif
14880 changed = 1;
14881 }
14882 #endif
14883 #else
14884 if ((0));
14885 #endif
14886 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
14887 else if (strcmp(memb->name, "__module__") == 0) {
14888 PyObject *descr;
14889 assert(memb->type == T_OBJECT);
14890 assert(memb->flags == 0 || memb->flags == READONLY);
14891 descr = PyDescr_NewMember(type, memb);
14892 if (unlikely(!descr))
14893 return -1;
14894 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
14895 Py_DECREF(descr);
14896 return -1;
14897 }
14898 Py_DECREF(descr);
14899 changed = 1;
14900 }
14901 #endif
14902 }
14903 memb++;
14904 }
14905 if (changed)
14906 PyType_Modified(type);
14907 }
14908 #endif
14909 return 0;
14910 }
14911 #endif
14912
14913 /* FetchCommonType */
__Pyx_FetchSharedCythonABIModule(void)14914 static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
14915 PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME);
14916 if (!abi_module) return NULL;
14917 Py_INCREF(abi_module);
14918 return abi_module;
14919 }
__Pyx_VerifyCachedType(PyObject * cached_type,const char * name,Py_ssize_t basicsize,Py_ssize_t expected_basicsize)14920 static int __Pyx_VerifyCachedType(PyObject *cached_type,
14921 const char *name,
14922 Py_ssize_t basicsize,
14923 Py_ssize_t expected_basicsize) {
14924 if (!PyType_Check(cached_type)) {
14925 PyErr_Format(PyExc_TypeError,
14926 "Shared Cython type %.200s is not a type object", name);
14927 return -1;
14928 }
14929 if (basicsize != expected_basicsize) {
14930 PyErr_Format(PyExc_TypeError,
14931 "Shared Cython type %.200s has the wrong size, try recompiling",
14932 name);
14933 return -1;
14934 }
14935 return 0;
14936 }
14937 #if !CYTHON_USE_TYPE_SPECS
__Pyx_FetchCommonType(PyTypeObject * type)14938 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
14939 PyObject* abi_module;
14940 PyTypeObject *cached_type = NULL;
14941 abi_module = __Pyx_FetchSharedCythonABIModule();
14942 if (!abi_module) return NULL;
14943 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, type->tp_name);
14944 if (cached_type) {
14945 if (__Pyx_VerifyCachedType(
14946 (PyObject *)cached_type,
14947 type->tp_name,
14948 cached_type->tp_basicsize,
14949 type->tp_basicsize) < 0) {
14950 goto bad;
14951 }
14952 goto done;
14953 }
14954 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
14955 PyErr_Clear();
14956 if (PyType_Ready(type) < 0) goto bad;
14957 if (PyObject_SetAttrString(abi_module, type->tp_name, (PyObject *)type) < 0)
14958 goto bad;
14959 Py_INCREF(type);
14960 cached_type = type;
14961 done:
14962 Py_DECREF(abi_module);
14963 return cached_type;
14964 bad:
14965 Py_XDECREF(cached_type);
14966 cached_type = NULL;
14967 goto done;
14968 }
14969 #else
__Pyx_FetchCommonTypeFromSpec(PyObject * module,PyType_Spec * spec,PyObject * bases)14970 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
14971 PyObject *abi_module, *cached_type = NULL;
14972 abi_module = __Pyx_FetchSharedCythonABIModule();
14973 if (!abi_module) return NULL;
14974 cached_type = PyObject_GetAttrString(abi_module, spec->name);
14975 if (cached_type) {
14976 Py_ssize_t basicsize;
14977 #if CYTHON_COMPILING_IN_LIMITED_API
14978 PyObject *py_basicsize;
14979 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
14980 if (unlikely(!py_basicsize)) goto bad;
14981 basicsize = PyLong_AsSsize_t(py_basicsize);
14982 Py_DECREF(py_basicsize);
14983 py_basicsize = 0;
14984 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
14985 #else
14986 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
14987 #endif
14988 if (__Pyx_VerifyCachedType(
14989 cached_type,
14990 spec->name,
14991 basicsize,
14992 spec->basicsize) < 0) {
14993 goto bad;
14994 }
14995 goto done;
14996 }
14997 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
14998 PyErr_Clear();
14999 (void) module;
15000 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
15001 if (unlikely(!cached_type)) goto bad;
15002 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
15003 if (PyObject_SetAttrString(abi_module, spec->name, cached_type) < 0) goto bad;
15004 done:
15005 Py_DECREF(abi_module);
15006 assert(cached_type == NULL || PyType_Check(cached_type));
15007 return (PyTypeObject *) cached_type;
15008 bad:
15009 Py_XDECREF(cached_type);
15010 cached_type = NULL;
15011 goto done;
15012 }
15013 #endif
15014
15015 /* PyVectorcallFastCallDict */
15016 #if CYTHON_METH_FASTCALL
__Pyx_PyVectorcall_FastCallDict_kw(PyObject * func,__pyx_vectorcallfunc vc,PyObject * const * args,size_t nargs,PyObject * kw)15017 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
15018 {
15019 PyObject *res = NULL;
15020 PyObject *kwnames;
15021 PyObject **newargs;
15022 PyObject **kwvalues;
15023 Py_ssize_t i, pos;
15024 size_t j;
15025 PyObject *key, *value;
15026 unsigned long keys_are_strings;
15027 Py_ssize_t nkw = PyDict_GET_SIZE(kw);
15028 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
15029 if (unlikely(newargs == NULL)) {
15030 PyErr_NoMemory();
15031 return NULL;
15032 }
15033 for (j = 0; j < nargs; j++) newargs[j] = args[j];
15034 kwnames = PyTuple_New(nkw);
15035 if (unlikely(kwnames == NULL)) {
15036 PyMem_Free(newargs);
15037 return NULL;
15038 }
15039 kwvalues = newargs + nargs;
15040 pos = i = 0;
15041 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
15042 while (PyDict_Next(kw, &pos, &key, &value)) {
15043 keys_are_strings &= Py_TYPE(key)->tp_flags;
15044 Py_INCREF(key);
15045 Py_INCREF(value);
15046 PyTuple_SET_ITEM(kwnames, i, key);
15047 kwvalues[i] = value;
15048 i++;
15049 }
15050 if (unlikely(!keys_are_strings)) {
15051 PyErr_SetString(PyExc_TypeError, "keywords must be strings");
15052 goto cleanup;
15053 }
15054 res = vc(func, newargs, nargs, kwnames);
15055 cleanup:
15056 Py_DECREF(kwnames);
15057 for (i = 0; i < nkw; i++)
15058 Py_DECREF(kwvalues[i]);
15059 PyMem_Free(newargs);
15060 return res;
15061 }
__Pyx_PyVectorcall_FastCallDict(PyObject * func,__pyx_vectorcallfunc vc,PyObject * const * args,size_t nargs,PyObject * kw)15062 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
15063 {
15064 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
15065 return vc(func, args, nargs, NULL);
15066 }
15067 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
15068 }
15069 #endif
15070
15071 /* CythonFunctionShared */
__Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject * f,PyObject * classobj)15072 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
15073 #if PY_VERSION_HEX < 0x030900B1
15074 __Pyx_Py_XDECREF_SET(
15075 __Pyx_CyFunction_GetClassObj(f),
15076 ((classobj) ? __Pyx_NewRef(classobj) : NULL));
15077 #else
15078 __Pyx_Py_XDECREF_SET(
15079 ((PyCMethodObject *) (f))->mm_class,
15080 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
15081 #endif
15082 }
15083 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,void * closure)15084 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
15085 {
15086 CYTHON_UNUSED_VAR(closure);
15087 if (unlikely(op->func_doc == NULL)) {
15088 if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
15089 #if PY_MAJOR_VERSION >= 3
15090 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
15091 #else
15092 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
15093 #endif
15094 if (unlikely(op->func_doc == NULL))
15095 return NULL;
15096 } else {
15097 Py_INCREF(Py_None);
15098 return Py_None;
15099 }
15100 }
15101 Py_INCREF(op->func_doc);
15102 return op->func_doc;
15103 }
15104 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,void * context)15105 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
15106 {
15107 CYTHON_UNUSED_VAR(context);
15108 if (value == NULL) {
15109 value = Py_None;
15110 }
15111 Py_INCREF(value);
15112 __Pyx_Py_XDECREF_SET(op->func_doc, value);
15113 return 0;
15114 }
15115 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,void * context)15116 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
15117 {
15118 CYTHON_UNUSED_VAR(context);
15119 if (unlikely(op->func_name == NULL)) {
15120 #if PY_MAJOR_VERSION >= 3
15121 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
15122 #else
15123 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
15124 #endif
15125 if (unlikely(op->func_name == NULL))
15126 return NULL;
15127 }
15128 Py_INCREF(op->func_name);
15129 return op->func_name;
15130 }
15131 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,void * context)15132 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
15133 {
15134 CYTHON_UNUSED_VAR(context);
15135 #if PY_MAJOR_VERSION >= 3
15136 if (unlikely(value == NULL || !PyUnicode_Check(value)))
15137 #else
15138 if (unlikely(value == NULL || !PyString_Check(value)))
15139 #endif
15140 {
15141 PyErr_SetString(PyExc_TypeError,
15142 "__name__ must be set to a string object");
15143 return -1;
15144 }
15145 Py_INCREF(value);
15146 __Pyx_Py_XDECREF_SET(op->func_name, value);
15147 return 0;
15148 }
15149 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,void * context)15150 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
15151 {
15152 CYTHON_UNUSED_VAR(context);
15153 Py_INCREF(op->func_qualname);
15154 return op->func_qualname;
15155 }
15156 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,void * context)15157 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
15158 {
15159 CYTHON_UNUSED_VAR(context);
15160 #if PY_MAJOR_VERSION >= 3
15161 if (unlikely(value == NULL || !PyUnicode_Check(value)))
15162 #else
15163 if (unlikely(value == NULL || !PyString_Check(value)))
15164 #endif
15165 {
15166 PyErr_SetString(PyExc_TypeError,
15167 "__qualname__ must be set to a string object");
15168 return -1;
15169 }
15170 Py_INCREF(value);
15171 __Pyx_Py_XDECREF_SET(op->func_qualname, value);
15172 return 0;
15173 }
15174 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,void * context)15175 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
15176 {
15177 CYTHON_UNUSED_VAR(context);
15178 if (unlikely(op->func_dict == NULL)) {
15179 op->func_dict = PyDict_New();
15180 if (unlikely(op->func_dict == NULL))
15181 return NULL;
15182 }
15183 Py_INCREF(op->func_dict);
15184 return op->func_dict;
15185 }
15186 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,void * context)15187 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
15188 {
15189 CYTHON_UNUSED_VAR(context);
15190 if (unlikely(value == NULL)) {
15191 PyErr_SetString(PyExc_TypeError,
15192 "function's dictionary may not be deleted");
15193 return -1;
15194 }
15195 if (unlikely(!PyDict_Check(value))) {
15196 PyErr_SetString(PyExc_TypeError,
15197 "setting function's dictionary to a non-dict");
15198 return -1;
15199 }
15200 Py_INCREF(value);
15201 __Pyx_Py_XDECREF_SET(op->func_dict, value);
15202 return 0;
15203 }
15204 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,void * context)15205 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
15206 {
15207 CYTHON_UNUSED_VAR(context);
15208 Py_INCREF(op->func_globals);
15209 return op->func_globals;
15210 }
15211 static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject * op,void * context)15212 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
15213 {
15214 CYTHON_UNUSED_VAR(op);
15215 CYTHON_UNUSED_VAR(context);
15216 Py_INCREF(Py_None);
15217 return Py_None;
15218 }
15219 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,void * context)15220 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
15221 {
15222 PyObject* result = (op->func_code) ? op->func_code : Py_None;
15223 CYTHON_UNUSED_VAR(context);
15224 Py_INCREF(result);
15225 return result;
15226 }
15227 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)15228 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
15229 int result = 0;
15230 PyObject *res = op->defaults_getter((PyObject *) op);
15231 if (unlikely(!res))
15232 return -1;
15233 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15234 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
15235 Py_INCREF(op->defaults_tuple);
15236 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
15237 Py_INCREF(op->defaults_kwdict);
15238 #else
15239 op->defaults_tuple = PySequence_ITEM(res, 0);
15240 if (unlikely(!op->defaults_tuple)) result = -1;
15241 else {
15242 op->defaults_kwdict = PySequence_ITEM(res, 1);
15243 if (unlikely(!op->defaults_kwdict)) result = -1;
15244 }
15245 #endif
15246 Py_DECREF(res);
15247 return result;
15248 }
15249 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,void * context)15250 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
15251 CYTHON_UNUSED_VAR(context);
15252 if (!value) {
15253 value = Py_None;
15254 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
15255 PyErr_SetString(PyExc_TypeError,
15256 "__defaults__ must be set to a tuple object");
15257 return -1;
15258 }
15259 Py_INCREF(value);
15260 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
15261 return 0;
15262 }
15263 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,void * context)15264 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
15265 PyObject* result = op->defaults_tuple;
15266 CYTHON_UNUSED_VAR(context);
15267 if (unlikely(!result)) {
15268 if (op->defaults_getter) {
15269 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
15270 result = op->defaults_tuple;
15271 } else {
15272 result = Py_None;
15273 }
15274 }
15275 Py_INCREF(result);
15276 return result;
15277 }
15278 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,void * context)15279 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
15280 CYTHON_UNUSED_VAR(context);
15281 if (!value) {
15282 value = Py_None;
15283 } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
15284 PyErr_SetString(PyExc_TypeError,
15285 "__kwdefaults__ must be set to a dict object");
15286 return -1;
15287 }
15288 Py_INCREF(value);
15289 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
15290 return 0;
15291 }
15292 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,void * context)15293 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
15294 PyObject* result = op->defaults_kwdict;
15295 CYTHON_UNUSED_VAR(context);
15296 if (unlikely(!result)) {
15297 if (op->defaults_getter) {
15298 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
15299 result = op->defaults_kwdict;
15300 } else {
15301 result = Py_None;
15302 }
15303 }
15304 Py_INCREF(result);
15305 return result;
15306 }
15307 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,void * context)15308 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
15309 CYTHON_UNUSED_VAR(context);
15310 if (!value || value == Py_None) {
15311 value = NULL;
15312 } else if (unlikely(!PyDict_Check(value))) {
15313 PyErr_SetString(PyExc_TypeError,
15314 "__annotations__ must be set to a dict object");
15315 return -1;
15316 }
15317 Py_XINCREF(value);
15318 __Pyx_Py_XDECREF_SET(op->func_annotations, value);
15319 return 0;
15320 }
15321 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,void * context)15322 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
15323 PyObject* result = op->func_annotations;
15324 CYTHON_UNUSED_VAR(context);
15325 if (unlikely(!result)) {
15326 result = PyDict_New();
15327 if (unlikely(!result)) return NULL;
15328 op->func_annotations = result;
15329 }
15330 Py_INCREF(result);
15331 return result;
15332 }
15333 static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject * op,void * context)15334 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
15335 int is_coroutine;
15336 CYTHON_UNUSED_VAR(context);
15337 if (op->func_is_coroutine) {
15338 return __Pyx_NewRef(op->func_is_coroutine);
15339 }
15340 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
15341 #if PY_VERSION_HEX >= 0x03050000
15342 if (is_coroutine) {
15343 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
15344 fromlist = PyList_New(1);
15345 if (unlikely(!fromlist)) return NULL;
15346 Py_INCREF(marker);
15347 PyList_SET_ITEM(fromlist, 0, marker);
15348 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
15349 Py_DECREF(fromlist);
15350 if (unlikely(!module)) goto ignore;
15351 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
15352 Py_DECREF(module);
15353 if (likely(op->func_is_coroutine)) {
15354 return __Pyx_NewRef(op->func_is_coroutine);
15355 }
15356 ignore:
15357 PyErr_Clear();
15358 }
15359 #endif
15360 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
15361 return __Pyx_NewRef(op->func_is_coroutine);
15362 }
15363 static PyGetSetDef __pyx_CyFunction_getsets[] = {
15364 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
15365 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
15366 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
15367 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
15368 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
15369 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
15370 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
15371 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
15372 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
15373 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
15374 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
15375 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
15376 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
15377 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
15378 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
15379 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
15380 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
15381 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
15382 {0, 0, 0, 0, 0}
15383 };
15384 static PyMemberDef __pyx_CyFunction_members[] = {
15385 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
15386 #if CYTHON_USE_TYPE_SPECS
15387 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
15388 #if CYTHON_METH_FASTCALL
15389 #if CYTHON_BACKPORT_VECTORCALL
15390 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
15391 #else
15392 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
15393 #endif
15394 #endif
15395 #if PY_VERSION_HEX < 0x030500A0
15396 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
15397 #else
15398 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
15399 #endif
15400 #endif
15401 {0, 0, 0, 0, 0}
15402 };
15403 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,PyObject * args)15404 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
15405 {
15406 CYTHON_UNUSED_VAR(args);
15407 #if PY_MAJOR_VERSION >= 3
15408 Py_INCREF(m->func_qualname);
15409 return m->func_qualname;
15410 #else
15411 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
15412 #endif
15413 }
15414 static PyMethodDef __pyx_CyFunction_methods[] = {
15415 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
15416 {0, 0, 0, 0}
15417 };
15418 #if PY_VERSION_HEX < 0x030500A0
15419 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
15420 #else
15421 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
15422 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)15423 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
15424 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
15425 PyCFunctionObject *cf = (PyCFunctionObject*) op;
15426 if (unlikely(op == NULL))
15427 return NULL;
15428 op->flags = flags;
15429 __Pyx_CyFunction_weakreflist(op) = NULL;
15430 cf->m_ml = ml;
15431 cf->m_self = (PyObject *) op;
15432 Py_XINCREF(closure);
15433 op->func_closure = closure;
15434 Py_XINCREF(module);
15435 cf->m_module = module;
15436 op->func_dict = NULL;
15437 op->func_name = NULL;
15438 Py_INCREF(qualname);
15439 op->func_qualname = qualname;
15440 op->func_doc = NULL;
15441 #if PY_VERSION_HEX < 0x030900B1
15442 op->func_classobj = NULL;
15443 #else
15444 ((PyCMethodObject*)op)->mm_class = NULL;
15445 #endif
15446 op->func_globals = globals;
15447 Py_INCREF(op->func_globals);
15448 Py_XINCREF(code);
15449 op->func_code = code;
15450 op->defaults_pyobjects = 0;
15451 op->defaults_size = 0;
15452 op->defaults = NULL;
15453 op->defaults_tuple = NULL;
15454 op->defaults_kwdict = NULL;
15455 op->defaults_getter = NULL;
15456 op->func_annotations = NULL;
15457 op->func_is_coroutine = NULL;
15458 #if CYTHON_METH_FASTCALL
15459 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
15460 case METH_NOARGS:
15461 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
15462 break;
15463 case METH_O:
15464 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
15465 break;
15466 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
15467 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
15468 break;
15469 case METH_FASTCALL | METH_KEYWORDS:
15470 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
15471 break;
15472 case METH_VARARGS | METH_KEYWORDS:
15473 __Pyx_CyFunction_func_vectorcall(op) = NULL;
15474 break;
15475 default:
15476 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
15477 Py_DECREF(op);
15478 return NULL;
15479 }
15480 #endif
15481 return (PyObject *) op;
15482 }
15483 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)15484 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
15485 {
15486 Py_CLEAR(m->func_closure);
15487 Py_CLEAR(((PyCFunctionObject*)m)->m_module);
15488 Py_CLEAR(m->func_dict);
15489 Py_CLEAR(m->func_name);
15490 Py_CLEAR(m->func_qualname);
15491 Py_CLEAR(m->func_doc);
15492 Py_CLEAR(m->func_globals);
15493 Py_CLEAR(m->func_code);
15494 #if PY_VERSION_HEX < 0x030900B1
15495 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
15496 #else
15497 {
15498 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
15499 ((PyCMethodObject *) (m))->mm_class = NULL;
15500 Py_XDECREF(cls);
15501 }
15502 #endif
15503 Py_CLEAR(m->defaults_tuple);
15504 Py_CLEAR(m->defaults_kwdict);
15505 Py_CLEAR(m->func_annotations);
15506 Py_CLEAR(m->func_is_coroutine);
15507 if (m->defaults) {
15508 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15509 int i;
15510 for (i = 0; i < m->defaults_pyobjects; i++)
15511 Py_XDECREF(pydefaults[i]);
15512 PyObject_Free(m->defaults);
15513 m->defaults = NULL;
15514 }
15515 return 0;
15516 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)15517 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
15518 {
15519 if (__Pyx_CyFunction_weakreflist(m) != NULL)
15520 PyObject_ClearWeakRefs((PyObject *) m);
15521 __Pyx_CyFunction_clear(m);
15522 __Pyx_PyHeapTypeObject_GC_Del(m);
15523 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)15524 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
15525 {
15526 PyObject_GC_UnTrack(m);
15527 __Pyx__CyFunction_dealloc(m);
15528 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)15529 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
15530 {
15531 Py_VISIT(m->func_closure);
15532 Py_VISIT(((PyCFunctionObject*)m)->m_module);
15533 Py_VISIT(m->func_dict);
15534 Py_VISIT(m->func_name);
15535 Py_VISIT(m->func_qualname);
15536 Py_VISIT(m->func_doc);
15537 Py_VISIT(m->func_globals);
15538 Py_VISIT(m->func_code);
15539 Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
15540 Py_VISIT(m->defaults_tuple);
15541 Py_VISIT(m->defaults_kwdict);
15542 Py_VISIT(m->func_is_coroutine);
15543 if (m->defaults) {
15544 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15545 int i;
15546 for (i = 0; i < m->defaults_pyobjects; i++)
15547 Py_VISIT(pydefaults[i]);
15548 }
15549 return 0;
15550 }
15551 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)15552 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
15553 {
15554 #if PY_MAJOR_VERSION >= 3
15555 return PyUnicode_FromFormat("<cyfunction %U at %p>",
15556 op->func_qualname, (void *)op);
15557 #else
15558 return PyString_FromFormat("<cyfunction %s at %p>",
15559 PyString_AsString(op->func_qualname), (void *)op);
15560 #endif
15561 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)15562 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
15563 PyCFunctionObject* f = (PyCFunctionObject*)func;
15564 PyCFunction meth = f->m_ml->ml_meth;
15565 Py_ssize_t size;
15566 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
15567 case METH_VARARGS:
15568 if (likely(kw == NULL || PyDict_Size(kw) == 0))
15569 return (*meth)(self, arg);
15570 break;
15571 case METH_VARARGS | METH_KEYWORDS:
15572 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
15573 case METH_NOARGS:
15574 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
15575 size = PyTuple_GET_SIZE(arg);
15576 if (likely(size == 0))
15577 return (*meth)(self, NULL);
15578 PyErr_Format(PyExc_TypeError,
15579 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
15580 f->m_ml->ml_name, size);
15581 return NULL;
15582 }
15583 break;
15584 case METH_O:
15585 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
15586 size = PyTuple_GET_SIZE(arg);
15587 if (likely(size == 1)) {
15588 PyObject *result, *arg0;
15589 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15590 arg0 = PyTuple_GET_ITEM(arg, 0);
15591 #else
15592 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
15593 #endif
15594 result = (*meth)(self, arg0);
15595 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
15596 Py_DECREF(arg0);
15597 #endif
15598 return result;
15599 }
15600 PyErr_Format(PyExc_TypeError,
15601 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
15602 f->m_ml->ml_name, size);
15603 return NULL;
15604 }
15605 break;
15606 default:
15607 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
15608 return NULL;
15609 }
15610 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
15611 f->m_ml->ml_name);
15612 return NULL;
15613 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)15614 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
15615 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
15616 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)15617 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
15618 PyObject *result;
15619 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
15620 #if CYTHON_METH_FASTCALL
15621 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
15622 if (vc) {
15623 #if CYTHON_ASSUME_SAFE_MACROS
15624 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
15625 #else
15626 (void) &__Pyx_PyVectorcall_FastCallDict;
15627 return PyVectorcall_Call(func, args, kw);
15628 #endif
15629 }
15630 #endif
15631 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
15632 Py_ssize_t argc;
15633 PyObject *new_args;
15634 PyObject *self;
15635 argc = PyTuple_GET_SIZE(args);
15636 new_args = PyTuple_GetSlice(args, 1, argc);
15637 if (unlikely(!new_args))
15638 return NULL;
15639 self = PyTuple_GetItem(args, 0);
15640 if (unlikely(!self)) {
15641 Py_DECREF(new_args);
15642 return NULL;
15643 }
15644 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
15645 Py_DECREF(new_args);
15646 } else {
15647 result = __Pyx_CyFunction_Call(func, args, kw);
15648 }
15649 return result;
15650 }
15651 #if CYTHON_METH_FASTCALL
__Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject * cyfunc,Py_ssize_t nargs,PyObject * kwnames)15652 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
15653 {
15654 int ret = 0;
15655 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
15656 if (unlikely(nargs < 1)) {
15657 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
15658 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
15659 return -1;
15660 }
15661 ret = 1;
15662 }
15663 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
15664 PyErr_Format(PyExc_TypeError,
15665 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
15666 return -1;
15667 }
15668 return ret;
15669 }
__Pyx_CyFunction_Vectorcall_NOARGS(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)15670 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
15671 {
15672 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
15673 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
15674 #if CYTHON_BACKPORT_VECTORCALL
15675 Py_ssize_t nargs = (Py_ssize_t)nargsf;
15676 #else
15677 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
15678 #endif
15679 PyObject *self;
15680 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
15681 case 1:
15682 self = args[0];
15683 args += 1;
15684 nargs -= 1;
15685 break;
15686 case 0:
15687 self = ((PyCFunctionObject*)cyfunc)->m_self;
15688 break;
15689 default:
15690 return NULL;
15691 }
15692 if (unlikely(nargs != 0)) {
15693 PyErr_Format(PyExc_TypeError,
15694 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
15695 def->ml_name, nargs);
15696 return NULL;
15697 }
15698 return def->ml_meth(self, NULL);
15699 }
__Pyx_CyFunction_Vectorcall_O(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)15700 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
15701 {
15702 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
15703 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
15704 #if CYTHON_BACKPORT_VECTORCALL
15705 Py_ssize_t nargs = (Py_ssize_t)nargsf;
15706 #else
15707 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
15708 #endif
15709 PyObject *self;
15710 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
15711 case 1:
15712 self = args[0];
15713 args += 1;
15714 nargs -= 1;
15715 break;
15716 case 0:
15717 self = ((PyCFunctionObject*)cyfunc)->m_self;
15718 break;
15719 default:
15720 return NULL;
15721 }
15722 if (unlikely(nargs != 1)) {
15723 PyErr_Format(PyExc_TypeError,
15724 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
15725 def->ml_name, nargs);
15726 return NULL;
15727 }
15728 return def->ml_meth(self, args[0]);
15729 }
__Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)15730 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
15731 {
15732 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
15733 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
15734 #if CYTHON_BACKPORT_VECTORCALL
15735 Py_ssize_t nargs = (Py_ssize_t)nargsf;
15736 #else
15737 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
15738 #endif
15739 PyObject *self;
15740 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
15741 case 1:
15742 self = args[0];
15743 args += 1;
15744 nargs -= 1;
15745 break;
15746 case 0:
15747 self = ((PyCFunctionObject*)cyfunc)->m_self;
15748 break;
15749 default:
15750 return NULL;
15751 }
15752 return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
15753 }
__Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)15754 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
15755 {
15756 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
15757 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
15758 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
15759 #if CYTHON_BACKPORT_VECTORCALL
15760 Py_ssize_t nargs = (Py_ssize_t)nargsf;
15761 #else
15762 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
15763 #endif
15764 PyObject *self;
15765 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
15766 case 1:
15767 self = args[0];
15768 args += 1;
15769 nargs -= 1;
15770 break;
15771 case 0:
15772 self = ((PyCFunctionObject*)cyfunc)->m_self;
15773 break;
15774 default:
15775 return NULL;
15776 }
15777 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, nargs, kwnames);
15778 }
15779 #endif
15780 #if CYTHON_USE_TYPE_SPECS
15781 static PyType_Slot __pyx_CyFunctionType_slots[] = {
15782 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
15783 {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
15784 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
15785 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
15786 {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
15787 {Py_tp_methods, (void *)__pyx_CyFunction_methods},
15788 {Py_tp_members, (void *)__pyx_CyFunction_members},
15789 {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
15790 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
15791 {0, 0},
15792 };
15793 static PyType_Spec __pyx_CyFunctionType_spec = {
15794 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
15795 sizeof(__pyx_CyFunctionObject),
15796 0,
15797 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
15798 Py_TPFLAGS_METHOD_DESCRIPTOR |
15799 #endif
15800 #ifdef _Py_TPFLAGS_HAVE_VECTORCALL
15801 _Py_TPFLAGS_HAVE_VECTORCALL |
15802 #endif
15803 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
15804 __pyx_CyFunctionType_slots
15805 };
15806 #else
15807 static PyTypeObject __pyx_CyFunctionType_type = {
15808 PyVarObject_HEAD_INIT(0, 0)
15809 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
15810 sizeof(__pyx_CyFunctionObject),
15811 0,
15812 (destructor) __Pyx_CyFunction_dealloc,
15813 #if !CYTHON_METH_FASTCALL
15814 0,
15815 #elif CYTHON_BACKPORT_VECTORCALL
15816 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
15817 #else
15818 offsetof(PyCFunctionObject, vectorcall),
15819 #endif
15820 0,
15821 0,
15822 #if PY_MAJOR_VERSION < 3
15823 0,
15824 #else
15825 0,
15826 #endif
15827 (reprfunc) __Pyx_CyFunction_repr,
15828 0,
15829 0,
15830 0,
15831 0,
15832 __Pyx_CyFunction_CallAsMethod,
15833 0,
15834 0,
15835 0,
15836 0,
15837 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
15838 Py_TPFLAGS_METHOD_DESCRIPTOR |
15839 #endif
15840 #ifdef _Py_TPFLAGS_HAVE_VECTORCALL
15841 _Py_TPFLAGS_HAVE_VECTORCALL |
15842 #endif
15843 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
15844 0,
15845 (traverseproc) __Pyx_CyFunction_traverse,
15846 (inquiry) __Pyx_CyFunction_clear,
15847 0,
15848 #if PY_VERSION_HEX < 0x030500A0
15849 offsetof(__pyx_CyFunctionObject, func_weakreflist),
15850 #else
15851 offsetof(PyCFunctionObject, m_weakreflist),
15852 #endif
15853 0,
15854 0,
15855 __pyx_CyFunction_methods,
15856 __pyx_CyFunction_members,
15857 __pyx_CyFunction_getsets,
15858 0,
15859 0,
15860 __Pyx_PyMethod_New,
15861 0,
15862 offsetof(__pyx_CyFunctionObject, func_dict),
15863 0,
15864 0,
15865 0,
15866 0,
15867 0,
15868 0,
15869 0,
15870 0,
15871 0,
15872 0,
15873 0,
15874 0,
15875 #if PY_VERSION_HEX >= 0x030400a1
15876 0,
15877 #endif
15878 #if PY_VERSION_HEX >= 0x030800b1
15879 0,
15880 #endif
15881 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15882 0,
15883 #endif
15884 #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
15885 0,
15886 #endif
15887 };
15888 #endif
__pyx_CyFunction_init(PyObject * module)15889 static int __pyx_CyFunction_init(PyObject *module) {
15890 #if CYTHON_USE_TYPE_SPECS
15891 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
15892 #else
15893 (void) module;
15894 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
15895 #endif
15896 if (unlikely(__pyx_CyFunctionType == NULL)) {
15897 return -1;
15898 }
15899 return 0;
15900 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)15901 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
15902 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15903 m->defaults = PyObject_Malloc(size);
15904 if (unlikely(!m->defaults))
15905 return PyErr_NoMemory();
15906 memset(m->defaults, 0, size);
15907 m->defaults_pyobjects = pyobjects;
15908 m->defaults_size = size;
15909 return m->defaults;
15910 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)15911 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
15912 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15913 m->defaults_tuple = tuple;
15914 Py_INCREF(tuple);
15915 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)15916 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
15917 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15918 m->defaults_kwdict = dict;
15919 Py_INCREF(dict);
15920 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)15921 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
15922 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15923 m->func_annotations = dict;
15924 Py_INCREF(dict);
15925 }
15926
15927 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)15928 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
15929 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
15930 PyObject *op = __Pyx_CyFunction_Init(
15931 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
15932 ml, flags, qualname, closure, module, globals, code
15933 );
15934 if (likely(op)) {
15935 PyObject_GC_Track(op);
15936 }
15937 return op;
15938 }
15939
15940 /* CLineInTraceback */
15941 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)15942 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
15943 PyObject *use_cline;
15944 PyObject *ptype, *pvalue, *ptraceback;
15945 #if CYTHON_COMPILING_IN_CPYTHON
15946 PyObject **cython_runtime_dict;
15947 #endif
15948 if (unlikely(!__pyx_cython_runtime)) {
15949 return c_line;
15950 }
15951 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
15952 #if CYTHON_COMPILING_IN_CPYTHON
15953 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
15954 if (likely(cython_runtime_dict)) {
15955 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
15956 use_cline, *cython_runtime_dict,
15957 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
15958 } else
15959 #endif
15960 {
15961 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
15962 if (use_cline_obj) {
15963 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
15964 Py_DECREF(use_cline_obj);
15965 } else {
15966 PyErr_Clear();
15967 use_cline = NULL;
15968 }
15969 }
15970 if (!use_cline) {
15971 c_line = 0;
15972 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
15973 }
15974 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
15975 c_line = 0;
15976 }
15977 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
15978 return c_line;
15979 }
15980 #endif
15981
15982 /* CodeObjectCache */
15983 #if !CYTHON_COMPILING_IN_LIMITED_API
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)15984 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
15985 int start = 0, mid = 0, end = count - 1;
15986 if (end >= 0 && code_line > entries[end].code_line) {
15987 return count;
15988 }
15989 while (start < end) {
15990 mid = start + (end - start) / 2;
15991 if (code_line < entries[mid].code_line) {
15992 end = mid;
15993 } else if (code_line > entries[mid].code_line) {
15994 start = mid + 1;
15995 } else {
15996 return mid;
15997 }
15998 }
15999 if (code_line <= entries[mid].code_line) {
16000 return mid;
16001 } else {
16002 return mid + 1;
16003 }
16004 }
__pyx_find_code_object(int code_line)16005 static PyCodeObject *__pyx_find_code_object(int code_line) {
16006 PyCodeObject* code_object;
16007 int pos;
16008 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
16009 return NULL;
16010 }
16011 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16012 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
16013 return NULL;
16014 }
16015 code_object = __pyx_code_cache.entries[pos].code_object;
16016 Py_INCREF(code_object);
16017 return code_object;
16018 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)16019 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
16020 int pos, i;
16021 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
16022 if (unlikely(!code_line)) {
16023 return;
16024 }
16025 if (unlikely(!entries)) {
16026 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
16027 if (likely(entries)) {
16028 __pyx_code_cache.entries = entries;
16029 __pyx_code_cache.max_count = 64;
16030 __pyx_code_cache.count = 1;
16031 entries[0].code_line = code_line;
16032 entries[0].code_object = code_object;
16033 Py_INCREF(code_object);
16034 }
16035 return;
16036 }
16037 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16038 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
16039 PyCodeObject* tmp = entries[pos].code_object;
16040 entries[pos].code_object = code_object;
16041 Py_DECREF(tmp);
16042 return;
16043 }
16044 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
16045 int new_max = __pyx_code_cache.max_count + 64;
16046 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
16047 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
16048 if (unlikely(!entries)) {
16049 return;
16050 }
16051 __pyx_code_cache.entries = entries;
16052 __pyx_code_cache.max_count = new_max;
16053 }
16054 for (i=__pyx_code_cache.count; i>pos; i--) {
16055 entries[i] = entries[i-1];
16056 }
16057 entries[pos].code_line = code_line;
16058 entries[pos].code_object = code_object;
16059 __pyx_code_cache.count++;
16060 Py_INCREF(code_object);
16061 }
16062 #endif
16063
16064 /* AddTraceback */
16065 #include "compile.h"
16066 #include "frameobject.h"
16067 #include "traceback.h"
16068 #if CYTHON_COMPILING_IN_LIMITED_API
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)16069 static void __Pyx_AddTraceback(const char *funcname, int c_line,
16070 int py_line, const char *filename) {
16071 if (c_line) {
16072 (void) __pyx_cfilenm;
16073 c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
16074 }
16075 _PyTraceback_Add(funcname, filename, c_line ? -c_line : py_line);
16076 }
16077 #else
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)16078 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
16079 const char *funcname, int c_line,
16080 int py_line, const char *filename) {
16081 PyCodeObject *py_code = 0;
16082 PyObject *py_srcfile = 0;
16083 PyObject *py_funcname = 0;
16084 #if PY_MAJOR_VERSION < 3
16085 py_srcfile = PyString_FromString(filename);
16086 #else
16087 py_srcfile = PyUnicode_FromString(filename);
16088 #endif
16089 if (!py_srcfile) goto bad;
16090 if (c_line) {
16091 #if PY_MAJOR_VERSION < 3
16092 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16093 #else
16094 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16095 #endif
16096 }
16097 else {
16098 #if PY_MAJOR_VERSION < 3
16099 py_funcname = PyString_FromString(funcname);
16100 #else
16101 py_funcname = PyUnicode_FromString(funcname);
16102 #endif
16103 }
16104 if (!py_funcname) goto bad;
16105 py_code = __Pyx_PyCode_New(
16106 0,
16107 0,
16108 0,
16109 0,
16110 0,
16111 0,
16112 __pyx_empty_bytes, /*PyObject *code,*/
16113 __pyx_empty_tuple, /*PyObject *consts,*/
16114 __pyx_empty_tuple, /*PyObject *names,*/
16115 __pyx_empty_tuple, /*PyObject *varnames,*/
16116 __pyx_empty_tuple, /*PyObject *freevars,*/
16117 __pyx_empty_tuple, /*PyObject *cellvars,*/
16118 py_srcfile, /*PyObject *filename,*/
16119 py_funcname, /*PyObject *name,*/
16120 py_line,
16121 __pyx_empty_bytes /*PyObject *lnotab*/
16122 );
16123 Py_DECREF(py_srcfile);
16124 Py_DECREF(py_funcname);
16125 return py_code;
16126 bad:
16127 Py_XDECREF(py_srcfile);
16128 Py_XDECREF(py_funcname);
16129 return NULL;
16130 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)16131 static void __Pyx_AddTraceback(const char *funcname, int c_line,
16132 int py_line, const char *filename) {
16133 PyCodeObject *py_code = 0;
16134 PyFrameObject *py_frame = 0;
16135 PyThreadState *tstate = __Pyx_PyThreadState_Current;
16136 if (c_line) {
16137 c_line = __Pyx_CLineForTraceback(tstate, c_line);
16138 }
16139 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
16140 if (!py_code) {
16141 py_code = __Pyx_CreateCodeObjectForTraceback(
16142 funcname, c_line, py_line, filename);
16143 if (!py_code) goto bad;
16144 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
16145 }
16146 py_frame = PyFrame_New(
16147 tstate, /*PyThreadState *tstate,*/
16148 py_code, /*PyCodeObject *code,*/
16149 __pyx_d, /*PyObject *globals,*/
16150 0 /*PyObject *locals*/
16151 );
16152 if (!py_frame) goto bad;
16153 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
16154 PyTraceBack_Here(py_frame);
16155 bad:
16156 Py_XDECREF(py_code);
16157 Py_XDECREF(py_frame);
16158 }
16159 #endif
16160
16161 /* CIntFromPyVerify */
16162 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
16163 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
16164 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
16165 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
16166 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
16167 {\
16168 func_type value = func_value;\
16169 if (sizeof(target_type) < sizeof(func_type)) {\
16170 if (unlikely(value != (func_type) (target_type) value)) {\
16171 func_type zero = 0;\
16172 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
16173 return (target_type) -1;\
16174 if (is_unsigned && unlikely(value < zero))\
16175 goto raise_neg_overflow;\
16176 else\
16177 goto raise_overflow;\
16178 }\
16179 }\
16180 return (target_type) value;\
16181 }
16182
16183 /* UnicodeAsUCS4 */
__Pyx_PyUnicode_AsPy_UCS4(PyObject * x)16184 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
16185 Py_ssize_t length;
16186 #if CYTHON_PEP393_ENABLED
16187 length = PyUnicode_GET_LENGTH(x);
16188 if (likely(length == 1)) {
16189 return PyUnicode_READ_CHAR(x, 0);
16190 }
16191 #else
16192 length = PyUnicode_GET_SIZE(x);
16193 if (likely(length == 1)) {
16194 return PyUnicode_AS_UNICODE(x)[0];
16195 }
16196 #if Py_UNICODE_SIZE == 2
16197 else if (PyUnicode_GET_SIZE(x) == 2) {
16198 Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
16199 if (high_val >= 0xD800 && high_val <= 0xDBFF) {
16200 Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
16201 if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
16202 return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
16203 }
16204 }
16205 }
16206 #endif
16207 #endif
16208 PyErr_Format(PyExc_ValueError,
16209 "only single character unicode strings can be converted to Py_UCS4, "
16210 "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
16211 return (Py_UCS4)-1;
16212 }
16213
16214 /* Declarations */
16215 #if CYTHON_CCOMPLEX
16216 #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)16217 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
16218 return ::std::complex< float >(x, y);
16219 }
16220 #else
__pyx_t_float_complex_from_parts(float x,float y)16221 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
16222 return x + y*(__pyx_t_float_complex)_Complex_I;
16223 }
16224 #endif
16225 #else
__pyx_t_float_complex_from_parts(float x,float y)16226 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
16227 __pyx_t_float_complex z;
16228 z.real = x;
16229 z.imag = y;
16230 return z;
16231 }
16232 #endif
16233
16234 /* Arithmetic */
16235 #if CYTHON_CCOMPLEX
16236 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16237 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16238 return (a.real == b.real) && (a.imag == b.imag);
16239 }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16240 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16241 __pyx_t_float_complex z;
16242 z.real = a.real + b.real;
16243 z.imag = a.imag + b.imag;
16244 return z;
16245 }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16246 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16247 __pyx_t_float_complex z;
16248 z.real = a.real - b.real;
16249 z.imag = a.imag - b.imag;
16250 return z;
16251 }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16252 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16253 __pyx_t_float_complex z;
16254 z.real = a.real * b.real - a.imag * b.imag;
16255 z.imag = a.real * b.imag + a.imag * b.real;
16256 return z;
16257 }
16258 #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16259 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16260 if (b.imag == 0) {
16261 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
16262 } else if (fabsf(b.real) >= fabsf(b.imag)) {
16263 if (b.real == 0 && b.imag == 0) {
16264 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
16265 } else {
16266 float r = b.imag / b.real;
16267 float s = (float)(1.0) / (b.real + b.imag * r);
16268 return __pyx_t_float_complex_from_parts(
16269 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
16270 }
16271 } else {
16272 float r = b.real / b.imag;
16273 float s = (float)(1.0) / (b.imag + b.real * r);
16274 return __pyx_t_float_complex_from_parts(
16275 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
16276 }
16277 }
16278 #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16279 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16280 if (b.imag == 0) {
16281 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
16282 } else {
16283 float denom = b.real * b.real + b.imag * b.imag;
16284 return __pyx_t_float_complex_from_parts(
16285 (a.real * b.real + a.imag * b.imag) / denom,
16286 (a.imag * b.real - a.real * b.imag) / denom);
16287 }
16288 }
16289 #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)16290 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
16291 __pyx_t_float_complex z;
16292 z.real = -a.real;
16293 z.imag = -a.imag;
16294 return z;
16295 }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)16296 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
16297 return (a.real == 0) && (a.imag == 0);
16298 }
__Pyx_c_conj_float(__pyx_t_float_complex a)16299 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
16300 __pyx_t_float_complex z;
16301 z.real = a.real;
16302 z.imag = -a.imag;
16303 return z;
16304 }
16305 #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)16306 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
16307 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
16308 return sqrtf(z.real*z.real + z.imag*z.imag);
16309 #else
16310 return hypotf(z.real, z.imag);
16311 #endif
16312 }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)16313 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
16314 __pyx_t_float_complex z;
16315 float r, lnr, theta, z_r, z_theta;
16316 if (b.imag == 0 && b.real == (int)b.real) {
16317 if (b.real < 0) {
16318 float denom = a.real * a.real + a.imag * a.imag;
16319 a.real = a.real / denom;
16320 a.imag = -a.imag / denom;
16321 b.real = -b.real;
16322 }
16323 switch ((int)b.real) {
16324 case 0:
16325 z.real = 1;
16326 z.imag = 0;
16327 return z;
16328 case 1:
16329 return a;
16330 case 2:
16331 return __Pyx_c_prod_float(a, a);
16332 case 3:
16333 z = __Pyx_c_prod_float(a, a);
16334 return __Pyx_c_prod_float(z, a);
16335 case 4:
16336 z = __Pyx_c_prod_float(a, a);
16337 return __Pyx_c_prod_float(z, z);
16338 }
16339 }
16340 if (a.imag == 0) {
16341 if (a.real == 0) {
16342 return a;
16343 } else if (b.imag == 0) {
16344 z.real = powf(a.real, b.real);
16345 z.imag = 0;
16346 return z;
16347 } else if (a.real > 0) {
16348 r = a.real;
16349 theta = 0;
16350 } else {
16351 r = -a.real;
16352 theta = atan2f(0.0, -1.0);
16353 }
16354 } else {
16355 r = __Pyx_c_abs_float(a);
16356 theta = atan2f(a.imag, a.real);
16357 }
16358 lnr = logf(r);
16359 z_r = expf(lnr * b.real - theta * b.imag);
16360 z_theta = theta * b.real + lnr * b.imag;
16361 z.real = z_r * cosf(z_theta);
16362 z.imag = z_r * sinf(z_theta);
16363 return z;
16364 }
16365 #endif
16366 #endif
16367
16368 /* Declarations */
16369 #if CYTHON_CCOMPLEX
16370 #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)16371 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
16372 return ::std::complex< double >(x, y);
16373 }
16374 #else
__pyx_t_double_complex_from_parts(double x,double y)16375 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
16376 return x + y*(__pyx_t_double_complex)_Complex_I;
16377 }
16378 #endif
16379 #else
__pyx_t_double_complex_from_parts(double x,double y)16380 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
16381 __pyx_t_double_complex z;
16382 z.real = x;
16383 z.imag = y;
16384 return z;
16385 }
16386 #endif
16387
16388 /* Arithmetic */
16389 #if CYTHON_CCOMPLEX
16390 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16391 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16392 return (a.real == b.real) && (a.imag == b.imag);
16393 }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16394 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16395 __pyx_t_double_complex z;
16396 z.real = a.real + b.real;
16397 z.imag = a.imag + b.imag;
16398 return z;
16399 }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16400 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16401 __pyx_t_double_complex z;
16402 z.real = a.real - b.real;
16403 z.imag = a.imag - b.imag;
16404 return z;
16405 }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16406 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16407 __pyx_t_double_complex z;
16408 z.real = a.real * b.real - a.imag * b.imag;
16409 z.imag = a.real * b.imag + a.imag * b.real;
16410 return z;
16411 }
16412 #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16413 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16414 if (b.imag == 0) {
16415 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
16416 } else if (fabs(b.real) >= fabs(b.imag)) {
16417 if (b.real == 0 && b.imag == 0) {
16418 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
16419 } else {
16420 double r = b.imag / b.real;
16421 double s = (double)(1.0) / (b.real + b.imag * r);
16422 return __pyx_t_double_complex_from_parts(
16423 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
16424 }
16425 } else {
16426 double r = b.real / b.imag;
16427 double s = (double)(1.0) / (b.imag + b.real * r);
16428 return __pyx_t_double_complex_from_parts(
16429 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
16430 }
16431 }
16432 #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16433 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16434 if (b.imag == 0) {
16435 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
16436 } else {
16437 double denom = b.real * b.real + b.imag * b.imag;
16438 return __pyx_t_double_complex_from_parts(
16439 (a.real * b.real + a.imag * b.imag) / denom,
16440 (a.imag * b.real - a.real * b.imag) / denom);
16441 }
16442 }
16443 #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)16444 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
16445 __pyx_t_double_complex z;
16446 z.real = -a.real;
16447 z.imag = -a.imag;
16448 return z;
16449 }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)16450 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
16451 return (a.real == 0) && (a.imag == 0);
16452 }
__Pyx_c_conj_double(__pyx_t_double_complex a)16453 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
16454 __pyx_t_double_complex z;
16455 z.real = a.real;
16456 z.imag = -a.imag;
16457 return z;
16458 }
16459 #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)16460 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
16461 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
16462 return sqrt(z.real*z.real + z.imag*z.imag);
16463 #else
16464 return hypot(z.real, z.imag);
16465 #endif
16466 }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)16467 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
16468 __pyx_t_double_complex z;
16469 double r, lnr, theta, z_r, z_theta;
16470 if (b.imag == 0 && b.real == (int)b.real) {
16471 if (b.real < 0) {
16472 double denom = a.real * a.real + a.imag * a.imag;
16473 a.real = a.real / denom;
16474 a.imag = -a.imag / denom;
16475 b.real = -b.real;
16476 }
16477 switch ((int)b.real) {
16478 case 0:
16479 z.real = 1;
16480 z.imag = 0;
16481 return z;
16482 case 1:
16483 return a;
16484 case 2:
16485 return __Pyx_c_prod_double(a, a);
16486 case 3:
16487 z = __Pyx_c_prod_double(a, a);
16488 return __Pyx_c_prod_double(z, a);
16489 case 4:
16490 z = __Pyx_c_prod_double(a, a);
16491 return __Pyx_c_prod_double(z, z);
16492 }
16493 }
16494 if (a.imag == 0) {
16495 if (a.real == 0) {
16496 return a;
16497 } else if (b.imag == 0) {
16498 z.real = pow(a.real, b.real);
16499 z.imag = 0;
16500 return z;
16501 } else if (a.real > 0) {
16502 r = a.real;
16503 theta = 0;
16504 } else {
16505 r = -a.real;
16506 theta = atan2(0.0, -1.0);
16507 }
16508 } else {
16509 r = __Pyx_c_abs_double(a);
16510 theta = atan2(a.imag, a.real);
16511 }
16512 lnr = log(r);
16513 z_r = exp(lnr * b.real - theta * b.imag);
16514 z_theta = theta * b.real + lnr * b.imag;
16515 z.real = z_r * cos(z_theta);
16516 z.imag = z_r * sin(z_theta);
16517 return z;
16518 }
16519 #endif
16520 #endif
16521
16522 /* CIntFromPy */
__Pyx_PyInt_As_size_t(PyObject * x)16523 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
16524 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16525 #pragma GCC diagnostic push
16526 #pragma GCC diagnostic ignored "-Wconversion"
16527 #endif
16528 const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
16529 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16530 #pragma GCC diagnostic pop
16531 #endif
16532 const int is_unsigned = neg_one > const_zero;
16533 #if PY_MAJOR_VERSION < 3
16534 if (likely(PyInt_Check(x))) {
16535 if ((sizeof(size_t) < sizeof(long))) {
16536 __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
16537 } else {
16538 long val = PyInt_AS_LONG(x);
16539 if (is_unsigned && unlikely(val < 0)) {
16540 goto raise_neg_overflow;
16541 }
16542 return (size_t) val;
16543 }
16544 } else
16545 #endif
16546 if (likely(PyLong_Check(x))) {
16547 if (is_unsigned) {
16548 #if CYTHON_USE_PYLONG_INTERNALS
16549 const digit* digits = ((PyLongObject*)x)->ob_digit;
16550 switch (Py_SIZE(x)) {
16551 case 0: return (size_t) 0;
16552 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
16553 case 2:
16554 if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
16555 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16556 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16557 } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
16558 return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16559 }
16560 }
16561 break;
16562 case 3:
16563 if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
16564 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16565 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16566 } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
16567 return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16568 }
16569 }
16570 break;
16571 case 4:
16572 if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
16573 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16574 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16575 } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
16576 return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16577 }
16578 }
16579 break;
16580 }
16581 #endif
16582 #if CYTHON_COMPILING_IN_CPYTHON
16583 if (unlikely(Py_SIZE(x) < 0)) {
16584 goto raise_neg_overflow;
16585 }
16586 #else
16587 {
16588 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16589 if (unlikely(result < 0))
16590 return (size_t) -1;
16591 if (unlikely(result == 1))
16592 goto raise_neg_overflow;
16593 }
16594 #endif
16595 if ((sizeof(size_t) <= sizeof(unsigned long))) {
16596 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
16597 #ifdef HAVE_LONG_LONG
16598 } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
16599 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16600 #endif
16601 }
16602 } else {
16603 #if CYTHON_USE_PYLONG_INTERNALS
16604 const digit* digits = ((PyLongObject*)x)->ob_digit;
16605 switch (Py_SIZE(x)) {
16606 case 0: return (size_t) 0;
16607 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
16608 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
16609 case -2:
16610 if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
16611 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16612 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16613 } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
16614 return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
16615 }
16616 }
16617 break;
16618 case 2:
16619 if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
16620 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16621 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16622 } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
16623 return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
16624 }
16625 }
16626 break;
16627 case -3:
16628 if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
16629 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16630 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16631 } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
16632 return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
16633 }
16634 }
16635 break;
16636 case 3:
16637 if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
16638 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16639 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16640 } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
16641 return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
16642 }
16643 }
16644 break;
16645 case -4:
16646 if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
16647 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16648 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16649 } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
16650 return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
16651 }
16652 }
16653 break;
16654 case 4:
16655 if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
16656 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16657 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16658 } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
16659 return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
16660 }
16661 }
16662 break;
16663 }
16664 #endif
16665 if ((sizeof(size_t) <= sizeof(long))) {
16666 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
16667 #ifdef HAVE_LONG_LONG
16668 } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
16669 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
16670 #endif
16671 }
16672 }
16673 {
16674 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
16675 PyErr_SetString(PyExc_RuntimeError,
16676 "_PyLong_AsByteArray() not available, cannot convert large numbers");
16677 #else
16678 size_t val;
16679 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16680 #if PY_MAJOR_VERSION < 3
16681 if (likely(v) && !PyLong_Check(v)) {
16682 PyObject *tmp = v;
16683 v = PyNumber_Long(tmp);
16684 Py_DECREF(tmp);
16685 }
16686 #endif
16687 if (likely(v)) {
16688 int one = 1; int is_little = (int)*(unsigned char *)&one;
16689 unsigned char *bytes = (unsigned char *)&val;
16690 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16691 bytes, sizeof(val),
16692 is_little, !is_unsigned);
16693 Py_DECREF(v);
16694 if (likely(!ret))
16695 return val;
16696 }
16697 #endif
16698 return (size_t) -1;
16699 }
16700 } else {
16701 size_t val;
16702 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16703 if (!tmp) return (size_t) -1;
16704 val = __Pyx_PyInt_As_size_t(tmp);
16705 Py_DECREF(tmp);
16706 return val;
16707 }
16708 raise_overflow:
16709 PyErr_SetString(PyExc_OverflowError,
16710 "value too large to convert to size_t");
16711 return (size_t) -1;
16712 raise_neg_overflow:
16713 PyErr_SetString(PyExc_OverflowError,
16714 "can't convert negative value to size_t");
16715 return (size_t) -1;
16716 }
16717
16718 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)16719 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
16720 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16721 #pragma GCC diagnostic push
16722 #pragma GCC diagnostic ignored "-Wconversion"
16723 #endif
16724 const int neg_one = (int) -1, const_zero = (int) 0;
16725 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16726 #pragma GCC diagnostic pop
16727 #endif
16728 const int is_unsigned = neg_one > const_zero;
16729 #if PY_MAJOR_VERSION < 3
16730 if (likely(PyInt_Check(x))) {
16731 if ((sizeof(int) < sizeof(long))) {
16732 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
16733 } else {
16734 long val = PyInt_AS_LONG(x);
16735 if (is_unsigned && unlikely(val < 0)) {
16736 goto raise_neg_overflow;
16737 }
16738 return (int) val;
16739 }
16740 } else
16741 #endif
16742 if (likely(PyLong_Check(x))) {
16743 if (is_unsigned) {
16744 #if CYTHON_USE_PYLONG_INTERNALS
16745 const digit* digits = ((PyLongObject*)x)->ob_digit;
16746 switch (Py_SIZE(x)) {
16747 case 0: return (int) 0;
16748 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
16749 case 2:
16750 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
16751 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16752 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16753 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
16754 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16755 }
16756 }
16757 break;
16758 case 3:
16759 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
16760 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16761 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16762 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
16763 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16764 }
16765 }
16766 break;
16767 case 4:
16768 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
16769 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16770 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16771 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
16772 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16773 }
16774 }
16775 break;
16776 }
16777 #endif
16778 #if CYTHON_COMPILING_IN_CPYTHON
16779 if (unlikely(Py_SIZE(x) < 0)) {
16780 goto raise_neg_overflow;
16781 }
16782 #else
16783 {
16784 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16785 if (unlikely(result < 0))
16786 return (int) -1;
16787 if (unlikely(result == 1))
16788 goto raise_neg_overflow;
16789 }
16790 #endif
16791 if ((sizeof(int) <= sizeof(unsigned long))) {
16792 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
16793 #ifdef HAVE_LONG_LONG
16794 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
16795 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16796 #endif
16797 }
16798 } else {
16799 #if CYTHON_USE_PYLONG_INTERNALS
16800 const digit* digits = ((PyLongObject*)x)->ob_digit;
16801 switch (Py_SIZE(x)) {
16802 case 0: return (int) 0;
16803 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
16804 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
16805 case -2:
16806 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
16807 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16808 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16809 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
16810 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16811 }
16812 }
16813 break;
16814 case 2:
16815 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
16816 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16817 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16818 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
16819 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16820 }
16821 }
16822 break;
16823 case -3:
16824 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
16825 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16826 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16827 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
16828 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16829 }
16830 }
16831 break;
16832 case 3:
16833 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
16834 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16835 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16836 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
16837 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16838 }
16839 }
16840 break;
16841 case -4:
16842 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
16843 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16844 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16845 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
16846 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16847 }
16848 }
16849 break;
16850 case 4:
16851 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
16852 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16853 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16854 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
16855 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16856 }
16857 }
16858 break;
16859 }
16860 #endif
16861 if ((sizeof(int) <= sizeof(long))) {
16862 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
16863 #ifdef HAVE_LONG_LONG
16864 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
16865 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
16866 #endif
16867 }
16868 }
16869 {
16870 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
16871 PyErr_SetString(PyExc_RuntimeError,
16872 "_PyLong_AsByteArray() not available, cannot convert large numbers");
16873 #else
16874 int val;
16875 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16876 #if PY_MAJOR_VERSION < 3
16877 if (likely(v) && !PyLong_Check(v)) {
16878 PyObject *tmp = v;
16879 v = PyNumber_Long(tmp);
16880 Py_DECREF(tmp);
16881 }
16882 #endif
16883 if (likely(v)) {
16884 int one = 1; int is_little = (int)*(unsigned char *)&one;
16885 unsigned char *bytes = (unsigned char *)&val;
16886 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16887 bytes, sizeof(val),
16888 is_little, !is_unsigned);
16889 Py_DECREF(v);
16890 if (likely(!ret))
16891 return val;
16892 }
16893 #endif
16894 return (int) -1;
16895 }
16896 } else {
16897 int val;
16898 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16899 if (!tmp) return (int) -1;
16900 val = __Pyx_PyInt_As_int(tmp);
16901 Py_DECREF(tmp);
16902 return val;
16903 }
16904 raise_overflow:
16905 PyErr_SetString(PyExc_OverflowError,
16906 "value too large to convert to int");
16907 return (int) -1;
16908 raise_neg_overflow:
16909 PyErr_SetString(PyExc_OverflowError,
16910 "can't convert negative value to int");
16911 return (int) -1;
16912 }
16913
16914 /* CIntFromPy */
__Pyx_PyInt_As_uint64_t(PyObject * x)16915 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
16916 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16917 #pragma GCC diagnostic push
16918 #pragma GCC diagnostic ignored "-Wconversion"
16919 #endif
16920 const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
16921 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
16922 #pragma GCC diagnostic pop
16923 #endif
16924 const int is_unsigned = neg_one > const_zero;
16925 #if PY_MAJOR_VERSION < 3
16926 if (likely(PyInt_Check(x))) {
16927 if ((sizeof(uint64_t) < sizeof(long))) {
16928 __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
16929 } else {
16930 long val = PyInt_AS_LONG(x);
16931 if (is_unsigned && unlikely(val < 0)) {
16932 goto raise_neg_overflow;
16933 }
16934 return (uint64_t) val;
16935 }
16936 } else
16937 #endif
16938 if (likely(PyLong_Check(x))) {
16939 if (is_unsigned) {
16940 #if CYTHON_USE_PYLONG_INTERNALS
16941 const digit* digits = ((PyLongObject*)x)->ob_digit;
16942 switch (Py_SIZE(x)) {
16943 case 0: return (uint64_t) 0;
16944 case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
16945 case 2:
16946 if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
16947 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
16948 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16949 } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) {
16950 return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
16951 }
16952 }
16953 break;
16954 case 3:
16955 if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
16956 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
16957 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16958 } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) {
16959 return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
16960 }
16961 }
16962 break;
16963 case 4:
16964 if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
16965 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
16966 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16967 } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) {
16968 return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
16969 }
16970 }
16971 break;
16972 }
16973 #endif
16974 #if CYTHON_COMPILING_IN_CPYTHON
16975 if (unlikely(Py_SIZE(x) < 0)) {
16976 goto raise_neg_overflow;
16977 }
16978 #else
16979 {
16980 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16981 if (unlikely(result < 0))
16982 return (uint64_t) -1;
16983 if (unlikely(result == 1))
16984 goto raise_neg_overflow;
16985 }
16986 #endif
16987 if ((sizeof(uint64_t) <= sizeof(unsigned long))) {
16988 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
16989 #ifdef HAVE_LONG_LONG
16990 } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) {
16991 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16992 #endif
16993 }
16994 } else {
16995 #if CYTHON_USE_PYLONG_INTERNALS
16996 const digit* digits = ((PyLongObject*)x)->ob_digit;
16997 switch (Py_SIZE(x)) {
16998 case 0: return (uint64_t) 0;
16999 case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
17000 case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0])
17001 case -2:
17002 if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) {
17003 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
17004 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17005 } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
17006 return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
17007 }
17008 }
17009 break;
17010 case 2:
17011 if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
17012 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
17013 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17014 } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
17015 return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
17016 }
17017 }
17018 break;
17019 case -3:
17020 if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
17021 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
17022 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17023 } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
17024 return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
17025 }
17026 }
17027 break;
17028 case 3:
17029 if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
17030 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
17031 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17032 } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
17033 return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
17034 }
17035 }
17036 break;
17037 case -4:
17038 if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
17039 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
17040 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17041 } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
17042 return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
17043 }
17044 }
17045 break;
17046 case 4:
17047 if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
17048 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
17049 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17050 } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
17051 return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
17052 }
17053 }
17054 break;
17055 }
17056 #endif
17057 if ((sizeof(uint64_t) <= sizeof(long))) {
17058 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
17059 #ifdef HAVE_LONG_LONG
17060 } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) {
17061 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
17062 #endif
17063 }
17064 }
17065 {
17066 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
17067 PyErr_SetString(PyExc_RuntimeError,
17068 "_PyLong_AsByteArray() not available, cannot convert large numbers");
17069 #else
17070 uint64_t val;
17071 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
17072 #if PY_MAJOR_VERSION < 3
17073 if (likely(v) && !PyLong_Check(v)) {
17074 PyObject *tmp = v;
17075 v = PyNumber_Long(tmp);
17076 Py_DECREF(tmp);
17077 }
17078 #endif
17079 if (likely(v)) {
17080 int one = 1; int is_little = (int)*(unsigned char *)&one;
17081 unsigned char *bytes = (unsigned char *)&val;
17082 int ret = _PyLong_AsByteArray((PyLongObject *)v,
17083 bytes, sizeof(val),
17084 is_little, !is_unsigned);
17085 Py_DECREF(v);
17086 if (likely(!ret))
17087 return val;
17088 }
17089 #endif
17090 return (uint64_t) -1;
17091 }
17092 } else {
17093 uint64_t val;
17094 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
17095 if (!tmp) return (uint64_t) -1;
17096 val = __Pyx_PyInt_As_uint64_t(tmp);
17097 Py_DECREF(tmp);
17098 return val;
17099 }
17100 raise_overflow:
17101 PyErr_SetString(PyExc_OverflowError,
17102 "value too large to convert to uint64_t");
17103 return (uint64_t) -1;
17104 raise_neg_overflow:
17105 PyErr_SetString(PyExc_OverflowError,
17106 "can't convert negative value to uint64_t");
17107 return (uint64_t) -1;
17108 }
17109
17110 /* ObjectAsUCS4 */
__Pyx__PyObject_AsPy_UCS4_raise_error(long ival)17111 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) {
17112 if (ival < 0) {
17113 if (!PyErr_Occurred())
17114 PyErr_SetString(PyExc_OverflowError,
17115 "cannot convert negative value to Py_UCS4");
17116 } else {
17117 PyErr_SetString(PyExc_OverflowError,
17118 "value too large to convert to Py_UCS4");
17119 }
17120 return (Py_UCS4)-1;
17121 }
__Pyx__PyObject_AsPy_UCS4(PyObject * x)17122 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) {
17123 long ival;
17124 ival = __Pyx_PyInt_As_long(x);
17125 if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) {
17126 return __Pyx__PyObject_AsPy_UCS4_raise_error(ival);
17127 }
17128 return (Py_UCS4)ival;
17129 }
17130
17131 /* FormatTypeName */
17132 #if CYTHON_COMPILING_IN_LIMITED_API
17133 static __Pyx_TypeName
__Pyx_PyType_GetName(PyTypeObject * tp)17134 __Pyx_PyType_GetName(PyTypeObject* tp)
17135 {
17136 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
17137 __pyx_n_s_name);
17138 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
17139 PyErr_Clear();
17140 Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__10));
17141 }
17142 return name;
17143 }
17144 #endif
17145
17146 /* CIntToPy */
__Pyx_PyInt_From_long(long value)17147 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
17148 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
17149 #pragma GCC diagnostic push
17150 #pragma GCC diagnostic ignored "-Wconversion"
17151 #endif
17152 const long neg_one = (long) -1, const_zero = (long) 0;
17153 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
17154 #pragma GCC diagnostic pop
17155 #endif
17156 const int is_unsigned = neg_one > const_zero;
17157 if (is_unsigned) {
17158 if (sizeof(long) < sizeof(long)) {
17159 return PyInt_FromLong((long) value);
17160 } else if (sizeof(long) <= sizeof(unsigned long)) {
17161 return PyLong_FromUnsignedLong((unsigned long) value);
17162 #ifdef HAVE_LONG_LONG
17163 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
17164 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
17165 #endif
17166 }
17167 } else {
17168 if (sizeof(long) <= sizeof(long)) {
17169 return PyInt_FromLong((long) value);
17170 #ifdef HAVE_LONG_LONG
17171 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
17172 return PyLong_FromLongLong((PY_LONG_LONG) value);
17173 #endif
17174 }
17175 }
17176 {
17177 int one = 1; int little = (int)*(unsigned char *)&one;
17178 unsigned char *bytes = (unsigned char *)&value;
17179 return _PyLong_FromByteArray(bytes, sizeof(long),
17180 little, !is_unsigned);
17181 }
17182 }
17183
17184 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)17185 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
17186 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
17187 #pragma GCC diagnostic push
17188 #pragma GCC diagnostic ignored "-Wconversion"
17189 #endif
17190 const long neg_one = (long) -1, const_zero = (long) 0;
17191 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
17192 #pragma GCC diagnostic pop
17193 #endif
17194 const int is_unsigned = neg_one > const_zero;
17195 #if PY_MAJOR_VERSION < 3
17196 if (likely(PyInt_Check(x))) {
17197 if ((sizeof(long) < sizeof(long))) {
17198 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
17199 } else {
17200 long val = PyInt_AS_LONG(x);
17201 if (is_unsigned && unlikely(val < 0)) {
17202 goto raise_neg_overflow;
17203 }
17204 return (long) val;
17205 }
17206 } else
17207 #endif
17208 if (likely(PyLong_Check(x))) {
17209 if (is_unsigned) {
17210 #if CYTHON_USE_PYLONG_INTERNALS
17211 const digit* digits = ((PyLongObject*)x)->ob_digit;
17212 switch (Py_SIZE(x)) {
17213 case 0: return (long) 0;
17214 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
17215 case 2:
17216 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
17217 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
17218 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17219 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
17220 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
17221 }
17222 }
17223 break;
17224 case 3:
17225 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
17226 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
17227 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17228 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
17229 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
17230 }
17231 }
17232 break;
17233 case 4:
17234 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
17235 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
17236 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17237 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
17238 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
17239 }
17240 }
17241 break;
17242 }
17243 #endif
17244 #if CYTHON_COMPILING_IN_CPYTHON
17245 if (unlikely(Py_SIZE(x) < 0)) {
17246 goto raise_neg_overflow;
17247 }
17248 #else
17249 {
17250 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
17251 if (unlikely(result < 0))
17252 return (long) -1;
17253 if (unlikely(result == 1))
17254 goto raise_neg_overflow;
17255 }
17256 #endif
17257 if ((sizeof(long) <= sizeof(unsigned long))) {
17258 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
17259 #ifdef HAVE_LONG_LONG
17260 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
17261 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
17262 #endif
17263 }
17264 } else {
17265 #if CYTHON_USE_PYLONG_INTERNALS
17266 const digit* digits = ((PyLongObject*)x)->ob_digit;
17267 switch (Py_SIZE(x)) {
17268 case 0: return (long) 0;
17269 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
17270 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
17271 case -2:
17272 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
17273 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
17274 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17275 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
17276 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17277 }
17278 }
17279 break;
17280 case 2:
17281 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
17282 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
17283 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17284 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
17285 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17286 }
17287 }
17288 break;
17289 case -3:
17290 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
17291 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
17292 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17293 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
17294 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17295 }
17296 }
17297 break;
17298 case 3:
17299 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
17300 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
17301 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17302 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
17303 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17304 }
17305 }
17306 break;
17307 case -4:
17308 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
17309 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
17310 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17311 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
17312 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17313 }
17314 }
17315 break;
17316 case 4:
17317 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
17318 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
17319 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17320 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
17321 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17322 }
17323 }
17324 break;
17325 }
17326 #endif
17327 if ((sizeof(long) <= sizeof(long))) {
17328 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
17329 #ifdef HAVE_LONG_LONG
17330 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
17331 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
17332 #endif
17333 }
17334 }
17335 {
17336 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
17337 PyErr_SetString(PyExc_RuntimeError,
17338 "_PyLong_AsByteArray() not available, cannot convert large numbers");
17339 #else
17340 long val;
17341 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
17342 #if PY_MAJOR_VERSION < 3
17343 if (likely(v) && !PyLong_Check(v)) {
17344 PyObject *tmp = v;
17345 v = PyNumber_Long(tmp);
17346 Py_DECREF(tmp);
17347 }
17348 #endif
17349 if (likely(v)) {
17350 int one = 1; int is_little = (int)*(unsigned char *)&one;
17351 unsigned char *bytes = (unsigned char *)&val;
17352 int ret = _PyLong_AsByteArray((PyLongObject *)v,
17353 bytes, sizeof(val),
17354 is_little, !is_unsigned);
17355 Py_DECREF(v);
17356 if (likely(!ret))
17357 return val;
17358 }
17359 #endif
17360 return (long) -1;
17361 }
17362 } else {
17363 long val;
17364 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
17365 if (!tmp) return (long) -1;
17366 val = __Pyx_PyInt_As_long(tmp);
17367 Py_DECREF(tmp);
17368 return val;
17369 }
17370 raise_overflow:
17371 PyErr_SetString(PyExc_OverflowError,
17372 "value too large to convert to long");
17373 return (long) -1;
17374 raise_neg_overflow:
17375 PyErr_SetString(PyExc_OverflowError,
17376 "can't convert negative value to long");
17377 return (long) -1;
17378 }
17379
17380 /* FastTypeChecks */
17381 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)17382 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
17383 while (a) {
17384 a = a->tp_base;
17385 if (a == b)
17386 return 1;
17387 }
17388 return b == &PyBaseObject_Type;
17389 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)17390 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
17391 PyObject *mro;
17392 if (a == b) return 1;
17393 mro = a->tp_mro;
17394 if (likely(mro)) {
17395 Py_ssize_t i, n;
17396 n = PyTuple_GET_SIZE(mro);
17397 for (i = 0; i < n; i++) {
17398 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
17399 return 1;
17400 }
17401 return 0;
17402 }
17403 return __Pyx_InBases(a, b);
17404 }
__Pyx_IsAnySubtype2(PyTypeObject * cls,PyTypeObject * a,PyTypeObject * b)17405 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
17406 PyObject *mro;
17407 if (cls == a || cls == b) return 1;
17408 mro = cls->tp_mro;
17409 if (likely(mro)) {
17410 Py_ssize_t i, n;
17411 n = PyTuple_GET_SIZE(mro);
17412 for (i = 0; i < n; i++) {
17413 PyObject *base = PyTuple_GET_ITEM(mro, i);
17414 if (base == (PyObject *)a || base == (PyObject *)b)
17415 return 1;
17416 }
17417 return 0;
17418 }
17419 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
17420 }
17421 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)17422 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
17423 PyObject *exception, *value, *tb;
17424 int res;
17425 __Pyx_PyThreadState_declare
17426 __Pyx_PyThreadState_assign
17427 __Pyx_ErrFetch(&exception, &value, &tb);
17428 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
17429 if (unlikely(res == -1)) {
17430 PyErr_WriteUnraisable(err);
17431 res = 0;
17432 }
17433 if (!res) {
17434 res = PyObject_IsSubclass(err, exc_type2);
17435 if (unlikely(res == -1)) {
17436 PyErr_WriteUnraisable(err);
17437 res = 0;
17438 }
17439 }
17440 __Pyx_ErrRestore(exception, value, tb);
17441 return res;
17442 }
17443 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)17444 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
17445 if (exc_type1) {
17446 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
17447 } else {
17448 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
17449 }
17450 }
17451 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)17452 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
17453 Py_ssize_t i, n;
17454 assert(PyExceptionClass_Check(exc_type));
17455 n = PyTuple_GET_SIZE(tuple);
17456 #if PY_MAJOR_VERSION >= 3
17457 for (i=0; i<n; i++) {
17458 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
17459 }
17460 #endif
17461 for (i=0; i<n; i++) {
17462 PyObject *t = PyTuple_GET_ITEM(tuple, i);
17463 #if PY_MAJOR_VERSION < 3
17464 if (likely(exc_type == t)) return 1;
17465 #endif
17466 if (likely(PyExceptionClass_Check(t))) {
17467 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
17468 } else {
17469 }
17470 }
17471 return 0;
17472 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)17473 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
17474 if (likely(err == exc_type)) return 1;
17475 if (likely(PyExceptionClass_Check(err))) {
17476 if (likely(PyExceptionClass_Check(exc_type))) {
17477 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
17478 } else if (likely(PyTuple_Check(exc_type))) {
17479 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
17480 } else {
17481 }
17482 }
17483 return PyErr_GivenExceptionMatches(err, exc_type);
17484 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)17485 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
17486 assert(PyExceptionClass_Check(exc_type1));
17487 assert(PyExceptionClass_Check(exc_type2));
17488 if (likely(err == exc_type1 || err == exc_type2)) return 1;
17489 if (likely(PyExceptionClass_Check(err))) {
17490 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
17491 }
17492 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
17493 }
17494 #endif
17495
17496 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)17497 static int __Pyx_check_binary_version(void) {
17498 char ctversion[4], rtversion[4];
17499 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
17500 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
17501 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
17502 char message[200];
17503 PyOS_snprintf(message, sizeof(message),
17504 "compiletime version %s of module '%.100s' "
17505 "does not match runtime version %s",
17506 ctversion, __Pyx_MODULE_NAME, rtversion);
17507 return PyErr_WarnEx(NULL, message, 1);
17508 }
17509 return 0;
17510 }
17511
17512 /* InitStrings */
17513 #if PY_MAJOR_VERSION >= 3
__Pyx_InitString(__Pyx_StringTabEntry t,PyObject ** str)17514 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
17515 if (t.is_unicode | t.is_str) {
17516 if (t.intern) {
17517 *str = PyUnicode_InternFromString(t.s);
17518 } else if (t.encoding) {
17519 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
17520 } else {
17521 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
17522 }
17523 } else {
17524 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
17525 }
17526 if (!*str)
17527 return -1;
17528 if (PyObject_Hash(*str) == -1)
17529 return -1;
17530 return 0;
17531 }
17532 #endif
17533 #if !CYTHON_COMPILING_IN_LIMITED_API
__Pyx_InitStrings(__Pyx_StringTabEntry * t)17534 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
17535 while (t->p) {
17536 #if PY_MAJOR_VERSION >= 3
17537 __Pyx_InitString(*t, t->p);
17538 #else
17539 if (t->is_unicode) {
17540 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
17541 } else if (t->intern) {
17542 *t->p = PyString_InternFromString(t->s);
17543 } else {
17544 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
17545 }
17546 if (!*t->p)
17547 return -1;
17548 if (PyObject_Hash(*t->p) == -1)
17549 return -1;
17550 #endif
17551 ++t;
17552 }
17553 return 0;
17554 }
17555 #endif
17556
__Pyx_PyUnicode_FromString(const char * c_str)17557 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
17558 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
17559 }
__Pyx_PyObject_AsString(PyObject * o)17560 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
17561 Py_ssize_t ignore;
17562 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
17563 }
17564 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
17565 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)17566 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17567 char* defenc_c;
17568 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
17569 if (!defenc) return NULL;
17570 defenc_c = PyBytes_AS_STRING(defenc);
17571 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17572 {
17573 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
17574 char* c;
17575 for (c = defenc_c; c < end; c++) {
17576 if ((unsigned char) (*c) >= 128) {
17577 PyUnicode_AsASCIIString(o);
17578 return NULL;
17579 }
17580 }
17581 }
17582 #endif
17583 *length = PyBytes_GET_SIZE(defenc);
17584 return defenc_c;
17585 }
17586 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)17587 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17588 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
17589 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17590 if (likely(PyUnicode_IS_ASCII(o))) {
17591 *length = PyUnicode_GET_LENGTH(o);
17592 return PyUnicode_AsUTF8(o);
17593 } else {
17594 PyUnicode_AsASCIIString(o);
17595 return NULL;
17596 }
17597 #else
17598 return PyUnicode_AsUTF8AndSize(o, length);
17599 #endif
17600 }
17601 #endif
17602 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)17603 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17604 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
17605 if (
17606 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17607 __Pyx_sys_getdefaultencoding_not_ascii &&
17608 #endif
17609 PyUnicode_Check(o)) {
17610 return __Pyx_PyUnicode_AsStringAndSize(o, length);
17611 } else
17612 #endif
17613 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
17614 if (PyByteArray_Check(o)) {
17615 *length = PyByteArray_GET_SIZE(o);
17616 return PyByteArray_AS_STRING(o);
17617 } else
17618 #endif
17619 {
17620 char* result;
17621 int r = PyBytes_AsStringAndSize(o, &result, length);
17622 if (unlikely(r < 0)) {
17623 return NULL;
17624 } else {
17625 return result;
17626 }
17627 }
17628 }
__Pyx_PyObject_IsTrue(PyObject * x)17629 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
17630 int is_true = x == Py_True;
17631 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
17632 else return PyObject_IsTrue(x);
17633 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)17634 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
17635 int retval;
17636 if (unlikely(!x)) return -1;
17637 retval = __Pyx_PyObject_IsTrue(x);
17638 Py_DECREF(x);
17639 return retval;
17640 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)17641 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
17642 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
17643 #if PY_MAJOR_VERSION >= 3
17644 if (PyLong_Check(result)) {
17645 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
17646 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
17647 "The ability to return an instance of a strict subclass of int is deprecated, "
17648 "and may be removed in a future version of Python.",
17649 result_type_name)) {
17650 __Pyx_DECREF_TypeName(result_type_name);
17651 Py_DECREF(result);
17652 return NULL;
17653 }
17654 __Pyx_DECREF_TypeName(result_type_name);
17655 return result;
17656 }
17657 #endif
17658 PyErr_Format(PyExc_TypeError,
17659 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
17660 type_name, type_name, result_type_name);
17661 __Pyx_DECREF_TypeName(result_type_name);
17662 Py_DECREF(result);
17663 return NULL;
17664 }
__Pyx_PyNumber_IntOrLong(PyObject * x)17665 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
17666 #if CYTHON_USE_TYPE_SLOTS
17667 PyNumberMethods *m;
17668 #endif
17669 const char *name = NULL;
17670 PyObject *res = NULL;
17671 #if PY_MAJOR_VERSION < 3
17672 if (likely(PyInt_Check(x) || PyLong_Check(x)))
17673 #else
17674 if (likely(PyLong_Check(x)))
17675 #endif
17676 return __Pyx_NewRef(x);
17677 #if CYTHON_USE_TYPE_SLOTS
17678 m = Py_TYPE(x)->tp_as_number;
17679 #if PY_MAJOR_VERSION < 3
17680 if (m && m->nb_int) {
17681 name = "int";
17682 res = m->nb_int(x);
17683 }
17684 else if (m && m->nb_long) {
17685 name = "long";
17686 res = m->nb_long(x);
17687 }
17688 #else
17689 if (likely(m && m->nb_int)) {
17690 name = "int";
17691 res = m->nb_int(x);
17692 }
17693 #endif
17694 #else
17695 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
17696 res = PyNumber_Int(x);
17697 }
17698 #endif
17699 if (likely(res)) {
17700 #if PY_MAJOR_VERSION < 3
17701 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
17702 #else
17703 if (unlikely(!PyLong_CheckExact(res))) {
17704 #endif
17705 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
17706 }
17707 }
17708 else if (!PyErr_Occurred()) {
17709 PyErr_SetString(PyExc_TypeError,
17710 "an integer is required");
17711 }
17712 return res;
17713 }
17714 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
17715 Py_ssize_t ival;
17716 PyObject *x;
17717 #if PY_MAJOR_VERSION < 3
17718 if (likely(PyInt_CheckExact(b))) {
17719 if (sizeof(Py_ssize_t) >= sizeof(long))
17720 return PyInt_AS_LONG(b);
17721 else
17722 return PyInt_AsSsize_t(b);
17723 }
17724 #endif
17725 if (likely(PyLong_CheckExact(b))) {
17726 #if CYTHON_USE_PYLONG_INTERNALS
17727 const digit* digits = ((PyLongObject*)b)->ob_digit;
17728 const Py_ssize_t size = Py_SIZE(b);
17729 if (likely(__Pyx_sst_abs(size) <= 1)) {
17730 ival = likely(size) ? digits[0] : 0;
17731 if (size == -1) ival = -ival;
17732 return ival;
17733 } else {
17734 switch (size) {
17735 case 2:
17736 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
17737 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17738 }
17739 break;
17740 case -2:
17741 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
17742 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17743 }
17744 break;
17745 case 3:
17746 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
17747 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17748 }
17749 break;
17750 case -3:
17751 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
17752 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17753 }
17754 break;
17755 case 4:
17756 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
17757 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17758 }
17759 break;
17760 case -4:
17761 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
17762 return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17763 }
17764 break;
17765 }
17766 }
17767 #endif
17768 return PyLong_AsSsize_t(b);
17769 }
17770 x = PyNumber_Index(b);
17771 if (!x) return -1;
17772 ival = PyInt_AsSsize_t(x);
17773 Py_DECREF(x);
17774 return ival;
17775 }
17776 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
17777 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
17778 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
17779 #if PY_MAJOR_VERSION < 3
17780 } else if (likely(PyInt_CheckExact(o))) {
17781 return PyInt_AS_LONG(o);
17782 #endif
17783 } else {
17784 Py_ssize_t ival;
17785 PyObject *x;
17786 x = PyNumber_Index(o);
17787 if (!x) return -1;
17788 ival = PyInt_AsLong(x);
17789 Py_DECREF(x);
17790 return ival;
17791 }
17792 }
17793 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
17794 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
17795 }
17796 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
17797 return PyInt_FromSize_t(ival);
17798 }
17799
17800
17801 /* #### Code section: utility_code_pragmas_end ### */
17802 #if _MSV_VER
17803 #pragma warning( pop )
17804 #endif
17805
17806
17807
17808 /* #### Code section: end ### */
17809 #endif /* Py_PYTHON_H */
17810