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_string_metric
809 #define __PYX_HAVE_API__cpp_string_metric
810 /* Early includes */
811 #include <stdint.h>
812 #include <string.h>
813 #include <stdlib.h>
814 #include <stddef.h>
815 #include "ios"
816 #include "new"
817 #include "stdexcept"
818 #include "typeinfo"
819 #include <utility>
820
821 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
822 // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
823 #include <type_traits>
824
825 namespace cython_std {
move(T & t)826 template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
move(T && t)827 template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
828 }
829
830 #endif
831
832 #include "cpp_common.hpp"
833 #include <vector>
834 #include <stdio.h>
835 #include "cpp_scorer.hpp"
836 #ifdef _OPENMP
837 #include <omp.h>
838 #endif /* _OPENMP */
839
840 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
841 #define CYTHON_WITHOUT_ASSERTIONS
842 #endif
843
844 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
845 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
846
847 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
848 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
849 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
850 #define __PYX_DEFAULT_STRING_ENCODING ""
851 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
852 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
853 #define __Pyx_uchar_cast(c) ((unsigned char)c)
854 #define __Pyx_long_cast(x) ((long)x)
855 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
856 (sizeof(type) < sizeof(Py_ssize_t)) ||\
857 (sizeof(type) > sizeof(Py_ssize_t) &&\
858 likely(v < (type)PY_SSIZE_T_MAX ||\
859 v == (type)PY_SSIZE_T_MAX) &&\
860 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
861 v == (type)PY_SSIZE_T_MIN))) ||\
862 (sizeof(type) == sizeof(Py_ssize_t) &&\
863 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
864 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)865 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
866 return (size_t) i < (size_t) limit;
867 }
868 #if defined (__cplusplus) && __cplusplus >= 201103L
869 #include <cstdlib>
870 #define __Pyx_sst_abs(value) std::abs(value)
871 #elif SIZEOF_INT >= SIZEOF_SIZE_T
872 #define __Pyx_sst_abs(value) abs(value)
873 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
874 #define __Pyx_sst_abs(value) labs(value)
875 #elif defined (_MSC_VER)
876 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
877 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
878 #define __Pyx_sst_abs(value) llabs(value)
879 #elif defined (__GNUC__)
880 #define __Pyx_sst_abs(value) __builtin_llabs(value)
881 #else
882 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
883 #endif
884 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
885 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
886 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
887 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
888 #define __Pyx_PyBytes_FromString PyBytes_FromString
889 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
890 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
891 #if PY_MAJOR_VERSION < 3
892 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
893 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
894 #else
895 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
896 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
897 #endif
898 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
899 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
900 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
901 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
902 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
903 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
904 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
905 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
906 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
907 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
908 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
909 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
910 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
911 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
912 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
913 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
914 #if CYTHON_COMPILING_IN_LIMITED_API
__Pyx_Py_UNICODE_strlen(const wchar_t * u)915 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u)
916 {
917 const wchar_t *u_end = u;
918 while (*u_end++) ;
919 return (size_t)(u_end - u - 1);
920 }
921 #else
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)922 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
923 {
924 const Py_UNICODE *u_end = u;
925 while (*u_end++) ;
926 return (size_t)(u_end - u - 1);
927 }
928 #endif
929 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
930 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
931 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
932 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
933 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
934 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
935 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
936 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
937 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
938 #define __Pyx_PySequence_Tuple(obj)\
939 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
940 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
941 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
942 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
943 #if CYTHON_ASSUME_SAFE_MACROS
944 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
945 #else
946 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
947 #endif
948 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
949 #if PY_MAJOR_VERSION >= 3
950 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
951 #else
952 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
953 #endif
954 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
955 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)956 static int __Pyx_init_sys_getdefaultencoding_params(void) {
957 PyObject* sys;
958 PyObject* default_encoding = NULL;
959 PyObject* ascii_chars_u = NULL;
960 PyObject* ascii_chars_b = NULL;
961 const char* default_encoding_c;
962 sys = PyImport_ImportModule("sys");
963 if (!sys) goto bad;
964 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
965 Py_DECREF(sys);
966 if (!default_encoding) goto bad;
967 default_encoding_c = PyBytes_AsString(default_encoding);
968 if (!default_encoding_c) goto bad;
969 if (strcmp(default_encoding_c, "ascii") == 0) {
970 __Pyx_sys_getdefaultencoding_not_ascii = 0;
971 } else {
972 char ascii_chars[128];
973 int c;
974 for (c = 0; c < 128; c++) {
975 ascii_chars[c] = c;
976 }
977 __Pyx_sys_getdefaultencoding_not_ascii = 1;
978 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
979 if (!ascii_chars_u) goto bad;
980 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
981 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
982 PyErr_Format(
983 PyExc_ValueError,
984 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
985 default_encoding_c);
986 goto bad;
987 }
988 Py_DECREF(ascii_chars_u);
989 Py_DECREF(ascii_chars_b);
990 }
991 Py_DECREF(default_encoding);
992 return 0;
993 bad:
994 Py_XDECREF(default_encoding);
995 Py_XDECREF(ascii_chars_u);
996 Py_XDECREF(ascii_chars_b);
997 return -1;
998 }
999 #endif
1000 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1001 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1002 #else
1003 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1004 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1005 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)1006 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1007 PyObject* sys;
1008 PyObject* default_encoding = NULL;
1009 char* default_encoding_c;
1010 sys = PyImport_ImportModule("sys");
1011 if (!sys) goto bad;
1012 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1013 Py_DECREF(sys);
1014 if (!default_encoding) goto bad;
1015 default_encoding_c = PyBytes_AsString(default_encoding);
1016 if (!default_encoding_c) goto bad;
1017 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1018 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1019 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1020 Py_DECREF(default_encoding);
1021 return 0;
1022 bad:
1023 Py_XDECREF(default_encoding);
1024 return -1;
1025 }
1026 #endif
1027 #endif
1028
1029
1030 /* Test for GCC > 2.95 */
1031 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1032 #define likely(x) __builtin_expect(!!(x), 1)
1033 #define unlikely(x) __builtin_expect(!!(x), 0)
1034 #else /* !__GNUC__ or GCC < 2.95 */
1035 #define likely(x) (x)
1036 #define unlikely(x) (x)
1037 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)1038 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1039
1040 #if !CYTHON_USE_MODULE_STATE
1041 static PyObject *__pyx_m = NULL;
1042 static PyObject *__pyx_d;
1043 static PyObject *__pyx_b;
1044 static PyObject *__pyx_cython_runtime = NULL;
1045 static PyObject *__pyx_empty_tuple;
1046 static PyObject *__pyx_empty_bytes;
1047 static PyObject *__pyx_empty_unicode;
1048 #endif
1049 static int __pyx_lineno;
1050 static int __pyx_clineno = 0;
1051 static const char * __pyx_cfilenm = __FILE__;
1052 static const char *__pyx_filename;
1053
1054 /* #### Code section: filename_table ### */
1055
1056 static const char *__pyx_f[] = {
1057 "cpp_string_metric.pyx",
1058 "cpp_common.pxd",
1059 "stringsource",
1060 "type.pxd",
1061 };
1062 /* #### Code section: utility_code_proto_before_types ### */
1063 /* NoFastGil.proto */
1064 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1065 #define __Pyx_PyGILState_Release PyGILState_Release
1066 #define __Pyx_FastGIL_Remember()
1067 #define __Pyx_FastGIL_Forget()
1068 #define __Pyx_FastGilFuncInit()
1069
1070 /* #### Code section: numeric_typedefs ### */
1071 /* #### Code section: complex_type_declarations ### */
1072 /* #### Code section: type_declarations ### */
1073
1074 /*--- Type declarations ---*/
1075 struct __pyx_obj___Pyx_EnumMeta;
1076
1077 /* "EnumBase":12
1078 *
1079 * @cython.internal
1080 * cdef class __Pyx_EnumMeta(type): # <<<<<<<<<<<<<<
1081 * def __init__(cls, name, parents, dct):
1082 * type.__init__(cls, name, parents, dct)
1083 */
1084 struct __pyx_obj___Pyx_EnumMeta {
1085 PyHeapTypeObject __pyx_base;
1086 };
1087
1088 /* #### Code section: utility_code_proto ### */
1089
1090 /* --- Runtime support code (head) --- */
1091 /* Refnanny.proto */
1092 #ifndef CYTHON_REFNANNY
1093 #define CYTHON_REFNANNY 0
1094 #endif
1095 #if CYTHON_REFNANNY
1096 typedef struct {
1097 void (*INCREF)(void*, PyObject*, Py_ssize_t);
1098 void (*DECREF)(void*, PyObject*, Py_ssize_t);
1099 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1100 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1101 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1102 void (*FinishContext)(void**);
1103 } __Pyx_RefNannyAPIStruct;
1104 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1105 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1106 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1107 #ifdef WITH_THREAD
1108 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1109 if (acquire_gil) {\
1110 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1111 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1112 PyGILState_Release(__pyx_gilstate_save);\
1113 } else {\
1114 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1115 }
1116 #define __Pyx_RefNannyFinishContextNogil() {\
1117 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1118 __Pyx_RefNannyFinishContext();\
1119 PyGILState_Release(__pyx_gilstate_save);\
1120 }
1121 #else
1122 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1123 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1124 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1125 #endif
1126 #define __Pyx_RefNannyFinishContext()\
1127 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1128 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1129 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1130 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1131 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1132 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1133 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1134 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1135 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1136 #else
1137 #define __Pyx_RefNannyDeclarations
1138 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1139 #define __Pyx_RefNannyFinishContextNogil()
1140 #define __Pyx_RefNannyFinishContext()
1141 #define __Pyx_INCREF(r) Py_INCREF(r)
1142 #define __Pyx_DECREF(r) Py_DECREF(r)
1143 #define __Pyx_GOTREF(r)
1144 #define __Pyx_GIVEREF(r)
1145 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1146 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1147 #define __Pyx_XGOTREF(r)
1148 #define __Pyx_XGIVEREF(r)
1149 #endif
1150 #define __Pyx_Py_XDECREF_SET(r, v) do {\
1151 PyObject *tmp = (PyObject *) r;\
1152 r = v; Py_XDECREF(tmp);\
1153 } while (0)
1154 #define __Pyx_XDECREF_SET(r, v) do {\
1155 PyObject *tmp = (PyObject *) r;\
1156 r = v; __Pyx_XDECREF(tmp);\
1157 } while (0)
1158 #define __Pyx_DECREF_SET(r, v) do {\
1159 PyObject *tmp = (PyObject *) r;\
1160 r = v; __Pyx_DECREF(tmp);\
1161 } while (0)
1162 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1163 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1164
1165 /* PyErrExceptionMatches.proto */
1166 #if CYTHON_FAST_THREAD_STATE
1167 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1168 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1169 #else
1170 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1171 #endif
1172
1173 /* PyThreadStateGet.proto */
1174 #if CYTHON_FAST_THREAD_STATE
1175 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1176 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1177 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1178 #else
1179 #define __Pyx_PyThreadState_declare
1180 #define __Pyx_PyThreadState_assign
1181 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1182 #endif
1183
1184 /* PyErrFetchRestore.proto */
1185 #if CYTHON_FAST_THREAD_STATE
1186 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1187 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1188 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1189 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1190 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1191 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1192 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1193 #if CYTHON_COMPILING_IN_CPYTHON
1194 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1195 #else
1196 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1197 #endif
1198 #else
1199 #define __Pyx_PyErr_Clear() PyErr_Clear()
1200 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1201 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1202 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1203 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1204 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1205 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1206 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1207 #endif
1208
1209 /* PyObjectGetAttrStr.proto */
1210 #if CYTHON_USE_TYPE_SLOTS
1211 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1212 #else
1213 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1214 #endif
1215
1216 /* PyObjectGetAttrStrNoError.proto */
1217 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1218
1219 /* GetBuiltinName.proto */
1220 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1221
1222 /* Profile.proto */
1223 #ifndef CYTHON_PROFILE
1224 #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
1225 #define CYTHON_PROFILE 0
1226 #else
1227 #define CYTHON_PROFILE 1
1228 #endif
1229 #endif
1230 #ifndef CYTHON_TRACE_NOGIL
1231 #define CYTHON_TRACE_NOGIL 0
1232 #else
1233 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
1234 #define CYTHON_TRACE 1
1235 #endif
1236 #endif
1237 #ifndef CYTHON_TRACE
1238 #define CYTHON_TRACE 0
1239 #endif
1240 #if CYTHON_TRACE
1241 #undef CYTHON_PROFILE_REUSE_FRAME
1242 #endif
1243 #ifndef CYTHON_PROFILE_REUSE_FRAME
1244 #define CYTHON_PROFILE_REUSE_FRAME 0
1245 #endif
1246 #if CYTHON_PROFILE || CYTHON_TRACE
1247 #include "compile.h"
1248 #include "frameobject.h"
1249 #include "traceback.h"
1250 #if CYTHON_PROFILE_REUSE_FRAME
1251 #define CYTHON_FRAME_MODIFIER static
1252 #define CYTHON_FRAME_DEL(frame)
1253 #else
1254 #define CYTHON_FRAME_MODIFIER
1255 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1256 #endif
1257 #define __Pyx_TraceDeclarations\
1258 static PyCodeObject *__pyx_frame_code = NULL;\
1259 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1260 int __Pyx_use_tracing = 0;
1261 #define __Pyx_TraceFrameInit(codeobj)\
1262 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1263 #if PY_VERSION_HEX >= 0x030a00b1
1264 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1265 (unlikely((tstate)->cframe->use_tracing) &&\
1266 (!(check_tracing) || !(tstate)->tracing) &&\
1267 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1268 #define __Pyx_SetTracing(tstate, enable)\
1269 (tstate)->cframe->use_tracing = (enable)
1270 #else
1271 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1272 (unlikely((tstate)->use_tracing) &&\
1273 (!(check_tracing) || !(tstate)->tracing) &&\
1274 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1275 #define __Pyx_SetTracing(tstate, enable)\
1276 (tstate)->use_tracing = (enable)
1277 #endif
1278 #ifdef WITH_THREAD
1279 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1280 if (nogil) {\
1281 if (CYTHON_TRACE_NOGIL) {\
1282 PyThreadState *tstate;\
1283 PyGILState_STATE state = PyGILState_Ensure();\
1284 tstate = __Pyx_PyThreadState_Current;\
1285 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1286 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1287 }\
1288 PyGILState_Release(state);\
1289 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1290 }\
1291 } else {\
1292 PyThreadState* tstate = PyThreadState_GET();\
1293 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1294 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1295 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1296 }\
1297 }
1298 #else
1299 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1300 { PyThreadState* tstate = PyThreadState_GET();\
1301 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1302 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1303 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1304 }\
1305 }
1306 #endif
1307 #define __Pyx_TraceException()\
1308 if (likely(!__Pyx_use_tracing)); else {\
1309 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1310 if (__Pyx_IsTracing(tstate, 0, 1)) {\
1311 tstate->tracing++;\
1312 __Pyx_SetTracing(tstate, 0);\
1313 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1314 if (exc_info) {\
1315 if (CYTHON_TRACE && tstate->c_tracefunc)\
1316 tstate->c_tracefunc(\
1317 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1318 tstate->c_profilefunc(\
1319 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1320 Py_DECREF(exc_info);\
1321 }\
1322 __Pyx_SetTracing(tstate, 1);\
1323 tstate->tracing--;\
1324 }\
1325 }
__Pyx_call_return_trace_func(PyThreadState * tstate,PyFrameObject * frame,PyObject * result)1326 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1327 PyObject *type, *value, *traceback;
1328 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1329 tstate->tracing++;
1330 __Pyx_SetTracing(tstate, 0);
1331 if (CYTHON_TRACE && tstate->c_tracefunc)
1332 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1333 if (tstate->c_profilefunc)
1334 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1335 CYTHON_FRAME_DEL(frame);
1336 __Pyx_SetTracing(tstate, 1);
1337 tstate->tracing--;
1338 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1339 }
1340 #ifdef WITH_THREAD
1341 #define __Pyx_TraceReturn(result, nogil)\
1342 if (likely(!__Pyx_use_tracing)); else {\
1343 if (nogil) {\
1344 if (CYTHON_TRACE_NOGIL) {\
1345 PyThreadState *tstate;\
1346 PyGILState_STATE state = PyGILState_Ensure();\
1347 tstate = __Pyx_PyThreadState_Current;\
1348 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1349 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1350 }\
1351 PyGILState_Release(state);\
1352 }\
1353 } else {\
1354 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1355 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1356 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1357 }\
1358 }\
1359 }
1360 #else
1361 #define __Pyx_TraceReturn(result, nogil)\
1362 if (likely(!__Pyx_use_tracing)); else {\
1363 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1364 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1365 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1366 }\
1367 }
1368 #endif
1369 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
1370 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
1371 #else
1372 #define __Pyx_TraceDeclarations
1373 #define __Pyx_TraceFrameInit(codeobj)
1374 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
1375 #define __Pyx_TraceException()
1376 #define __Pyx_TraceReturn(result, nogil)
1377 #endif
1378 #if CYTHON_TRACE
__Pyx_call_line_trace_func(PyThreadState * tstate,PyFrameObject * frame,int lineno)1379 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
1380 int ret;
1381 PyObject *type, *value, *traceback;
1382 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1383 __Pyx_PyFrame_SetLineNumber(frame, lineno);
1384 tstate->tracing++;
1385 __Pyx_SetTracing(tstate, 0);
1386 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
1387 __Pyx_SetTracing(tstate, 1);
1388 tstate->tracing--;
1389 if (likely(!ret)) {
1390 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1391 } else {
1392 Py_XDECREF(type);
1393 Py_XDECREF(value);
1394 Py_XDECREF(traceback);
1395 }
1396 return ret;
1397 }
1398 #ifdef WITH_THREAD
1399 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1400 if (likely(!__Pyx_use_tracing)); else {\
1401 if (nogil) {\
1402 if (CYTHON_TRACE_NOGIL) {\
1403 int ret = 0;\
1404 PyThreadState *tstate;\
1405 PyGILState_STATE state = __Pyx_PyGILState_Ensure();\
1406 tstate = __Pyx_PyThreadState_Current;\
1407 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1408 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1409 }\
1410 __Pyx_PyGILState_Release(state);\
1411 if (unlikely(ret)) goto_error;\
1412 }\
1413 } else {\
1414 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1415 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1416 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1417 if (unlikely(ret)) goto_error;\
1418 }\
1419 }\
1420 }
1421 #else
1422 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1423 if (likely(!__Pyx_use_tracing)); else {\
1424 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1425 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1426 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1427 if (unlikely(ret)) goto_error;\
1428 }\
1429 }
1430 #endif
1431 #else
1432 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
1433 #endif
1434
1435 /* PyDictVersioning.proto */
1436 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1437 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1438 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1439 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1440 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1441 (cache_var) = (value);
1442 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1443 static PY_UINT64_T __pyx_dict_version = 0;\
1444 static PyObject *__pyx_dict_cached_value = NULL;\
1445 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1446 (VAR) = __pyx_dict_cached_value;\
1447 } else {\
1448 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1449 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1450 }\
1451 }
1452 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1453 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1454 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1455 #else
1456 #define __PYX_GET_DICT_VERSION(dict) (0)
1457 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1458 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1459 #endif
1460
1461 /* GetModuleGlobalName.proto */
1462 #if CYTHON_USE_DICT_VERSIONS
1463 #define __Pyx_GetModuleGlobalName(var, name) {\
1464 static PY_UINT64_T __pyx_dict_version = 0;\
1465 static PyObject *__pyx_dict_cached_value = NULL;\
1466 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1467 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1468 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1469 }
1470 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1471 PY_UINT64_T __pyx_dict_version;\
1472 PyObject *__pyx_dict_cached_value;\
1473 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1474 }
1475 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1476 #else
1477 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1478 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1479 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1480 #endif
1481
1482 /* MoveIfSupported.proto */
1483 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
1484 #include <utility>
1485 #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
1486 #else
1487 #define __PYX_STD_MOVE_IF_SUPPORTED(x) x
1488 #endif
1489
1490 /* TupleAndListFromArray.proto */
1491 #if CYTHON_COMPILING_IN_CPYTHON
1492 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
1493 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
1494 #endif
1495
1496 /* IncludeStringH.proto */
1497 #include <string.h>
1498
1499 /* BytesEquals.proto */
1500 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1501
1502 /* UnicodeEquals.proto */
1503 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1504
1505 /* fastcall.proto */
1506 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
1507 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
1508 #define __Pyx_KwValues_VARARGS(args, nargs) NULL
1509 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
1510 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
1511 #if CYTHON_METH_FASTCALL
1512 #define __Pyx_Arg_FASTCALL(args, i) args[i]
1513 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
1514 #define __Pyx_KwValues_FASTCALL(args, nargs) (&args[nargs])
1515 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
1516 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
1517 #else
1518 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
1519 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
1520 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
1521 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
1522 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
1523 #endif
1524 #if CYTHON_COMPILING_IN_CPYTHON
1525 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
1526 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
1527 #else
1528 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
1529 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
1530 #endif
1531
1532 /* RaiseArgTupleInvalid.proto */
1533 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1534 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1535
1536 /* RaiseDoubleKeywords.proto */
1537 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1538
1539 /* ParseKeywords.proto */
1540 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
1541 PyObject **argnames[],
1542 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
1543 const char* function_name);
1544
1545 /* RaiseTooManyValuesToUnpack.proto */
1546 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1547
1548 /* RaiseNeedMoreValuesToUnpack.proto */
1549 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1550
1551 /* IterFinish.proto */
1552 static CYTHON_INLINE int __Pyx_IterFinish(void);
1553
1554 /* UnpackItemEndCheck.proto */
1555 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1556
1557 /* CallableCheck.proto */
1558 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
1559 #define __Pyx_PyCallable_Check(obj) (Py_TYPE(obj)->tp_call != NULL)
1560 #else
1561 #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj)
1562 #endif
1563
1564 /* PyFunctionFastCall.proto */
1565 #if CYTHON_FAST_PYCALL
1566 #if !CYTHON_VECTORCALL
1567 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1568 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1569 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1570 #endif
1571 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1572 (sizeof(char [1 - 2*!(cond)]) - 1)
1573 #ifndef Py_MEMBER_SIZE
1574 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1575 #endif
1576 static size_t __pyx_pyframe_localsplus_offset = 0;
1577 #include "frameobject.h"
1578 #define __Pxy_PyFrame_Initialize_Offsets()\
1579 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1580 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1581 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1582 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1583 #endif
1584
1585 /* PyObjectCall.proto */
1586 #if CYTHON_COMPILING_IN_CPYTHON
1587 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1588 #else
1589 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1590 #endif
1591
1592 /* PyObjectCallMethO.proto */
1593 #if CYTHON_COMPILING_IN_CPYTHON
1594 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1595 #endif
1596
1597 /* PyObjectFastCall.proto */
1598 #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
1599 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
1600
1601 /* GetItemInt.proto */
1602 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1603 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1604 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1605 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1606 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1607 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1608 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1609 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1610 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1611 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1612 int wraparound, int boundscheck);
1613 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1614 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1615 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1616 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1617 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1618 int wraparound, int boundscheck);
1619 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1620 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1621 int is_list, int wraparound, int boundscheck);
1622
1623 /* GetTopmostException.proto */
1624 #if CYTHON_USE_EXC_INFO_STACK
1625 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1626 #endif
1627
1628 /* SaveResetException.proto */
1629 #if CYTHON_FAST_THREAD_STATE
1630 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1631 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1632 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1633 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1634 #else
1635 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1636 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1637 #endif
1638
1639 /* GetException.proto */
1640 #if CYTHON_FAST_THREAD_STATE
1641 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1642 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1643 #else
1644 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1645 #endif
1646
1647 /* SwapException.proto */
1648 #if CYTHON_FAST_THREAD_STATE
1649 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1650 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1651 #else
1652 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1653 #endif
1654
1655 /* PyObjectSetAttrStr.proto */
1656 #if CYTHON_USE_TYPE_SLOTS
1657 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1658 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1659 #else
1660 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1661 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1662 #endif
1663
1664 /* PyObjectCallOneArg.proto */
1665 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1666
1667 /* ObjectGetItem.proto */
1668 #if CYTHON_USE_TYPE_SLOTS
1669 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
1670 #else
1671 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1672 #endif
1673
1674 /* KeywordStringCheck.proto */
1675 static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed);
1676
1677 /* GetAttr3.proto */
1678 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1679
1680 /* RaiseUnexpectedTypeError.proto */
1681 static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);
1682
1683 /* RaiseException.proto */
1684 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1685
1686 /* Import.proto */
1687 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1688
1689 /* ImportFrom.proto */
1690 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1691
1692 /* GetAttr.proto */
1693 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1694
1695 /* HasAttr.proto */
1696 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1697
1698 /* IncludeStructmemberH.proto */
1699 #include <structmember.h>
1700
1701 /* FixUpExtensionType.proto */
1702 #if CYTHON_USE_TYPE_SPECS
1703 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
1704 #endif
1705
1706 /* PyObjectCallNoArg.proto */
1707 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1708
1709 /* PyObjectGetMethod.proto */
1710 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1711
1712 /* PyObjectCallMethod0.proto */
1713 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1714
1715 /* ValidateBasesTuple.proto */
1716 #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
1717 static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
1718 #endif
1719
1720 /* PyType_Ready.proto */
1721 static int __Pyx_PyType_Ready(PyTypeObject *t);
1722
1723 /* PyObject_GenericGetAttrNoDict.proto */
1724 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1725 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1726 #else
1727 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1728 #endif
1729
1730 /* PyObject_GenericGetAttr.proto */
1731 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1732 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1733 #else
1734 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1735 #endif
1736
1737 /* SetupReduce.proto */
1738 #if !CYTHON_COMPILING_IN_LIMITED_API
1739 static int __Pyx_setup_reduce(PyObject* type_obj);
1740 #endif
1741
1742 /* TypeImport.proto */
1743 #ifndef __PYX_HAVE_RT_ImportType_proto
1744 #define __PYX_HAVE_RT_ImportType_proto
1745 enum __Pyx_ImportType_CheckSize {
1746 __Pyx_ImportType_CheckSize_Error = 0,
1747 __Pyx_ImportType_CheckSize_Warn = 1,
1748 __Pyx_ImportType_CheckSize_Ignore = 2
1749 };
1750 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1751 #endif
1752
1753 /* FetchCommonType.proto */
1754 #if !CYTHON_USE_TYPE_SPECS
1755 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1756 #else
1757 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
1758 #endif
1759
1760 /* PyMethodNew.proto */
1761 #if PY_MAJOR_VERSION >= 3
__Pyx_PyMethod_New(PyObject * func,PyObject * self,PyObject * typ)1762 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
1763 CYTHON_UNUSED_VAR(typ);
1764 if (!self)
1765 return __Pyx_NewRef(func);
1766 return PyMethod_New(func, self);
1767 }
1768 #else
1769 #define __Pyx_PyMethod_New PyMethod_New
1770 #endif
1771
1772 /* PyVectorcallFastCallDict.proto */
1773 #if CYTHON_METH_FASTCALL
1774 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
1775 #endif
1776
1777 /* CythonFunctionShared.proto */
1778 #define __Pyx_CyFunction_USED
1779 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1780 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1781 #define __Pyx_CYFUNCTION_CCLASS 0x04
1782 #define __Pyx_CYFUNCTION_COROUTINE 0x08
1783 #define __Pyx_CyFunction_GetClosure(f)\
1784 (((__pyx_CyFunctionObject *) (f))->func_closure)
1785 #if PY_VERSION_HEX < 0x030900B1
1786 #define __Pyx_CyFunction_GetClassObj(f)\
1787 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1788 #else
1789 #define __Pyx_CyFunction_GetClassObj(f)\
1790 ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
1791 #endif
1792 #define __Pyx_CyFunction_SetClassObj(f, classobj)\
1793 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
1794 #define __Pyx_CyFunction_Defaults(type, f)\
1795 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1796 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1797 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1798 typedef struct {
1799 #if PY_VERSION_HEX < 0x030900B1
1800 PyCFunctionObject func;
1801 #else
1802 PyCMethodObject func;
1803 #endif
1804 #if CYTHON_BACKPORT_VECTORCALL
1805 __pyx_vectorcallfunc func_vectorcall;
1806 #endif
1807 #if PY_VERSION_HEX < 0x030500A0
1808 PyObject *func_weakreflist;
1809 #endif
1810 PyObject *func_dict;
1811 PyObject *func_name;
1812 PyObject *func_qualname;
1813 PyObject *func_doc;
1814 PyObject *func_globals;
1815 PyObject *func_code;
1816 PyObject *func_closure;
1817 #if PY_VERSION_HEX < 0x030900B1
1818 PyObject *func_classobj;
1819 #endif
1820 void *defaults;
1821 int defaults_pyobjects;
1822 size_t defaults_size; // used by FusedFunction for copying defaults
1823 int flags;
1824 PyObject *defaults_tuple;
1825 PyObject *defaults_kwdict;
1826 PyObject *(*defaults_getter)(PyObject *);
1827 PyObject *func_annotations;
1828 PyObject *func_is_coroutine;
1829 } __pyx_CyFunctionObject;
1830 #if !CYTHON_USE_MODULE_STATE
1831 static PyTypeObject *__pyx_CyFunctionType = 0;
1832 #endif
1833 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
1834 #define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
1835 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
1836 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1837 int flags, PyObject* qualname,
1838 PyObject *closure,
1839 PyObject *module, PyObject *globals,
1840 PyObject* code);
1841 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
1842 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1843 size_t size,
1844 int pyobjects);
1845 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1846 PyObject *tuple);
1847 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1848 PyObject *dict);
1849 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1850 PyObject *dict);
1851 static int __pyx_CyFunction_init(PyObject *module);
1852 #if CYTHON_METH_FASTCALL
1853 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
1854 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
1855 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
1856 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
1857 #if CYTHON_BACKPORT_VECTORCALL
1858 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
1859 #else
1860 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
1861 #endif
1862 #endif
1863
1864 /* CythonFunction.proto */
1865 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1866 int flags, PyObject* qualname,
1867 PyObject *closure,
1868 PyObject *module, PyObject *globals,
1869 PyObject* code);
1870
1871 /* Py3UpdateBases.proto */
1872 static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);
1873
1874 /* SetNameInClass.proto */
1875 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1876 #define __Pyx_SetNameInClass(ns, name, value)\
1877 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1878 #elif CYTHON_COMPILING_IN_CPYTHON
1879 #define __Pyx_SetNameInClass(ns, name, value)\
1880 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1881 #else
1882 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1883 #endif
1884
1885 /* SetNewInClass.proto */
1886 static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value);
1887
1888 /* CalculateMetaclass.proto */
1889 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1890
1891 /* PyObjectCall2Args.proto */
1892 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1893
1894 /* PyObjectLookupSpecial.proto */
1895 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
1896 #define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
1897 #define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
1898 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
1899 #else
1900 #define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
1901 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1902 #endif
1903
1904 /* Py3ClassCreate.proto */
1905 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1906 PyObject *mkw, PyObject *modname, PyObject *doc);
1907 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1908 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1909
1910 /* Globals.proto */
1911 static PyObject* __Pyx_Globals(void);
1912
1913 /* DictGetItem.proto */
1914 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1915 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1916 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1917 (likely(PyDict_CheckExact(obj)) ?\
1918 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1919 #else
1920 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1921 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1922 #endif
1923
1924 /* CLineInTraceback.proto */
1925 #ifdef CYTHON_CLINE_IN_TRACEBACK
1926 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1927 #else
1928 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1929 #endif
1930
1931 /* CodeObjectCache.proto */
1932 #if !CYTHON_COMPILING_IN_LIMITED_API
1933 typedef struct {
1934 PyCodeObject* code_object;
1935 int code_line;
1936 } __Pyx_CodeObjectCacheEntry;
1937 struct __Pyx_CodeObjectCache {
1938 int count;
1939 int max_count;
1940 __Pyx_CodeObjectCacheEntry* entries;
1941 };
1942 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1943 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1944 static PyCodeObject *__pyx_find_code_object(int code_line);
1945 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1946 #endif
1947
1948 /* AddTraceback.proto */
1949 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1950 int py_line, const char *filename);
1951
1952 /* EnumClassDecl.proto */
1953 #if defined (_MSC_VER)
1954 #if PY_VERSION_HEX >= 0x03040000 && PY_VERSION_HEX < 0x03050000
1955 #define __PYX_ENUM_CLASS_DECL
1956 #else
1957 #define __PYX_ENUM_CLASS_DECL
1958 #endif
1959 #else
1960 #define __PYX_ENUM_CLASS_DECL enum
1961 #endif
1962
1963 /* CppExceptionConversion.proto */
1964 #ifndef __Pyx_CppExn2PyErr
1965 #include <new>
1966 #include <typeinfo>
1967 #include <stdexcept>
1968 #include <ios>
__Pyx_CppExn2PyErr()1969 static void __Pyx_CppExn2PyErr() {
1970 try {
1971 if (PyErr_Occurred())
1972 ; // let the latest Python exn pass through and ignore the current one
1973 else
1974 throw;
1975 } catch (const std::bad_alloc& exn) {
1976 PyErr_SetString(PyExc_MemoryError, exn.what());
1977 } catch (const std::bad_cast& exn) {
1978 PyErr_SetString(PyExc_TypeError, exn.what());
1979 } catch (const std::bad_typeid& exn) {
1980 PyErr_SetString(PyExc_TypeError, exn.what());
1981 } catch (const std::domain_error& exn) {
1982 PyErr_SetString(PyExc_ValueError, exn.what());
1983 } catch (const std::invalid_argument& exn) {
1984 PyErr_SetString(PyExc_ValueError, exn.what());
1985 } catch (const std::ios_base::failure& exn) {
1986 PyErr_SetString(PyExc_IOError, exn.what());
1987 } catch (const std::out_of_range& exn) {
1988 PyErr_SetString(PyExc_IndexError, exn.what());
1989 } catch (const std::overflow_error& exn) {
1990 PyErr_SetString(PyExc_OverflowError, exn.what());
1991 } catch (const std::range_error& exn) {
1992 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1993 } catch (const std::underflow_error& exn) {
1994 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1995 } catch (const std::exception& exn) {
1996 PyErr_SetString(PyExc_RuntimeError, exn.what());
1997 }
1998 catch (...)
1999 {
2000 PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
2001 }
2002 }
2003 #endif
2004
2005 /* GCCDiagnostics.proto */
2006 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2007 #define __Pyx_HAS_GCC_DIAGNOSTIC
2008 #endif
2009
2010 /* UnicodeAsUCS4.proto */
2011 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);
2012
2013 /* CIntFromPy.proto */
2014 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
2015
2016 /* CIntFromPy.proto */
2017 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
2018
2019 /* ObjectAsUCS4.proto */
2020 #define __Pyx_PyObject_AsPy_UCS4(x)\
2021 (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x))
2022 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*);
2023
2024 /* CIntFromPy.proto */
2025 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2026
2027 /* CIntToPy.proto */
2028 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2029
2030 /* CIntToPy.proto */
2031 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2032
2033 /* FormatTypeName.proto */
2034 #if CYTHON_COMPILING_IN_LIMITED_API
2035 typedef PyObject *__Pyx_TypeName;
2036 #define __Pyx_FMT_TYPENAME "%U"
2037 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
2038 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
2039 #else
2040 typedef const char *__Pyx_TypeName;
2041 #define __Pyx_FMT_TYPENAME "%.200s"
2042 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
2043 #define __Pyx_DECREF_TypeName(obj)
2044 #endif
2045
2046 /* CIntFromPy.proto */
2047 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2048
2049 /* FastTypeChecks.proto */
2050 #if CYTHON_COMPILING_IN_CPYTHON
2051 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2052 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
2053 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2054 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
2055 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2056 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2057 #else
2058 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2059 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
2060 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2061 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2062 #endif
2063 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_Occurred(), err1, err2)
2064 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2065
2066 /* CheckBinaryVersion.proto */
2067 static int __Pyx_check_binary_version(void);
2068
2069 /* InitStrings.proto */
2070 #if CYTHON_COMPILING_IN_LIMITED_API
2071 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str);
2072 #else
2073 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2074 #endif
2075
2076 /* #### Code section: module_declarations ### */
2077
2078 /* Module declarations from "libc.stdint" */
2079 #if !CYTHON_USE_MODULE_STATE
2080 #endif
2081
2082 /* Module declarations from "libc.string" */
2083 #if !CYTHON_USE_MODULE_STATE
2084 #endif
2085
2086 /* Module declarations from "libc.stdlib" */
2087 #if !CYTHON_USE_MODULE_STATE
2088 #endif
2089
2090 /* Module declarations from "libc.stddef" */
2091 #if !CYTHON_USE_MODULE_STATE
2092 #endif
2093
2094 /* Module declarations from "libcpp.utility" */
2095 #if !CYTHON_USE_MODULE_STATE
2096 #endif
2097
2098 /* Module declarations from "libcpp" */
2099 #if !CYTHON_USE_MODULE_STATE
2100 #endif
2101
2102 /* Module declarations from "cpp_common" */
2103 #if !CYTHON_USE_MODULE_STATE
2104 #endif
2105 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *); /*proto*/
2106 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *); /*proto*/
2107
2108 /* Module declarations from "libcpp.vector" */
2109 #if !CYTHON_USE_MODULE_STATE
2110 #endif
2111
2112 /* Module declarations from "libc.stdio" */
2113 #if !CYTHON_USE_MODULE_STATE
2114 #endif
2115
2116 /* Module declarations from "__builtin__" */
2117 #if !CYTHON_USE_MODULE_STATE
2118 #endif
2119
2120 /* Module declarations from "cpython.type" */
2121 #if !CYTHON_USE_MODULE_STATE
2122 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2123 #endif
2124
2125 /* Module declarations from "cpython" */
2126 #if !CYTHON_USE_MODULE_STATE
2127 #endif
2128
2129 /* Module declarations from "cpython.object" */
2130 #if !CYTHON_USE_MODULE_STATE
2131 #endif
2132
2133 /* Module declarations from "cpython.list" */
2134 #if !CYTHON_USE_MODULE_STATE
2135 #endif
2136
2137 /* Module declarations from "cpython.ref" */
2138 #if !CYTHON_USE_MODULE_STATE
2139 #endif
2140
2141 /* Module declarations from "cpp_string_metric" */
2142 #if !CYTHON_USE_MODULE_STATE
2143 static PyTypeObject *__pyx_ptype___Pyx_EnumMeta = 0;
2144 #endif
2145 static PyObject *__Pyx_OrderedDict = 0;
2146 static PyObject *__Pyx_EnumBase = 0;
2147 static PyObject *__Pyx_globals = 0;
2148 static CYTHON_INLINE proc_string __pyx_f_17cpp_string_metric_conv_sequence(PyObject *); /*proto*/
2149 static PyObject *__pyx_f_17cpp_string_metric_levenshtein_edit_type_to_str(__PYX_ENUM_CLASS_DECL rapidfuzz::LevenshteinEditType); /*proto*/
2150 static PyObject *__pyx_f_17cpp_string_metric_levenshtein_editops_to_list(std::vector<rapidfuzz::LevenshteinEditOp> ); /*proto*/
2151 static PyObject *__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta *, PyObject *); /*proto*/
2152 /* #### Code section: typeinfo ### */
2153 /* #### Code section: before_global_var ### */
2154 #define __Pyx_MODULE_NAME "cpp_string_metric"
2155 extern int __pyx_module_is_main_cpp_string_metric;
2156 int __pyx_module_is_main_cpp_string_metric = 0;
2157
2158 /* Implementation of "cpp_string_metric" */
2159 /* #### Code section: global_var ### */
2160 static PyObject *__pyx_builtin_range;
2161 static PyObject *__pyx_builtin_MemoryError;
2162 static PyObject *__pyx_builtin_ValueError;
2163 /* #### Code section: string_decls ### */
2164 static const char __pyx_k_v[] = "v";
2165 static const char __pyx_k_gc[] = "gc";
2166 static const char __pyx_k_s1[] = "s1";
2167 static const char __pyx_k_s2[] = "s2";
2168 static const char __pyx_k__29[] = "?";
2169 static const char __pyx_k_cls[] = "cls";
2170 static const char __pyx_k_dct[] = "dct";
2171 static const char __pyx_k_doc[] = "__doc__";
2172 static const char __pyx_k_max[] = "max";
2173 static const char __pyx_k_new[] = "__new__";
2174 static const char __pyx_k_res[] = "res";
2175 static const char __pyx_k_s_s[] = "%s.%s";
2176 static const char __pyx_k_str[] = "__str__";
2177 static const char __pyx_k_None[] = "None";
2178 static const char __pyx_k_dict[] = "__dict__";
2179 static const char __pyx_k_enum[] = "enum";
2180 static const char __pyx_k_init[] = "__init__";
2181 static const char __pyx_k_main[] = "__main__";
2182 static const char __pyx_k_name[] = "name";
2183 static const char __pyx_k_repr[] = "__repr__";
2184 static const char __pyx_k_self[] = "self";
2185 static const char __pyx_k_test[] = "__test__";
2186 static const char __pyx_k_array[] = "array";
2187 static const char __pyx_k_c_max[] = "c_max";
2188 static const char __pyx_k_class[] = "__class__";
2189 static const char __pyx_k_range[] = "range";
2190 static const char __pyx_k_s_s_d[] = "<%s.%s: %d>";
2191 static const char __pyx_k_state[] = "state";
2192 static const char __pyx_k_super[] = "super";
2193 static const char __pyx_k_value[] = "value";
2194 static const char __pyx_k_Delete[] = "Delete";
2195 static const char __pyx_k_Insert[] = "Insert";
2196 static const char __pyx_k_delete[] = "delete";
2197 static const char __pyx_k_dict_2[] = "_dict";
2198 static const char __pyx_k_enable[] = "enable";
2199 static const char __pyx_k_import[] = "__import__";
2200 static const char __pyx_k_insert[] = "insert";
2201 static const char __pyx_k_module[] = "__module__";
2202 static const char __pyx_k_name_2[] = "__name__";
2203 static const char __pyx_k_pickle[] = "pickle";
2204 static const char __pyx_k_reduce[] = "__reduce__";
2205 static const char __pyx_k_update[] = "update";
2206 static const char __pyx_k_values[] = "values";
2207 static const char __pyx_k_IntEnum[] = "IntEnum";
2208 static const char __pyx_k_Replace[] = "Replace";
2209 static const char __pyx_k_disable[] = "disable";
2210 static const char __pyx_k_hamming[] = "hamming";
2211 static const char __pyx_k_members[] = "__members__";
2212 static const char __pyx_k_parents[] = "parents";
2213 static const char __pyx_k_prepare[] = "__prepare__";
2214 static const char __pyx_k_replace[] = "replace";
2215 static const char __pyx_k_weights[] = "weights";
2216 static const char __pyx_k_EnumBase[] = "EnumBase";
2217 static const char __pyx_k_deletion[] = "deletion";
2218 static const char __pyx_k_getstate[] = "__getstate__";
2219 static const char __pyx_k_pyx_type[] = "__pyx_type";
2220 static const char __pyx_k_qualname[] = "__qualname__";
2221 static const char __pyx_k_set_name[] = "__set_name__";
2222 static const char __pyx_k_setstate[] = "__setstate__";
2223 static const char __pyx_k_typecode[] = "typecode";
2224 static const char __pyx_k_insertion[] = "insertion";
2225 static const char __pyx_k_isenabled[] = "isenabled";
2226 static const char __pyx_k_metaclass[] = "__metaclass__";
2227 static const char __pyx_k_processor[] = "processor";
2228 static const char __pyx_k_pyx_state[] = "__pyx_state";
2229 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2230 static const char __pyx_k_ValueError[] = "ValueError";
2231 static const char __pyx_k_pyx_result[] = "__pyx_result";
2232 static const char __pyx_k_MemoryError[] = "MemoryError";
2233 static const char __pyx_k_OrderedDict[] = "OrderedDict";
2234 static const char __pyx_k_PickleError[] = "PickleError";
2235 static const char __pyx_k_collections[] = "collections";
2236 static const char __pyx_k_levenshtein[] = "levenshtein";
2237 static const char __pyx_k_mro_entries[] = "__mro_entries__";
2238 static const char __pyx_k_Pyx_EnumBase[] = "__Pyx_EnumBase";
2239 static const char __pyx_k_is_coroutine[] = "_is_coroutine";
2240 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2241 static const char __pyx_k_score_cutoff[] = "score_cutoff";
2242 static const char __pyx_k_stringsource[] = "stringsource";
2243 static const char __pyx_k_substitution[] = "substitution";
2244 static const char __pyx_k_use_setstate[] = "use_setstate";
2245 static const char __pyx_k_class_getitem[] = "__class_getitem__";
2246 static const char __pyx_k_init_subclass[] = "__init_subclass__";
2247 static const char __pyx_k_prefix_weight[] = "prefix_weight";
2248 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2249 static const char __pyx_k_c_score_cutoff[] = "c_score_cutoff";
2250 static const char __pyx_k_default_process[] = "default_process";
2251 static const char __pyx_k_jaro_similarity[] = "jaro_similarity";
2252 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2253 static const char __pyx_k_rapidfuzz_utils[] = "rapidfuzz.utils";
2254 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2255 static const char __pyx_k_cpp_string_metric[] = "cpp_string_metric";
2256 static const char __pyx_k_Pyx_EnumBase___new[] = "__Pyx_EnumBase.__new__";
2257 static const char __pyx_k_Pyx_EnumBase___str[] = "__Pyx_EnumBase.__str__";
2258 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
2259 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2260 static const char __pyx_k_normalized_hamming[] = "normalized_hamming";
2261 static const char __pyx_k_LevenshteinEditType[] = "LevenshteinEditType";
2262 static const char __pyx_k_Pyx_EnumBase___repr[] = "__Pyx_EnumBase.__repr__";
2263 static const char __pyx_k_levenshtein_editops[] = "levenshtein_editops";
2264 static const char __pyx_k_levenshtein_line_50[] = "levenshtein (line 50)";
2265 static const char __pyx_k_Unknown_enum_value_s[] = "Unknown enum value: '%s'";
2266 static const char __pyx_k_cpp_string_metric_pyx[] = "cpp_string_metric.pyx";
2267 static const char __pyx_k_normalized_levenshtein[] = "normalized_levenshtein";
2268 static const char __pyx_k_jaro_winkler_similarity[] = "jaro_winkler_similarity";
2269 static const char __pyx_k_pyx_unpickle___Pyx_EnumMeta[] = "__pyx_unpickle___Pyx_EnumMeta";
2270 static const char __pyx_k_Pyx_EnumMeta___reduce_cython[] = "__Pyx_EnumMeta.__reduce_cython__";
2271 static const char __pyx_k_levenshtein_editops_line_248[] = "levenshtein_editops (line 248)";
2272 static const char __pyx_k_Pyx_EnumMeta___setstate_cython[] = "__Pyx_EnumMeta.__setstate_cython__";
2273 static const char __pyx_k_Calculates_a_normalized_levensh[] = "\n Calculates a normalized levenshtein distance using custom\n costs for insertion, deletion and substitution.\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n weights : Tuple[int, int, int] or None, optional\n The weights for the three operations in the form\n (insertion, deletion, substitution). Default is (1, 1, 1),\n which gives all three operations a weight of 1.\n processor: bool or 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 : float, optional\n Optional argument for a score threshold as a float between 0 and 100.\n For ratio < score_cutoff 0 is returned instead. Default is 0,\n which deactivates this behaviour.\n\n Returns\n -------\n similarity : float\n similarity between s1 and s2 as a float between 0 and 100\n\n Raises\n ------\n ValueError\n If unsupported weights are provided a ValueError is thrown\n\n See Also\n --------\n levenshtein : Levenshtein distance\n\n Notes\n -----\n The normalization of the Levenshtein distance is performed in the following way:\n\n .. math::\n :nowrap:\n\n \\begin{align*}\n dist_{max} &= \\begin{cases}\n min(len(s1), len(s2)) \\cdot sub, & \\text{if } sub \\leq ins + del \\\\\n len(s1) \\cdot del + len(s2) \\cdot ins, & \\text{otherwise}\n \\end{cases}\\\\[10pt]\n\n dist_{max} &= \\begin{cases}\n dist_{max} + (len(s1) - len(s2)) \\cdot del, & \\text{if } len(s1) > len(s2) \\\\\n dist_{max} + (len(s2) - len(s1)) \\cdot ins, & \\text{if } len(s1) < len(s2) \\\\\n dist_{max}, & \\text{if } len""(s1) = len(s2)\n \\end{cases}\\\\[10pt]\n\n ratio &= 100 \\cdot \\frac{distance(s1, s2)}{dist_{max}}\n \\end{align*}\n\n Examples\n --------\n Find the normalized Levenshtein distance between two strings:\n\n >>> from rapidfuzz.string_metric import normalized_levenshtein\n >>> normalized_levenshtein(\"lewenstein\", \"levenshtein\")\n 81.81818181818181\n\n Setting a score_cutoff allows the implementation to select\n a more efficient implementation:\n\n >>> normalized_levenshtein(\"lewenstein\", \"levenshtein\", score_cutoff=85)\n 0.0\n\n It is possible to select different weights by passing a `weight`\n tuple.\n\n >>> normalized_levenshtein(\"lewenstein\", \"levenshtein\", weights=(1,1,2))\n 85.71428571428571\n\n When a different processor is used s1 and s2 do not have to be strings\n\n >>> normalized_levenshtein([\"lewenstein\"], [\"levenshtein\"], processor=lambda s: s[0])\n 81.81818181818181\n ";
2274 static const char __pyx_k_Calculates_the_minimum_number_o[] = "\n Calculates the minimum number of insertions, deletions, and substitutions\n required to change one sequence into the other according to Levenshtein with custom\n costs for insertion, deletion and substitution\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n weights : Tuple[int, int, int] or None, optional\n The weights for the three operations in the form\n (insertion, deletion, substitution). Default is (1, 1, 1),\n which gives all three operations a weight of 1.\n processor: bool or 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 max : int or None, optional\n Maximum distance between s1 and s2, that is\n considered as a result. If the distance is bigger than max,\n -1 is returned instead. Default is None, which deactivates\n this behaviour.\n\n Returns\n -------\n distance : int\n distance between s1 and s2\n\n Raises\n ------\n ValueError\n If unsupported weights are provided a ValueError is thrown\n\n Notes\n -----\n Depending on the input parameters different optimized implementation are used\n to improve the performance.\n\n Insertion = Deletion = Substitution:\n This is known as uniform Levenshtein distance and is the distance most commonly\n referred to as Levenshtein distance. The following implementation is used\n with a worst-case performance of ``O([N/64]M)``.\n\n - if max is 0 the similarity can be calculated using a direct comparision,\n since no difference between the strings is allowed. The time complexity of\n this algorithm is ``O(N)``.\n\n - A common prefix/suffix of the two compared strings does"" not affect\n the Levenshtein distance, so the affix is removed before calculating the\n similarity.\n\n - If max is \342\211\244 3 the mbleven algorithm is used. This algorithm\n checks all possible edit operations that are possible under\n the threshold `max`. The time complexity of this algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\244 64 after removing the common affix\n Hyyr\303\266s' algorithm is used, which calculates the Levenshtein distance in\n parallel. The algorithm is described by [1]_. The time complexity of this\n algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\245 64 after removing the common affix\n a blockwise implementation of Myers' algorithm is used, which calculates\n the Levenshtein distance in parallel (64 characters at a time).\n The algorithm is described by [3]_. The time complexity of this\n algorithm is ``O([N/64]M)``.\n\n The following image shows a benchmark of the Levenshtein distance in multiple\n Python libraries. All of them are implemented either in C/C++ or Cython.\n The graph shows, that python-Levenshtein is the only library with a time\n complexity of ``O(NM)``, while all other libraries have a time complexity of\n ``O([N/64]M)``. Especially for long strings RapidFuzz is a lot faster than\n all the other tested libraries.\n\n .. image:: img/uniform_levenshtein.svg\n\n\n Insertion = Deletion, Substitution >= Insertion + Deletion:\n Since every Substitution can be performed as Insertion + Deletion, this variant\n of the Levenshtein distance only uses Insertions and Deletions. Therefore this\n variant is often referred to as InDel-Distance. The following implementation\n is used with a worst-case performance of ``O([N/64]M)``.\n\n - if max is 0 the similarity can be calculated using a direct comparision,\n since no differenc""e between the strings is allowed. The time complexity of\n this algorithm is ``O(N)``.\n\n - if max is 1 and the two strings have a similar length, the similarity can be\n calculated using a direct comparision aswell, since a substitution would cause\n a edit distance higher than max. The time complexity of this algorithm\n is ``O(N)``.\n\n - A common prefix/suffix of the two compared strings does not affect\n the Levenshtein distance, so the affix is removed before calculating the\n similarity.\n\n - If max is \342\211\244 4 the mbleven algorithm is used. This algorithm\n checks all possible edit operations that are possible under\n the threshold `max`. As a difference to the normal Levenshtein distance this\n algorithm can even be used up to a threshold of 4 here, since the higher weight\n of substitutions decreases the amount of possible edit operations.\n The time complexity of this algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\244 64 after removing the common affix\n Hyyr\303\266s' lcs algorithm is used, which calculates the InDel distance in\n parallel. The algorithm is described by [4]_ and is extended with support\n for UTF32 in this implementation. The time complexity of this\n algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\245 64 after removing the common affix\n a blockwise implementation of the Hyyr\303\266s' lcs algorithm is used, which calculates\n the Levenshtein distance in parallel (64 characters at a time).\n The algorithm is described by [4]_. The time complexity of this\n algorithm is ``O([N/64]M)``.\n\n The following image shows a benchmark of the InDel distance in RapidFuzz\n and python-Levenshtein. Similar to the normal Levenshtein distance\n python-Levenshtein uses a implementation with a time complexity of ``O(NM)``,""\n while RapidFuzz has a time complexity of ``O([N/64]M)``.\n\n .. image:: img/indel_levenshtein.svg\n\n\n Other weights:\n The implementation for other weights is based on Wagner-Fischer.\n It has a performance of ``O(N * M)`` and has a memory usage of ``O(N)``.\n Further details can be found in [2]_.\n\n References\n ----------\n .. [1] Hyyr\303\266, Heikki. \"A Bit-Vector Algorithm for Computing\n Levenshtein and Damerau Edit Distances.\"\n Nordic Journal of Computing, Volume 10 (2003): 29-39.\n .. [2] Wagner, Robert & Fischer, Michael\n \"The String-to-String Correction Problem.\"\n J. ACM. 21. (1974): 168-173\n .. [3] Myers, Gene. \"A fast bit-vector algorithm for approximate\n string matching based on dynamic programming.\"\n Journal of the ACM (JACM) 46.3 (1999): 395-415.\n .. [4] Hyyr\303\266, Heikki. \"Bit-Parallel LCS-length Computation Revisited\"\n Proc. 15th Australasian Workshop on Combinatorial Algorithms (AWOCA 2004). \n\n Examples\n --------\n Find the Levenshtein distance between two strings:\n\n >>> from rapidfuzz.string_metric import levenshtein\n >>> levenshtein(\"lewenstein\", \"levenshtein\")\n 2\n\n Setting a maximum distance allows the implementation to select\n a more efficient implementation:\n\n >>> levenshtein(\"lewenstein\", \"levenshtein\", max=1)\n -1\n\n It is possible to select different weights by passing a `weight`\n tuple.\n\n >>> levenshtein(\"lewenstein\", \"levenshtein\", weights=(1,1,2))\n 3\n ";
2275 static const char __pyx_k_Return_list_of_3_tuples_describ[] = "\n Return list of 3-tuples describing how to turn s1 into s2.\n Each tuple is of the form (tag, src_pos, dest_pos).\n\n The tags are strings, with these meanings:\n 'replace': s1[src_pos] should be replaced by s2[dest_pos]\n 'delete': s1[src_pos] should be deleted.\n 'insert': s2[dest_pos] should be inserted at s1[src_pos].\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n processor: bool or 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\n Returns\n -------\n editops : list[]\n edit operations required to turn s1 into s2\n\n Examples\n --------\n >>> from rapidfuzz.string_metric import levenshtein_editops\n >>> for tag, src_pos, dest_pos in levenshtein_editops(\"qabxcd\", \"abycdf\"):\n ... print((\"%7s s1[%d] s2[%d]\" % (tag, src_pos, dest_pos)))\n delete s1[1] s2[0]\n replace s1[4] s2[3]\n insert s1[6] s2[6]\n ";
2276 static const char __pyx_k_normalized_levenshtein_line_295[] = "normalized_levenshtein (line 295)";
2277 static const char __pyx_k_Incompatible_checksums_s_vs_0xda[] = "Incompatible checksums (%s vs 0xda39a3e = ())";
2278 #if !CYTHON_USE_MODULE_STATE
2279 static PyObject *__pyx_kp_u_Calculates_a_normalized_levensh;
2280 static PyObject *__pyx_kp_u_Calculates_the_minimum_number_o;
2281 static PyObject *__pyx_n_s_Delete;
2282 static PyObject *__pyx_n_s_EnumBase;
2283 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xda;
2284 static PyObject *__pyx_n_s_Insert;
2285 static PyObject *__pyx_n_s_IntEnum;
2286 static PyObject *__pyx_n_s_LevenshteinEditType;
2287 static PyObject *__pyx_n_s_MemoryError;
2288 static PyObject *__pyx_n_s_None;
2289 static PyObject *__pyx_n_s_OrderedDict;
2290 static PyObject *__pyx_n_s_PickleError;
2291 static PyObject *__pyx_n_s_Pyx_EnumBase;
2292 static PyObject *__pyx_n_s_Pyx_EnumBase___new;
2293 static PyObject *__pyx_n_s_Pyx_EnumBase___repr;
2294 static PyObject *__pyx_n_s_Pyx_EnumBase___str;
2295 static PyObject *__pyx_n_s_Pyx_EnumMeta___reduce_cython;
2296 static PyObject *__pyx_n_s_Pyx_EnumMeta___setstate_cython;
2297 static PyObject *__pyx_n_s_Replace;
2298 static PyObject *__pyx_kp_u_Return_list_of_3_tuples_describ;
2299 static PyObject *__pyx_kp_s_Unknown_enum_value_s;
2300 static PyObject *__pyx_n_s_ValueError;
2301 static PyObject *__pyx_n_s__29;
2302 static PyObject *__pyx_n_s_array;
2303 static PyObject *__pyx_n_s_asyncio_coroutines;
2304 static PyObject *__pyx_n_s_c_max;
2305 static PyObject *__pyx_n_s_c_score_cutoff;
2306 static PyObject *__pyx_n_s_class;
2307 static PyObject *__pyx_n_s_class_getitem;
2308 static PyObject *__pyx_n_s_cline_in_traceback;
2309 static PyObject *__pyx_n_s_cls;
2310 static PyObject *__pyx_n_s_collections;
2311 static PyObject *__pyx_n_s_cpp_string_metric;
2312 static PyObject *__pyx_kp_s_cpp_string_metric_pyx;
2313 static PyObject *__pyx_n_s_dct;
2314 static PyObject *__pyx_n_s_default_process;
2315 static PyObject *__pyx_n_u_delete;
2316 static PyObject *__pyx_n_s_deletion;
2317 static PyObject *__pyx_n_s_dict;
2318 static PyObject *__pyx_n_s_dict_2;
2319 static PyObject *__pyx_kp_u_disable;
2320 static PyObject *__pyx_n_s_doc;
2321 static PyObject *__pyx_kp_u_enable;
2322 static PyObject *__pyx_n_s_enum;
2323 static PyObject *__pyx_kp_u_gc;
2324 static PyObject *__pyx_n_s_getstate;
2325 static PyObject *__pyx_n_s_hamming;
2326 static PyObject *__pyx_n_s_import;
2327 static PyObject *__pyx_n_s_init;
2328 static PyObject *__pyx_n_s_init_subclass;
2329 static PyObject *__pyx_n_u_insert;
2330 static PyObject *__pyx_n_s_insertion;
2331 static PyObject *__pyx_n_s_is_coroutine;
2332 static PyObject *__pyx_kp_u_isenabled;
2333 static PyObject *__pyx_n_s_jaro_similarity;
2334 static PyObject *__pyx_n_s_jaro_winkler_similarity;
2335 static PyObject *__pyx_n_s_levenshtein;
2336 static PyObject *__pyx_n_s_levenshtein_editops;
2337 static PyObject *__pyx_kp_u_levenshtein_editops_line_248;
2338 static PyObject *__pyx_kp_u_levenshtein_line_50;
2339 static PyObject *__pyx_n_s_main;
2340 static PyObject *__pyx_n_s_max;
2341 static PyObject *__pyx_n_s_members;
2342 static PyObject *__pyx_n_s_metaclass;
2343 static PyObject *__pyx_n_s_module;
2344 static PyObject *__pyx_n_s_mro_entries;
2345 static PyObject *__pyx_n_s_name;
2346 static PyObject *__pyx_n_s_name_2;
2347 static PyObject *__pyx_n_s_new;
2348 static PyObject *__pyx_n_s_normalized_hamming;
2349 static PyObject *__pyx_n_s_normalized_levenshtein;
2350 static PyObject *__pyx_kp_u_normalized_levenshtein_line_295;
2351 static PyObject *__pyx_n_s_parents;
2352 static PyObject *__pyx_n_s_pickle;
2353 static PyObject *__pyx_n_s_prefix_weight;
2354 static PyObject *__pyx_n_s_prepare;
2355 static PyObject *__pyx_n_s_processor;
2356 static PyObject *__pyx_n_s_pyx_PickleError;
2357 static PyObject *__pyx_n_s_pyx_checksum;
2358 static PyObject *__pyx_n_s_pyx_result;
2359 static PyObject *__pyx_n_s_pyx_state;
2360 static PyObject *__pyx_n_s_pyx_type;
2361 static PyObject *__pyx_n_s_pyx_unpickle___Pyx_EnumMeta;
2362 static PyObject *__pyx_n_s_qualname;
2363 static PyObject *__pyx_n_s_range;
2364 static PyObject *__pyx_n_s_rapidfuzz_utils;
2365 static PyObject *__pyx_n_s_reduce;
2366 static PyObject *__pyx_n_s_reduce_cython;
2367 static PyObject *__pyx_n_s_reduce_ex;
2368 static PyObject *__pyx_n_u_replace;
2369 static PyObject *__pyx_n_s_repr;
2370 static PyObject *__pyx_n_s_res;
2371 static PyObject *__pyx_n_s_s1;
2372 static PyObject *__pyx_n_s_s2;
2373 static PyObject *__pyx_kp_s_s_s;
2374 static PyObject *__pyx_kp_s_s_s_d;
2375 static PyObject *__pyx_n_s_score_cutoff;
2376 static PyObject *__pyx_n_s_self;
2377 static PyObject *__pyx_n_s_set_name;
2378 static PyObject *__pyx_n_s_setstate;
2379 static PyObject *__pyx_n_s_setstate_cython;
2380 static PyObject *__pyx_n_s_state;
2381 static PyObject *__pyx_n_s_str;
2382 static PyObject *__pyx_kp_s_stringsource;
2383 static PyObject *__pyx_n_s_substitution;
2384 static PyObject *__pyx_n_s_super;
2385 static PyObject *__pyx_n_s_test;
2386 static PyObject *__pyx_n_s_typecode;
2387 static PyObject *__pyx_n_s_update;
2388 static PyObject *__pyx_n_s_use_setstate;
2389 static PyObject *__pyx_n_s_v;
2390 static PyObject *__pyx_n_s_value;
2391 static PyObject *__pyx_n_s_values;
2392 static PyObject *__pyx_n_s_weights;
2393 #endif
2394 /* #### Code section: decls ### */
2395 static PyObject *__pyx_pf_17cpp_string_metric_levenshtein(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_weights, PyObject *__pyx_v_processor, PyObject *__pyx_v_max); /* proto */
2396 static PyObject *__pyx_pf_17cpp_string_metric_2levenshtein_editops(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor); /* proto */
2397 static PyObject *__pyx_pf_17cpp_string_metric_4normalized_levenshtein(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_weights, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff); /* proto */
2398 static PyObject *__pyx_pf_17cpp_string_metric_6hamming(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor, PyObject *__pyx_v_max); /* proto */
2399 static PyObject *__pyx_pf_17cpp_string_metric_8normalized_hamming(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff); /* proto */
2400 static PyObject *__pyx_pf_17cpp_string_metric_10jaro_similarity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff); /* proto */
2401 static PyObject *__pyx_pf_17cpp_string_metric_12jaro_winkler_similarity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, double __pyx_v_prefix_weight, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff); /* proto */
2402 static int __pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_parents, PyObject *__pyx_v_dct); /* proto */
2403 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls); /* proto */
2404 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name); /* proto */
2405 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self); /* proto */
2406 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2407 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value, PyObject *__pyx_v_name); /* proto */
2408 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2409 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2410 static PyObject *__pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2411 #if !CYTHON_USE_MODULE_STATE
2412 static PyObject *__pyx_int_0;
2413 static PyObject *__pyx_int_1;
2414 static PyObject *__pyx_int_228825662;
2415 #endif
2416 #if !CYTHON_USE_MODULE_STATE
2417 static PyObject *__pyx_tuple_;
2418 static PyObject *__pyx_tuple__9;
2419 static PyObject *__pyx_tuple__10;
2420 static PyObject *__pyx_tuple__11;
2421 static PyObject *__pyx_tuple__12;
2422 static PyObject *__pyx_tuple__13;
2423 static PyObject *__pyx_tuple__14;
2424 static PyObject *__pyx_tuple__15;
2425 static PyObject *__pyx_tuple__16;
2426 static PyObject *__pyx_tuple__18;
2427 static PyObject *__pyx_tuple__20;
2428 static PyObject *__pyx_tuple__22;
2429 static PyObject *__pyx_tuple__23;
2430 static PyObject *__pyx_tuple__25;
2431 static PyObject *__pyx_tuple__27;
2432 static PyObject *__pyx_codeobj__2;
2433 static PyObject *__pyx_codeobj__3;
2434 static PyObject *__pyx_codeobj__4;
2435 static PyObject *__pyx_codeobj__5;
2436 static PyObject *__pyx_codeobj__6;
2437 static PyObject *__pyx_codeobj__7;
2438 static PyObject *__pyx_codeobj__8;
2439 static PyObject *__pyx_codeobj__17;
2440 static PyObject *__pyx_codeobj__19;
2441 static PyObject *__pyx_codeobj__21;
2442 static PyObject *__pyx_codeobj__24;
2443 static PyObject *__pyx_codeobj__26;
2444 static PyObject *__pyx_codeobj__28;
2445 #endif
2446 /* #### Code section: late_includes ### */
2447 /* #### Code section: module_state ### */
2448 #if CYTHON_USE_MODULE_STATE
2449 typedef struct {
2450 PyObject *__pyx_d;
2451 PyObject *__pyx_b;
2452 PyObject *__pyx_cython_runtime;
2453 PyObject *__pyx_empty_tuple;
2454 PyObject *__pyx_empty_bytes;
2455 PyObject *__pyx_empty_unicode;
2456 #ifdef __Pyx_CyFunction_USED
2457 PyTypeObject *__pyx_CyFunctionType;
2458 #endif
2459 #ifdef __Pyx_FusedFunction_USED
2460 PyTypeObject *__pyx_FusedFunctionType;
2461 #endif
2462 PyTypeObject *__pyx_ptype_7cpython_4type_type;
2463 PyTypeObject *__pyx_ptype___Pyx_EnumMeta;
2464 PyObject *__Pyx_EnumMeta;
2465 PyObject *__pyx_kp_u_Calculates_a_normalized_levensh;
2466 PyObject *__pyx_kp_u_Calculates_the_minimum_number_o;
2467 PyObject *__pyx_n_s_Delete;
2468 PyObject *__pyx_n_s_EnumBase;
2469 PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xda;
2470 PyObject *__pyx_n_s_Insert;
2471 PyObject *__pyx_n_s_IntEnum;
2472 PyObject *__pyx_n_s_LevenshteinEditType;
2473 PyObject *__pyx_n_s_MemoryError;
2474 PyObject *__pyx_n_s_None;
2475 PyObject *__pyx_n_s_OrderedDict;
2476 PyObject *__pyx_n_s_PickleError;
2477 PyObject *__pyx_n_s_Pyx_EnumBase;
2478 PyObject *__pyx_n_s_Pyx_EnumBase___new;
2479 PyObject *__pyx_n_s_Pyx_EnumBase___repr;
2480 PyObject *__pyx_n_s_Pyx_EnumBase___str;
2481 PyObject *__pyx_n_s_Pyx_EnumMeta___reduce_cython;
2482 PyObject *__pyx_n_s_Pyx_EnumMeta___setstate_cython;
2483 PyObject *__pyx_n_s_Replace;
2484 PyObject *__pyx_kp_u_Return_list_of_3_tuples_describ;
2485 PyObject *__pyx_kp_s_Unknown_enum_value_s;
2486 PyObject *__pyx_n_s_ValueError;
2487 PyObject *__pyx_n_s__29;
2488 PyObject *__pyx_n_s_array;
2489 PyObject *__pyx_n_s_asyncio_coroutines;
2490 PyObject *__pyx_n_s_c_max;
2491 PyObject *__pyx_n_s_c_score_cutoff;
2492 PyObject *__pyx_n_s_class;
2493 PyObject *__pyx_n_s_class_getitem;
2494 PyObject *__pyx_n_s_cline_in_traceback;
2495 PyObject *__pyx_n_s_cls;
2496 PyObject *__pyx_n_s_collections;
2497 PyObject *__pyx_n_s_cpp_string_metric;
2498 PyObject *__pyx_kp_s_cpp_string_metric_pyx;
2499 PyObject *__pyx_n_s_dct;
2500 PyObject *__pyx_n_s_default_process;
2501 PyObject *__pyx_n_u_delete;
2502 PyObject *__pyx_n_s_deletion;
2503 PyObject *__pyx_n_s_dict;
2504 PyObject *__pyx_n_s_dict_2;
2505 PyObject *__pyx_kp_u_disable;
2506 PyObject *__pyx_n_s_doc;
2507 PyObject *__pyx_kp_u_enable;
2508 PyObject *__pyx_n_s_enum;
2509 PyObject *__pyx_kp_u_gc;
2510 PyObject *__pyx_n_s_getstate;
2511 PyObject *__pyx_n_s_hamming;
2512 PyObject *__pyx_n_s_import;
2513 PyObject *__pyx_n_s_init;
2514 PyObject *__pyx_n_s_init_subclass;
2515 PyObject *__pyx_n_u_insert;
2516 PyObject *__pyx_n_s_insertion;
2517 PyObject *__pyx_n_s_is_coroutine;
2518 PyObject *__pyx_kp_u_isenabled;
2519 PyObject *__pyx_n_s_jaro_similarity;
2520 PyObject *__pyx_n_s_jaro_winkler_similarity;
2521 PyObject *__pyx_n_s_levenshtein;
2522 PyObject *__pyx_n_s_levenshtein_editops;
2523 PyObject *__pyx_kp_u_levenshtein_editops_line_248;
2524 PyObject *__pyx_kp_u_levenshtein_line_50;
2525 PyObject *__pyx_n_s_main;
2526 PyObject *__pyx_n_s_max;
2527 PyObject *__pyx_n_s_members;
2528 PyObject *__pyx_n_s_metaclass;
2529 PyObject *__pyx_n_s_module;
2530 PyObject *__pyx_n_s_mro_entries;
2531 PyObject *__pyx_n_s_name;
2532 PyObject *__pyx_n_s_name_2;
2533 PyObject *__pyx_n_s_new;
2534 PyObject *__pyx_n_s_normalized_hamming;
2535 PyObject *__pyx_n_s_normalized_levenshtein;
2536 PyObject *__pyx_kp_u_normalized_levenshtein_line_295;
2537 PyObject *__pyx_n_s_parents;
2538 PyObject *__pyx_n_s_pickle;
2539 PyObject *__pyx_n_s_prefix_weight;
2540 PyObject *__pyx_n_s_prepare;
2541 PyObject *__pyx_n_s_processor;
2542 PyObject *__pyx_n_s_pyx_PickleError;
2543 PyObject *__pyx_n_s_pyx_checksum;
2544 PyObject *__pyx_n_s_pyx_result;
2545 PyObject *__pyx_n_s_pyx_state;
2546 PyObject *__pyx_n_s_pyx_type;
2547 PyObject *__pyx_n_s_pyx_unpickle___Pyx_EnumMeta;
2548 PyObject *__pyx_n_s_qualname;
2549 PyObject *__pyx_n_s_range;
2550 PyObject *__pyx_n_s_rapidfuzz_utils;
2551 PyObject *__pyx_n_s_reduce;
2552 PyObject *__pyx_n_s_reduce_cython;
2553 PyObject *__pyx_n_s_reduce_ex;
2554 PyObject *__pyx_n_u_replace;
2555 PyObject *__pyx_n_s_repr;
2556 PyObject *__pyx_n_s_res;
2557 PyObject *__pyx_n_s_s1;
2558 PyObject *__pyx_n_s_s2;
2559 PyObject *__pyx_kp_s_s_s;
2560 PyObject *__pyx_kp_s_s_s_d;
2561 PyObject *__pyx_n_s_score_cutoff;
2562 PyObject *__pyx_n_s_self;
2563 PyObject *__pyx_n_s_set_name;
2564 PyObject *__pyx_n_s_setstate;
2565 PyObject *__pyx_n_s_setstate_cython;
2566 PyObject *__pyx_n_s_state;
2567 PyObject *__pyx_n_s_str;
2568 PyObject *__pyx_kp_s_stringsource;
2569 PyObject *__pyx_n_s_substitution;
2570 PyObject *__pyx_n_s_super;
2571 PyObject *__pyx_n_s_test;
2572 PyObject *__pyx_n_s_typecode;
2573 PyObject *__pyx_n_s_update;
2574 PyObject *__pyx_n_s_use_setstate;
2575 PyObject *__pyx_n_s_v;
2576 PyObject *__pyx_n_s_value;
2577 PyObject *__pyx_n_s_values;
2578 PyObject *__pyx_n_s_weights;
2579 PyObject *__pyx_int_0;
2580 PyObject *__pyx_int_1;
2581 PyObject *__pyx_int_228825662;
2582 PyObject *__pyx_tuple_;
2583 PyObject *__pyx_tuple__9;
2584 PyObject *__pyx_tuple__10;
2585 PyObject *__pyx_tuple__11;
2586 PyObject *__pyx_tuple__12;
2587 PyObject *__pyx_tuple__13;
2588 PyObject *__pyx_tuple__14;
2589 PyObject *__pyx_tuple__15;
2590 PyObject *__pyx_tuple__16;
2591 PyObject *__pyx_tuple__18;
2592 PyObject *__pyx_tuple__20;
2593 PyObject *__pyx_tuple__22;
2594 PyObject *__pyx_tuple__23;
2595 PyObject *__pyx_tuple__25;
2596 PyObject *__pyx_tuple__27;
2597 PyObject *__pyx_codeobj__2;
2598 PyObject *__pyx_codeobj__3;
2599 PyObject *__pyx_codeobj__4;
2600 PyObject *__pyx_codeobj__5;
2601 PyObject *__pyx_codeobj__6;
2602 PyObject *__pyx_codeobj__7;
2603 PyObject *__pyx_codeobj__8;
2604 PyObject *__pyx_codeobj__17;
2605 PyObject *__pyx_codeobj__19;
2606 PyObject *__pyx_codeobj__21;
2607 PyObject *__pyx_codeobj__24;
2608 PyObject *__pyx_codeobj__26;
2609 PyObject *__pyx_codeobj__28;
2610 } __pyx_mstate;
2611
2612 #ifdef __cplusplus
2613 namespace {
2614 extern struct PyModuleDef __pyx_moduledef;
2615 } /* anonymous namespace */
2616 #else
2617 static struct PyModuleDef __pyx_moduledef;
2618 #endif
2619
2620 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
2621
2622 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
2623
2624 #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
2625 #endif
2626 /* #### Code section: module_state_clear ### */
2627 #if CYTHON_USE_MODULE_STATE
__pyx_m_clear(PyObject * m)2628 static int __pyx_m_clear(PyObject *m) {
2629 __pyx_mstate *clear_module_state = __pyx_mstate(m);
2630 if (!clear_module_state) return 0;
2631 Py_CLEAR(clear_module_state->__pyx_d);
2632 Py_CLEAR(clear_module_state->__pyx_b);
2633 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
2634 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
2635 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
2636 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
2637 #ifdef __Pyx_CyFunction_USED
2638 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
2639 #endif
2640 #ifdef __Pyx_FusedFunction_USED
2641 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
2642 #endif
2643 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
2644 Py_CLEAR(clear_module_state->__pyx_ptype___Pyx_EnumMeta);
2645 Py_CLEAR(clear_module_state->__Pyx_EnumMeta);
2646 Py_CLEAR(clear_module_state->__pyx_kp_u_Calculates_a_normalized_levensh);
2647 Py_CLEAR(clear_module_state->__pyx_kp_u_Calculates_the_minimum_number_o);
2648 Py_CLEAR(clear_module_state->__pyx_n_s_Delete);
2649 Py_CLEAR(clear_module_state->__pyx_n_s_EnumBase);
2650 Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_s_vs_0xda);
2651 Py_CLEAR(clear_module_state->__pyx_n_s_Insert);
2652 Py_CLEAR(clear_module_state->__pyx_n_s_IntEnum);
2653 Py_CLEAR(clear_module_state->__pyx_n_s_LevenshteinEditType);
2654 Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
2655 Py_CLEAR(clear_module_state->__pyx_n_s_None);
2656 Py_CLEAR(clear_module_state->__pyx_n_s_OrderedDict);
2657 Py_CLEAR(clear_module_state->__pyx_n_s_PickleError);
2658 Py_CLEAR(clear_module_state->__pyx_n_s_Pyx_EnumBase);
2659 Py_CLEAR(clear_module_state->__pyx_n_s_Pyx_EnumBase___new);
2660 Py_CLEAR(clear_module_state->__pyx_n_s_Pyx_EnumBase___repr);
2661 Py_CLEAR(clear_module_state->__pyx_n_s_Pyx_EnumBase___str);
2662 Py_CLEAR(clear_module_state->__pyx_n_s_Pyx_EnumMeta___reduce_cython);
2663 Py_CLEAR(clear_module_state->__pyx_n_s_Pyx_EnumMeta___setstate_cython);
2664 Py_CLEAR(clear_module_state->__pyx_n_s_Replace);
2665 Py_CLEAR(clear_module_state->__pyx_kp_u_Return_list_of_3_tuples_describ);
2666 Py_CLEAR(clear_module_state->__pyx_kp_s_Unknown_enum_value_s);
2667 Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
2668 Py_CLEAR(clear_module_state->__pyx_n_s__29);
2669 Py_CLEAR(clear_module_state->__pyx_n_s_array);
2670 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
2671 Py_CLEAR(clear_module_state->__pyx_n_s_c_max);
2672 Py_CLEAR(clear_module_state->__pyx_n_s_c_score_cutoff);
2673 Py_CLEAR(clear_module_state->__pyx_n_s_class);
2674 Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
2675 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
2676 Py_CLEAR(clear_module_state->__pyx_n_s_cls);
2677 Py_CLEAR(clear_module_state->__pyx_n_s_collections);
2678 Py_CLEAR(clear_module_state->__pyx_n_s_cpp_string_metric);
2679 Py_CLEAR(clear_module_state->__pyx_kp_s_cpp_string_metric_pyx);
2680 Py_CLEAR(clear_module_state->__pyx_n_s_dct);
2681 Py_CLEAR(clear_module_state->__pyx_n_s_default_process);
2682 Py_CLEAR(clear_module_state->__pyx_n_u_delete);
2683 Py_CLEAR(clear_module_state->__pyx_n_s_deletion);
2684 Py_CLEAR(clear_module_state->__pyx_n_s_dict);
2685 Py_CLEAR(clear_module_state->__pyx_n_s_dict_2);
2686 Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
2687 Py_CLEAR(clear_module_state->__pyx_n_s_doc);
2688 Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
2689 Py_CLEAR(clear_module_state->__pyx_n_s_enum);
2690 Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
2691 Py_CLEAR(clear_module_state->__pyx_n_s_getstate);
2692 Py_CLEAR(clear_module_state->__pyx_n_s_hamming);
2693 Py_CLEAR(clear_module_state->__pyx_n_s_import);
2694 Py_CLEAR(clear_module_state->__pyx_n_s_init);
2695 Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass);
2696 Py_CLEAR(clear_module_state->__pyx_n_u_insert);
2697 Py_CLEAR(clear_module_state->__pyx_n_s_insertion);
2698 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
2699 Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
2700 Py_CLEAR(clear_module_state->__pyx_n_s_jaro_similarity);
2701 Py_CLEAR(clear_module_state->__pyx_n_s_jaro_winkler_similarity);
2702 Py_CLEAR(clear_module_state->__pyx_n_s_levenshtein);
2703 Py_CLEAR(clear_module_state->__pyx_n_s_levenshtein_editops);
2704 Py_CLEAR(clear_module_state->__pyx_kp_u_levenshtein_editops_line_248);
2705 Py_CLEAR(clear_module_state->__pyx_kp_u_levenshtein_line_50);
2706 Py_CLEAR(clear_module_state->__pyx_n_s_main);
2707 Py_CLEAR(clear_module_state->__pyx_n_s_max);
2708 Py_CLEAR(clear_module_state->__pyx_n_s_members);
2709 Py_CLEAR(clear_module_state->__pyx_n_s_metaclass);
2710 Py_CLEAR(clear_module_state->__pyx_n_s_module);
2711 Py_CLEAR(clear_module_state->__pyx_n_s_mro_entries);
2712 Py_CLEAR(clear_module_state->__pyx_n_s_name);
2713 Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
2714 Py_CLEAR(clear_module_state->__pyx_n_s_new);
2715 Py_CLEAR(clear_module_state->__pyx_n_s_normalized_hamming);
2716 Py_CLEAR(clear_module_state->__pyx_n_s_normalized_levenshtein);
2717 Py_CLEAR(clear_module_state->__pyx_kp_u_normalized_levenshtein_line_295);
2718 Py_CLEAR(clear_module_state->__pyx_n_s_parents);
2719 Py_CLEAR(clear_module_state->__pyx_n_s_pickle);
2720 Py_CLEAR(clear_module_state->__pyx_n_s_prefix_weight);
2721 Py_CLEAR(clear_module_state->__pyx_n_s_prepare);
2722 Py_CLEAR(clear_module_state->__pyx_n_s_processor);
2723 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError);
2724 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum);
2725 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result);
2726 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state);
2727 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type);
2728 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle___Pyx_EnumMeta);
2729 Py_CLEAR(clear_module_state->__pyx_n_s_qualname);
2730 Py_CLEAR(clear_module_state->__pyx_n_s_range);
2731 Py_CLEAR(clear_module_state->__pyx_n_s_rapidfuzz_utils);
2732 Py_CLEAR(clear_module_state->__pyx_n_s_reduce);
2733 Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython);
2734 Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex);
2735 Py_CLEAR(clear_module_state->__pyx_n_u_replace);
2736 Py_CLEAR(clear_module_state->__pyx_n_s_repr);
2737 Py_CLEAR(clear_module_state->__pyx_n_s_res);
2738 Py_CLEAR(clear_module_state->__pyx_n_s_s1);
2739 Py_CLEAR(clear_module_state->__pyx_n_s_s2);
2740 Py_CLEAR(clear_module_state->__pyx_kp_s_s_s);
2741 Py_CLEAR(clear_module_state->__pyx_kp_s_s_s_d);
2742 Py_CLEAR(clear_module_state->__pyx_n_s_score_cutoff);
2743 Py_CLEAR(clear_module_state->__pyx_n_s_self);
2744 Py_CLEAR(clear_module_state->__pyx_n_s_set_name);
2745 Py_CLEAR(clear_module_state->__pyx_n_s_setstate);
2746 Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython);
2747 Py_CLEAR(clear_module_state->__pyx_n_s_state);
2748 Py_CLEAR(clear_module_state->__pyx_n_s_str);
2749 Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource);
2750 Py_CLEAR(clear_module_state->__pyx_n_s_substitution);
2751 Py_CLEAR(clear_module_state->__pyx_n_s_super);
2752 Py_CLEAR(clear_module_state->__pyx_n_s_test);
2753 Py_CLEAR(clear_module_state->__pyx_n_s_typecode);
2754 Py_CLEAR(clear_module_state->__pyx_n_s_update);
2755 Py_CLEAR(clear_module_state->__pyx_n_s_use_setstate);
2756 Py_CLEAR(clear_module_state->__pyx_n_s_v);
2757 Py_CLEAR(clear_module_state->__pyx_n_s_value);
2758 Py_CLEAR(clear_module_state->__pyx_n_s_values);
2759 Py_CLEAR(clear_module_state->__pyx_n_s_weights);
2760 Py_CLEAR(clear_module_state->__pyx_int_0);
2761 Py_CLEAR(clear_module_state->__pyx_int_1);
2762 Py_CLEAR(clear_module_state->__pyx_int_228825662);
2763 Py_CLEAR(clear_module_state->__pyx_tuple_);
2764 Py_CLEAR(clear_module_state->__pyx_tuple__9);
2765 Py_CLEAR(clear_module_state->__pyx_tuple__10);
2766 Py_CLEAR(clear_module_state->__pyx_tuple__11);
2767 Py_CLEAR(clear_module_state->__pyx_tuple__12);
2768 Py_CLEAR(clear_module_state->__pyx_tuple__13);
2769 Py_CLEAR(clear_module_state->__pyx_tuple__14);
2770 Py_CLEAR(clear_module_state->__pyx_tuple__15);
2771 Py_CLEAR(clear_module_state->__pyx_tuple__16);
2772 Py_CLEAR(clear_module_state->__pyx_tuple__18);
2773 Py_CLEAR(clear_module_state->__pyx_tuple__20);
2774 Py_CLEAR(clear_module_state->__pyx_tuple__22);
2775 Py_CLEAR(clear_module_state->__pyx_tuple__23);
2776 Py_CLEAR(clear_module_state->__pyx_tuple__25);
2777 Py_CLEAR(clear_module_state->__pyx_tuple__27);
2778 Py_CLEAR(clear_module_state->__pyx_codeobj__2);
2779 Py_CLEAR(clear_module_state->__pyx_codeobj__3);
2780 Py_CLEAR(clear_module_state->__pyx_codeobj__4);
2781 Py_CLEAR(clear_module_state->__pyx_codeobj__5);
2782 Py_CLEAR(clear_module_state->__pyx_codeobj__6);
2783 Py_CLEAR(clear_module_state->__pyx_codeobj__7);
2784 Py_CLEAR(clear_module_state->__pyx_codeobj__8);
2785 Py_CLEAR(clear_module_state->__pyx_codeobj__17);
2786 Py_CLEAR(clear_module_state->__pyx_codeobj__19);
2787 Py_CLEAR(clear_module_state->__pyx_codeobj__21);
2788 Py_CLEAR(clear_module_state->__pyx_codeobj__24);
2789 Py_CLEAR(clear_module_state->__pyx_codeobj__26);
2790 Py_CLEAR(clear_module_state->__pyx_codeobj__28);
2791 return 0;
2792 }
2793 #endif
2794 /* #### Code section: module_state_traverse ### */
2795 #if CYTHON_USE_MODULE_STATE
__pyx_m_traverse(PyObject * m,visitproc visit,void * arg)2796 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2797 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
2798 if (!traverse_module_state) return 0;
2799 Py_VISIT(traverse_module_state->__pyx_d);
2800 Py_VISIT(traverse_module_state->__pyx_b);
2801 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
2802 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
2803 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
2804 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
2805 #ifdef __Pyx_CyFunction_USED
2806 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
2807 #endif
2808 #ifdef __Pyx_FusedFunction_USED
2809 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
2810 #endif
2811 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
2812 Py_VISIT(traverse_module_state->__pyx_ptype___Pyx_EnumMeta);
2813 Py_VISIT(traverse_module_state->__Pyx_EnumMeta);
2814 Py_VISIT(traverse_module_state->__pyx_kp_u_Calculates_a_normalized_levensh);
2815 Py_VISIT(traverse_module_state->__pyx_kp_u_Calculates_the_minimum_number_o);
2816 Py_VISIT(traverse_module_state->__pyx_n_s_Delete);
2817 Py_VISIT(traverse_module_state->__pyx_n_s_EnumBase);
2818 Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_s_vs_0xda);
2819 Py_VISIT(traverse_module_state->__pyx_n_s_Insert);
2820 Py_VISIT(traverse_module_state->__pyx_n_s_IntEnum);
2821 Py_VISIT(traverse_module_state->__pyx_n_s_LevenshteinEditType);
2822 Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
2823 Py_VISIT(traverse_module_state->__pyx_n_s_None);
2824 Py_VISIT(traverse_module_state->__pyx_n_s_OrderedDict);
2825 Py_VISIT(traverse_module_state->__pyx_n_s_PickleError);
2826 Py_VISIT(traverse_module_state->__pyx_n_s_Pyx_EnumBase);
2827 Py_VISIT(traverse_module_state->__pyx_n_s_Pyx_EnumBase___new);
2828 Py_VISIT(traverse_module_state->__pyx_n_s_Pyx_EnumBase___repr);
2829 Py_VISIT(traverse_module_state->__pyx_n_s_Pyx_EnumBase___str);
2830 Py_VISIT(traverse_module_state->__pyx_n_s_Pyx_EnumMeta___reduce_cython);
2831 Py_VISIT(traverse_module_state->__pyx_n_s_Pyx_EnumMeta___setstate_cython);
2832 Py_VISIT(traverse_module_state->__pyx_n_s_Replace);
2833 Py_VISIT(traverse_module_state->__pyx_kp_u_Return_list_of_3_tuples_describ);
2834 Py_VISIT(traverse_module_state->__pyx_kp_s_Unknown_enum_value_s);
2835 Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
2836 Py_VISIT(traverse_module_state->__pyx_n_s__29);
2837 Py_VISIT(traverse_module_state->__pyx_n_s_array);
2838 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
2839 Py_VISIT(traverse_module_state->__pyx_n_s_c_max);
2840 Py_VISIT(traverse_module_state->__pyx_n_s_c_score_cutoff);
2841 Py_VISIT(traverse_module_state->__pyx_n_s_class);
2842 Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
2843 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
2844 Py_VISIT(traverse_module_state->__pyx_n_s_cls);
2845 Py_VISIT(traverse_module_state->__pyx_n_s_collections);
2846 Py_VISIT(traverse_module_state->__pyx_n_s_cpp_string_metric);
2847 Py_VISIT(traverse_module_state->__pyx_kp_s_cpp_string_metric_pyx);
2848 Py_VISIT(traverse_module_state->__pyx_n_s_dct);
2849 Py_VISIT(traverse_module_state->__pyx_n_s_default_process);
2850 Py_VISIT(traverse_module_state->__pyx_n_u_delete);
2851 Py_VISIT(traverse_module_state->__pyx_n_s_deletion);
2852 Py_VISIT(traverse_module_state->__pyx_n_s_dict);
2853 Py_VISIT(traverse_module_state->__pyx_n_s_dict_2);
2854 Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
2855 Py_VISIT(traverse_module_state->__pyx_n_s_doc);
2856 Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
2857 Py_VISIT(traverse_module_state->__pyx_n_s_enum);
2858 Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
2859 Py_VISIT(traverse_module_state->__pyx_n_s_getstate);
2860 Py_VISIT(traverse_module_state->__pyx_n_s_hamming);
2861 Py_VISIT(traverse_module_state->__pyx_n_s_import);
2862 Py_VISIT(traverse_module_state->__pyx_n_s_init);
2863 Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass);
2864 Py_VISIT(traverse_module_state->__pyx_n_u_insert);
2865 Py_VISIT(traverse_module_state->__pyx_n_s_insertion);
2866 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
2867 Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
2868 Py_VISIT(traverse_module_state->__pyx_n_s_jaro_similarity);
2869 Py_VISIT(traverse_module_state->__pyx_n_s_jaro_winkler_similarity);
2870 Py_VISIT(traverse_module_state->__pyx_n_s_levenshtein);
2871 Py_VISIT(traverse_module_state->__pyx_n_s_levenshtein_editops);
2872 Py_VISIT(traverse_module_state->__pyx_kp_u_levenshtein_editops_line_248);
2873 Py_VISIT(traverse_module_state->__pyx_kp_u_levenshtein_line_50);
2874 Py_VISIT(traverse_module_state->__pyx_n_s_main);
2875 Py_VISIT(traverse_module_state->__pyx_n_s_max);
2876 Py_VISIT(traverse_module_state->__pyx_n_s_members);
2877 Py_VISIT(traverse_module_state->__pyx_n_s_metaclass);
2878 Py_VISIT(traverse_module_state->__pyx_n_s_module);
2879 Py_VISIT(traverse_module_state->__pyx_n_s_mro_entries);
2880 Py_VISIT(traverse_module_state->__pyx_n_s_name);
2881 Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
2882 Py_VISIT(traverse_module_state->__pyx_n_s_new);
2883 Py_VISIT(traverse_module_state->__pyx_n_s_normalized_hamming);
2884 Py_VISIT(traverse_module_state->__pyx_n_s_normalized_levenshtein);
2885 Py_VISIT(traverse_module_state->__pyx_kp_u_normalized_levenshtein_line_295);
2886 Py_VISIT(traverse_module_state->__pyx_n_s_parents);
2887 Py_VISIT(traverse_module_state->__pyx_n_s_pickle);
2888 Py_VISIT(traverse_module_state->__pyx_n_s_prefix_weight);
2889 Py_VISIT(traverse_module_state->__pyx_n_s_prepare);
2890 Py_VISIT(traverse_module_state->__pyx_n_s_processor);
2891 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError);
2892 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum);
2893 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result);
2894 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state);
2895 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type);
2896 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle___Pyx_EnumMeta);
2897 Py_VISIT(traverse_module_state->__pyx_n_s_qualname);
2898 Py_VISIT(traverse_module_state->__pyx_n_s_range);
2899 Py_VISIT(traverse_module_state->__pyx_n_s_rapidfuzz_utils);
2900 Py_VISIT(traverse_module_state->__pyx_n_s_reduce);
2901 Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython);
2902 Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex);
2903 Py_VISIT(traverse_module_state->__pyx_n_u_replace);
2904 Py_VISIT(traverse_module_state->__pyx_n_s_repr);
2905 Py_VISIT(traverse_module_state->__pyx_n_s_res);
2906 Py_VISIT(traverse_module_state->__pyx_n_s_s1);
2907 Py_VISIT(traverse_module_state->__pyx_n_s_s2);
2908 Py_VISIT(traverse_module_state->__pyx_kp_s_s_s);
2909 Py_VISIT(traverse_module_state->__pyx_kp_s_s_s_d);
2910 Py_VISIT(traverse_module_state->__pyx_n_s_score_cutoff);
2911 Py_VISIT(traverse_module_state->__pyx_n_s_self);
2912 Py_VISIT(traverse_module_state->__pyx_n_s_set_name);
2913 Py_VISIT(traverse_module_state->__pyx_n_s_setstate);
2914 Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython);
2915 Py_VISIT(traverse_module_state->__pyx_n_s_state);
2916 Py_VISIT(traverse_module_state->__pyx_n_s_str);
2917 Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource);
2918 Py_VISIT(traverse_module_state->__pyx_n_s_substitution);
2919 Py_VISIT(traverse_module_state->__pyx_n_s_super);
2920 Py_VISIT(traverse_module_state->__pyx_n_s_test);
2921 Py_VISIT(traverse_module_state->__pyx_n_s_typecode);
2922 Py_VISIT(traverse_module_state->__pyx_n_s_update);
2923 Py_VISIT(traverse_module_state->__pyx_n_s_use_setstate);
2924 Py_VISIT(traverse_module_state->__pyx_n_s_v);
2925 Py_VISIT(traverse_module_state->__pyx_n_s_value);
2926 Py_VISIT(traverse_module_state->__pyx_n_s_values);
2927 Py_VISIT(traverse_module_state->__pyx_n_s_weights);
2928 Py_VISIT(traverse_module_state->__pyx_int_0);
2929 Py_VISIT(traverse_module_state->__pyx_int_1);
2930 Py_VISIT(traverse_module_state->__pyx_int_228825662);
2931 Py_VISIT(traverse_module_state->__pyx_tuple_);
2932 Py_VISIT(traverse_module_state->__pyx_tuple__9);
2933 Py_VISIT(traverse_module_state->__pyx_tuple__10);
2934 Py_VISIT(traverse_module_state->__pyx_tuple__11);
2935 Py_VISIT(traverse_module_state->__pyx_tuple__12);
2936 Py_VISIT(traverse_module_state->__pyx_tuple__13);
2937 Py_VISIT(traverse_module_state->__pyx_tuple__14);
2938 Py_VISIT(traverse_module_state->__pyx_tuple__15);
2939 Py_VISIT(traverse_module_state->__pyx_tuple__16);
2940 Py_VISIT(traverse_module_state->__pyx_tuple__18);
2941 Py_VISIT(traverse_module_state->__pyx_tuple__20);
2942 Py_VISIT(traverse_module_state->__pyx_tuple__22);
2943 Py_VISIT(traverse_module_state->__pyx_tuple__23);
2944 Py_VISIT(traverse_module_state->__pyx_tuple__25);
2945 Py_VISIT(traverse_module_state->__pyx_tuple__27);
2946 Py_VISIT(traverse_module_state->__pyx_codeobj__2);
2947 Py_VISIT(traverse_module_state->__pyx_codeobj__3);
2948 Py_VISIT(traverse_module_state->__pyx_codeobj__4);
2949 Py_VISIT(traverse_module_state->__pyx_codeobj__5);
2950 Py_VISIT(traverse_module_state->__pyx_codeobj__6);
2951 Py_VISIT(traverse_module_state->__pyx_codeobj__7);
2952 Py_VISIT(traverse_module_state->__pyx_codeobj__8);
2953 Py_VISIT(traverse_module_state->__pyx_codeobj__17);
2954 Py_VISIT(traverse_module_state->__pyx_codeobj__19);
2955 Py_VISIT(traverse_module_state->__pyx_codeobj__21);
2956 Py_VISIT(traverse_module_state->__pyx_codeobj__24);
2957 Py_VISIT(traverse_module_state->__pyx_codeobj__26);
2958 Py_VISIT(traverse_module_state->__pyx_codeobj__28);
2959 return 0;
2960 }
2961 #endif
2962 /* #### Code section: module_state_defines ### */
2963 #if CYTHON_USE_MODULE_STATE
2964 #define __pyx_d __pyx_mstate_global->__pyx_d
2965 #define __pyx_b __pyx_mstate_global->__pyx_b
2966 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
2967 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
2968 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
2969 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
2970 #ifdef __Pyx_CyFunction_USED
2971 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
2972 #endif
2973 #ifdef __Pyx_FusedFunction_USED
2974 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
2975 #endif
2976 #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
2977 #define __pyx_ptype___Pyx_EnumMeta __pyx_mstate_global->__pyx_ptype___Pyx_EnumMeta
2978 #define __Pyx_EnumMeta __pyx_mstate_global->__Pyx_EnumMeta
2979 #define __pyx_kp_u_Calculates_a_normalized_levensh __pyx_mstate_global->__pyx_kp_u_Calculates_a_normalized_levensh
2980 #define __pyx_kp_u_Calculates_the_minimum_number_o __pyx_mstate_global->__pyx_kp_u_Calculates_the_minimum_number_o
2981 #define __pyx_n_s_Delete __pyx_mstate_global->__pyx_n_s_Delete
2982 #define __pyx_n_s_EnumBase __pyx_mstate_global->__pyx_n_s_EnumBase
2983 #define __pyx_kp_s_Incompatible_checksums_s_vs_0xda __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_s_vs_0xda
2984 #define __pyx_n_s_Insert __pyx_mstate_global->__pyx_n_s_Insert
2985 #define __pyx_n_s_IntEnum __pyx_mstate_global->__pyx_n_s_IntEnum
2986 #define __pyx_n_s_LevenshteinEditType __pyx_mstate_global->__pyx_n_s_LevenshteinEditType
2987 #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
2988 #define __pyx_n_s_None __pyx_mstate_global->__pyx_n_s_None
2989 #define __pyx_n_s_OrderedDict __pyx_mstate_global->__pyx_n_s_OrderedDict
2990 #define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError
2991 #define __pyx_n_s_Pyx_EnumBase __pyx_mstate_global->__pyx_n_s_Pyx_EnumBase
2992 #define __pyx_n_s_Pyx_EnumBase___new __pyx_mstate_global->__pyx_n_s_Pyx_EnumBase___new
2993 #define __pyx_n_s_Pyx_EnumBase___repr __pyx_mstate_global->__pyx_n_s_Pyx_EnumBase___repr
2994 #define __pyx_n_s_Pyx_EnumBase___str __pyx_mstate_global->__pyx_n_s_Pyx_EnumBase___str
2995 #define __pyx_n_s_Pyx_EnumMeta___reduce_cython __pyx_mstate_global->__pyx_n_s_Pyx_EnumMeta___reduce_cython
2996 #define __pyx_n_s_Pyx_EnumMeta___setstate_cython __pyx_mstate_global->__pyx_n_s_Pyx_EnumMeta___setstate_cython
2997 #define __pyx_n_s_Replace __pyx_mstate_global->__pyx_n_s_Replace
2998 #define __pyx_kp_u_Return_list_of_3_tuples_describ __pyx_mstate_global->__pyx_kp_u_Return_list_of_3_tuples_describ
2999 #define __pyx_kp_s_Unknown_enum_value_s __pyx_mstate_global->__pyx_kp_s_Unknown_enum_value_s
3000 #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
3001 #define __pyx_n_s__29 __pyx_mstate_global->__pyx_n_s__29
3002 #define __pyx_n_s_array __pyx_mstate_global->__pyx_n_s_array
3003 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
3004 #define __pyx_n_s_c_max __pyx_mstate_global->__pyx_n_s_c_max
3005 #define __pyx_n_s_c_score_cutoff __pyx_mstate_global->__pyx_n_s_c_score_cutoff
3006 #define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class
3007 #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
3008 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
3009 #define __pyx_n_s_cls __pyx_mstate_global->__pyx_n_s_cls
3010 #define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections
3011 #define __pyx_n_s_cpp_string_metric __pyx_mstate_global->__pyx_n_s_cpp_string_metric
3012 #define __pyx_kp_s_cpp_string_metric_pyx __pyx_mstate_global->__pyx_kp_s_cpp_string_metric_pyx
3013 #define __pyx_n_s_dct __pyx_mstate_global->__pyx_n_s_dct
3014 #define __pyx_n_s_default_process __pyx_mstate_global->__pyx_n_s_default_process
3015 #define __pyx_n_u_delete __pyx_mstate_global->__pyx_n_u_delete
3016 #define __pyx_n_s_deletion __pyx_mstate_global->__pyx_n_s_deletion
3017 #define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict
3018 #define __pyx_n_s_dict_2 __pyx_mstate_global->__pyx_n_s_dict_2
3019 #define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
3020 #define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc
3021 #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
3022 #define __pyx_n_s_enum __pyx_mstate_global->__pyx_n_s_enum
3023 #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
3024 #define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate
3025 #define __pyx_n_s_hamming __pyx_mstate_global->__pyx_n_s_hamming
3026 #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
3027 #define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init
3028 #define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass
3029 #define __pyx_n_u_insert __pyx_mstate_global->__pyx_n_u_insert
3030 #define __pyx_n_s_insertion __pyx_mstate_global->__pyx_n_s_insertion
3031 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
3032 #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
3033 #define __pyx_n_s_jaro_similarity __pyx_mstate_global->__pyx_n_s_jaro_similarity
3034 #define __pyx_n_s_jaro_winkler_similarity __pyx_mstate_global->__pyx_n_s_jaro_winkler_similarity
3035 #define __pyx_n_s_levenshtein __pyx_mstate_global->__pyx_n_s_levenshtein
3036 #define __pyx_n_s_levenshtein_editops __pyx_mstate_global->__pyx_n_s_levenshtein_editops
3037 #define __pyx_kp_u_levenshtein_editops_line_248 __pyx_mstate_global->__pyx_kp_u_levenshtein_editops_line_248
3038 #define __pyx_kp_u_levenshtein_line_50 __pyx_mstate_global->__pyx_kp_u_levenshtein_line_50
3039 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
3040 #define __pyx_n_s_max __pyx_mstate_global->__pyx_n_s_max
3041 #define __pyx_n_s_members __pyx_mstate_global->__pyx_n_s_members
3042 #define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass
3043 #define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module
3044 #define __pyx_n_s_mro_entries __pyx_mstate_global->__pyx_n_s_mro_entries
3045 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
3046 #define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
3047 #define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new
3048 #define __pyx_n_s_normalized_hamming __pyx_mstate_global->__pyx_n_s_normalized_hamming
3049 #define __pyx_n_s_normalized_levenshtein __pyx_mstate_global->__pyx_n_s_normalized_levenshtein
3050 #define __pyx_kp_u_normalized_levenshtein_line_295 __pyx_mstate_global->__pyx_kp_u_normalized_levenshtein_line_295
3051 #define __pyx_n_s_parents __pyx_mstate_global->__pyx_n_s_parents
3052 #define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle
3053 #define __pyx_n_s_prefix_weight __pyx_mstate_global->__pyx_n_s_prefix_weight
3054 #define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare
3055 #define __pyx_n_s_processor __pyx_mstate_global->__pyx_n_s_processor
3056 #define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError
3057 #define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum
3058 #define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result
3059 #define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state
3060 #define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type
3061 #define __pyx_n_s_pyx_unpickle___Pyx_EnumMeta __pyx_mstate_global->__pyx_n_s_pyx_unpickle___Pyx_EnumMeta
3062 #define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname
3063 #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
3064 #define __pyx_n_s_rapidfuzz_utils __pyx_mstate_global->__pyx_n_s_rapidfuzz_utils
3065 #define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce
3066 #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython
3067 #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex
3068 #define __pyx_n_u_replace __pyx_mstate_global->__pyx_n_u_replace
3069 #define __pyx_n_s_repr __pyx_mstate_global->__pyx_n_s_repr
3070 #define __pyx_n_s_res __pyx_mstate_global->__pyx_n_s_res
3071 #define __pyx_n_s_s1 __pyx_mstate_global->__pyx_n_s_s1
3072 #define __pyx_n_s_s2 __pyx_mstate_global->__pyx_n_s_s2
3073 #define __pyx_kp_s_s_s __pyx_mstate_global->__pyx_kp_s_s_s
3074 #define __pyx_kp_s_s_s_d __pyx_mstate_global->__pyx_kp_s_s_s_d
3075 #define __pyx_n_s_score_cutoff __pyx_mstate_global->__pyx_n_s_score_cutoff
3076 #define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self
3077 #define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name
3078 #define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate
3079 #define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython
3080 #define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state
3081 #define __pyx_n_s_str __pyx_mstate_global->__pyx_n_s_str
3082 #define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource
3083 #define __pyx_n_s_substitution __pyx_mstate_global->__pyx_n_s_substitution
3084 #define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super
3085 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
3086 #define __pyx_n_s_typecode __pyx_mstate_global->__pyx_n_s_typecode
3087 #define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update
3088 #define __pyx_n_s_use_setstate __pyx_mstate_global->__pyx_n_s_use_setstate
3089 #define __pyx_n_s_v __pyx_mstate_global->__pyx_n_s_v
3090 #define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value
3091 #define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values
3092 #define __pyx_n_s_weights __pyx_mstate_global->__pyx_n_s_weights
3093 #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
3094 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
3095 #define __pyx_int_228825662 __pyx_mstate_global->__pyx_int_228825662
3096 #define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_
3097 #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
3098 #define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10
3099 #define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11
3100 #define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12
3101 #define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13
3102 #define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14
3103 #define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15
3104 #define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
3105 #define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18
3106 #define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20
3107 #define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22
3108 #define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23
3109 #define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25
3110 #define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27
3111 #define __pyx_codeobj__2 __pyx_mstate_global->__pyx_codeobj__2
3112 #define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3
3113 #define __pyx_codeobj__4 __pyx_mstate_global->__pyx_codeobj__4
3114 #define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5
3115 #define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6
3116 #define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7
3117 #define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8
3118 #define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17
3119 #define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19
3120 #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21
3121 #define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24
3122 #define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26
3123 #define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28
3124 #endif
3125 /* #### Code section: module_code ### */
3126
3127 /* "cpp_string_metric.pyx":12
3128 * from cpython.ref cimport Py_INCREF
3129 *
3130 * cdef inline proc_string conv_sequence(seq) except *: # <<<<<<<<<<<<<<
3131 * if is_valid_string(seq):
3132 * return move(convert_string(seq))
3133 */
3134
__pyx_f_17cpp_string_metric_conv_sequence(PyObject * __pyx_v_seq)3135 static CYTHON_INLINE proc_string __pyx_f_17cpp_string_metric_conv_sequence(PyObject *__pyx_v_seq) {
3136 proc_string __pyx_r;
3137 __Pyx_TraceDeclarations
3138 __Pyx_RefNannyDeclarations
3139 int __pyx_t_1;
3140 int __pyx_t_2;
3141 PyObject *__pyx_t_3 = NULL;
3142 int __pyx_t_4;
3143 proc_string __pyx_t_5;
3144 int __pyx_lineno = 0;
3145 const char *__pyx_filename = NULL;
3146 int __pyx_clineno = 0;
3147 __Pyx_RefNannySetupContext("conv_sequence", 0);
3148 __Pyx_TraceCall("conv_sequence", __pyx_f[0], 12, 0, __PYX_ERR(0, 12, __pyx_L1_error));
3149
3150 /* "cpp_string_metric.pyx":13
3151 *
3152 * cdef inline proc_string conv_sequence(seq) except *:
3153 * if is_valid_string(seq): # <<<<<<<<<<<<<<
3154 * return move(convert_string(seq))
3155 * elif isinstance(seq, array):
3156 */
3157 __Pyx_TraceLine(13,0,__PYX_ERR(0, 13, __pyx_L1_error))
3158 try {
3159 __pyx_t_1 = is_valid_string(__pyx_v_seq);
3160 } catch(...) {
3161 __Pyx_CppExn2PyErr();
3162 __PYX_ERR(0, 13, __pyx_L1_error)
3163 }
3164 __pyx_t_2 = (__pyx_t_1 != 0);
3165 if (__pyx_t_2) {
3166
3167 /* "cpp_string_metric.pyx":14
3168 * cdef inline proc_string conv_sequence(seq) except *:
3169 * if is_valid_string(seq):
3170 * return move(convert_string(seq)) # <<<<<<<<<<<<<<
3171 * elif isinstance(seq, array):
3172 * return move(hash_array(seq))
3173 */
3174 __Pyx_TraceLine(14,0,__PYX_ERR(0, 14, __pyx_L1_error))
3175 __pyx_r = cython_std::move<proc_string>(convert_string(__pyx_v_seq));
3176 goto __pyx_L0;
3177
3178 /* "cpp_string_metric.pyx":13
3179 *
3180 * cdef inline proc_string conv_sequence(seq) except *:
3181 * if is_valid_string(seq): # <<<<<<<<<<<<<<
3182 * return move(convert_string(seq))
3183 * elif isinstance(seq, array):
3184 */
3185 }
3186
3187 /* "cpp_string_metric.pyx":15
3188 * if is_valid_string(seq):
3189 * return move(convert_string(seq))
3190 * elif isinstance(seq, array): # <<<<<<<<<<<<<<
3191 * return move(hash_array(seq))
3192 * else:
3193 */
3194 __Pyx_TraceLine(15,0,__PYX_ERR(0, 15, __pyx_L1_error))
3195 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
3196 __Pyx_GOTREF(__pyx_t_3);
3197 __pyx_t_2 = PyObject_IsInstance(__pyx_v_seq, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 15, __pyx_L1_error)
3198 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3199 __pyx_t_4 = (__pyx_t_2 != 0);
3200 if (__pyx_t_4) {
3201
3202 /* "cpp_string_metric.pyx":16
3203 * return move(convert_string(seq))
3204 * elif isinstance(seq, array):
3205 * return move(hash_array(seq)) # <<<<<<<<<<<<<<
3206 * else:
3207 * return move(hash_sequence(seq))
3208 */
3209 __Pyx_TraceLine(16,0,__PYX_ERR(0, 16, __pyx_L1_error))
3210 __pyx_t_5 = __pyx_f_10cpp_common_hash_array(__pyx_v_seq); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L1_error)
3211 __pyx_r = cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5));
3212 goto __pyx_L0;
3213
3214 /* "cpp_string_metric.pyx":15
3215 * if is_valid_string(seq):
3216 * return move(convert_string(seq))
3217 * elif isinstance(seq, array): # <<<<<<<<<<<<<<
3218 * return move(hash_array(seq))
3219 * else:
3220 */
3221 }
3222
3223 /* "cpp_string_metric.pyx":18
3224 * return move(hash_array(seq))
3225 * else:
3226 * return move(hash_sequence(seq)) # <<<<<<<<<<<<<<
3227 *
3228 * cdef extern from "cpp_scorer.hpp" namespace "rapidfuzz" nogil:
3229 */
3230 __Pyx_TraceLine(18,0,__PYX_ERR(0, 18, __pyx_L1_error))
3231 /*else*/ {
3232 __pyx_t_5 = __pyx_f_10cpp_common_hash_sequence(__pyx_v_seq); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L1_error)
3233 __pyx_r = cython_std::move<proc_string>(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5));
3234 goto __pyx_L0;
3235 }
3236
3237 /* "cpp_string_metric.pyx":12
3238 * from cpython.ref cimport Py_INCREF
3239 *
3240 * cdef inline proc_string conv_sequence(seq) except *: # <<<<<<<<<<<<<<
3241 * if is_valid_string(seq):
3242 * return move(convert_string(seq))
3243 */
3244
3245 /* function exit code */
3246 __pyx_L1_error:;
3247 __Pyx_XDECREF(__pyx_t_3);
3248 __Pyx_AddTraceback("cpp_string_metric.conv_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
3249 __Pyx_pretend_to_initialize(&__pyx_r);
3250 __pyx_L0:;
3251 __Pyx_TraceReturn(Py_None, 0);
3252 __Pyx_RefNannyFinishContext();
3253 return __pyx_r;
3254 }
3255
3256 /* "cpp_string_metric.pyx":50
3257 * vector[LevenshteinEditOp] levenshtein_editops_default_process(const proc_string& s1, const proc_string& s2) nogil except +
3258 *
3259 * def levenshtein(s1, s2, *, weights=(1,1,1), processor=None, max=None): # <<<<<<<<<<<<<<
3260 * """
3261 * Calculates the minimum number of insertions, deletions, and substitutions
3262 */
3263
3264 /* Python wrapper */
3265 static PyObject *__pyx_pw_17cpp_string_metric_1levenshtein(PyObject *__pyx_self,
3266 #if CYTHON_METH_FASTCALL
3267 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
3268 #else
3269 PyObject *__pyx_args, PyObject *__pyx_kwds
3270 #endif
3271 ); /*proto*/
3272 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_levenshtein, "\n Calculates the minimum number of insertions, deletions, and substitutions\n required to change one sequence into the other according to Levenshtein with custom\n costs for insertion, deletion and substitution\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n weights : Tuple[int, int, int] or None, optional\n The weights for the three operations in the form\n (insertion, deletion, substitution). Default is (1, 1, 1),\n which gives all three operations a weight of 1.\n processor: bool or 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 max : int or None, optional\n Maximum distance between s1 and s2, that is\n considered as a result. If the distance is bigger than max,\n -1 is returned instead. Default is None, which deactivates\n this behaviour.\n\n Returns\n -------\n distance : int\n distance between s1 and s2\n\n Raises\n ------\n ValueError\n If unsupported weights are provided a ValueError is thrown\n\n Notes\n -----\n Depending on the input parameters different optimized implementation are used\n to improve the performance.\n\n Insertion = Deletion = Substitution:\n This is known as uniform Levenshtein distance and is the distance most commonly\n referred to as Levenshtein distance. The following implementation is used\n with a worst-case performance of ``O([N/64]M)``.\n\n - if max is 0 the similarity can be calculated using a direct comparision,\n since no difference between the strings is allowed. The time complexity of\n this algorithm is ``O(N)``.\n\n - A common prefix/suffix of the two compared strings does"" not affect\n the Levenshtein distance, so the affix is removed before calculating the\n similarity.\n\n - If max is \342\211\244 3 the mbleven algorithm is used. This algorithm\n checks all possible edit operations that are possible under\n the threshold `max`. The time complexity of this algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\244 64 after removing the common affix\n Hyyr\303\266s' algorithm is used, which calculates the Levenshtein distance in\n parallel. The algorithm is described by [1]_. The time complexity of this\n algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\245 64 after removing the common affix\n a blockwise implementation of Myers' algorithm is used, which calculates\n the Levenshtein distance in parallel (64 characters at a time).\n The algorithm is described by [3]_. The time complexity of this\n algorithm is ``O([N/64]M)``.\n\n The following image shows a benchmark of the Levenshtein distance in multiple\n Python libraries. All of them are implemented either in C/C++ or Cython.\n The graph shows, that python-Levenshtein is the only library with a time\n complexity of ``O(NM)``, while all other libraries have a time complexity of\n ``O([N/64]M)``. Especially for long strings RapidFuzz is a lot faster than\n all the other tested libraries.\n\n .. image:: img/uniform_levenshtein.svg\n\n\n Insertion = Deletion, Substitution >= Insertion + Deletion:\n Since every Substitution can be performed as Insertion + Deletion, this variant\n of the Levenshtein distance only uses Insertions and Deletions. Therefore this\n variant is often referred to as InDel-Distance. The following implementation\n is used with a worst-case performance of ``O([N/64]M)``.\n\n - if max is 0 the similarity can be calculated using a direct comparision,\n since no differenc""e between the strings is allowed. The time complexity of\n this algorithm is ``O(N)``.\n\n - if max is 1 and the two strings have a similar length, the similarity can be\n calculated using a direct comparision aswell, since a substitution would cause\n a edit distance higher than max. The time complexity of this algorithm\n is ``O(N)``.\n\n - A common prefix/suffix of the two compared strings does not affect\n the Levenshtein distance, so the affix is removed before calculating the\n similarity.\n\n - If max is \342\211\244 4 the mbleven algorithm is used. This algorithm\n checks all possible edit operations that are possible under\n the threshold `max`. As a difference to the normal Levenshtein distance this\n algorithm can even be used up to a threshold of 4 here, since the higher weight\n of substitutions decreases the amount of possible edit operations.\n The time complexity of this algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\244 64 after removing the common affix\n Hyyr\303\266s' lcs algorithm is used, which calculates the InDel distance in\n parallel. The algorithm is described by [4]_ and is extended with support\n for UTF32 in this implementation. The time complexity of this\n algorithm is ``O(N)``.\n\n - If the length of the shorter string is \342\211\245 64 after removing the common affix\n a blockwise implementation of the Hyyr\303\266s' lcs algorithm is used, which calculates\n the Levenshtein distance in parallel (64 characters at a time).\n The algorithm is described by [4]_. The time complexity of this\n algorithm is ``O([N/64]M)``.\n\n The following image shows a benchmark of the InDel distance in RapidFuzz\n and python-Levenshtein. Similar to the normal Levenshtein distance\n python-Levenshtein uses a implementation with a time complexity of ``O(NM)``,""\n while RapidFuzz has a time complexity of ``O([N/64]M)``.\n\n .. image:: img/indel_levenshtein.svg\n\n\n Other weights:\n The implementation for other weights is based on Wagner-Fischer.\n It has a performance of ``O(N * M)`` and has a memory usage of ``O(N)``.\n Further details can be found in [2]_.\n\n References\n ----------\n .. [1] Hyyr\303\266, Heikki. \"A Bit-Vector Algorithm for Computing\n Levenshtein and Damerau Edit Distances.\"\n Nordic Journal of Computing, Volume 10 (2003): 29-39.\n .. [2] Wagner, Robert & Fischer, Michael\n \"The String-to-String Correction Problem.\"\n J. ACM. 21. (1974): 168-173\n .. [3] Myers, Gene. \"A fast bit-vector algorithm for approximate\n string matching based on dynamic programming.\"\n Journal of the ACM (JACM) 46.3 (1999): 395-415.\n .. [4] Hyyr\303\266, Heikki. \"Bit-Parallel LCS-length Computation Revisited\"\n Proc. 15th Australasian Workshop on Combinatorial Algorithms (AWOCA 2004). \n\n Examples\n --------\n Find the Levenshtein distance between two strings:\n\n >>> from rapidfuzz.string_metric import levenshtein\n >>> levenshtein(\"lewenstein\", \"levenshtein\")\n 2\n\n Setting a maximum distance allows the implementation to select\n a more efficient implementation:\n\n >>> levenshtein(\"lewenstein\", \"levenshtein\", max=1)\n -1\n\n It is possible to select different weights by passing a `weight`\n tuple.\n\n >>> levenshtein(\"lewenstein\", \"levenshtein\", weights=(1,1,2))\n 3\n ");
3273 static PyMethodDef __pyx_mdef_17cpp_string_metric_1levenshtein = {"levenshtein", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_1levenshtein, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_levenshtein};
__pyx_pw_17cpp_string_metric_1levenshtein(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)3274 static PyObject *__pyx_pw_17cpp_string_metric_1levenshtein(PyObject *__pyx_self,
3275 #if CYTHON_METH_FASTCALL
3276 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
3277 #else
3278 PyObject *__pyx_args, PyObject *__pyx_kwds
3279 #endif
3280 ) {
3281 PyObject *__pyx_v_s1 = 0;
3282 PyObject *__pyx_v_s2 = 0;
3283 PyObject *__pyx_v_weights = 0;
3284 PyObject *__pyx_v_processor = 0;
3285 PyObject *__pyx_v_max = 0;
3286 #if !CYTHON_METH_FASTCALL
3287 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
3288 #endif
3289 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
3290 int __pyx_lineno = 0;
3291 const char *__pyx_filename = NULL;
3292 int __pyx_clineno = 0;
3293 PyObject *__pyx_r = 0;
3294 __Pyx_RefNannyDeclarations
3295 __Pyx_RefNannySetupContext("levenshtein (wrapper)", 0);
3296 {
3297 #if CYTHON_USE_MODULE_STATE
3298 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_weights,&__pyx_n_s_processor,&__pyx_n_s_max,0};
3299 #else
3300 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_weights,&__pyx_n_s_processor,&__pyx_n_s_max,0};
3301 #endif
3302 PyObject* values[5] = {0,0,0,0,0};
3303 values[2] = ((PyObject *)((PyObject*)__pyx_tuple_));
3304 values[3] = ((PyObject *)((PyObject *)Py_None));
3305 values[4] = ((PyObject *)((PyObject *)Py_None));
3306 if (__pyx_kwds) {
3307 Py_ssize_t kw_args;
3308 switch (__pyx_nargs) {
3309 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
3310 CYTHON_FALLTHROUGH;
3311 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
3312 CYTHON_FALLTHROUGH;
3313 case 0: break;
3314 default: goto __pyx_L5_argtuple_error;
3315 }
3316 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
3317 switch (__pyx_nargs) {
3318 case 0:
3319 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
3320 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L3_error)
3321 else goto __pyx_L5_argtuple_error;
3322 CYTHON_FALLTHROUGH;
3323 case 1:
3324 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
3325 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L3_error)
3326 else {
3327 __Pyx_RaiseArgtupleInvalid("levenshtein", 1, 2, 2, 1); __PYX_ERR(0, 50, __pyx_L3_error)
3328 }
3329 }
3330 if (kw_args > 0 && likely(kw_args <= 3)) {
3331 Py_ssize_t index;
3332 for (index = 2; index < 5 && kw_args > 0; index++) {
3333 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
3334 if (value) { values[index] = value; kw_args--; }
3335 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L3_error)
3336 }
3337 }
3338 if (unlikely(kw_args > 0)) {
3339 const Py_ssize_t kwd_pos_args = __pyx_nargs;
3340 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "levenshtein") < 0)) __PYX_ERR(0, 50, __pyx_L3_error)
3341 }
3342 } else if (unlikely(__pyx_nargs != 2)) {
3343 goto __pyx_L5_argtuple_error;
3344 } else {
3345 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
3346 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
3347 }
3348 __pyx_v_s1 = values[0];
3349 __pyx_v_s2 = values[1];
3350 __pyx_v_weights = values[2];
3351 __pyx_v_processor = values[3];
3352 __pyx_v_max = values[4];
3353 }
3354 goto __pyx_L4_argument_unpacking_done;
3355 __pyx_L5_argtuple_error:;
3356 __Pyx_RaiseArgtupleInvalid("levenshtein", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 50, __pyx_L3_error)
3357 __pyx_L3_error:;
3358 __Pyx_AddTraceback("cpp_string_metric.levenshtein", __pyx_clineno, __pyx_lineno, __pyx_filename);
3359 __Pyx_RefNannyFinishContext();
3360 return NULL;
3361 __pyx_L4_argument_unpacking_done:;
3362 __pyx_r = __pyx_pf_17cpp_string_metric_levenshtein(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_weights, __pyx_v_processor, __pyx_v_max);
3363
3364 /* function exit code */
3365 __Pyx_RefNannyFinishContext();
3366 return __pyx_r;
3367 }
3368
__pyx_pf_17cpp_string_metric_levenshtein(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,PyObject * __pyx_v_weights,PyObject * __pyx_v_processor,PyObject * __pyx_v_max)3369 static PyObject *__pyx_pf_17cpp_string_metric_levenshtein(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_weights, PyObject *__pyx_v_processor, PyObject *__pyx_v_max) {
3370 size_t __pyx_v_insertion;
3371 size_t __pyx_v_deletion;
3372 size_t __pyx_v_substitution;
3373 size_t __pyx_v_c_max;
3374 PyObject *__pyx_r = NULL;
3375 __Pyx_TraceDeclarations
3376 __Pyx_RefNannyDeclarations
3377 int __pyx_t_1;
3378 int __pyx_t_2;
3379 PyObject *__pyx_t_3 = NULL;
3380 PyObject *__pyx_t_4 = NULL;
3381 PyObject *__pyx_t_5 = NULL;
3382 PyObject *__pyx_t_6 = NULL;
3383 PyObject *(*__pyx_t_7)(PyObject *);
3384 size_t __pyx_t_8;
3385 size_t __pyx_t_9;
3386 size_t __pyx_t_10;
3387 int __pyx_t_11;
3388 proc_string __pyx_t_12;
3389 proc_string __pyx_t_13;
3390 int __pyx_t_14;
3391 int __pyx_lineno = 0;
3392 const char *__pyx_filename = NULL;
3393 int __pyx_clineno = 0;
3394 __Pyx_TraceFrameInit(__pyx_codeobj__2)
3395 __Pyx_RefNannySetupContext("levenshtein", 0);
3396 __Pyx_TraceCall("levenshtein", __pyx_f[0], 50, 0, __PYX_ERR(0, 50, __pyx_L1_error));
3397 __Pyx_INCREF(__pyx_v_s1);
3398 __Pyx_INCREF(__pyx_v_s2);
3399
3400 /* "cpp_string_metric.pyx":215
3401 * """
3402 * cdef size_t insertion, deletion, substitution
3403 * insertion = deletion = substitution = 1 # <<<<<<<<<<<<<<
3404 * if weights is not None:
3405 * insertion, deletion, substitution = weights
3406 */
3407 __Pyx_TraceLine(215,0,__PYX_ERR(0, 215, __pyx_L1_error))
3408 __pyx_v_insertion = 1;
3409 __pyx_v_deletion = 1;
3410 __pyx_v_substitution = 1;
3411
3412 /* "cpp_string_metric.pyx":216
3413 * cdef size_t insertion, deletion, substitution
3414 * insertion = deletion = substitution = 1
3415 * if weights is not None: # <<<<<<<<<<<<<<
3416 * insertion, deletion, substitution = weights
3417 *
3418 */
3419 __Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
3420 __pyx_t_1 = (__pyx_v_weights != Py_None);
3421 __pyx_t_2 = (__pyx_t_1 != 0);
3422 if (__pyx_t_2) {
3423
3424 /* "cpp_string_metric.pyx":217
3425 * insertion = deletion = substitution = 1
3426 * if weights is not None:
3427 * insertion, deletion, substitution = weights # <<<<<<<<<<<<<<
3428 *
3429 * cdef size_t c_max = <size_t>-1 if max is None else max
3430 */
3431 __Pyx_TraceLine(217,0,__PYX_ERR(0, 217, __pyx_L1_error))
3432 if ((likely(PyTuple_CheckExact(__pyx_v_weights))) || (PyList_CheckExact(__pyx_v_weights))) {
3433 PyObject* sequence = __pyx_v_weights;
3434 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3435 if (unlikely(size != 3)) {
3436 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
3437 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3438 __PYX_ERR(0, 217, __pyx_L1_error)
3439 }
3440 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3441 if (likely(PyTuple_CheckExact(sequence))) {
3442 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
3443 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
3444 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
3445 } else {
3446 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
3447 __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
3448 __pyx_t_5 = PyList_GET_ITEM(sequence, 2);
3449 }
3450 __Pyx_INCREF(__pyx_t_3);
3451 __Pyx_INCREF(__pyx_t_4);
3452 __Pyx_INCREF(__pyx_t_5);
3453 #else
3454 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)
3455 __Pyx_GOTREF(__pyx_t_3);
3456 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
3457 __Pyx_GOTREF(__pyx_t_4);
3458 __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error)
3459 __Pyx_GOTREF(__pyx_t_5);
3460 #endif
3461 } else {
3462 Py_ssize_t index = -1;
3463 __pyx_t_6 = PyObject_GetIter(__pyx_v_weights); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error)
3464 __Pyx_GOTREF(__pyx_t_6);
3465 __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
3466 index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
3467 __Pyx_GOTREF(__pyx_t_3);
3468 index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
3469 __Pyx_GOTREF(__pyx_t_4);
3470 index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
3471 __Pyx_GOTREF(__pyx_t_5);
3472 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
3473 __pyx_t_7 = NULL;
3474 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3475 goto __pyx_L5_unpacking_done;
3476 __pyx_L4_unpacking_failed:;
3477 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3478 __pyx_t_7 = NULL;
3479 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3480 __PYX_ERR(0, 217, __pyx_L1_error)
3481 __pyx_L5_unpacking_done:;
3482 }
3483 __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error)
3484 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3485 __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error)
3486 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3487 __pyx_t_10 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_10 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error)
3488 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3489 __pyx_v_insertion = __pyx_t_8;
3490 __pyx_v_deletion = __pyx_t_9;
3491 __pyx_v_substitution = __pyx_t_10;
3492
3493 /* "cpp_string_metric.pyx":216
3494 * cdef size_t insertion, deletion, substitution
3495 * insertion = deletion = substitution = 1
3496 * if weights is not None: # <<<<<<<<<<<<<<
3497 * insertion, deletion, substitution = weights
3498 *
3499 */
3500 }
3501
3502 /* "cpp_string_metric.pyx":219
3503 * insertion, deletion, substitution = weights
3504 *
3505 * cdef size_t c_max = <size_t>-1 if max is None else max # <<<<<<<<<<<<<<
3506 *
3507 * if processor is True or processor == default_process:
3508 */
3509 __Pyx_TraceLine(219,0,__PYX_ERR(0, 219, __pyx_L1_error))
3510 __pyx_t_2 = (__pyx_v_max == Py_None);
3511 if ((__pyx_t_2 != 0)) {
3512 __pyx_t_10 = ((size_t)-1L);
3513 } else {
3514 __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_v_max); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error)
3515 __pyx_t_10 = __pyx_t_9;
3516 }
3517 __pyx_v_c_max = __pyx_t_10;
3518
3519 /* "cpp_string_metric.pyx":221
3520 * cdef size_t c_max = <size_t>-1 if max is None else max
3521 *
3522 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
3523 * return levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3524 * elif callable(processor):
3525 */
3526 __Pyx_TraceLine(221,0,__PYX_ERR(0, 221, __pyx_L1_error))
3527 __pyx_t_1 = (__pyx_v_processor == Py_True);
3528 __pyx_t_11 = (__pyx_t_1 != 0);
3529 if (!__pyx_t_11) {
3530 } else {
3531 __pyx_t_2 = __pyx_t_11;
3532 goto __pyx_L7_bool_binop_done;
3533 }
3534 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error)
3535 __Pyx_GOTREF(__pyx_t_5);
3536 __pyx_t_4 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
3537 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3538 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 221, __pyx_L1_error)
3539 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3540 __pyx_t_2 = __pyx_t_11;
3541 __pyx_L7_bool_binop_done:;
3542 if (__pyx_t_2) {
3543
3544 /* "cpp_string_metric.pyx":222
3545 *
3546 * if processor is True or processor == default_process:
3547 * return levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max) # <<<<<<<<<<<<<<
3548 * elif callable(processor):
3549 * s1 = processor(s1)
3550 */
3551 __Pyx_TraceLine(222,0,__PYX_ERR(0, 222, __pyx_L1_error))
3552 __Pyx_XDECREF(__pyx_r);
3553 __pyx_t_12 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
3554 __pyx_t_13 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
3555 try {
3556 __pyx_t_4 = levenshtein_default_process(__pyx_t_12, __pyx_t_13, __pyx_v_insertion, __pyx_v_deletion, __pyx_v_substitution, __pyx_v_c_max);
3557 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error)
3558 } catch(...) {
3559 __Pyx_CppExn2PyErr();
3560 __PYX_ERR(0, 222, __pyx_L1_error)
3561 }
3562 __Pyx_GOTREF(__pyx_t_4);
3563 __pyx_r = __pyx_t_4;
3564 __pyx_t_4 = 0;
3565 goto __pyx_L0;
3566
3567 /* "cpp_string_metric.pyx":221
3568 * cdef size_t c_max = <size_t>-1 if max is None else max
3569 *
3570 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
3571 * return levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3572 * elif callable(processor):
3573 */
3574 }
3575
3576 /* "cpp_string_metric.pyx":223
3577 * if processor is True or processor == default_process:
3578 * return levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3579 * elif callable(processor): # <<<<<<<<<<<<<<
3580 * s1 = processor(s1)
3581 * s2 = processor(s2)
3582 */
3583 __Pyx_TraceLine(223,0,__PYX_ERR(0, 223, __pyx_L1_error))
3584 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 223, __pyx_L1_error)
3585 __pyx_t_11 = (__pyx_t_2 != 0);
3586 if (__pyx_t_11) {
3587
3588 /* "cpp_string_metric.pyx":224
3589 * return levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3590 * elif callable(processor):
3591 * s1 = processor(s1) # <<<<<<<<<<<<<<
3592 * s2 = processor(s2)
3593 *
3594 */
3595 __Pyx_TraceLine(224,0,__PYX_ERR(0, 224, __pyx_L1_error))
3596 __Pyx_INCREF(__pyx_v_processor);
3597 __pyx_t_5 = __pyx_v_processor; __pyx_t_3 = NULL;
3598 __pyx_t_14 = 0;
3599 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3600 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3601 if (likely(__pyx_t_3)) {
3602 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3603 __Pyx_INCREF(__pyx_t_3);
3604 __Pyx_INCREF(function);
3605 __Pyx_DECREF_SET(__pyx_t_5, function);
3606 __pyx_t_14 = 1;
3607 }
3608 }
3609 {
3610 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_s1};
3611 __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_14, 1+__pyx_t_14);
3612 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3613 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
3614 __Pyx_GOTREF(__pyx_t_4);
3615 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3616 }
3617 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_4);
3618 __pyx_t_4 = 0;
3619
3620 /* "cpp_string_metric.pyx":225
3621 * elif callable(processor):
3622 * s1 = processor(s1)
3623 * s2 = processor(s2) # <<<<<<<<<<<<<<
3624 *
3625 * return levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3626 */
3627 __Pyx_TraceLine(225,0,__PYX_ERR(0, 225, __pyx_L1_error))
3628 __Pyx_INCREF(__pyx_v_processor);
3629 __pyx_t_5 = __pyx_v_processor; __pyx_t_3 = NULL;
3630 __pyx_t_14 = 0;
3631 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3632 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3633 if (likely(__pyx_t_3)) {
3634 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3635 __Pyx_INCREF(__pyx_t_3);
3636 __Pyx_INCREF(function);
3637 __Pyx_DECREF_SET(__pyx_t_5, function);
3638 __pyx_t_14 = 1;
3639 }
3640 }
3641 {
3642 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_s2};
3643 __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_14, 1+__pyx_t_14);
3644 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3645 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
3646 __Pyx_GOTREF(__pyx_t_4);
3647 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3648 }
3649 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_4);
3650 __pyx_t_4 = 0;
3651
3652 /* "cpp_string_metric.pyx":223
3653 * if processor is True or processor == default_process:
3654 * return levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3655 * elif callable(processor): # <<<<<<<<<<<<<<
3656 * s1 = processor(s1)
3657 * s2 = processor(s2)
3658 */
3659 }
3660
3661 /* "cpp_string_metric.pyx":227
3662 * s2 = processor(s2)
3663 *
3664 * return levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max) # <<<<<<<<<<<<<<
3665 *
3666 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type):
3667 */
3668 __Pyx_TraceLine(227,0,__PYX_ERR(0, 227, __pyx_L1_error))
3669 __Pyx_XDECREF(__pyx_r);
3670 __pyx_t_13 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L1_error)
3671 __pyx_t_12 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L1_error)
3672 try {
3673 __pyx_t_4 = levenshtein_no_process(__pyx_t_13, __pyx_t_12, __pyx_v_insertion, __pyx_v_deletion, __pyx_v_substitution, __pyx_v_c_max);
3674 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
3675 } catch(...) {
3676 __Pyx_CppExn2PyErr();
3677 __PYX_ERR(0, 227, __pyx_L1_error)
3678 }
3679 __Pyx_GOTREF(__pyx_t_4);
3680 __pyx_r = __pyx_t_4;
3681 __pyx_t_4 = 0;
3682 goto __pyx_L0;
3683
3684 /* "cpp_string_metric.pyx":50
3685 * vector[LevenshteinEditOp] levenshtein_editops_default_process(const proc_string& s1, const proc_string& s2) nogil except +
3686 *
3687 * def levenshtein(s1, s2, *, weights=(1,1,1), processor=None, max=None): # <<<<<<<<<<<<<<
3688 * """
3689 * Calculates the minimum number of insertions, deletions, and substitutions
3690 */
3691
3692 /* function exit code */
3693 __pyx_L1_error:;
3694 __Pyx_XDECREF(__pyx_t_3);
3695 __Pyx_XDECREF(__pyx_t_4);
3696 __Pyx_XDECREF(__pyx_t_5);
3697 __Pyx_XDECREF(__pyx_t_6);
3698 __Pyx_AddTraceback("cpp_string_metric.levenshtein", __pyx_clineno, __pyx_lineno, __pyx_filename);
3699 __pyx_r = NULL;
3700 __pyx_L0:;
3701 __Pyx_XDECREF(__pyx_v_s1);
3702 __Pyx_XDECREF(__pyx_v_s2);
3703 __Pyx_XGIVEREF(__pyx_r);
3704 __Pyx_TraceReturn(__pyx_r, 0);
3705 __Pyx_RefNannyFinishContext();
3706 return __pyx_r;
3707 }
3708
3709 /* "cpp_string_metric.pyx":229
3710 * return levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3711 *
3712 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type): # <<<<<<<<<<<<<<
3713 * if edit_type == LevenshteinEditType.Insert:
3714 * return "insert"
3715 */
3716
__pyx_f_17cpp_string_metric_levenshtein_edit_type_to_str(__PYX_ENUM_CLASS_DECL rapidfuzz::LevenshteinEditType __pyx_v_edit_type)3717 static PyObject *__pyx_f_17cpp_string_metric_levenshtein_edit_type_to_str(__PYX_ENUM_CLASS_DECL rapidfuzz::LevenshteinEditType __pyx_v_edit_type) {
3718 PyObject *__pyx_r = NULL;
3719 __Pyx_TraceDeclarations
3720 __Pyx_RefNannyDeclarations
3721 int __pyx_t_1;
3722 int __pyx_lineno = 0;
3723 const char *__pyx_filename = NULL;
3724 int __pyx_clineno = 0;
3725 __Pyx_RefNannySetupContext("levenshtein_edit_type_to_str", 0);
3726 __Pyx_TraceCall("levenshtein_edit_type_to_str", __pyx_f[0], 229, 0, __PYX_ERR(0, 229, __pyx_L1_error));
3727
3728 /* "cpp_string_metric.pyx":230
3729 *
3730 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type):
3731 * if edit_type == LevenshteinEditType.Insert: # <<<<<<<<<<<<<<
3732 * return "insert"
3733 * elif edit_type == LevenshteinEditType.Delete:
3734 */
3735 __Pyx_TraceLine(230,0,__PYX_ERR(0, 230, __pyx_L1_error))
3736 __pyx_t_1 = ((__pyx_v_edit_type == rapidfuzz::LevenshteinEditType::Insert) != 0);
3737 if (__pyx_t_1) {
3738
3739 /* "cpp_string_metric.pyx":231
3740 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type):
3741 * if edit_type == LevenshteinEditType.Insert:
3742 * return "insert" # <<<<<<<<<<<<<<
3743 * elif edit_type == LevenshteinEditType.Delete:
3744 * return "delete"
3745 */
3746 __Pyx_TraceLine(231,0,__PYX_ERR(0, 231, __pyx_L1_error))
3747 __Pyx_XDECREF(__pyx_r);
3748 __Pyx_INCREF(__pyx_n_u_insert);
3749 __pyx_r = __pyx_n_u_insert;
3750 goto __pyx_L0;
3751
3752 /* "cpp_string_metric.pyx":230
3753 *
3754 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type):
3755 * if edit_type == LevenshteinEditType.Insert: # <<<<<<<<<<<<<<
3756 * return "insert"
3757 * elif edit_type == LevenshteinEditType.Delete:
3758 */
3759 }
3760
3761 /* "cpp_string_metric.pyx":232
3762 * if edit_type == LevenshteinEditType.Insert:
3763 * return "insert"
3764 * elif edit_type == LevenshteinEditType.Delete: # <<<<<<<<<<<<<<
3765 * return "delete"
3766 * # possibly requires no-op in the future as well
3767 */
3768 __Pyx_TraceLine(232,0,__PYX_ERR(0, 232, __pyx_L1_error))
3769 __pyx_t_1 = ((__pyx_v_edit_type == rapidfuzz::LevenshteinEditType::Delete) != 0);
3770 if (__pyx_t_1) {
3771
3772 /* "cpp_string_metric.pyx":233
3773 * return "insert"
3774 * elif edit_type == LevenshteinEditType.Delete:
3775 * return "delete" # <<<<<<<<<<<<<<
3776 * # possibly requires no-op in the future as well
3777 * else:
3778 */
3779 __Pyx_TraceLine(233,0,__PYX_ERR(0, 233, __pyx_L1_error))
3780 __Pyx_XDECREF(__pyx_r);
3781 __Pyx_INCREF(__pyx_n_u_delete);
3782 __pyx_r = __pyx_n_u_delete;
3783 goto __pyx_L0;
3784
3785 /* "cpp_string_metric.pyx":232
3786 * if edit_type == LevenshteinEditType.Insert:
3787 * return "insert"
3788 * elif edit_type == LevenshteinEditType.Delete: # <<<<<<<<<<<<<<
3789 * return "delete"
3790 * # possibly requires no-op in the future as well
3791 */
3792 }
3793
3794 /* "cpp_string_metric.pyx":236
3795 * # possibly requires no-op in the future as well
3796 * else:
3797 * return "replace" # <<<<<<<<<<<<<<
3798 *
3799 * cdef list levenshtein_editops_to_list(vector[LevenshteinEditOp] ops):
3800 */
3801 __Pyx_TraceLine(236,0,__PYX_ERR(0, 236, __pyx_L1_error))
3802 /*else*/ {
3803 __Pyx_XDECREF(__pyx_r);
3804 __Pyx_INCREF(__pyx_n_u_replace);
3805 __pyx_r = __pyx_n_u_replace;
3806 goto __pyx_L0;
3807 }
3808
3809 /* "cpp_string_metric.pyx":229
3810 * return levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
3811 *
3812 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type): # <<<<<<<<<<<<<<
3813 * if edit_type == LevenshteinEditType.Insert:
3814 * return "insert"
3815 */
3816
3817 /* function exit code */
3818 __pyx_L1_error:;
3819 __Pyx_AddTraceback("cpp_string_metric.levenshtein_edit_type_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
3820 __pyx_r = 0;
3821 __pyx_L0:;
3822 __Pyx_XGIVEREF(__pyx_r);
3823 __Pyx_TraceReturn(__pyx_r, 0);
3824 __Pyx_RefNannyFinishContext();
3825 return __pyx_r;
3826 }
3827
3828 /* "cpp_string_metric.pyx":238
3829 * return "replace"
3830 *
3831 * cdef list levenshtein_editops_to_list(vector[LevenshteinEditOp] ops): # <<<<<<<<<<<<<<
3832 * cdef size_t op_count = ops.size()
3833 * cdef list result_list = PyList_New(<Py_ssize_t>op_count)
3834 */
3835
__pyx_f_17cpp_string_metric_levenshtein_editops_to_list(std::vector<rapidfuzz::LevenshteinEditOp> __pyx_v_ops)3836 static PyObject *__pyx_f_17cpp_string_metric_levenshtein_editops_to_list(std::vector<rapidfuzz::LevenshteinEditOp> __pyx_v_ops) {
3837 size_t __pyx_v_op_count;
3838 PyObject *__pyx_v_result_list = 0;
3839 size_t __pyx_v_i;
3840 PyObject *__pyx_v_result_item = NULL;
3841 PyObject *__pyx_r = NULL;
3842 __Pyx_TraceDeclarations
3843 __Pyx_RefNannyDeclarations
3844 PyObject *__pyx_t_1 = NULL;
3845 size_t __pyx_t_2;
3846 size_t __pyx_t_3;
3847 size_t __pyx_t_4;
3848 PyObject *__pyx_t_5 = NULL;
3849 PyObject *__pyx_t_6 = NULL;
3850 PyObject *__pyx_t_7 = NULL;
3851 int __pyx_lineno = 0;
3852 const char *__pyx_filename = NULL;
3853 int __pyx_clineno = 0;
3854 __Pyx_RefNannySetupContext("levenshtein_editops_to_list", 0);
3855 __Pyx_TraceCall("levenshtein_editops_to_list", __pyx_f[0], 238, 0, __PYX_ERR(0, 238, __pyx_L1_error));
3856
3857 /* "cpp_string_metric.pyx":239
3858 *
3859 * cdef list levenshtein_editops_to_list(vector[LevenshteinEditOp] ops):
3860 * cdef size_t op_count = ops.size() # <<<<<<<<<<<<<<
3861 * cdef list result_list = PyList_New(<Py_ssize_t>op_count)
3862 * for i in range(op_count):
3863 */
3864 __Pyx_TraceLine(239,0,__PYX_ERR(0, 239, __pyx_L1_error))
3865 __pyx_v_op_count = __pyx_v_ops.size();
3866
3867 /* "cpp_string_metric.pyx":240
3868 * cdef list levenshtein_editops_to_list(vector[LevenshteinEditOp] ops):
3869 * cdef size_t op_count = ops.size()
3870 * cdef list result_list = PyList_New(<Py_ssize_t>op_count) # <<<<<<<<<<<<<<
3871 * for i in range(op_count):
3872 * result_item = (levenshtein_edit_type_to_str(ops[i].type), ops[i].src_pos, ops[i].dest_pos)
3873 */
3874 __Pyx_TraceLine(240,0,__PYX_ERR(0, 240, __pyx_L1_error))
3875 __pyx_t_1 = PyList_New(((Py_ssize_t)__pyx_v_op_count)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
3876 __Pyx_GOTREF(__pyx_t_1);
3877 __pyx_v_result_list = ((PyObject*)__pyx_t_1);
3878 __pyx_t_1 = 0;
3879
3880 /* "cpp_string_metric.pyx":241
3881 * cdef size_t op_count = ops.size()
3882 * cdef list result_list = PyList_New(<Py_ssize_t>op_count)
3883 * for i in range(op_count): # <<<<<<<<<<<<<<
3884 * result_item = (levenshtein_edit_type_to_str(ops[i].type), ops[i].src_pos, ops[i].dest_pos)
3885 * Py_INCREF(result_item)
3886 */
3887 __Pyx_TraceLine(241,0,__PYX_ERR(0, 241, __pyx_L1_error))
3888 __pyx_t_2 = __pyx_v_op_count;
3889 __pyx_t_3 = __pyx_t_2;
3890 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
3891 __pyx_v_i = __pyx_t_4;
3892
3893 /* "cpp_string_metric.pyx":242
3894 * cdef list result_list = PyList_New(<Py_ssize_t>op_count)
3895 * for i in range(op_count):
3896 * result_item = (levenshtein_edit_type_to_str(ops[i].type), ops[i].src_pos, ops[i].dest_pos) # <<<<<<<<<<<<<<
3897 * Py_INCREF(result_item)
3898 * PyList_SET_ITEM(result_list, <Py_ssize_t>i, result_item)
3899 */
3900 __Pyx_TraceLine(242,0,__PYX_ERR(0, 242, __pyx_L1_error))
3901 __pyx_t_1 = __pyx_f_17cpp_string_metric_levenshtein_edit_type_to_str((__pyx_v_ops[__pyx_v_i]).type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
3902 __Pyx_GOTREF(__pyx_t_1);
3903 __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_ops[__pyx_v_i]).src_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error)
3904 __Pyx_GOTREF(__pyx_t_5);
3905 __pyx_t_6 = __Pyx_PyInt_FromSize_t((__pyx_v_ops[__pyx_v_i]).dest_pos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error)
3906 __Pyx_GOTREF(__pyx_t_6);
3907 __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error)
3908 __Pyx_GOTREF(__pyx_t_7);
3909 __Pyx_GIVEREF(__pyx_t_1);
3910 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
3911 __Pyx_GIVEREF(__pyx_t_5);
3912 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
3913 __Pyx_GIVEREF(__pyx_t_6);
3914 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
3915 __pyx_t_1 = 0;
3916 __pyx_t_5 = 0;
3917 __pyx_t_6 = 0;
3918 __Pyx_XDECREF_SET(__pyx_v_result_item, ((PyObject*)__pyx_t_7));
3919 __pyx_t_7 = 0;
3920
3921 /* "cpp_string_metric.pyx":243
3922 * for i in range(op_count):
3923 * result_item = (levenshtein_edit_type_to_str(ops[i].type), ops[i].src_pos, ops[i].dest_pos)
3924 * Py_INCREF(result_item) # <<<<<<<<<<<<<<
3925 * PyList_SET_ITEM(result_list, <Py_ssize_t>i, result_item)
3926 *
3927 */
3928 __Pyx_TraceLine(243,0,__PYX_ERR(0, 243, __pyx_L1_error))
3929 Py_INCREF(__pyx_v_result_item);
3930
3931 /* "cpp_string_metric.pyx":244
3932 * result_item = (levenshtein_edit_type_to_str(ops[i].type), ops[i].src_pos, ops[i].dest_pos)
3933 * Py_INCREF(result_item)
3934 * PyList_SET_ITEM(result_list, <Py_ssize_t>i, result_item) # <<<<<<<<<<<<<<
3935 *
3936 * return result_list
3937 */
3938 __Pyx_TraceLine(244,0,__PYX_ERR(0, 244, __pyx_L1_error))
3939 PyList_SET_ITEM(__pyx_v_result_list, ((Py_ssize_t)__pyx_v_i), __pyx_v_result_item);
3940 }
3941
3942 /* "cpp_string_metric.pyx":246
3943 * PyList_SET_ITEM(result_list, <Py_ssize_t>i, result_item)
3944 *
3945 * return result_list # <<<<<<<<<<<<<<
3946 *
3947 * def levenshtein_editops(s1, s2, *, processor=None):
3948 */
3949 __Pyx_TraceLine(246,0,__PYX_ERR(0, 246, __pyx_L1_error))
3950 __Pyx_XDECREF(__pyx_r);
3951 __Pyx_INCREF(__pyx_v_result_list);
3952 __pyx_r = __pyx_v_result_list;
3953 goto __pyx_L0;
3954
3955 /* "cpp_string_metric.pyx":238
3956 * return "replace"
3957 *
3958 * cdef list levenshtein_editops_to_list(vector[LevenshteinEditOp] ops): # <<<<<<<<<<<<<<
3959 * cdef size_t op_count = ops.size()
3960 * cdef list result_list = PyList_New(<Py_ssize_t>op_count)
3961 */
3962
3963 /* function exit code */
3964 __pyx_L1_error:;
3965 __Pyx_XDECREF(__pyx_t_1);
3966 __Pyx_XDECREF(__pyx_t_5);
3967 __Pyx_XDECREF(__pyx_t_6);
3968 __Pyx_XDECREF(__pyx_t_7);
3969 __Pyx_AddTraceback("cpp_string_metric.levenshtein_editops_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
3970 __pyx_r = 0;
3971 __pyx_L0:;
3972 __Pyx_XDECREF(__pyx_v_result_list);
3973 __Pyx_XDECREF(__pyx_v_result_item);
3974 __Pyx_XGIVEREF(__pyx_r);
3975 __Pyx_TraceReturn(__pyx_r, 0);
3976 __Pyx_RefNannyFinishContext();
3977 return __pyx_r;
3978 }
3979
3980 /* "cpp_string_metric.pyx":248
3981 * return result_list
3982 *
3983 * def levenshtein_editops(s1, s2, *, processor=None): # <<<<<<<<<<<<<<
3984 * """
3985 * Return list of 3-tuples describing how to turn s1 into s2.
3986 */
3987
3988 /* Python wrapper */
3989 static PyObject *__pyx_pw_17cpp_string_metric_3levenshtein_editops(PyObject *__pyx_self,
3990 #if CYTHON_METH_FASTCALL
3991 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
3992 #else
3993 PyObject *__pyx_args, PyObject *__pyx_kwds
3994 #endif
3995 ); /*proto*/
3996 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_2levenshtein_editops, "\n Return list of 3-tuples describing how to turn s1 into s2.\n Each tuple is of the form (tag, src_pos, dest_pos).\n\n The tags are strings, with these meanings:\n 'replace': s1[src_pos] should be replaced by s2[dest_pos]\n 'delete': s1[src_pos] should be deleted.\n 'insert': s2[dest_pos] should be inserted at s1[src_pos].\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n processor: bool or 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\n Returns\n -------\n editops : list[]\n edit operations required to turn s1 into s2\n\n Examples\n --------\n >>> from rapidfuzz.string_metric import levenshtein_editops\n >>> for tag, src_pos, dest_pos in levenshtein_editops(\"qabxcd\", \"abycdf\"):\n ... print((\"%7s s1[%d] s2[%d]\" % (tag, src_pos, dest_pos)))\n delete s1[1] s2[0]\n replace s1[4] s2[3]\n insert s1[6] s2[6]\n ");
3997 static PyMethodDef __pyx_mdef_17cpp_string_metric_3levenshtein_editops = {"levenshtein_editops", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_3levenshtein_editops, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_2levenshtein_editops};
__pyx_pw_17cpp_string_metric_3levenshtein_editops(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)3998 static PyObject *__pyx_pw_17cpp_string_metric_3levenshtein_editops(PyObject *__pyx_self,
3999 #if CYTHON_METH_FASTCALL
4000 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
4001 #else
4002 PyObject *__pyx_args, PyObject *__pyx_kwds
4003 #endif
4004 ) {
4005 PyObject *__pyx_v_s1 = 0;
4006 PyObject *__pyx_v_s2 = 0;
4007 PyObject *__pyx_v_processor = 0;
4008 #if !CYTHON_METH_FASTCALL
4009 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
4010 #endif
4011 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
4012 int __pyx_lineno = 0;
4013 const char *__pyx_filename = NULL;
4014 int __pyx_clineno = 0;
4015 PyObject *__pyx_r = 0;
4016 __Pyx_RefNannyDeclarations
4017 __Pyx_RefNannySetupContext("levenshtein_editops (wrapper)", 0);
4018 {
4019 #if CYTHON_USE_MODULE_STATE
4020 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,0};
4021 #else
4022 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,0};
4023 #endif
4024 PyObject* values[3] = {0,0,0};
4025 values[2] = ((PyObject *)((PyObject *)Py_None));
4026 if (__pyx_kwds) {
4027 Py_ssize_t kw_args;
4028 switch (__pyx_nargs) {
4029 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
4030 CYTHON_FALLTHROUGH;
4031 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
4032 CYTHON_FALLTHROUGH;
4033 case 0: break;
4034 default: goto __pyx_L5_argtuple_error;
4035 }
4036 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
4037 switch (__pyx_nargs) {
4038 case 0:
4039 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
4040 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
4041 else goto __pyx_L5_argtuple_error;
4042 CYTHON_FALLTHROUGH;
4043 case 1:
4044 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
4045 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
4046 else {
4047 __Pyx_RaiseArgtupleInvalid("levenshtein_editops", 1, 2, 2, 1); __PYX_ERR(0, 248, __pyx_L3_error)
4048 }
4049 }
4050 if (kw_args == 1) {
4051 const Py_ssize_t index = 2;
4052 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
4053 if (value) { values[index] = value; kw_args--; }
4054 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
4055 }
4056 if (unlikely(kw_args > 0)) {
4057 const Py_ssize_t kwd_pos_args = __pyx_nargs;
4058 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "levenshtein_editops") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
4059 }
4060 } else if (unlikely(__pyx_nargs != 2)) {
4061 goto __pyx_L5_argtuple_error;
4062 } else {
4063 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
4064 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
4065 }
4066 __pyx_v_s1 = values[0];
4067 __pyx_v_s2 = values[1];
4068 __pyx_v_processor = values[2];
4069 }
4070 goto __pyx_L4_argument_unpacking_done;
4071 __pyx_L5_argtuple_error:;
4072 __Pyx_RaiseArgtupleInvalid("levenshtein_editops", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 248, __pyx_L3_error)
4073 __pyx_L3_error:;
4074 __Pyx_AddTraceback("cpp_string_metric.levenshtein_editops", __pyx_clineno, __pyx_lineno, __pyx_filename);
4075 __Pyx_RefNannyFinishContext();
4076 return NULL;
4077 __pyx_L4_argument_unpacking_done:;
4078 __pyx_r = __pyx_pf_17cpp_string_metric_2levenshtein_editops(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_processor);
4079
4080 /* function exit code */
4081 __Pyx_RefNannyFinishContext();
4082 return __pyx_r;
4083 }
4084
__pyx_pf_17cpp_string_metric_2levenshtein_editops(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,PyObject * __pyx_v_processor)4085 static PyObject *__pyx_pf_17cpp_string_metric_2levenshtein_editops(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor) {
4086 PyObject *__pyx_r = NULL;
4087 __Pyx_TraceDeclarations
4088 __Pyx_RefNannyDeclarations
4089 int __pyx_t_1;
4090 int __pyx_t_2;
4091 int __pyx_t_3;
4092 PyObject *__pyx_t_4 = NULL;
4093 PyObject *__pyx_t_5 = NULL;
4094 proc_string __pyx_t_6;
4095 proc_string __pyx_t_7;
4096 std::vector<rapidfuzz::LevenshteinEditOp> __pyx_t_8;
4097 PyObject *__pyx_t_9 = NULL;
4098 int __pyx_t_10;
4099 int __pyx_lineno = 0;
4100 const char *__pyx_filename = NULL;
4101 int __pyx_clineno = 0;
4102 __Pyx_TraceFrameInit(__pyx_codeobj__3)
4103 __Pyx_RefNannySetupContext("levenshtein_editops", 0);
4104 __Pyx_TraceCall("levenshtein_editops", __pyx_f[0], 248, 0, __PYX_ERR(0, 248, __pyx_L1_error));
4105 __Pyx_INCREF(__pyx_v_s1);
4106 __Pyx_INCREF(__pyx_v_s2);
4107
4108 /* "cpp_string_metric.pyx":283
4109 * insert s1[6] s2[6]
4110 * """
4111 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
4112 * return levenshtein_editops_to_list(
4113 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2))
4114 */
4115 __Pyx_TraceLine(283,0,__PYX_ERR(0, 283, __pyx_L1_error))
4116 __pyx_t_2 = (__pyx_v_processor == Py_True);
4117 __pyx_t_3 = (__pyx_t_2 != 0);
4118 if (!__pyx_t_3) {
4119 } else {
4120 __pyx_t_1 = __pyx_t_3;
4121 goto __pyx_L4_bool_binop_done;
4122 }
4123 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error)
4124 __Pyx_GOTREF(__pyx_t_4);
4125 __pyx_t_5 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
4126 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4127 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 283, __pyx_L1_error)
4128 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4129 __pyx_t_1 = __pyx_t_3;
4130 __pyx_L4_bool_binop_done:;
4131 if (__pyx_t_1) {
4132
4133 /* "cpp_string_metric.pyx":284
4134 * """
4135 * if processor is True or processor == default_process:
4136 * return levenshtein_editops_to_list( # <<<<<<<<<<<<<<
4137 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2))
4138 * )
4139 */
4140 __Pyx_TraceLine(284,0,__PYX_ERR(0, 284, __pyx_L1_error))
4141 __Pyx_XDECREF(__pyx_r);
4142
4143 /* "cpp_string_metric.pyx":285
4144 * if processor is True or processor == default_process:
4145 * return levenshtein_editops_to_list(
4146 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2)) # <<<<<<<<<<<<<<
4147 * )
4148 * elif callable(processor):
4149 */
4150 __Pyx_TraceLine(285,0,__PYX_ERR(0, 285, __pyx_L1_error))
4151 __pyx_t_6 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error)
4152 __pyx_t_7 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error)
4153 try {
4154 __pyx_t_8 = levenshtein_editops_default_process(__pyx_t_6, __pyx_t_7);
4155 } catch(...) {
4156 __Pyx_CppExn2PyErr();
4157 __PYX_ERR(0, 285, __pyx_L1_error)
4158 }
4159
4160 /* "cpp_string_metric.pyx":284
4161 * """
4162 * if processor is True or processor == default_process:
4163 * return levenshtein_editops_to_list( # <<<<<<<<<<<<<<
4164 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2))
4165 * )
4166 */
4167 __Pyx_TraceLine(284,0,__PYX_ERR(0, 284, __pyx_L1_error))
4168 __pyx_t_5 = __pyx_f_17cpp_string_metric_levenshtein_editops_to_list(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
4169 __Pyx_GOTREF(__pyx_t_5);
4170 __pyx_r = __pyx_t_5;
4171 __pyx_t_5 = 0;
4172 goto __pyx_L0;
4173
4174 /* "cpp_string_metric.pyx":283
4175 * insert s1[6] s2[6]
4176 * """
4177 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
4178 * return levenshtein_editops_to_list(
4179 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2))
4180 */
4181 }
4182
4183 /* "cpp_string_metric.pyx":287
4184 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2))
4185 * )
4186 * elif callable(processor): # <<<<<<<<<<<<<<
4187 * s1 = processor(s1)
4188 * s2 = processor(s2)
4189 */
4190 __Pyx_TraceLine(287,0,__PYX_ERR(0, 287, __pyx_L1_error))
4191 __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 287, __pyx_L1_error)
4192 __pyx_t_3 = (__pyx_t_1 != 0);
4193 if (__pyx_t_3) {
4194
4195 /* "cpp_string_metric.pyx":288
4196 * )
4197 * elif callable(processor):
4198 * s1 = processor(s1) # <<<<<<<<<<<<<<
4199 * s2 = processor(s2)
4200 *
4201 */
4202 __Pyx_TraceLine(288,0,__PYX_ERR(0, 288, __pyx_L1_error))
4203 __Pyx_INCREF(__pyx_v_processor);
4204 __pyx_t_4 = __pyx_v_processor; __pyx_t_9 = NULL;
4205 __pyx_t_10 = 0;
4206 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4207 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
4208 if (likely(__pyx_t_9)) {
4209 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4210 __Pyx_INCREF(__pyx_t_9);
4211 __Pyx_INCREF(function);
4212 __Pyx_DECREF_SET(__pyx_t_4, function);
4213 __pyx_t_10 = 1;
4214 }
4215 }
4216 {
4217 PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_s1};
4218 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
4219 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4220 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
4221 __Pyx_GOTREF(__pyx_t_5);
4222 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4223 }
4224 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_5);
4225 __pyx_t_5 = 0;
4226
4227 /* "cpp_string_metric.pyx":289
4228 * elif callable(processor):
4229 * s1 = processor(s1)
4230 * s2 = processor(s2) # <<<<<<<<<<<<<<
4231 *
4232 * return levenshtein_editops_to_list(
4233 */
4234 __Pyx_TraceLine(289,0,__PYX_ERR(0, 289, __pyx_L1_error))
4235 __Pyx_INCREF(__pyx_v_processor);
4236 __pyx_t_4 = __pyx_v_processor; __pyx_t_9 = NULL;
4237 __pyx_t_10 = 0;
4238 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4239 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
4240 if (likely(__pyx_t_9)) {
4241 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4242 __Pyx_INCREF(__pyx_t_9);
4243 __Pyx_INCREF(function);
4244 __Pyx_DECREF_SET(__pyx_t_4, function);
4245 __pyx_t_10 = 1;
4246 }
4247 }
4248 {
4249 PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_s2};
4250 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
4251 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4252 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
4253 __Pyx_GOTREF(__pyx_t_5);
4254 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4255 }
4256 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_5);
4257 __pyx_t_5 = 0;
4258
4259 /* "cpp_string_metric.pyx":287
4260 * levenshtein_editops_default_process(conv_sequence(s1), conv_sequence(s2))
4261 * )
4262 * elif callable(processor): # <<<<<<<<<<<<<<
4263 * s1 = processor(s1)
4264 * s2 = processor(s2)
4265 */
4266 }
4267
4268 /* "cpp_string_metric.pyx":291
4269 * s2 = processor(s2)
4270 *
4271 * return levenshtein_editops_to_list( # <<<<<<<<<<<<<<
4272 * levenshtein_editops_no_process(conv_sequence(s1), conv_sequence(s2))
4273 * )
4274 */
4275 __Pyx_TraceLine(291,0,__PYX_ERR(0, 291, __pyx_L1_error))
4276 __Pyx_XDECREF(__pyx_r);
4277
4278 /* "cpp_string_metric.pyx":292
4279 *
4280 * return levenshtein_editops_to_list(
4281 * levenshtein_editops_no_process(conv_sequence(s1), conv_sequence(s2)) # <<<<<<<<<<<<<<
4282 * )
4283 *
4284 */
4285 __Pyx_TraceLine(292,0,__PYX_ERR(0, 292, __pyx_L1_error))
4286 __pyx_t_7 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L1_error)
4287 __pyx_t_6 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L1_error)
4288 try {
4289 __pyx_t_8 = levenshtein_editops_no_process(__pyx_t_7, __pyx_t_6);
4290 } catch(...) {
4291 __Pyx_CppExn2PyErr();
4292 __PYX_ERR(0, 292, __pyx_L1_error)
4293 }
4294
4295 /* "cpp_string_metric.pyx":291
4296 * s2 = processor(s2)
4297 *
4298 * return levenshtein_editops_to_list( # <<<<<<<<<<<<<<
4299 * levenshtein_editops_no_process(conv_sequence(s1), conv_sequence(s2))
4300 * )
4301 */
4302 __Pyx_TraceLine(291,0,__PYX_ERR(0, 291, __pyx_L1_error))
4303 __pyx_t_5 = __pyx_f_17cpp_string_metric_levenshtein_editops_to_list(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error)
4304 __Pyx_GOTREF(__pyx_t_5);
4305 __pyx_r = __pyx_t_5;
4306 __pyx_t_5 = 0;
4307 goto __pyx_L0;
4308
4309 /* "cpp_string_metric.pyx":248
4310 * return result_list
4311 *
4312 * def levenshtein_editops(s1, s2, *, processor=None): # <<<<<<<<<<<<<<
4313 * """
4314 * Return list of 3-tuples describing how to turn s1 into s2.
4315 */
4316
4317 /* function exit code */
4318 __pyx_L1_error:;
4319 __Pyx_XDECREF(__pyx_t_4);
4320 __Pyx_XDECREF(__pyx_t_5);
4321 __Pyx_XDECREF(__pyx_t_9);
4322 __Pyx_AddTraceback("cpp_string_metric.levenshtein_editops", __pyx_clineno, __pyx_lineno, __pyx_filename);
4323 __pyx_r = NULL;
4324 __pyx_L0:;
4325 __Pyx_XDECREF(__pyx_v_s1);
4326 __Pyx_XDECREF(__pyx_v_s2);
4327 __Pyx_XGIVEREF(__pyx_r);
4328 __Pyx_TraceReturn(__pyx_r, 0);
4329 __Pyx_RefNannyFinishContext();
4330 return __pyx_r;
4331 }
4332
4333 /* "cpp_string_metric.pyx":295
4334 * )
4335 *
4336 * def normalized_levenshtein(s1, s2, *, weights=(1,1,1), processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
4337 * """
4338 * Calculates a normalized levenshtein distance using custom
4339 */
4340
4341 /* Python wrapper */
4342 static PyObject *__pyx_pw_17cpp_string_metric_5normalized_levenshtein(PyObject *__pyx_self,
4343 #if CYTHON_METH_FASTCALL
4344 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
4345 #else
4346 PyObject *__pyx_args, PyObject *__pyx_kwds
4347 #endif
4348 ); /*proto*/
4349 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_4normalized_levenshtein, "\n Calculates a normalized levenshtein distance using custom\n costs for insertion, deletion and substitution.\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n weights : Tuple[int, int, int] or None, optional\n The weights for the three operations in the form\n (insertion, deletion, substitution). Default is (1, 1, 1),\n which gives all three operations a weight of 1.\n processor: bool or 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 : float, optional\n Optional argument for a score threshold as a float between 0 and 100.\n For ratio < score_cutoff 0 is returned instead. Default is 0,\n which deactivates this behaviour.\n\n Returns\n -------\n similarity : float\n similarity between s1 and s2 as a float between 0 and 100\n\n Raises\n ------\n ValueError\n If unsupported weights are provided a ValueError is thrown\n\n See Also\n --------\n levenshtein : Levenshtein distance\n\n Notes\n -----\n The normalization of the Levenshtein distance is performed in the following way:\n\n .. math::\n :nowrap:\n\n \\begin{align*}\n dist_{max} &= \\begin{cases}\n min(len(s1), len(s2)) \\cdot sub, & \\text{if } sub \\leq ins + del \\\\\n len(s1) \\cdot del + len(s2) \\cdot ins, & \\text{otherwise}\n \\end{cases}\\\\[10pt]\n\n dist_{max} &= \\begin{cases}\n dist_{max} + (len(s1) - len(s2)) \\cdot del, & \\text{if } len(s1) > len(s2) \\\\\n dist_{max} + (len(s2) - len(s1)) \\cdot ins, & \\text{if } len(s1) < len(s2) \\\\\n dist_{max}, & \\text{if } len""(s1) = len(s2)\n \\end{cases}\\\\[10pt]\n\n ratio &= 100 \\cdot \\frac{distance(s1, s2)}{dist_{max}}\n \\end{align*}\n\n Examples\n --------\n Find the normalized Levenshtein distance between two strings:\n\n >>> from rapidfuzz.string_metric import normalized_levenshtein\n >>> normalized_levenshtein(\"lewenstein\", \"levenshtein\")\n 81.81818181818181\n\n Setting a score_cutoff allows the implementation to select\n a more efficient implementation:\n\n >>> normalized_levenshtein(\"lewenstein\", \"levenshtein\", score_cutoff=85)\n 0.0\n\n It is possible to select different weights by passing a `weight`\n tuple.\n\n >>> normalized_levenshtein(\"lewenstein\", \"levenshtein\", weights=(1,1,2))\n 85.71428571428571\n\n When a different processor is used s1 and s2 do not have to be strings\n\n >>> normalized_levenshtein([\"lewenstein\"], [\"levenshtein\"], processor=lambda s: s[0])\n 81.81818181818181\n ");
4350 static PyMethodDef __pyx_mdef_17cpp_string_metric_5normalized_levenshtein = {"normalized_levenshtein", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_5normalized_levenshtein, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_4normalized_levenshtein};
__pyx_pw_17cpp_string_metric_5normalized_levenshtein(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)4351 static PyObject *__pyx_pw_17cpp_string_metric_5normalized_levenshtein(PyObject *__pyx_self,
4352 #if CYTHON_METH_FASTCALL
4353 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
4354 #else
4355 PyObject *__pyx_args, PyObject *__pyx_kwds
4356 #endif
4357 ) {
4358 PyObject *__pyx_v_s1 = 0;
4359 PyObject *__pyx_v_s2 = 0;
4360 PyObject *__pyx_v_weights = 0;
4361 PyObject *__pyx_v_processor = 0;
4362 PyObject *__pyx_v_score_cutoff = 0;
4363 #if !CYTHON_METH_FASTCALL
4364 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
4365 #endif
4366 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
4367 int __pyx_lineno = 0;
4368 const char *__pyx_filename = NULL;
4369 int __pyx_clineno = 0;
4370 PyObject *__pyx_r = 0;
4371 __Pyx_RefNannyDeclarations
4372 __Pyx_RefNannySetupContext("normalized_levenshtein (wrapper)", 0);
4373 {
4374 #if CYTHON_USE_MODULE_STATE
4375 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_weights,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
4376 #else
4377 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_weights,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
4378 #endif
4379 PyObject* values[5] = {0,0,0,0,0};
4380 values[2] = ((PyObject *)((PyObject*)__pyx_tuple_));
4381 values[3] = ((PyObject *)((PyObject *)Py_None));
4382 values[4] = ((PyObject *)((PyObject *)Py_None));
4383 if (__pyx_kwds) {
4384 Py_ssize_t kw_args;
4385 switch (__pyx_nargs) {
4386 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
4387 CYTHON_FALLTHROUGH;
4388 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
4389 CYTHON_FALLTHROUGH;
4390 case 0: break;
4391 default: goto __pyx_L5_argtuple_error;
4392 }
4393 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
4394 switch (__pyx_nargs) {
4395 case 0:
4396 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
4397 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L3_error)
4398 else goto __pyx_L5_argtuple_error;
4399 CYTHON_FALLTHROUGH;
4400 case 1:
4401 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
4402 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L3_error)
4403 else {
4404 __Pyx_RaiseArgtupleInvalid("normalized_levenshtein", 1, 2, 2, 1); __PYX_ERR(0, 295, __pyx_L3_error)
4405 }
4406 }
4407 if (kw_args > 0 && likely(kw_args <= 3)) {
4408 Py_ssize_t index;
4409 for (index = 2; index < 5 && kw_args > 0; index++) {
4410 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
4411 if (value) { values[index] = value; kw_args--; }
4412 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L3_error)
4413 }
4414 }
4415 if (unlikely(kw_args > 0)) {
4416 const Py_ssize_t kwd_pos_args = __pyx_nargs;
4417 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "normalized_levenshtein") < 0)) __PYX_ERR(0, 295, __pyx_L3_error)
4418 }
4419 } else if (unlikely(__pyx_nargs != 2)) {
4420 goto __pyx_L5_argtuple_error;
4421 } else {
4422 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
4423 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
4424 }
4425 __pyx_v_s1 = values[0];
4426 __pyx_v_s2 = values[1];
4427 __pyx_v_weights = values[2];
4428 __pyx_v_processor = values[3];
4429 __pyx_v_score_cutoff = values[4];
4430 }
4431 goto __pyx_L4_argument_unpacking_done;
4432 __pyx_L5_argtuple_error:;
4433 __Pyx_RaiseArgtupleInvalid("normalized_levenshtein", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 295, __pyx_L3_error)
4434 __pyx_L3_error:;
4435 __Pyx_AddTraceback("cpp_string_metric.normalized_levenshtein", __pyx_clineno, __pyx_lineno, __pyx_filename);
4436 __Pyx_RefNannyFinishContext();
4437 return NULL;
4438 __pyx_L4_argument_unpacking_done:;
4439 __pyx_r = __pyx_pf_17cpp_string_metric_4normalized_levenshtein(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_weights, __pyx_v_processor, __pyx_v_score_cutoff);
4440
4441 /* function exit code */
4442 __Pyx_RefNannyFinishContext();
4443 return __pyx_r;
4444 }
4445
__pyx_pf_17cpp_string_metric_4normalized_levenshtein(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,PyObject * __pyx_v_weights,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff)4446 static PyObject *__pyx_pf_17cpp_string_metric_4normalized_levenshtein(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_weights, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff) {
4447 size_t __pyx_v_insertion;
4448 size_t __pyx_v_deletion;
4449 size_t __pyx_v_substitution;
4450 double __pyx_v_c_score_cutoff;
4451 PyObject *__pyx_r = NULL;
4452 __Pyx_TraceDeclarations
4453 __Pyx_RefNannyDeclarations
4454 int __pyx_t_1;
4455 int __pyx_t_2;
4456 int __pyx_t_3;
4457 PyObject *__pyx_t_4 = NULL;
4458 PyObject *__pyx_t_5 = NULL;
4459 PyObject *__pyx_t_6 = NULL;
4460 PyObject *__pyx_t_7 = NULL;
4461 PyObject *(*__pyx_t_8)(PyObject *);
4462 size_t __pyx_t_9;
4463 size_t __pyx_t_10;
4464 size_t __pyx_t_11;
4465 double __pyx_t_12;
4466 double __pyx_t_13;
4467 proc_string __pyx_t_14;
4468 proc_string __pyx_t_15;
4469 int __pyx_t_16;
4470 int __pyx_lineno = 0;
4471 const char *__pyx_filename = NULL;
4472 int __pyx_clineno = 0;
4473 __Pyx_TraceFrameInit(__pyx_codeobj__4)
4474 __Pyx_RefNannySetupContext("normalized_levenshtein", 0);
4475 __Pyx_TraceCall("normalized_levenshtein", __pyx_f[0], 295, 0, __PYX_ERR(0, 295, __pyx_L1_error));
4476 __Pyx_INCREF(__pyx_v_s1);
4477 __Pyx_INCREF(__pyx_v_s2);
4478
4479 /* "cpp_string_metric.pyx":380
4480 * 81.81818181818181
4481 * """
4482 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
4483 * return 0
4484 *
4485 */
4486 __Pyx_TraceLine(380,0,__PYX_ERR(0, 380, __pyx_L1_error))
4487 __pyx_t_2 = (__pyx_v_s1 == Py_None);
4488 __pyx_t_3 = (__pyx_t_2 != 0);
4489 if (!__pyx_t_3) {
4490 } else {
4491 __pyx_t_1 = __pyx_t_3;
4492 goto __pyx_L4_bool_binop_done;
4493 }
4494 __pyx_t_3 = (__pyx_v_s2 == Py_None);
4495 __pyx_t_2 = (__pyx_t_3 != 0);
4496 __pyx_t_1 = __pyx_t_2;
4497 __pyx_L4_bool_binop_done:;
4498 if (__pyx_t_1) {
4499
4500 /* "cpp_string_metric.pyx":381
4501 * """
4502 * if s1 is None or s2 is None:
4503 * return 0 # <<<<<<<<<<<<<<
4504 *
4505 * cdef size_t insertion, deletion, substitution
4506 */
4507 __Pyx_TraceLine(381,0,__PYX_ERR(0, 381, __pyx_L1_error))
4508 __Pyx_XDECREF(__pyx_r);
4509 __Pyx_INCREF(__pyx_int_0);
4510 __pyx_r = __pyx_int_0;
4511 goto __pyx_L0;
4512
4513 /* "cpp_string_metric.pyx":380
4514 * 81.81818181818181
4515 * """
4516 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
4517 * return 0
4518 *
4519 */
4520 }
4521
4522 /* "cpp_string_metric.pyx":384
4523 *
4524 * cdef size_t insertion, deletion, substitution
4525 * insertion = deletion = substitution = 1 # <<<<<<<<<<<<<<
4526 * if weights is not None:
4527 * insertion, deletion, substitution = weights
4528 */
4529 __Pyx_TraceLine(384,0,__PYX_ERR(0, 384, __pyx_L1_error))
4530 __pyx_v_insertion = 1;
4531 __pyx_v_deletion = 1;
4532 __pyx_v_substitution = 1;
4533
4534 /* "cpp_string_metric.pyx":385
4535 * cdef size_t insertion, deletion, substitution
4536 * insertion = deletion = substitution = 1
4537 * if weights is not None: # <<<<<<<<<<<<<<
4538 * insertion, deletion, substitution = weights
4539 *
4540 */
4541 __Pyx_TraceLine(385,0,__PYX_ERR(0, 385, __pyx_L1_error))
4542 __pyx_t_1 = (__pyx_v_weights != Py_None);
4543 __pyx_t_2 = (__pyx_t_1 != 0);
4544 if (__pyx_t_2) {
4545
4546 /* "cpp_string_metric.pyx":386
4547 * insertion = deletion = substitution = 1
4548 * if weights is not None:
4549 * insertion, deletion, substitution = weights # <<<<<<<<<<<<<<
4550 *
4551 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
4552 */
4553 __Pyx_TraceLine(386,0,__PYX_ERR(0, 386, __pyx_L1_error))
4554 if ((likely(PyTuple_CheckExact(__pyx_v_weights))) || (PyList_CheckExact(__pyx_v_weights))) {
4555 PyObject* sequence = __pyx_v_weights;
4556 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4557 if (unlikely(size != 3)) {
4558 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
4559 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4560 __PYX_ERR(0, 386, __pyx_L1_error)
4561 }
4562 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4563 if (likely(PyTuple_CheckExact(sequence))) {
4564 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
4565 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
4566 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
4567 } else {
4568 __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
4569 __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
4570 __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
4571 }
4572 __Pyx_INCREF(__pyx_t_4);
4573 __Pyx_INCREF(__pyx_t_5);
4574 __Pyx_INCREF(__pyx_t_6);
4575 #else
4576 __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 386, __pyx_L1_error)
4577 __Pyx_GOTREF(__pyx_t_4);
4578 __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 386, __pyx_L1_error)
4579 __Pyx_GOTREF(__pyx_t_5);
4580 __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 386, __pyx_L1_error)
4581 __Pyx_GOTREF(__pyx_t_6);
4582 #endif
4583 } else {
4584 Py_ssize_t index = -1;
4585 __pyx_t_7 = PyObject_GetIter(__pyx_v_weights); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 386, __pyx_L1_error)
4586 __Pyx_GOTREF(__pyx_t_7);
4587 __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
4588 index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
4589 __Pyx_GOTREF(__pyx_t_4);
4590 index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
4591 __Pyx_GOTREF(__pyx_t_5);
4592 index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
4593 __Pyx_GOTREF(__pyx_t_6);
4594 if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(0, 386, __pyx_L1_error)
4595 __pyx_t_8 = NULL;
4596 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4597 goto __pyx_L8_unpacking_done;
4598 __pyx_L7_unpacking_failed:;
4599 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4600 __pyx_t_8 = NULL;
4601 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4602 __PYX_ERR(0, 386, __pyx_L1_error)
4603 __pyx_L8_unpacking_done:;
4604 }
4605 __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 386, __pyx_L1_error)
4606 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4607 __pyx_t_10 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_10 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 386, __pyx_L1_error)
4608 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4609 __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_6); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 386, __pyx_L1_error)
4610 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4611 __pyx_v_insertion = __pyx_t_9;
4612 __pyx_v_deletion = __pyx_t_10;
4613 __pyx_v_substitution = __pyx_t_11;
4614
4615 /* "cpp_string_metric.pyx":385
4616 * cdef size_t insertion, deletion, substitution
4617 * insertion = deletion = substitution = 1
4618 * if weights is not None: # <<<<<<<<<<<<<<
4619 * insertion, deletion, substitution = weights
4620 *
4621 */
4622 }
4623
4624 /* "cpp_string_metric.pyx":388
4625 * insertion, deletion, substitution = weights
4626 *
4627 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff # <<<<<<<<<<<<<<
4628 *
4629 * if processor is True or processor == default_process:
4630 */
4631 __Pyx_TraceLine(388,0,__PYX_ERR(0, 388, __pyx_L1_error))
4632 __pyx_t_2 = (__pyx_v_score_cutoff == Py_None);
4633 if ((__pyx_t_2 != 0)) {
4634 __pyx_t_12 = 0.0;
4635 } else {
4636 __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 388, __pyx_L1_error)
4637 __pyx_t_12 = __pyx_t_13;
4638 }
4639 __pyx_v_c_score_cutoff = __pyx_t_12;
4640
4641 /* "cpp_string_metric.pyx":390
4642 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
4643 *
4644 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
4645 * return normalized_levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff)
4646 * elif callable(processor):
4647 */
4648 __Pyx_TraceLine(390,0,__PYX_ERR(0, 390, __pyx_L1_error))
4649 __pyx_t_1 = (__pyx_v_processor == Py_True);
4650 __pyx_t_3 = (__pyx_t_1 != 0);
4651 if (!__pyx_t_3) {
4652 } else {
4653 __pyx_t_2 = __pyx_t_3;
4654 goto __pyx_L10_bool_binop_done;
4655 }
4656 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 390, __pyx_L1_error)
4657 __Pyx_GOTREF(__pyx_t_6);
4658 __pyx_t_5 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error)
4659 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4660 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 390, __pyx_L1_error)
4661 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4662 __pyx_t_2 = __pyx_t_3;
4663 __pyx_L10_bool_binop_done:;
4664 if (__pyx_t_2) {
4665
4666 /* "cpp_string_metric.pyx":391
4667 *
4668 * if processor is True or processor == default_process:
4669 * return normalized_levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff) # <<<<<<<<<<<<<<
4670 * elif callable(processor):
4671 * s1 = processor(s1)
4672 */
4673 __Pyx_TraceLine(391,0,__PYX_ERR(0, 391, __pyx_L1_error))
4674 __Pyx_XDECREF(__pyx_r);
4675 __pyx_t_14 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error)
4676 __pyx_t_15 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error)
4677 try {
4678 __pyx_t_12 = normalized_levenshtein_default_process(__pyx_t_14, __pyx_t_15, __pyx_v_insertion, __pyx_v_deletion, __pyx_v_substitution, __pyx_v_c_score_cutoff);
4679 } catch(...) {
4680 __Pyx_CppExn2PyErr();
4681 __PYX_ERR(0, 391, __pyx_L1_error)
4682 }
4683 __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error)
4684 __Pyx_GOTREF(__pyx_t_5);
4685 __pyx_r = __pyx_t_5;
4686 __pyx_t_5 = 0;
4687 goto __pyx_L0;
4688
4689 /* "cpp_string_metric.pyx":390
4690 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
4691 *
4692 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
4693 * return normalized_levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff)
4694 * elif callable(processor):
4695 */
4696 }
4697
4698 /* "cpp_string_metric.pyx":392
4699 * if processor is True or processor == default_process:
4700 * return normalized_levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff)
4701 * elif callable(processor): # <<<<<<<<<<<<<<
4702 * s1 = processor(s1)
4703 * s2 = processor(s2)
4704 */
4705 __Pyx_TraceLine(392,0,__PYX_ERR(0, 392, __pyx_L1_error))
4706 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 392, __pyx_L1_error)
4707 __pyx_t_3 = (__pyx_t_2 != 0);
4708 if (__pyx_t_3) {
4709
4710 /* "cpp_string_metric.pyx":393
4711 * return normalized_levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff)
4712 * elif callable(processor):
4713 * s1 = processor(s1) # <<<<<<<<<<<<<<
4714 * s2 = processor(s2)
4715 *
4716 */
4717 __Pyx_TraceLine(393,0,__PYX_ERR(0, 393, __pyx_L1_error))
4718 __Pyx_INCREF(__pyx_v_processor);
4719 __pyx_t_6 = __pyx_v_processor; __pyx_t_4 = NULL;
4720 __pyx_t_16 = 0;
4721 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
4722 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
4723 if (likely(__pyx_t_4)) {
4724 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4725 __Pyx_INCREF(__pyx_t_4);
4726 __Pyx_INCREF(function);
4727 __Pyx_DECREF_SET(__pyx_t_6, function);
4728 __pyx_t_16 = 1;
4729 }
4730 }
4731 {
4732 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_s1};
4733 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_16, 1+__pyx_t_16);
4734 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4735 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error)
4736 __Pyx_GOTREF(__pyx_t_5);
4737 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4738 }
4739 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_5);
4740 __pyx_t_5 = 0;
4741
4742 /* "cpp_string_metric.pyx":394
4743 * elif callable(processor):
4744 * s1 = processor(s1)
4745 * s2 = processor(s2) # <<<<<<<<<<<<<<
4746 *
4747 * return normalized_levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff)
4748 */
4749 __Pyx_TraceLine(394,0,__PYX_ERR(0, 394, __pyx_L1_error))
4750 __Pyx_INCREF(__pyx_v_processor);
4751 __pyx_t_6 = __pyx_v_processor; __pyx_t_4 = NULL;
4752 __pyx_t_16 = 0;
4753 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
4754 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
4755 if (likely(__pyx_t_4)) {
4756 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4757 __Pyx_INCREF(__pyx_t_4);
4758 __Pyx_INCREF(function);
4759 __Pyx_DECREF_SET(__pyx_t_6, function);
4760 __pyx_t_16 = 1;
4761 }
4762 }
4763 {
4764 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_s2};
4765 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_16, 1+__pyx_t_16);
4766 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4767 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 394, __pyx_L1_error)
4768 __Pyx_GOTREF(__pyx_t_5);
4769 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4770 }
4771 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_5);
4772 __pyx_t_5 = 0;
4773
4774 /* "cpp_string_metric.pyx":392
4775 * if processor is True or processor == default_process:
4776 * return normalized_levenshtein_default_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff)
4777 * elif callable(processor): # <<<<<<<<<<<<<<
4778 * s1 = processor(s1)
4779 * s2 = processor(s2)
4780 */
4781 }
4782
4783 /* "cpp_string_metric.pyx":396
4784 * s2 = processor(s2)
4785 *
4786 * return normalized_levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_score_cutoff) # <<<<<<<<<<<<<<
4787 *
4788 *
4789 */
4790 __Pyx_TraceLine(396,0,__PYX_ERR(0, 396, __pyx_L1_error))
4791 __Pyx_XDECREF(__pyx_r);
4792 __pyx_t_15 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L1_error)
4793 __pyx_t_14 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L1_error)
4794 try {
4795 __pyx_t_12 = normalized_levenshtein_no_process(__pyx_t_15, __pyx_t_14, __pyx_v_insertion, __pyx_v_deletion, __pyx_v_substitution, __pyx_v_c_score_cutoff);
4796 } catch(...) {
4797 __Pyx_CppExn2PyErr();
4798 __PYX_ERR(0, 396, __pyx_L1_error)
4799 }
4800 __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 396, __pyx_L1_error)
4801 __Pyx_GOTREF(__pyx_t_5);
4802 __pyx_r = __pyx_t_5;
4803 __pyx_t_5 = 0;
4804 goto __pyx_L0;
4805
4806 /* "cpp_string_metric.pyx":295
4807 * )
4808 *
4809 * def normalized_levenshtein(s1, s2, *, weights=(1,1,1), processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
4810 * """
4811 * Calculates a normalized levenshtein distance using custom
4812 */
4813
4814 /* function exit code */
4815 __pyx_L1_error:;
4816 __Pyx_XDECREF(__pyx_t_4);
4817 __Pyx_XDECREF(__pyx_t_5);
4818 __Pyx_XDECREF(__pyx_t_6);
4819 __Pyx_XDECREF(__pyx_t_7);
4820 __Pyx_AddTraceback("cpp_string_metric.normalized_levenshtein", __pyx_clineno, __pyx_lineno, __pyx_filename);
4821 __pyx_r = NULL;
4822 __pyx_L0:;
4823 __Pyx_XDECREF(__pyx_v_s1);
4824 __Pyx_XDECREF(__pyx_v_s2);
4825 __Pyx_XGIVEREF(__pyx_r);
4826 __Pyx_TraceReturn(__pyx_r, 0);
4827 __Pyx_RefNannyFinishContext();
4828 return __pyx_r;
4829 }
4830
4831 /* "cpp_string_metric.pyx":399
4832 *
4833 *
4834 * def hamming(s1, s2, *, processor=None, max=None): # <<<<<<<<<<<<<<
4835 * """
4836 * Calculates the Hamming distance between two strings.
4837 */
4838
4839 /* Python wrapper */
4840 static PyObject *__pyx_pw_17cpp_string_metric_7hamming(PyObject *__pyx_self,
4841 #if CYTHON_METH_FASTCALL
4842 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
4843 #else
4844 PyObject *__pyx_args, PyObject *__pyx_kwds
4845 #endif
4846 ); /*proto*/
4847 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_6hamming, "\n Calculates the Hamming distance between two strings.\n The hamming distance is defined as the number of positions \n where the two strings differ. It describes the minimum\n amount of substitutions required to transform s1 into s2.\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n processor: bool or 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 max : int or None, optional\n Maximum distance between s1 and s2, that is\n considered as a result. If the distance is bigger than max,\n -1 is returned instead. Default is None, which deactivates\n this behaviour.\n\n Returns\n -------\n distance : int\n distance between s1 and s2\n\n Raises\n ------\n ValueError\n If s1 and s2 have a different length\n ");
4848 static PyMethodDef __pyx_mdef_17cpp_string_metric_7hamming = {"hamming", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_7hamming, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_6hamming};
__pyx_pw_17cpp_string_metric_7hamming(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)4849 static PyObject *__pyx_pw_17cpp_string_metric_7hamming(PyObject *__pyx_self,
4850 #if CYTHON_METH_FASTCALL
4851 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
4852 #else
4853 PyObject *__pyx_args, PyObject *__pyx_kwds
4854 #endif
4855 ) {
4856 PyObject *__pyx_v_s1 = 0;
4857 PyObject *__pyx_v_s2 = 0;
4858 PyObject *__pyx_v_processor = 0;
4859 PyObject *__pyx_v_max = 0;
4860 #if !CYTHON_METH_FASTCALL
4861 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
4862 #endif
4863 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
4864 int __pyx_lineno = 0;
4865 const char *__pyx_filename = NULL;
4866 int __pyx_clineno = 0;
4867 PyObject *__pyx_r = 0;
4868 __Pyx_RefNannyDeclarations
4869 __Pyx_RefNannySetupContext("hamming (wrapper)", 0);
4870 {
4871 #if CYTHON_USE_MODULE_STATE
4872 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,&__pyx_n_s_max,0};
4873 #else
4874 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,&__pyx_n_s_max,0};
4875 #endif
4876 PyObject* values[4] = {0,0,0,0};
4877 values[2] = ((PyObject *)((PyObject *)Py_None));
4878 values[3] = ((PyObject *)((PyObject *)Py_None));
4879 if (__pyx_kwds) {
4880 Py_ssize_t kw_args;
4881 switch (__pyx_nargs) {
4882 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
4883 CYTHON_FALLTHROUGH;
4884 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
4885 CYTHON_FALLTHROUGH;
4886 case 0: break;
4887 default: goto __pyx_L5_argtuple_error;
4888 }
4889 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
4890 switch (__pyx_nargs) {
4891 case 0:
4892 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
4893 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L3_error)
4894 else goto __pyx_L5_argtuple_error;
4895 CYTHON_FALLTHROUGH;
4896 case 1:
4897 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
4898 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L3_error)
4899 else {
4900 __Pyx_RaiseArgtupleInvalid("hamming", 1, 2, 2, 1); __PYX_ERR(0, 399, __pyx_L3_error)
4901 }
4902 }
4903 if (kw_args > 0 && likely(kw_args <= 2)) {
4904 Py_ssize_t index;
4905 for (index = 2; index < 4 && kw_args > 0; index++) {
4906 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
4907 if (value) { values[index] = value; kw_args--; }
4908 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L3_error)
4909 }
4910 }
4911 if (unlikely(kw_args > 0)) {
4912 const Py_ssize_t kwd_pos_args = __pyx_nargs;
4913 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "hamming") < 0)) __PYX_ERR(0, 399, __pyx_L3_error)
4914 }
4915 } else if (unlikely(__pyx_nargs != 2)) {
4916 goto __pyx_L5_argtuple_error;
4917 } else {
4918 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
4919 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
4920 }
4921 __pyx_v_s1 = values[0];
4922 __pyx_v_s2 = values[1];
4923 __pyx_v_processor = values[2];
4924 __pyx_v_max = values[3];
4925 }
4926 goto __pyx_L4_argument_unpacking_done;
4927 __pyx_L5_argtuple_error:;
4928 __Pyx_RaiseArgtupleInvalid("hamming", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 399, __pyx_L3_error)
4929 __pyx_L3_error:;
4930 __Pyx_AddTraceback("cpp_string_metric.hamming", __pyx_clineno, __pyx_lineno, __pyx_filename);
4931 __Pyx_RefNannyFinishContext();
4932 return NULL;
4933 __pyx_L4_argument_unpacking_done:;
4934 __pyx_r = __pyx_pf_17cpp_string_metric_6hamming(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_processor, __pyx_v_max);
4935
4936 /* function exit code */
4937 __Pyx_RefNannyFinishContext();
4938 return __pyx_r;
4939 }
4940
__pyx_pf_17cpp_string_metric_6hamming(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,PyObject * __pyx_v_processor,PyObject * __pyx_v_max)4941 static PyObject *__pyx_pf_17cpp_string_metric_6hamming(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor, PyObject *__pyx_v_max) {
4942 size_t __pyx_v_c_max;
4943 PyObject *__pyx_r = NULL;
4944 __Pyx_TraceDeclarations
4945 __Pyx_RefNannyDeclarations
4946 size_t __pyx_t_1;
4947 int __pyx_t_2;
4948 size_t __pyx_t_3;
4949 int __pyx_t_4;
4950 int __pyx_t_5;
4951 PyObject *__pyx_t_6 = NULL;
4952 PyObject *__pyx_t_7 = NULL;
4953 proc_string __pyx_t_8;
4954 proc_string __pyx_t_9;
4955 PyObject *__pyx_t_10 = NULL;
4956 int __pyx_t_11;
4957 int __pyx_lineno = 0;
4958 const char *__pyx_filename = NULL;
4959 int __pyx_clineno = 0;
4960 __Pyx_TraceFrameInit(__pyx_codeobj__5)
4961 __Pyx_RefNannySetupContext("hamming", 0);
4962 __Pyx_TraceCall("hamming", __pyx_f[0], 399, 0, __PYX_ERR(0, 399, __pyx_L1_error));
4963 __Pyx_INCREF(__pyx_v_s1);
4964 __Pyx_INCREF(__pyx_v_s2);
4965
4966 /* "cpp_string_metric.pyx":432
4967 * If s1 and s2 have a different length
4968 * """
4969 * cdef size_t c_max = <size_t>-1 if max is None else max # <<<<<<<<<<<<<<
4970 *
4971 * if s1 is None or s2 is None:
4972 */
4973 __Pyx_TraceLine(432,0,__PYX_ERR(0, 432, __pyx_L1_error))
4974 __pyx_t_2 = (__pyx_v_max == Py_None);
4975 if ((__pyx_t_2 != 0)) {
4976 __pyx_t_1 = ((size_t)-1L);
4977 } else {
4978 __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_max); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 432, __pyx_L1_error)
4979 __pyx_t_1 = __pyx_t_3;
4980 }
4981 __pyx_v_c_max = __pyx_t_1;
4982
4983 /* "cpp_string_metric.pyx":434
4984 * cdef size_t c_max = <size_t>-1 if max is None else max
4985 *
4986 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
4987 * return 0
4988 *
4989 */
4990 __Pyx_TraceLine(434,0,__PYX_ERR(0, 434, __pyx_L1_error))
4991 __pyx_t_4 = (__pyx_v_s1 == Py_None);
4992 __pyx_t_5 = (__pyx_t_4 != 0);
4993 if (!__pyx_t_5) {
4994 } else {
4995 __pyx_t_2 = __pyx_t_5;
4996 goto __pyx_L4_bool_binop_done;
4997 }
4998 __pyx_t_5 = (__pyx_v_s2 == Py_None);
4999 __pyx_t_4 = (__pyx_t_5 != 0);
5000 __pyx_t_2 = __pyx_t_4;
5001 __pyx_L4_bool_binop_done:;
5002 if (__pyx_t_2) {
5003
5004 /* "cpp_string_metric.pyx":435
5005 *
5006 * if s1 is None or s2 is None:
5007 * return 0 # <<<<<<<<<<<<<<
5008 *
5009 * if processor is True or processor == default_process:
5010 */
5011 __Pyx_TraceLine(435,0,__PYX_ERR(0, 435, __pyx_L1_error))
5012 __Pyx_XDECREF(__pyx_r);
5013 __Pyx_INCREF(__pyx_int_0);
5014 __pyx_r = __pyx_int_0;
5015 goto __pyx_L0;
5016
5017 /* "cpp_string_metric.pyx":434
5018 * cdef size_t c_max = <size_t>-1 if max is None else max
5019 *
5020 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
5021 * return 0
5022 *
5023 */
5024 }
5025
5026 /* "cpp_string_metric.pyx":437
5027 * return 0
5028 *
5029 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
5030 * return hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_max)
5031 * elif callable(processor):
5032 */
5033 __Pyx_TraceLine(437,0,__PYX_ERR(0, 437, __pyx_L1_error))
5034 __pyx_t_4 = (__pyx_v_processor == Py_True);
5035 __pyx_t_5 = (__pyx_t_4 != 0);
5036 if (!__pyx_t_5) {
5037 } else {
5038 __pyx_t_2 = __pyx_t_5;
5039 goto __pyx_L7_bool_binop_done;
5040 }
5041 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L1_error)
5042 __Pyx_GOTREF(__pyx_t_6);
5043 __pyx_t_7 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error)
5044 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5045 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 437, __pyx_L1_error)
5046 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5047 __pyx_t_2 = __pyx_t_5;
5048 __pyx_L7_bool_binop_done:;
5049 if (__pyx_t_2) {
5050
5051 /* "cpp_string_metric.pyx":438
5052 *
5053 * if processor is True or processor == default_process:
5054 * return hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_max) # <<<<<<<<<<<<<<
5055 * elif callable(processor):
5056 * s1 = processor(s1)
5057 */
5058 __Pyx_TraceLine(438,0,__PYX_ERR(0, 438, __pyx_L1_error))
5059 __Pyx_XDECREF(__pyx_r);
5060 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 438, __pyx_L1_error)
5061 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 438, __pyx_L1_error)
5062 try {
5063 __pyx_t_7 = hamming_default_process(__pyx_t_8, __pyx_t_9, __pyx_v_c_max);
5064 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error)
5065 } catch(...) {
5066 __Pyx_CppExn2PyErr();
5067 __PYX_ERR(0, 438, __pyx_L1_error)
5068 }
5069 __Pyx_GOTREF(__pyx_t_7);
5070 __pyx_r = __pyx_t_7;
5071 __pyx_t_7 = 0;
5072 goto __pyx_L0;
5073
5074 /* "cpp_string_metric.pyx":437
5075 * return 0
5076 *
5077 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
5078 * return hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_max)
5079 * elif callable(processor):
5080 */
5081 }
5082
5083 /* "cpp_string_metric.pyx":439
5084 * if processor is True or processor == default_process:
5085 * return hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_max)
5086 * elif callable(processor): # <<<<<<<<<<<<<<
5087 * s1 = processor(s1)
5088 * s2 = processor(s2)
5089 */
5090 __Pyx_TraceLine(439,0,__PYX_ERR(0, 439, __pyx_L1_error))
5091 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 439, __pyx_L1_error)
5092 __pyx_t_5 = (__pyx_t_2 != 0);
5093 if (__pyx_t_5) {
5094
5095 /* "cpp_string_metric.pyx":440
5096 * return hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_max)
5097 * elif callable(processor):
5098 * s1 = processor(s1) # <<<<<<<<<<<<<<
5099 * s2 = processor(s2)
5100 *
5101 */
5102 __Pyx_TraceLine(440,0,__PYX_ERR(0, 440, __pyx_L1_error))
5103 __Pyx_INCREF(__pyx_v_processor);
5104 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
5105 __pyx_t_11 = 0;
5106 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5107 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
5108 if (likely(__pyx_t_10)) {
5109 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5110 __Pyx_INCREF(__pyx_t_10);
5111 __Pyx_INCREF(function);
5112 __Pyx_DECREF_SET(__pyx_t_6, function);
5113 __pyx_t_11 = 1;
5114 }
5115 }
5116 {
5117 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s1};
5118 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
5119 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5120 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error)
5121 __Pyx_GOTREF(__pyx_t_7);
5122 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5123 }
5124 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_7);
5125 __pyx_t_7 = 0;
5126
5127 /* "cpp_string_metric.pyx":441
5128 * elif callable(processor):
5129 * s1 = processor(s1)
5130 * s2 = processor(s2) # <<<<<<<<<<<<<<
5131 *
5132 * return hamming_no_process(conv_sequence(s1), conv_sequence(s2), c_max)
5133 */
5134 __Pyx_TraceLine(441,0,__PYX_ERR(0, 441, __pyx_L1_error))
5135 __Pyx_INCREF(__pyx_v_processor);
5136 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
5137 __pyx_t_11 = 0;
5138 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5139 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
5140 if (likely(__pyx_t_10)) {
5141 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5142 __Pyx_INCREF(__pyx_t_10);
5143 __Pyx_INCREF(function);
5144 __Pyx_DECREF_SET(__pyx_t_6, function);
5145 __pyx_t_11 = 1;
5146 }
5147 }
5148 {
5149 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s2};
5150 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
5151 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5152 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
5153 __Pyx_GOTREF(__pyx_t_7);
5154 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5155 }
5156 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_7);
5157 __pyx_t_7 = 0;
5158
5159 /* "cpp_string_metric.pyx":439
5160 * if processor is True or processor == default_process:
5161 * return hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_max)
5162 * elif callable(processor): # <<<<<<<<<<<<<<
5163 * s1 = processor(s1)
5164 * s2 = processor(s2)
5165 */
5166 }
5167
5168 /* "cpp_string_metric.pyx":443
5169 * s2 = processor(s2)
5170 *
5171 * return hamming_no_process(conv_sequence(s1), conv_sequence(s2), c_max) # <<<<<<<<<<<<<<
5172 *
5173 *
5174 */
5175 __Pyx_TraceLine(443,0,__PYX_ERR(0, 443, __pyx_L1_error))
5176 __Pyx_XDECREF(__pyx_r);
5177 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error)
5178 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error)
5179 try {
5180 __pyx_t_7 = hamming_no_process(__pyx_t_9, __pyx_t_8, __pyx_v_c_max);
5181 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L1_error)
5182 } catch(...) {
5183 __Pyx_CppExn2PyErr();
5184 __PYX_ERR(0, 443, __pyx_L1_error)
5185 }
5186 __Pyx_GOTREF(__pyx_t_7);
5187 __pyx_r = __pyx_t_7;
5188 __pyx_t_7 = 0;
5189 goto __pyx_L0;
5190
5191 /* "cpp_string_metric.pyx":399
5192 *
5193 *
5194 * def hamming(s1, s2, *, processor=None, max=None): # <<<<<<<<<<<<<<
5195 * """
5196 * Calculates the Hamming distance between two strings.
5197 */
5198
5199 /* function exit code */
5200 __pyx_L1_error:;
5201 __Pyx_XDECREF(__pyx_t_6);
5202 __Pyx_XDECREF(__pyx_t_7);
5203 __Pyx_XDECREF(__pyx_t_10);
5204 __Pyx_AddTraceback("cpp_string_metric.hamming", __pyx_clineno, __pyx_lineno, __pyx_filename);
5205 __pyx_r = NULL;
5206 __pyx_L0:;
5207 __Pyx_XDECREF(__pyx_v_s1);
5208 __Pyx_XDECREF(__pyx_v_s2);
5209 __Pyx_XGIVEREF(__pyx_r);
5210 __Pyx_TraceReturn(__pyx_r, 0);
5211 __Pyx_RefNannyFinishContext();
5212 return __pyx_r;
5213 }
5214
5215 /* "cpp_string_metric.pyx":446
5216 *
5217 *
5218 * def normalized_hamming(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
5219 * """
5220 * Calculates a normalized hamming distance
5221 */
5222
5223 /* Python wrapper */
5224 static PyObject *__pyx_pw_17cpp_string_metric_9normalized_hamming(PyObject *__pyx_self,
5225 #if CYTHON_METH_FASTCALL
5226 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5227 #else
5228 PyObject *__pyx_args, PyObject *__pyx_kwds
5229 #endif
5230 ); /*proto*/
5231 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_8normalized_hamming, "\n Calculates a normalized hamming distance\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n processor: bool or 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 : float, optional\n Optional argument for a score threshold as a float between 0 and 100.\n For ratio < score_cutoff 0 is returned instead. Default is 0,\n which deactivates this behaviour.\n\n Returns\n -------\n similarity : float\n similarity between s1 and s2 as a float between 0 and 100\n\n Raises\n ------\n ValueError\n If s1 and s2 have a different length\n\n See Also\n --------\n hamming : Hamming distance\n ");
5232 static PyMethodDef __pyx_mdef_17cpp_string_metric_9normalized_hamming = {"normalized_hamming", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_9normalized_hamming, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_8normalized_hamming};
__pyx_pw_17cpp_string_metric_9normalized_hamming(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)5233 static PyObject *__pyx_pw_17cpp_string_metric_9normalized_hamming(PyObject *__pyx_self,
5234 #if CYTHON_METH_FASTCALL
5235 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5236 #else
5237 PyObject *__pyx_args, PyObject *__pyx_kwds
5238 #endif
5239 ) {
5240 PyObject *__pyx_v_s1 = 0;
5241 PyObject *__pyx_v_s2 = 0;
5242 PyObject *__pyx_v_processor = 0;
5243 PyObject *__pyx_v_score_cutoff = 0;
5244 #if !CYTHON_METH_FASTCALL
5245 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
5246 #endif
5247 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
5248 int __pyx_lineno = 0;
5249 const char *__pyx_filename = NULL;
5250 int __pyx_clineno = 0;
5251 PyObject *__pyx_r = 0;
5252 __Pyx_RefNannyDeclarations
5253 __Pyx_RefNannySetupContext("normalized_hamming (wrapper)", 0);
5254 {
5255 #if CYTHON_USE_MODULE_STATE
5256 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
5257 #else
5258 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
5259 #endif
5260 PyObject* values[4] = {0,0,0,0};
5261 values[2] = ((PyObject *)((PyObject *)Py_None));
5262 values[3] = ((PyObject *)((PyObject *)Py_None));
5263 if (__pyx_kwds) {
5264 Py_ssize_t kw_args;
5265 switch (__pyx_nargs) {
5266 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
5267 CYTHON_FALLTHROUGH;
5268 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5269 CYTHON_FALLTHROUGH;
5270 case 0: break;
5271 default: goto __pyx_L5_argtuple_error;
5272 }
5273 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
5274 switch (__pyx_nargs) {
5275 case 0:
5276 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
5277 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error)
5278 else goto __pyx_L5_argtuple_error;
5279 CYTHON_FALLTHROUGH;
5280 case 1:
5281 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
5282 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error)
5283 else {
5284 __Pyx_RaiseArgtupleInvalid("normalized_hamming", 1, 2, 2, 1); __PYX_ERR(0, 446, __pyx_L3_error)
5285 }
5286 }
5287 if (kw_args > 0 && likely(kw_args <= 2)) {
5288 Py_ssize_t index;
5289 for (index = 2; index < 4 && kw_args > 0; index++) {
5290 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
5291 if (value) { values[index] = value; kw_args--; }
5292 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error)
5293 }
5294 }
5295 if (unlikely(kw_args > 0)) {
5296 const Py_ssize_t kwd_pos_args = __pyx_nargs;
5297 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "normalized_hamming") < 0)) __PYX_ERR(0, 446, __pyx_L3_error)
5298 }
5299 } else if (unlikely(__pyx_nargs != 2)) {
5300 goto __pyx_L5_argtuple_error;
5301 } else {
5302 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5303 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
5304 }
5305 __pyx_v_s1 = values[0];
5306 __pyx_v_s2 = values[1];
5307 __pyx_v_processor = values[2];
5308 __pyx_v_score_cutoff = values[3];
5309 }
5310 goto __pyx_L4_argument_unpacking_done;
5311 __pyx_L5_argtuple_error:;
5312 __Pyx_RaiseArgtupleInvalid("normalized_hamming", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 446, __pyx_L3_error)
5313 __pyx_L3_error:;
5314 __Pyx_AddTraceback("cpp_string_metric.normalized_hamming", __pyx_clineno, __pyx_lineno, __pyx_filename);
5315 __Pyx_RefNannyFinishContext();
5316 return NULL;
5317 __pyx_L4_argument_unpacking_done:;
5318 __pyx_r = __pyx_pf_17cpp_string_metric_8normalized_hamming(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_processor, __pyx_v_score_cutoff);
5319
5320 /* function exit code */
5321 __Pyx_RefNannyFinishContext();
5322 return __pyx_r;
5323 }
5324
__pyx_pf_17cpp_string_metric_8normalized_hamming(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff)5325 static PyObject *__pyx_pf_17cpp_string_metric_8normalized_hamming(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff) {
5326 double __pyx_v_c_score_cutoff;
5327 PyObject *__pyx_r = NULL;
5328 __Pyx_TraceDeclarations
5329 __Pyx_RefNannyDeclarations
5330 double __pyx_t_1;
5331 int __pyx_t_2;
5332 double __pyx_t_3;
5333 int __pyx_t_4;
5334 int __pyx_t_5;
5335 PyObject *__pyx_t_6 = NULL;
5336 PyObject *__pyx_t_7 = NULL;
5337 proc_string __pyx_t_8;
5338 proc_string __pyx_t_9;
5339 PyObject *__pyx_t_10 = NULL;
5340 int __pyx_t_11;
5341 int __pyx_lineno = 0;
5342 const char *__pyx_filename = NULL;
5343 int __pyx_clineno = 0;
5344 __Pyx_TraceFrameInit(__pyx_codeobj__6)
5345 __Pyx_RefNannySetupContext("normalized_hamming", 0);
5346 __Pyx_TraceCall("normalized_hamming", __pyx_f[0], 446, 0, __PYX_ERR(0, 446, __pyx_L1_error));
5347 __Pyx_INCREF(__pyx_v_s1);
5348 __Pyx_INCREF(__pyx_v_s2);
5349
5350 /* "cpp_string_metric.pyx":479
5351 * hamming : Hamming distance
5352 * """
5353 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff # <<<<<<<<<<<<<<
5354 *
5355 * if s1 is None or s2 is None:
5356 */
5357 __Pyx_TraceLine(479,0,__PYX_ERR(0, 479, __pyx_L1_error))
5358 __pyx_t_2 = (__pyx_v_score_cutoff == Py_None);
5359 if ((__pyx_t_2 != 0)) {
5360 __pyx_t_1 = 0.0;
5361 } else {
5362 __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error)
5363 __pyx_t_1 = __pyx_t_3;
5364 }
5365 __pyx_v_c_score_cutoff = __pyx_t_1;
5366
5367 /* "cpp_string_metric.pyx":481
5368 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
5369 *
5370 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
5371 * return 0
5372 *
5373 */
5374 __Pyx_TraceLine(481,0,__PYX_ERR(0, 481, __pyx_L1_error))
5375 __pyx_t_4 = (__pyx_v_s1 == Py_None);
5376 __pyx_t_5 = (__pyx_t_4 != 0);
5377 if (!__pyx_t_5) {
5378 } else {
5379 __pyx_t_2 = __pyx_t_5;
5380 goto __pyx_L4_bool_binop_done;
5381 }
5382 __pyx_t_5 = (__pyx_v_s2 == Py_None);
5383 __pyx_t_4 = (__pyx_t_5 != 0);
5384 __pyx_t_2 = __pyx_t_4;
5385 __pyx_L4_bool_binop_done:;
5386 if (__pyx_t_2) {
5387
5388 /* "cpp_string_metric.pyx":482
5389 *
5390 * if s1 is None or s2 is None:
5391 * return 0 # <<<<<<<<<<<<<<
5392 *
5393 * if processor is True or processor == default_process:
5394 */
5395 __Pyx_TraceLine(482,0,__PYX_ERR(0, 482, __pyx_L1_error))
5396 __Pyx_XDECREF(__pyx_r);
5397 __Pyx_INCREF(__pyx_int_0);
5398 __pyx_r = __pyx_int_0;
5399 goto __pyx_L0;
5400
5401 /* "cpp_string_metric.pyx":481
5402 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
5403 *
5404 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
5405 * return 0
5406 *
5407 */
5408 }
5409
5410 /* "cpp_string_metric.pyx":484
5411 * return 0
5412 *
5413 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
5414 * return normalized_hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5415 * elif callable(processor):
5416 */
5417 __Pyx_TraceLine(484,0,__PYX_ERR(0, 484, __pyx_L1_error))
5418 __pyx_t_4 = (__pyx_v_processor == Py_True);
5419 __pyx_t_5 = (__pyx_t_4 != 0);
5420 if (!__pyx_t_5) {
5421 } else {
5422 __pyx_t_2 = __pyx_t_5;
5423 goto __pyx_L7_bool_binop_done;
5424 }
5425 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error)
5426 __Pyx_GOTREF(__pyx_t_6);
5427 __pyx_t_7 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 484, __pyx_L1_error)
5428 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5429 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 484, __pyx_L1_error)
5430 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5431 __pyx_t_2 = __pyx_t_5;
5432 __pyx_L7_bool_binop_done:;
5433 if (__pyx_t_2) {
5434
5435 /* "cpp_string_metric.pyx":485
5436 *
5437 * if processor is True or processor == default_process:
5438 * return normalized_hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff) # <<<<<<<<<<<<<<
5439 * elif callable(processor):
5440 * s1 = processor(s1)
5441 */
5442 __Pyx_TraceLine(485,0,__PYX_ERR(0, 485, __pyx_L1_error))
5443 __Pyx_XDECREF(__pyx_r);
5444 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 485, __pyx_L1_error)
5445 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 485, __pyx_L1_error)
5446 try {
5447 __pyx_t_1 = normalized_hamming_default_process(__pyx_t_8, __pyx_t_9, __pyx_v_c_score_cutoff);
5448 } catch(...) {
5449 __Pyx_CppExn2PyErr();
5450 __PYX_ERR(0, 485, __pyx_L1_error)
5451 }
5452 __pyx_t_7 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 485, __pyx_L1_error)
5453 __Pyx_GOTREF(__pyx_t_7);
5454 __pyx_r = __pyx_t_7;
5455 __pyx_t_7 = 0;
5456 goto __pyx_L0;
5457
5458 /* "cpp_string_metric.pyx":484
5459 * return 0
5460 *
5461 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
5462 * return normalized_hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5463 * elif callable(processor):
5464 */
5465 }
5466
5467 /* "cpp_string_metric.pyx":486
5468 * if processor is True or processor == default_process:
5469 * return normalized_hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5470 * elif callable(processor): # <<<<<<<<<<<<<<
5471 * s1 = processor(s1)
5472 * s2 = processor(s2)
5473 */
5474 __Pyx_TraceLine(486,0,__PYX_ERR(0, 486, __pyx_L1_error))
5475 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 486, __pyx_L1_error)
5476 __pyx_t_5 = (__pyx_t_2 != 0);
5477 if (__pyx_t_5) {
5478
5479 /* "cpp_string_metric.pyx":487
5480 * return normalized_hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5481 * elif callable(processor):
5482 * s1 = processor(s1) # <<<<<<<<<<<<<<
5483 * s2 = processor(s2)
5484 *
5485 */
5486 __Pyx_TraceLine(487,0,__PYX_ERR(0, 487, __pyx_L1_error))
5487 __Pyx_INCREF(__pyx_v_processor);
5488 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
5489 __pyx_t_11 = 0;
5490 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5491 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
5492 if (likely(__pyx_t_10)) {
5493 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5494 __Pyx_INCREF(__pyx_t_10);
5495 __Pyx_INCREF(function);
5496 __Pyx_DECREF_SET(__pyx_t_6, function);
5497 __pyx_t_11 = 1;
5498 }
5499 }
5500 {
5501 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s1};
5502 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
5503 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5504 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 487, __pyx_L1_error)
5505 __Pyx_GOTREF(__pyx_t_7);
5506 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5507 }
5508 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_7);
5509 __pyx_t_7 = 0;
5510
5511 /* "cpp_string_metric.pyx":488
5512 * elif callable(processor):
5513 * s1 = processor(s1)
5514 * s2 = processor(s2) # <<<<<<<<<<<<<<
5515 *
5516 * return normalized_hamming_no_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5517 */
5518 __Pyx_TraceLine(488,0,__PYX_ERR(0, 488, __pyx_L1_error))
5519 __Pyx_INCREF(__pyx_v_processor);
5520 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
5521 __pyx_t_11 = 0;
5522 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5523 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
5524 if (likely(__pyx_t_10)) {
5525 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5526 __Pyx_INCREF(__pyx_t_10);
5527 __Pyx_INCREF(function);
5528 __Pyx_DECREF_SET(__pyx_t_6, function);
5529 __pyx_t_11 = 1;
5530 }
5531 }
5532 {
5533 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s2};
5534 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
5535 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5536 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error)
5537 __Pyx_GOTREF(__pyx_t_7);
5538 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5539 }
5540 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_7);
5541 __pyx_t_7 = 0;
5542
5543 /* "cpp_string_metric.pyx":486
5544 * if processor is True or processor == default_process:
5545 * return normalized_hamming_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5546 * elif callable(processor): # <<<<<<<<<<<<<<
5547 * s1 = processor(s1)
5548 * s2 = processor(s2)
5549 */
5550 }
5551
5552 /* "cpp_string_metric.pyx":490
5553 * s2 = processor(s2)
5554 *
5555 * return normalized_hamming_no_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff) # <<<<<<<<<<<<<<
5556 *
5557 *
5558 */
5559 __Pyx_TraceLine(490,0,__PYX_ERR(0, 490, __pyx_L1_error))
5560 __Pyx_XDECREF(__pyx_r);
5561 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L1_error)
5562 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L1_error)
5563 try {
5564 __pyx_t_1 = normalized_hamming_no_process(__pyx_t_9, __pyx_t_8, __pyx_v_c_score_cutoff);
5565 } catch(...) {
5566 __Pyx_CppExn2PyErr();
5567 __PYX_ERR(0, 490, __pyx_L1_error)
5568 }
5569 __pyx_t_7 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 490, __pyx_L1_error)
5570 __Pyx_GOTREF(__pyx_t_7);
5571 __pyx_r = __pyx_t_7;
5572 __pyx_t_7 = 0;
5573 goto __pyx_L0;
5574
5575 /* "cpp_string_metric.pyx":446
5576 *
5577 *
5578 * def normalized_hamming(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
5579 * """
5580 * Calculates a normalized hamming distance
5581 */
5582
5583 /* function exit code */
5584 __pyx_L1_error:;
5585 __Pyx_XDECREF(__pyx_t_6);
5586 __Pyx_XDECREF(__pyx_t_7);
5587 __Pyx_XDECREF(__pyx_t_10);
5588 __Pyx_AddTraceback("cpp_string_metric.normalized_hamming", __pyx_clineno, __pyx_lineno, __pyx_filename);
5589 __pyx_r = NULL;
5590 __pyx_L0:;
5591 __Pyx_XDECREF(__pyx_v_s1);
5592 __Pyx_XDECREF(__pyx_v_s2);
5593 __Pyx_XGIVEREF(__pyx_r);
5594 __Pyx_TraceReturn(__pyx_r, 0);
5595 __Pyx_RefNannyFinishContext();
5596 return __pyx_r;
5597 }
5598
5599 /* "cpp_string_metric.pyx":493
5600 *
5601 *
5602 * def jaro_similarity(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
5603 * """
5604 * Calculates the jaro similarity
5605 */
5606
5607 /* Python wrapper */
5608 static PyObject *__pyx_pw_17cpp_string_metric_11jaro_similarity(PyObject *__pyx_self,
5609 #if CYTHON_METH_FASTCALL
5610 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5611 #else
5612 PyObject *__pyx_args, PyObject *__pyx_kwds
5613 #endif
5614 ); /*proto*/
5615 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_10jaro_similarity, "\n Calculates the jaro similarity\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n processor: bool or 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 : float, optional\n Optional argument for a score threshold as a float between 0 and 100.\n For ratio < score_cutoff 0 is returned instead. Default is 0,\n which deactivates this behaviour.\n\n Returns\n -------\n similarity : float\n similarity between s1 and s2 as a float between 0 and 100\n\n ");
5616 static PyMethodDef __pyx_mdef_17cpp_string_metric_11jaro_similarity = {"jaro_similarity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_11jaro_similarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_10jaro_similarity};
__pyx_pw_17cpp_string_metric_11jaro_similarity(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)5617 static PyObject *__pyx_pw_17cpp_string_metric_11jaro_similarity(PyObject *__pyx_self,
5618 #if CYTHON_METH_FASTCALL
5619 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5620 #else
5621 PyObject *__pyx_args, PyObject *__pyx_kwds
5622 #endif
5623 ) {
5624 PyObject *__pyx_v_s1 = 0;
5625 PyObject *__pyx_v_s2 = 0;
5626 PyObject *__pyx_v_processor = 0;
5627 PyObject *__pyx_v_score_cutoff = 0;
5628 #if !CYTHON_METH_FASTCALL
5629 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
5630 #endif
5631 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
5632 int __pyx_lineno = 0;
5633 const char *__pyx_filename = NULL;
5634 int __pyx_clineno = 0;
5635 PyObject *__pyx_r = 0;
5636 __Pyx_RefNannyDeclarations
5637 __Pyx_RefNannySetupContext("jaro_similarity (wrapper)", 0);
5638 {
5639 #if CYTHON_USE_MODULE_STATE
5640 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
5641 #else
5642 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
5643 #endif
5644 PyObject* values[4] = {0,0,0,0};
5645 values[2] = ((PyObject *)((PyObject *)Py_None));
5646 values[3] = ((PyObject *)((PyObject *)Py_None));
5647 if (__pyx_kwds) {
5648 Py_ssize_t kw_args;
5649 switch (__pyx_nargs) {
5650 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
5651 CYTHON_FALLTHROUGH;
5652 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5653 CYTHON_FALLTHROUGH;
5654 case 0: break;
5655 default: goto __pyx_L5_argtuple_error;
5656 }
5657 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
5658 switch (__pyx_nargs) {
5659 case 0:
5660 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
5661 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L3_error)
5662 else goto __pyx_L5_argtuple_error;
5663 CYTHON_FALLTHROUGH;
5664 case 1:
5665 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
5666 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L3_error)
5667 else {
5668 __Pyx_RaiseArgtupleInvalid("jaro_similarity", 1, 2, 2, 1); __PYX_ERR(0, 493, __pyx_L3_error)
5669 }
5670 }
5671 if (kw_args > 0 && likely(kw_args <= 2)) {
5672 Py_ssize_t index;
5673 for (index = 2; index < 4 && kw_args > 0; index++) {
5674 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
5675 if (value) { values[index] = value; kw_args--; }
5676 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L3_error)
5677 }
5678 }
5679 if (unlikely(kw_args > 0)) {
5680 const Py_ssize_t kwd_pos_args = __pyx_nargs;
5681 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "jaro_similarity") < 0)) __PYX_ERR(0, 493, __pyx_L3_error)
5682 }
5683 } else if (unlikely(__pyx_nargs != 2)) {
5684 goto __pyx_L5_argtuple_error;
5685 } else {
5686 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5687 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
5688 }
5689 __pyx_v_s1 = values[0];
5690 __pyx_v_s2 = values[1];
5691 __pyx_v_processor = values[2];
5692 __pyx_v_score_cutoff = values[3];
5693 }
5694 goto __pyx_L4_argument_unpacking_done;
5695 __pyx_L5_argtuple_error:;
5696 __Pyx_RaiseArgtupleInvalid("jaro_similarity", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 493, __pyx_L3_error)
5697 __pyx_L3_error:;
5698 __Pyx_AddTraceback("cpp_string_metric.jaro_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
5699 __Pyx_RefNannyFinishContext();
5700 return NULL;
5701 __pyx_L4_argument_unpacking_done:;
5702 __pyx_r = __pyx_pf_17cpp_string_metric_10jaro_similarity(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_processor, __pyx_v_score_cutoff);
5703
5704 /* function exit code */
5705 __Pyx_RefNannyFinishContext();
5706 return __pyx_r;
5707 }
5708
__pyx_pf_17cpp_string_metric_10jaro_similarity(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff)5709 static PyObject *__pyx_pf_17cpp_string_metric_10jaro_similarity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff) {
5710 double __pyx_v_c_score_cutoff;
5711 PyObject *__pyx_r = NULL;
5712 __Pyx_TraceDeclarations
5713 __Pyx_RefNannyDeclarations
5714 double __pyx_t_1;
5715 int __pyx_t_2;
5716 double __pyx_t_3;
5717 int __pyx_t_4;
5718 int __pyx_t_5;
5719 PyObject *__pyx_t_6 = NULL;
5720 PyObject *__pyx_t_7 = NULL;
5721 proc_string __pyx_t_8;
5722 proc_string __pyx_t_9;
5723 PyObject *__pyx_t_10 = NULL;
5724 int __pyx_t_11;
5725 int __pyx_lineno = 0;
5726 const char *__pyx_filename = NULL;
5727 int __pyx_clineno = 0;
5728 __Pyx_TraceFrameInit(__pyx_codeobj__7)
5729 __Pyx_RefNannySetupContext("jaro_similarity", 0);
5730 __Pyx_TraceCall("jaro_similarity", __pyx_f[0], 493, 0, __PYX_ERR(0, 493, __pyx_L1_error));
5731 __Pyx_INCREF(__pyx_v_s1);
5732 __Pyx_INCREF(__pyx_v_s2);
5733
5734 /* "cpp_string_metric.pyx":518
5735 *
5736 * """
5737 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff # <<<<<<<<<<<<<<
5738 *
5739 * if s1 is None or s2 is None:
5740 */
5741 __Pyx_TraceLine(518,0,__PYX_ERR(0, 518, __pyx_L1_error))
5742 __pyx_t_2 = (__pyx_v_score_cutoff == Py_None);
5743 if ((__pyx_t_2 != 0)) {
5744 __pyx_t_1 = 0.0;
5745 } else {
5746 __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
5747 __pyx_t_1 = __pyx_t_3;
5748 }
5749 __pyx_v_c_score_cutoff = __pyx_t_1;
5750
5751 /* "cpp_string_metric.pyx":520
5752 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
5753 *
5754 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
5755 * return 0
5756 *
5757 */
5758 __Pyx_TraceLine(520,0,__PYX_ERR(0, 520, __pyx_L1_error))
5759 __pyx_t_4 = (__pyx_v_s1 == Py_None);
5760 __pyx_t_5 = (__pyx_t_4 != 0);
5761 if (!__pyx_t_5) {
5762 } else {
5763 __pyx_t_2 = __pyx_t_5;
5764 goto __pyx_L4_bool_binop_done;
5765 }
5766 __pyx_t_5 = (__pyx_v_s2 == Py_None);
5767 __pyx_t_4 = (__pyx_t_5 != 0);
5768 __pyx_t_2 = __pyx_t_4;
5769 __pyx_L4_bool_binop_done:;
5770 if (__pyx_t_2) {
5771
5772 /* "cpp_string_metric.pyx":521
5773 *
5774 * if s1 is None or s2 is None:
5775 * return 0 # <<<<<<<<<<<<<<
5776 *
5777 * if processor is True or processor == default_process:
5778 */
5779 __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L1_error))
5780 __Pyx_XDECREF(__pyx_r);
5781 __Pyx_INCREF(__pyx_int_0);
5782 __pyx_r = __pyx_int_0;
5783 goto __pyx_L0;
5784
5785 /* "cpp_string_metric.pyx":520
5786 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
5787 *
5788 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
5789 * return 0
5790 *
5791 */
5792 }
5793
5794 /* "cpp_string_metric.pyx":523
5795 * return 0
5796 *
5797 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
5798 * return jaro_similarity_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5799 * elif callable(processor):
5800 */
5801 __Pyx_TraceLine(523,0,__PYX_ERR(0, 523, __pyx_L1_error))
5802 __pyx_t_4 = (__pyx_v_processor == Py_True);
5803 __pyx_t_5 = (__pyx_t_4 != 0);
5804 if (!__pyx_t_5) {
5805 } else {
5806 __pyx_t_2 = __pyx_t_5;
5807 goto __pyx_L7_bool_binop_done;
5808 }
5809 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error)
5810 __Pyx_GOTREF(__pyx_t_6);
5811 __pyx_t_7 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 523, __pyx_L1_error)
5812 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5813 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 523, __pyx_L1_error)
5814 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5815 __pyx_t_2 = __pyx_t_5;
5816 __pyx_L7_bool_binop_done:;
5817 if (__pyx_t_2) {
5818
5819 /* "cpp_string_metric.pyx":524
5820 *
5821 * if processor is True or processor == default_process:
5822 * return jaro_similarity_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff) # <<<<<<<<<<<<<<
5823 * elif callable(processor):
5824 * s1 = processor(s1)
5825 */
5826 __Pyx_TraceLine(524,0,__PYX_ERR(0, 524, __pyx_L1_error))
5827 __Pyx_XDECREF(__pyx_r);
5828 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L1_error)
5829 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L1_error)
5830 try {
5831 __pyx_t_1 = jaro_similarity_default_process(__pyx_t_8, __pyx_t_9, __pyx_v_c_score_cutoff);
5832 } catch(...) {
5833 __Pyx_CppExn2PyErr();
5834 __PYX_ERR(0, 524, __pyx_L1_error)
5835 }
5836 __pyx_t_7 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 524, __pyx_L1_error)
5837 __Pyx_GOTREF(__pyx_t_7);
5838 __pyx_r = __pyx_t_7;
5839 __pyx_t_7 = 0;
5840 goto __pyx_L0;
5841
5842 /* "cpp_string_metric.pyx":523
5843 * return 0
5844 *
5845 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
5846 * return jaro_similarity_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5847 * elif callable(processor):
5848 */
5849 }
5850
5851 /* "cpp_string_metric.pyx":525
5852 * if processor is True or processor == default_process:
5853 * return jaro_similarity_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5854 * elif callable(processor): # <<<<<<<<<<<<<<
5855 * s1 = processor(s1)
5856 * s2 = processor(s2)
5857 */
5858 __Pyx_TraceLine(525,0,__PYX_ERR(0, 525, __pyx_L1_error))
5859 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 525, __pyx_L1_error)
5860 __pyx_t_5 = (__pyx_t_2 != 0);
5861 if (__pyx_t_5) {
5862
5863 /* "cpp_string_metric.pyx":526
5864 * return jaro_similarity_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5865 * elif callable(processor):
5866 * s1 = processor(s1) # <<<<<<<<<<<<<<
5867 * s2 = processor(s2)
5868 *
5869 */
5870 __Pyx_TraceLine(526,0,__PYX_ERR(0, 526, __pyx_L1_error))
5871 __Pyx_INCREF(__pyx_v_processor);
5872 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
5873 __pyx_t_11 = 0;
5874 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5875 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
5876 if (likely(__pyx_t_10)) {
5877 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5878 __Pyx_INCREF(__pyx_t_10);
5879 __Pyx_INCREF(function);
5880 __Pyx_DECREF_SET(__pyx_t_6, function);
5881 __pyx_t_11 = 1;
5882 }
5883 }
5884 {
5885 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s1};
5886 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
5887 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5888 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error)
5889 __Pyx_GOTREF(__pyx_t_7);
5890 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5891 }
5892 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_7);
5893 __pyx_t_7 = 0;
5894
5895 /* "cpp_string_metric.pyx":527
5896 * elif callable(processor):
5897 * s1 = processor(s1)
5898 * s2 = processor(s2) # <<<<<<<<<<<<<<
5899 *
5900 * return jaro_similarity_no_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5901 */
5902 __Pyx_TraceLine(527,0,__PYX_ERR(0, 527, __pyx_L1_error))
5903 __Pyx_INCREF(__pyx_v_processor);
5904 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
5905 __pyx_t_11 = 0;
5906 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5907 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
5908 if (likely(__pyx_t_10)) {
5909 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5910 __Pyx_INCREF(__pyx_t_10);
5911 __Pyx_INCREF(function);
5912 __Pyx_DECREF_SET(__pyx_t_6, function);
5913 __pyx_t_11 = 1;
5914 }
5915 }
5916 {
5917 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s2};
5918 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
5919 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5920 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 527, __pyx_L1_error)
5921 __Pyx_GOTREF(__pyx_t_7);
5922 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5923 }
5924 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_7);
5925 __pyx_t_7 = 0;
5926
5927 /* "cpp_string_metric.pyx":525
5928 * if processor is True or processor == default_process:
5929 * return jaro_similarity_default_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff)
5930 * elif callable(processor): # <<<<<<<<<<<<<<
5931 * s1 = processor(s1)
5932 * s2 = processor(s2)
5933 */
5934 }
5935
5936 /* "cpp_string_metric.pyx":529
5937 * s2 = processor(s2)
5938 *
5939 * return jaro_similarity_no_process(conv_sequence(s1), conv_sequence(s2), c_score_cutoff) # <<<<<<<<<<<<<<
5940 *
5941 *
5942 */
5943 __Pyx_TraceLine(529,0,__PYX_ERR(0, 529, __pyx_L1_error))
5944 __Pyx_XDECREF(__pyx_r);
5945 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L1_error)
5946 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L1_error)
5947 try {
5948 __pyx_t_1 = jaro_similarity_no_process(__pyx_t_9, __pyx_t_8, __pyx_v_c_score_cutoff);
5949 } catch(...) {
5950 __Pyx_CppExn2PyErr();
5951 __PYX_ERR(0, 529, __pyx_L1_error)
5952 }
5953 __pyx_t_7 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 529, __pyx_L1_error)
5954 __Pyx_GOTREF(__pyx_t_7);
5955 __pyx_r = __pyx_t_7;
5956 __pyx_t_7 = 0;
5957 goto __pyx_L0;
5958
5959 /* "cpp_string_metric.pyx":493
5960 *
5961 *
5962 * def jaro_similarity(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
5963 * """
5964 * Calculates the jaro similarity
5965 */
5966
5967 /* function exit code */
5968 __pyx_L1_error:;
5969 __Pyx_XDECREF(__pyx_t_6);
5970 __Pyx_XDECREF(__pyx_t_7);
5971 __Pyx_XDECREF(__pyx_t_10);
5972 __Pyx_AddTraceback("cpp_string_metric.jaro_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
5973 __pyx_r = NULL;
5974 __pyx_L0:;
5975 __Pyx_XDECREF(__pyx_v_s1);
5976 __Pyx_XDECREF(__pyx_v_s2);
5977 __Pyx_XGIVEREF(__pyx_r);
5978 __Pyx_TraceReturn(__pyx_r, 0);
5979 __Pyx_RefNannyFinishContext();
5980 return __pyx_r;
5981 }
5982
5983 /* "cpp_string_metric.pyx":532
5984 *
5985 *
5986 * def jaro_winkler_similarity(s1, s2, *, double prefix_weight=0.1, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
5987 * """
5988 * Calculates the jaro winkler similarity
5989 */
5990
5991 /* Python wrapper */
5992 static PyObject *__pyx_pw_17cpp_string_metric_13jaro_winkler_similarity(PyObject *__pyx_self,
5993 #if CYTHON_METH_FASTCALL
5994 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5995 #else
5996 PyObject *__pyx_args, PyObject *__pyx_kwds
5997 #endif
5998 ); /*proto*/
5999 PyDoc_STRVAR(__pyx_doc_17cpp_string_metric_12jaro_winkler_similarity, "\n Calculates the jaro winkler similarity\n\n Parameters\n ----------\n s1 : Sequence[Hashable]\n First string to compare.\n s2 : Sequence[Hashable]\n Second string to compare.\n prefix_weight : float, optional\n Weight used for the common prefix of the two strings.\n Has to be between 0 and 0.25. Default is 0.1.\n processor: bool or 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 : float, optional\n Optional argument for a score threshold as a float between 0 and 100.\n For ratio < score_cutoff 0 is returned instead. Default is 0,\n which deactivates this behaviour.\n\n Returns\n -------\n similarity : float\n similarity between s1 and s2 as a float between 0 and 100\n\n Raises\n ------\n ValueError\n If prefix_weight is invalid\n ");
6000 static PyMethodDef __pyx_mdef_17cpp_string_metric_13jaro_winkler_similarity = {"jaro_winkler_similarity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_17cpp_string_metric_13jaro_winkler_similarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_17cpp_string_metric_12jaro_winkler_similarity};
__pyx_pw_17cpp_string_metric_13jaro_winkler_similarity(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)6001 static PyObject *__pyx_pw_17cpp_string_metric_13jaro_winkler_similarity(PyObject *__pyx_self,
6002 #if CYTHON_METH_FASTCALL
6003 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6004 #else
6005 PyObject *__pyx_args, PyObject *__pyx_kwds
6006 #endif
6007 ) {
6008 PyObject *__pyx_v_s1 = 0;
6009 PyObject *__pyx_v_s2 = 0;
6010 double __pyx_v_prefix_weight;
6011 PyObject *__pyx_v_processor = 0;
6012 PyObject *__pyx_v_score_cutoff = 0;
6013 #if !CYTHON_METH_FASTCALL
6014 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6015 #endif
6016 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
6017 int __pyx_lineno = 0;
6018 const char *__pyx_filename = NULL;
6019 int __pyx_clineno = 0;
6020 PyObject *__pyx_r = 0;
6021 __Pyx_RefNannyDeclarations
6022 __Pyx_RefNannySetupContext("jaro_winkler_similarity (wrapper)", 0);
6023 {
6024 #if CYTHON_USE_MODULE_STATE
6025 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_prefix_weight,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
6026 #else
6027 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_prefix_weight,&__pyx_n_s_processor,&__pyx_n_s_score_cutoff,0};
6028 #endif
6029 PyObject* values[5] = {0,0,0,0,0};
6030 values[3] = ((PyObject *)((PyObject *)Py_None));
6031 values[4] = ((PyObject *)((PyObject *)Py_None));
6032 if (__pyx_kwds) {
6033 Py_ssize_t kw_args;
6034 switch (__pyx_nargs) {
6035 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
6036 CYTHON_FALLTHROUGH;
6037 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
6038 CYTHON_FALLTHROUGH;
6039 case 0: break;
6040 default: goto __pyx_L5_argtuple_error;
6041 }
6042 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
6043 switch (__pyx_nargs) {
6044 case 0:
6045 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) kw_args--;
6046 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L3_error)
6047 else goto __pyx_L5_argtuple_error;
6048 CYTHON_FALLTHROUGH;
6049 case 1:
6050 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) kw_args--;
6051 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L3_error)
6052 else {
6053 __Pyx_RaiseArgtupleInvalid("jaro_winkler_similarity", 1, 2, 2, 1); __PYX_ERR(0, 532, __pyx_L3_error)
6054 }
6055 }
6056 if (kw_args > 0 && likely(kw_args <= 3)) {
6057 Py_ssize_t index;
6058 for (index = 2; index < 5 && kw_args > 0; index++) {
6059 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, *__pyx_pyargnames[index]);
6060 if (value) { values[index] = value; kw_args--; }
6061 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L3_error)
6062 }
6063 }
6064 if (unlikely(kw_args > 0)) {
6065 const Py_ssize_t kwd_pos_args = __pyx_nargs;
6066 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "jaro_winkler_similarity") < 0)) __PYX_ERR(0, 532, __pyx_L3_error)
6067 }
6068 } else if (unlikely(__pyx_nargs != 2)) {
6069 goto __pyx_L5_argtuple_error;
6070 } else {
6071 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
6072 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
6073 }
6074 __pyx_v_s1 = values[0];
6075 __pyx_v_s2 = values[1];
6076 if (values[2]) {
6077 __pyx_v_prefix_weight = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_prefix_weight == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L3_error)
6078 } else {
6079 __pyx_v_prefix_weight = ((double)((double)0.1));
6080 }
6081 __pyx_v_processor = values[3];
6082 __pyx_v_score_cutoff = values[4];
6083 }
6084 goto __pyx_L4_argument_unpacking_done;
6085 __pyx_L5_argtuple_error:;
6086 __Pyx_RaiseArgtupleInvalid("jaro_winkler_similarity", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 532, __pyx_L3_error)
6087 __pyx_L3_error:;
6088 __Pyx_AddTraceback("cpp_string_metric.jaro_winkler_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6089 __Pyx_RefNannyFinishContext();
6090 return NULL;
6091 __pyx_L4_argument_unpacking_done:;
6092 __pyx_r = __pyx_pf_17cpp_string_metric_12jaro_winkler_similarity(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_prefix_weight, __pyx_v_processor, __pyx_v_score_cutoff);
6093
6094 /* function exit code */
6095 __Pyx_RefNannyFinishContext();
6096 return __pyx_r;
6097 }
6098
__pyx_pf_17cpp_string_metric_12jaro_winkler_similarity(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_s1,PyObject * __pyx_v_s2,double __pyx_v_prefix_weight,PyObject * __pyx_v_processor,PyObject * __pyx_v_score_cutoff)6099 static PyObject *__pyx_pf_17cpp_string_metric_12jaro_winkler_similarity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, double __pyx_v_prefix_weight, PyObject *__pyx_v_processor, PyObject *__pyx_v_score_cutoff) {
6100 double __pyx_v_c_score_cutoff;
6101 PyObject *__pyx_r = NULL;
6102 __Pyx_TraceDeclarations
6103 __Pyx_RefNannyDeclarations
6104 double __pyx_t_1;
6105 int __pyx_t_2;
6106 double __pyx_t_3;
6107 int __pyx_t_4;
6108 int __pyx_t_5;
6109 PyObject *__pyx_t_6 = NULL;
6110 PyObject *__pyx_t_7 = NULL;
6111 proc_string __pyx_t_8;
6112 proc_string __pyx_t_9;
6113 PyObject *__pyx_t_10 = NULL;
6114 int __pyx_t_11;
6115 int __pyx_lineno = 0;
6116 const char *__pyx_filename = NULL;
6117 int __pyx_clineno = 0;
6118 __Pyx_TraceFrameInit(__pyx_codeobj__8)
6119 __Pyx_RefNannySetupContext("jaro_winkler_similarity", 0);
6120 __Pyx_TraceCall("jaro_winkler_similarity", __pyx_f[0], 532, 0, __PYX_ERR(0, 532, __pyx_L1_error));
6121 __Pyx_INCREF(__pyx_v_s1);
6122 __Pyx_INCREF(__pyx_v_s2);
6123
6124 /* "cpp_string_metric.pyx":564
6125 * If prefix_weight is invalid
6126 * """
6127 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff # <<<<<<<<<<<<<<
6128 *
6129 * if s1 is None or s2 is None:
6130 */
6131 __Pyx_TraceLine(564,0,__PYX_ERR(0, 564, __pyx_L1_error))
6132 __pyx_t_2 = (__pyx_v_score_cutoff == Py_None);
6133 if ((__pyx_t_2 != 0)) {
6134 __pyx_t_1 = 0.0;
6135 } else {
6136 __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_score_cutoff); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 564, __pyx_L1_error)
6137 __pyx_t_1 = __pyx_t_3;
6138 }
6139 __pyx_v_c_score_cutoff = __pyx_t_1;
6140
6141 /* "cpp_string_metric.pyx":566
6142 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
6143 *
6144 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
6145 * return 0
6146 *
6147 */
6148 __Pyx_TraceLine(566,0,__PYX_ERR(0, 566, __pyx_L1_error))
6149 __pyx_t_4 = (__pyx_v_s1 == Py_None);
6150 __pyx_t_5 = (__pyx_t_4 != 0);
6151 if (!__pyx_t_5) {
6152 } else {
6153 __pyx_t_2 = __pyx_t_5;
6154 goto __pyx_L4_bool_binop_done;
6155 }
6156 __pyx_t_5 = (__pyx_v_s2 == Py_None);
6157 __pyx_t_4 = (__pyx_t_5 != 0);
6158 __pyx_t_2 = __pyx_t_4;
6159 __pyx_L4_bool_binop_done:;
6160 if (__pyx_t_2) {
6161
6162 /* "cpp_string_metric.pyx":567
6163 *
6164 * if s1 is None or s2 is None:
6165 * return 0 # <<<<<<<<<<<<<<
6166 *
6167 * if processor is True or processor == default_process:
6168 */
6169 __Pyx_TraceLine(567,0,__PYX_ERR(0, 567, __pyx_L1_error))
6170 __Pyx_XDECREF(__pyx_r);
6171 __Pyx_INCREF(__pyx_int_0);
6172 __pyx_r = __pyx_int_0;
6173 goto __pyx_L0;
6174
6175 /* "cpp_string_metric.pyx":566
6176 * cdef double c_score_cutoff = 0.0 if score_cutoff is None else score_cutoff
6177 *
6178 * if s1 is None or s2 is None: # <<<<<<<<<<<<<<
6179 * return 0
6180 *
6181 */
6182 }
6183
6184 /* "cpp_string_metric.pyx":569
6185 * return 0
6186 *
6187 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
6188 * return jaro_winkler_similarity_default_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff)
6189 * elif callable(processor):
6190 */
6191 __Pyx_TraceLine(569,0,__PYX_ERR(0, 569, __pyx_L1_error))
6192 __pyx_t_4 = (__pyx_v_processor == Py_True);
6193 __pyx_t_5 = (__pyx_t_4 != 0);
6194 if (!__pyx_t_5) {
6195 } else {
6196 __pyx_t_2 = __pyx_t_5;
6197 goto __pyx_L7_bool_binop_done;
6198 }
6199 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 569, __pyx_L1_error)
6200 __Pyx_GOTREF(__pyx_t_6);
6201 __pyx_t_7 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 569, __pyx_L1_error)
6202 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6203 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 569, __pyx_L1_error)
6204 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6205 __pyx_t_2 = __pyx_t_5;
6206 __pyx_L7_bool_binop_done:;
6207 if (__pyx_t_2) {
6208
6209 /* "cpp_string_metric.pyx":570
6210 *
6211 * if processor is True or processor == default_process:
6212 * return jaro_winkler_similarity_default_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff) # <<<<<<<<<<<<<<
6213 * elif callable(processor):
6214 * s1 = processor(s1)
6215 */
6216 __Pyx_TraceLine(570,0,__PYX_ERR(0, 570, __pyx_L1_error))
6217 __Pyx_XDECREF(__pyx_r);
6218 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 570, __pyx_L1_error)
6219 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 570, __pyx_L1_error)
6220 try {
6221 __pyx_t_1 = jaro_winkler_similarity_default_process(__pyx_t_8, __pyx_t_9, __pyx_v_prefix_weight, __pyx_v_c_score_cutoff);
6222 } catch(...) {
6223 __Pyx_CppExn2PyErr();
6224 __PYX_ERR(0, 570, __pyx_L1_error)
6225 }
6226 __pyx_t_7 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 570, __pyx_L1_error)
6227 __Pyx_GOTREF(__pyx_t_7);
6228 __pyx_r = __pyx_t_7;
6229 __pyx_t_7 = 0;
6230 goto __pyx_L0;
6231
6232 /* "cpp_string_metric.pyx":569
6233 * return 0
6234 *
6235 * if processor is True or processor == default_process: # <<<<<<<<<<<<<<
6236 * return jaro_winkler_similarity_default_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff)
6237 * elif callable(processor):
6238 */
6239 }
6240
6241 /* "cpp_string_metric.pyx":571
6242 * if processor is True or processor == default_process:
6243 * return jaro_winkler_similarity_default_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff)
6244 * elif callable(processor): # <<<<<<<<<<<<<<
6245 * s1 = processor(s1)
6246 * s2 = processor(s2)
6247 */
6248 __Pyx_TraceLine(571,0,__PYX_ERR(0, 571, __pyx_L1_error))
6249 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 571, __pyx_L1_error)
6250 __pyx_t_5 = (__pyx_t_2 != 0);
6251 if (__pyx_t_5) {
6252
6253 /* "cpp_string_metric.pyx":572
6254 * return jaro_winkler_similarity_default_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff)
6255 * elif callable(processor):
6256 * s1 = processor(s1) # <<<<<<<<<<<<<<
6257 * s2 = processor(s2)
6258 *
6259 */
6260 __Pyx_TraceLine(572,0,__PYX_ERR(0, 572, __pyx_L1_error))
6261 __Pyx_INCREF(__pyx_v_processor);
6262 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
6263 __pyx_t_11 = 0;
6264 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
6265 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
6266 if (likely(__pyx_t_10)) {
6267 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6268 __Pyx_INCREF(__pyx_t_10);
6269 __Pyx_INCREF(function);
6270 __Pyx_DECREF_SET(__pyx_t_6, function);
6271 __pyx_t_11 = 1;
6272 }
6273 }
6274 {
6275 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s1};
6276 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
6277 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6278 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 572, __pyx_L1_error)
6279 __Pyx_GOTREF(__pyx_t_7);
6280 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6281 }
6282 __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_7);
6283 __pyx_t_7 = 0;
6284
6285 /* "cpp_string_metric.pyx":573
6286 * elif callable(processor):
6287 * s1 = processor(s1)
6288 * s2 = processor(s2) # <<<<<<<<<<<<<<
6289 *
6290 * return jaro_winkler_similarity_no_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff)
6291 */
6292 __Pyx_TraceLine(573,0,__PYX_ERR(0, 573, __pyx_L1_error))
6293 __Pyx_INCREF(__pyx_v_processor);
6294 __pyx_t_6 = __pyx_v_processor; __pyx_t_10 = NULL;
6295 __pyx_t_11 = 0;
6296 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
6297 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
6298 if (likely(__pyx_t_10)) {
6299 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6300 __Pyx_INCREF(__pyx_t_10);
6301 __Pyx_INCREF(function);
6302 __Pyx_DECREF_SET(__pyx_t_6, function);
6303 __pyx_t_11 = 1;
6304 }
6305 }
6306 {
6307 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_s2};
6308 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11);
6309 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6310 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 573, __pyx_L1_error)
6311 __Pyx_GOTREF(__pyx_t_7);
6312 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6313 }
6314 __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_7);
6315 __pyx_t_7 = 0;
6316
6317 /* "cpp_string_metric.pyx":571
6318 * if processor is True or processor == default_process:
6319 * return jaro_winkler_similarity_default_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff)
6320 * elif callable(processor): # <<<<<<<<<<<<<<
6321 * s1 = processor(s1)
6322 * s2 = processor(s2)
6323 */
6324 }
6325
6326 /* "cpp_string_metric.pyx":575
6327 * s2 = processor(s2)
6328 *
6329 * return jaro_winkler_similarity_no_process(conv_sequence(s1), conv_sequence(s2), prefix_weight, c_score_cutoff) # <<<<<<<<<<<<<<
6330 */
6331 __Pyx_TraceLine(575,0,__PYX_ERR(0, 575, __pyx_L1_error))
6332 __Pyx_XDECREF(__pyx_r);
6333 __pyx_t_9 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L1_error)
6334 __pyx_t_8 = __pyx_f_17cpp_string_metric_conv_sequence(__pyx_v_s2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L1_error)
6335 try {
6336 __pyx_t_1 = jaro_winkler_similarity_no_process(__pyx_t_9, __pyx_t_8, __pyx_v_prefix_weight, __pyx_v_c_score_cutoff);
6337 } catch(...) {
6338 __Pyx_CppExn2PyErr();
6339 __PYX_ERR(0, 575, __pyx_L1_error)
6340 }
6341 __pyx_t_7 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 575, __pyx_L1_error)
6342 __Pyx_GOTREF(__pyx_t_7);
6343 __pyx_r = __pyx_t_7;
6344 __pyx_t_7 = 0;
6345 goto __pyx_L0;
6346
6347 /* "cpp_string_metric.pyx":532
6348 *
6349 *
6350 * def jaro_winkler_similarity(s1, s2, *, double prefix_weight=0.1, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
6351 * """
6352 * Calculates the jaro winkler similarity
6353 */
6354
6355 /* function exit code */
6356 __pyx_L1_error:;
6357 __Pyx_XDECREF(__pyx_t_6);
6358 __Pyx_XDECREF(__pyx_t_7);
6359 __Pyx_XDECREF(__pyx_t_10);
6360 __Pyx_AddTraceback("cpp_string_metric.jaro_winkler_similarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6361 __pyx_r = NULL;
6362 __pyx_L0:;
6363 __Pyx_XDECREF(__pyx_v_s1);
6364 __Pyx_XDECREF(__pyx_v_s2);
6365 __Pyx_XGIVEREF(__pyx_r);
6366 __Pyx_TraceReturn(__pyx_r, 0);
6367 __Pyx_RefNannyFinishContext();
6368 return __pyx_r;
6369 }
6370
6371 /* "cpp_common.pxd":24
6372 * proc_string default_process_func(proc_string sentence) except +
6373 *
6374 * cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
6375 * # TODO on Cpython this does not require any copies
6376 * cdef proc_string s_proc
6377 */
6378
__pyx_f_10cpp_common_hash_array(PyObject * __pyx_v_arr)6379 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx_v_arr) {
6380 proc_string __pyx_v_s_proc;
6381 Py_UCS4 __pyx_v_typecode;
6382 size_t __pyx_v_i;
6383 CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
6384 proc_string __pyx_r;
6385 __Pyx_RefNannyDeclarations
6386 PyObject *__pyx_t_1 = NULL;
6387 Py_UCS4 __pyx_t_2;
6388 Py_ssize_t __pyx_t_3;
6389 int __pyx_t_4;
6390 PyObject *__pyx_t_5 = NULL;
6391 PyObject *__pyx_t_6 = NULL;
6392 PyObject *__pyx_t_7 = NULL;
6393 size_t __pyx_t_8;
6394 size_t __pyx_t_9;
6395 size_t __pyx_t_10;
6396 uint64_t __pyx_t_11;
6397 Py_hash_t __pyx_t_12;
6398 int __pyx_t_13;
6399 PyObject *__pyx_t_14 = NULL;
6400 PyObject *__pyx_t_15 = NULL;
6401 int __pyx_t_16;
6402 char const *__pyx_t_17;
6403 PyObject *__pyx_t_18 = NULL;
6404 PyObject *__pyx_t_19 = NULL;
6405 PyObject *__pyx_t_20 = NULL;
6406 PyObject *__pyx_t_21 = NULL;
6407 PyObject *__pyx_t_22 = NULL;
6408 PyObject *__pyx_t_23 = NULL;
6409 int __pyx_lineno = 0;
6410 const char *__pyx_filename = NULL;
6411 int __pyx_clineno = 0;
6412 __Pyx_RefNannySetupContext("hash_array", 0);
6413
6414 /* "cpp_common.pxd":27
6415 * # TODO on Cpython this does not require any copies
6416 * cdef proc_string s_proc
6417 * cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode # <<<<<<<<<<<<<<
6418 * s_proc.length = <size_t>len(arr)
6419 *
6420 */
6421 __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)
6422 __Pyx_GOTREF(__pyx_t_1);
6423 __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)
6424 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6425 __pyx_v_typecode = ((Py_UCS4)__pyx_t_2);
6426
6427 /* "cpp_common.pxd":28
6428 * cdef proc_string s_proc
6429 * cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode
6430 * s_proc.length = <size_t>len(arr) # <<<<<<<<<<<<<<
6431 *
6432 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
6433 */
6434 __pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 28, __pyx_L1_error)
6435 __pyx_v_s_proc.length = ((size_t)__pyx_t_3);
6436
6437 /* "cpp_common.pxd":30
6438 * s_proc.length = <size_t>len(arr)
6439 *
6440 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
6441 *
6442 * if s_proc.data == NULL:
6443 */
6444 __pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
6445
6446 /* "cpp_common.pxd":32
6447 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
6448 *
6449 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
6450 * raise MemoryError
6451 *
6452 */
6453 __pyx_t_4 = ((__pyx_v_s_proc.data == NULL) != 0);
6454 if (unlikely(__pyx_t_4)) {
6455
6456 /* "cpp_common.pxd":33
6457 *
6458 * if s_proc.data == NULL:
6459 * raise MemoryError # <<<<<<<<<<<<<<
6460 *
6461 * try:
6462 */
6463 PyErr_NoMemory(); __PYX_ERR(1, 33, __pyx_L1_error)
6464
6465 /* "cpp_common.pxd":32
6466 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
6467 *
6468 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
6469 * raise MemoryError
6470 *
6471 */
6472 }
6473
6474 /* "cpp_common.pxd":35
6475 * raise MemoryError
6476 *
6477 * try: # <<<<<<<<<<<<<<
6478 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
6479 * if typecode in {'b', 'B'}: # signed/unsigned char
6480 */
6481 {
6482 __Pyx_PyThreadState_declare
6483 __Pyx_PyThreadState_assign
6484 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
6485 __Pyx_XGOTREF(__pyx_t_5);
6486 __Pyx_XGOTREF(__pyx_t_6);
6487 __Pyx_XGOTREF(__pyx_t_7);
6488 /*try:*/ {
6489
6490 /* "cpp_common.pxd":37
6491 * try:
6492 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
6493 * if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
6494 * s_proc.kind = RAPIDFUZZ_UINT64
6495 * for i in range(s_proc.length):
6496 */
6497 switch (__pyx_v_typecode) {
6498 case 98:
6499 case 66:
6500
6501 /* "cpp_common.pxd":38
6502 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
6503 * if typecode in {'b', 'B'}: # signed/unsigned char
6504 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6505 * for i in range(s_proc.length):
6506 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6507 */
6508 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6509
6510 /* "cpp_common.pxd":39
6511 * if typecode in {'b', 'B'}: # signed/unsigned char
6512 * s_proc.kind = RAPIDFUZZ_UINT64
6513 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6514 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6515 * elif typecode == 'u': # 'u' wchar_t
6516 */
6517 __pyx_t_8 = __pyx_v_s_proc.length;
6518 __pyx_t_9 = __pyx_t_8;
6519 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6520 __pyx_v_i = __pyx_t_10;
6521
6522 /* "cpp_common.pxd":40
6523 * s_proc.kind = RAPIDFUZZ_UINT64
6524 * for i in range(s_proc.length):
6525 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
6526 * elif typecode == 'u': # 'u' wchar_t
6527 * s_proc.kind = RAPIDFUZZ_UINT64
6528 */
6529 __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)
6530 __Pyx_GOTREF(__pyx_t_1);
6531 __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)
6532 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6533 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
6534 }
6535
6536 /* "cpp_common.pxd":37
6537 * try:
6538 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
6539 * if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
6540 * s_proc.kind = RAPIDFUZZ_UINT64
6541 * for i in range(s_proc.length):
6542 */
6543 break;
6544 case 0x75:
6545
6546 /* "cpp_common.pxd":42
6547 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6548 * elif typecode == 'u': # 'u' wchar_t
6549 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6550 * for i in range(s_proc.length):
6551 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
6552 */
6553 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6554
6555 /* "cpp_common.pxd":43
6556 * elif typecode == 'u': # 'u' wchar_t
6557 * s_proc.kind = RAPIDFUZZ_UINT64
6558 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6559 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
6560 * elif typecode in {'h', 'H'}: # signed/unsigned short
6561 */
6562 __pyx_t_8 = __pyx_v_s_proc.length;
6563 __pyx_t_9 = __pyx_t_8;
6564 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6565 __pyx_v_i = __pyx_t_10;
6566
6567 /* "cpp_common.pxd":44
6568 * s_proc.kind = RAPIDFUZZ_UINT64
6569 * for i in range(s_proc.length):
6570 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i] # <<<<<<<<<<<<<<
6571 * elif typecode in {'h', 'H'}: # signed/unsigned short
6572 * s_proc.kind = RAPIDFUZZ_UINT64
6573 */
6574 __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)
6575 __Pyx_GOTREF(__pyx_t_1);
6576 __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)
6577 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6578 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_2));
6579 }
6580
6581 /* "cpp_common.pxd":41
6582 * for i in range(s_proc.length):
6583 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6584 * elif typecode == 'u': # 'u' wchar_t # <<<<<<<<<<<<<<
6585 * s_proc.kind = RAPIDFUZZ_UINT64
6586 * for i in range(s_proc.length):
6587 */
6588 break;
6589 case 0x68:
6590
6591 /* "cpp_common.pxd":45
6592 * for i in range(s_proc.length):
6593 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
6594 * elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
6595 * s_proc.kind = RAPIDFUZZ_UINT64
6596 * for i in range(s_proc.length):
6597 */
6598 case 72:
6599
6600 /* "cpp_common.pxd":46
6601 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
6602 * elif typecode in {'h', 'H'}: # signed/unsigned short
6603 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6604 * for i in range(s_proc.length):
6605 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6606 */
6607 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6608
6609 /* "cpp_common.pxd":47
6610 * elif typecode in {'h', 'H'}: # signed/unsigned short
6611 * s_proc.kind = RAPIDFUZZ_UINT64
6612 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6613 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6614 * elif typecode in {'i', 'I'}: # signed/unsigned int
6615 */
6616 __pyx_t_8 = __pyx_v_s_proc.length;
6617 __pyx_t_9 = __pyx_t_8;
6618 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6619 __pyx_v_i = __pyx_t_10;
6620
6621 /* "cpp_common.pxd":48
6622 * s_proc.kind = RAPIDFUZZ_UINT64
6623 * for i in range(s_proc.length):
6624 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
6625 * elif typecode in {'i', 'I'}: # signed/unsigned int
6626 * s_proc.kind = RAPIDFUZZ_UINT64
6627 */
6628 __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)
6629 __Pyx_GOTREF(__pyx_t_1);
6630 __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)
6631 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6632 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
6633 }
6634
6635 /* "cpp_common.pxd":45
6636 * for i in range(s_proc.length):
6637 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
6638 * elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
6639 * s_proc.kind = RAPIDFUZZ_UINT64
6640 * for i in range(s_proc.length):
6641 */
6642 break;
6643 case 0x69:
6644
6645 /* "cpp_common.pxd":49
6646 * for i in range(s_proc.length):
6647 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6648 * elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
6649 * s_proc.kind = RAPIDFUZZ_UINT64
6650 * for i in range(s_proc.length):
6651 */
6652 case 73:
6653
6654 /* "cpp_common.pxd":50
6655 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6656 * elif typecode in {'i', 'I'}: # signed/unsigned int
6657 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6658 * for i in range(s_proc.length):
6659 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6660 */
6661 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6662
6663 /* "cpp_common.pxd":51
6664 * elif typecode in {'i', 'I'}: # signed/unsigned int
6665 * s_proc.kind = RAPIDFUZZ_UINT64
6666 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6667 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6668 * elif typecode in {'l', 'L'}: # signed/unsigned long
6669 */
6670 __pyx_t_8 = __pyx_v_s_proc.length;
6671 __pyx_t_9 = __pyx_t_8;
6672 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6673 __pyx_v_i = __pyx_t_10;
6674
6675 /* "cpp_common.pxd":52
6676 * s_proc.kind = RAPIDFUZZ_UINT64
6677 * for i in range(s_proc.length):
6678 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
6679 * elif typecode in {'l', 'L'}: # signed/unsigned long
6680 * s_proc.kind = RAPIDFUZZ_UINT64
6681 */
6682 __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)
6683 __Pyx_GOTREF(__pyx_t_1);
6684 __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)
6685 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6686 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
6687 }
6688
6689 /* "cpp_common.pxd":49
6690 * for i in range(s_proc.length):
6691 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6692 * elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
6693 * s_proc.kind = RAPIDFUZZ_UINT64
6694 * for i in range(s_proc.length):
6695 */
6696 break;
6697 case 0x6C:
6698
6699 /* "cpp_common.pxd":53
6700 * for i in range(s_proc.length):
6701 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6702 * elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
6703 * s_proc.kind = RAPIDFUZZ_UINT64
6704 * for i in range(s_proc.length):
6705 */
6706 case 76:
6707
6708 /* "cpp_common.pxd":54
6709 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6710 * elif typecode in {'l', 'L'}: # signed/unsigned long
6711 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6712 * for i in range(s_proc.length):
6713 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6714 */
6715 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6716
6717 /* "cpp_common.pxd":55
6718 * elif typecode in {'l', 'L'}: # signed/unsigned long
6719 * s_proc.kind = RAPIDFUZZ_UINT64
6720 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6721 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6722 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
6723 */
6724 __pyx_t_8 = __pyx_v_s_proc.length;
6725 __pyx_t_9 = __pyx_t_8;
6726 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6727 __pyx_v_i = __pyx_t_10;
6728
6729 /* "cpp_common.pxd":56
6730 * s_proc.kind = RAPIDFUZZ_UINT64
6731 * for i in range(s_proc.length):
6732 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
6733 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
6734 * s_proc.kind = RAPIDFUZZ_UINT64
6735 */
6736 __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)
6737 __Pyx_GOTREF(__pyx_t_1);
6738 __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)
6739 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6740 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
6741 }
6742
6743 /* "cpp_common.pxd":53
6744 * for i in range(s_proc.length):
6745 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6746 * elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
6747 * s_proc.kind = RAPIDFUZZ_UINT64
6748 * for i in range(s_proc.length):
6749 */
6750 break;
6751 case 0x71:
6752
6753 /* "cpp_common.pxd":57
6754 * for i in range(s_proc.length):
6755 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6756 * elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
6757 * s_proc.kind = RAPIDFUZZ_UINT64
6758 * for i in range(s_proc.length):
6759 */
6760 case 81:
6761
6762 /* "cpp_common.pxd":58
6763 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6764 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
6765 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6766 * for i in range(s_proc.length):
6767 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6768 */
6769 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6770
6771 /* "cpp_common.pxd":59
6772 * elif typecode in {'q', 'Q'}: # signed/unsigned long long
6773 * s_proc.kind = RAPIDFUZZ_UINT64
6774 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6775 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6776 * else: # float/double are hashed
6777 */
6778 __pyx_t_8 = __pyx_v_s_proc.length;
6779 __pyx_t_9 = __pyx_t_8;
6780 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6781 __pyx_v_i = __pyx_t_10;
6782
6783 /* "cpp_common.pxd":60
6784 * s_proc.kind = RAPIDFUZZ_UINT64
6785 * for i in range(s_proc.length):
6786 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
6787 * else: # float/double are hashed
6788 * s_proc.kind = RAPIDFUZZ_UINT64
6789 */
6790 __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)
6791 __Pyx_GOTREF(__pyx_t_1);
6792 __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)
6793 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6794 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
6795 }
6796
6797 /* "cpp_common.pxd":57
6798 * for i in range(s_proc.length):
6799 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6800 * elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
6801 * s_proc.kind = RAPIDFUZZ_UINT64
6802 * for i in range(s_proc.length):
6803 */
6804 break;
6805 default:
6806
6807 /* "cpp_common.pxd":62
6808 * (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
6809 * else: # float/double are hashed
6810 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
6811 * for i in range(s_proc.length):
6812 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
6813 */
6814 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
6815
6816 /* "cpp_common.pxd":63
6817 * else: # float/double are hashed
6818 * s_proc.kind = RAPIDFUZZ_UINT64
6819 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
6820 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
6821 * except Exception as e:
6822 */
6823 __pyx_t_8 = __pyx_v_s_proc.length;
6824 __pyx_t_9 = __pyx_t_8;
6825 for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
6826 __pyx_v_i = __pyx_t_10;
6827
6828 /* "cpp_common.pxd":64
6829 * s_proc.kind = RAPIDFUZZ_UINT64
6830 * for i in range(s_proc.length):
6831 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i]) # <<<<<<<<<<<<<<
6832 * except Exception as e:
6833 * free(s_proc.data)
6834 */
6835 __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)
6836 __Pyx_GOTREF(__pyx_t_1);
6837 __pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 64, __pyx_L4_error)
6838 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6839 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_12);
6840 }
6841 break;
6842 }
6843
6844 /* "cpp_common.pxd":35
6845 * raise MemoryError
6846 *
6847 * try: # <<<<<<<<<<<<<<
6848 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
6849 * if typecode in {'b', 'B'}: # signed/unsigned char
6850 */
6851 }
6852 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6853 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6854 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6855 goto __pyx_L9_try_end;
6856 __pyx_L4_error:;
6857 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6858
6859 /* "cpp_common.pxd":65
6860 * for i in range(s_proc.length):
6861 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
6862 * except Exception as e: # <<<<<<<<<<<<<<
6863 * free(s_proc.data)
6864 * s_proc.data = NULL
6865 */
6866 __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6867 if (__pyx_t_13) {
6868 __Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6869 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 65, __pyx_L6_except_error)
6870 __Pyx_GOTREF(__pyx_t_1);
6871 __Pyx_GOTREF(__pyx_t_14);
6872 __Pyx_GOTREF(__pyx_t_15);
6873 __Pyx_INCREF(__pyx_t_14);
6874 __pyx_v_e = __pyx_t_14;
6875 /*try:*/ {
6876
6877 /* "cpp_common.pxd":66
6878 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
6879 * except Exception as e:
6880 * free(s_proc.data) # <<<<<<<<<<<<<<
6881 * s_proc.data = NULL
6882 * raise
6883 */
6884 free(__pyx_v_s_proc.data);
6885
6886 /* "cpp_common.pxd":67
6887 * except Exception as e:
6888 * free(s_proc.data)
6889 * s_proc.data = NULL # <<<<<<<<<<<<<<
6890 * raise
6891 *
6892 */
6893 __pyx_v_s_proc.data = NULL;
6894
6895 /* "cpp_common.pxd":68
6896 * free(s_proc.data)
6897 * s_proc.data = NULL
6898 * raise # <<<<<<<<<<<<<<
6899 *
6900 * s_proc.allocated = True
6901 */
6902 __Pyx_GIVEREF(__pyx_t_1);
6903 __Pyx_GIVEREF(__pyx_t_14);
6904 __Pyx_XGIVEREF(__pyx_t_15);
6905 __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_14, __pyx_t_15);
6906 __pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
6907 __PYX_ERR(1, 68, __pyx_L29_error)
6908 }
6909
6910 /* "cpp_common.pxd":65
6911 * for i in range(s_proc.length):
6912 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
6913 * except Exception as e: # <<<<<<<<<<<<<<
6914 * free(s_proc.data)
6915 * s_proc.data = NULL
6916 */
6917 /*finally:*/ {
6918 __pyx_L29_error:;
6919 /*exception exit:*/{
6920 __Pyx_PyThreadState_declare
6921 __Pyx_PyThreadState_assign
6922 __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
6923 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
6924 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);
6925 __Pyx_XGOTREF(__pyx_t_18);
6926 __Pyx_XGOTREF(__pyx_t_19);
6927 __Pyx_XGOTREF(__pyx_t_20);
6928 __Pyx_XGOTREF(__pyx_t_21);
6929 __Pyx_XGOTREF(__pyx_t_22);
6930 __Pyx_XGOTREF(__pyx_t_23);
6931 __pyx_t_13 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
6932 {
6933 __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
6934 }
6935 if (PY_MAJOR_VERSION >= 3) {
6936 __Pyx_XGIVEREF(__pyx_t_21);
6937 __Pyx_XGIVEREF(__pyx_t_22);
6938 __Pyx_XGIVEREF(__pyx_t_23);
6939 __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
6940 }
6941 __Pyx_XGIVEREF(__pyx_t_18);
6942 __Pyx_XGIVEREF(__pyx_t_19);
6943 __Pyx_XGIVEREF(__pyx_t_20);
6944 __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
6945 __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
6946 __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
6947 goto __pyx_L6_except_error;
6948 }
6949 }
6950 }
6951 goto __pyx_L6_except_error;
6952 __pyx_L6_except_error:;
6953
6954 /* "cpp_common.pxd":35
6955 * raise MemoryError
6956 *
6957 * try: # <<<<<<<<<<<<<<
6958 * # ignore signed/unsigned, since it is not relevant in any of the algorithms
6959 * if typecode in {'b', 'B'}: # signed/unsigned char
6960 */
6961 __Pyx_XGIVEREF(__pyx_t_5);
6962 __Pyx_XGIVEREF(__pyx_t_6);
6963 __Pyx_XGIVEREF(__pyx_t_7);
6964 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
6965 goto __pyx_L1_error;
6966 __pyx_L9_try_end:;
6967 }
6968
6969 /* "cpp_common.pxd":70
6970 * raise
6971 *
6972 * s_proc.allocated = True # <<<<<<<<<<<<<<
6973 * return move(s_proc)
6974 *
6975 */
6976 __pyx_v_s_proc.allocated = 1;
6977
6978 /* "cpp_common.pxd":71
6979 *
6980 * s_proc.allocated = True
6981 * return move(s_proc) # <<<<<<<<<<<<<<
6982 *
6983 *
6984 */
6985 __pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
6986 goto __pyx_L0;
6987
6988 /* "cpp_common.pxd":24
6989 * proc_string default_process_func(proc_string sentence) except +
6990 *
6991 * cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
6992 * # TODO on Cpython this does not require any copies
6993 * cdef proc_string s_proc
6994 */
6995
6996 /* function exit code */
6997 __pyx_L1_error:;
6998 __Pyx_XDECREF(__pyx_t_1);
6999 __Pyx_XDECREF(__pyx_t_14);
7000 __Pyx_XDECREF(__pyx_t_15);
7001 __Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7002 __Pyx_pretend_to_initialize(&__pyx_r);
7003 __pyx_L0:;
7004 __Pyx_XDECREF(__pyx_v_e);
7005 __Pyx_RefNannyFinishContext();
7006 return __pyx_r;
7007 }
7008
7009 /* "cpp_common.pxd":74
7010 *
7011 *
7012 * cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
7013 * cdef proc_string s_proc
7014 * s_proc.length = <size_t>len(seq)
7015 */
7016
__pyx_f_10cpp_common_hash_sequence(PyObject * __pyx_v_seq)7017 static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__pyx_v_seq) {
7018 proc_string __pyx_v_s_proc;
7019 size_t __pyx_v_i;
7020 PyObject *__pyx_v_elem = NULL;
7021 CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
7022 proc_string __pyx_r;
7023 __Pyx_RefNannyDeclarations
7024 Py_ssize_t __pyx_t_1;
7025 int __pyx_t_2;
7026 PyObject *__pyx_t_3 = NULL;
7027 PyObject *__pyx_t_4 = NULL;
7028 PyObject *__pyx_t_5 = NULL;
7029 size_t __pyx_t_6;
7030 size_t __pyx_t_7;
7031 size_t __pyx_t_8;
7032 PyObject *__pyx_t_9 = NULL;
7033 int __pyx_t_10;
7034 int __pyx_t_11;
7035 Py_UCS4 __pyx_t_12;
7036 Py_hash_t __pyx_t_13;
7037 int __pyx_t_14;
7038 PyObject *__pyx_t_15 = NULL;
7039 PyObject *__pyx_t_16 = NULL;
7040 int __pyx_t_17;
7041 char const *__pyx_t_18;
7042 PyObject *__pyx_t_19 = NULL;
7043 PyObject *__pyx_t_20 = NULL;
7044 PyObject *__pyx_t_21 = NULL;
7045 PyObject *__pyx_t_22 = NULL;
7046 PyObject *__pyx_t_23 = NULL;
7047 PyObject *__pyx_t_24 = NULL;
7048 int __pyx_lineno = 0;
7049 const char *__pyx_filename = NULL;
7050 int __pyx_clineno = 0;
7051 __Pyx_RefNannySetupContext("hash_sequence", 0);
7052
7053 /* "cpp_common.pxd":76
7054 * cdef inline proc_string hash_sequence(seq) except *:
7055 * cdef proc_string s_proc
7056 * s_proc.length = <size_t>len(seq) # <<<<<<<<<<<<<<
7057 *
7058 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
7059 */
7060 __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 76, __pyx_L1_error)
7061 __pyx_v_s_proc.length = ((size_t)__pyx_t_1);
7062
7063 /* "cpp_common.pxd":78
7064 * s_proc.length = <size_t>len(seq)
7065 *
7066 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
7067 *
7068 * if s_proc.data == NULL:
7069 */
7070 __pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
7071
7072 /* "cpp_common.pxd":80
7073 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
7074 *
7075 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
7076 * raise MemoryError
7077 *
7078 */
7079 __pyx_t_2 = ((__pyx_v_s_proc.data == NULL) != 0);
7080 if (unlikely(__pyx_t_2)) {
7081
7082 /* "cpp_common.pxd":81
7083 *
7084 * if s_proc.data == NULL:
7085 * raise MemoryError # <<<<<<<<<<<<<<
7086 *
7087 * try:
7088 */
7089 PyErr_NoMemory(); __PYX_ERR(1, 81, __pyx_L1_error)
7090
7091 /* "cpp_common.pxd":80
7092 * s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
7093 *
7094 * if s_proc.data == NULL: # <<<<<<<<<<<<<<
7095 * raise MemoryError
7096 *
7097 */
7098 }
7099
7100 /* "cpp_common.pxd":83
7101 * raise MemoryError
7102 *
7103 * try: # <<<<<<<<<<<<<<
7104 * s_proc.kind = RAPIDFUZZ_UINT64
7105 * for i in range(s_proc.length):
7106 */
7107 {
7108 __Pyx_PyThreadState_declare
7109 __Pyx_PyThreadState_assign
7110 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
7111 __Pyx_XGOTREF(__pyx_t_3);
7112 __Pyx_XGOTREF(__pyx_t_4);
7113 __Pyx_XGOTREF(__pyx_t_5);
7114 /*try:*/ {
7115
7116 /* "cpp_common.pxd":84
7117 *
7118 * try:
7119 * s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
7120 * for i in range(s_proc.length):
7121 * elem = seq[i]
7122 */
7123 __pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
7124
7125 /* "cpp_common.pxd":85
7126 * try:
7127 * s_proc.kind = RAPIDFUZZ_UINT64
7128 * for i in range(s_proc.length): # <<<<<<<<<<<<<<
7129 * elem = seq[i]
7130 * # this is required so e.g. a list of char can be compared to a string
7131 */
7132 __pyx_t_6 = __pyx_v_s_proc.length;
7133 __pyx_t_7 = __pyx_t_6;
7134 for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
7135 __pyx_v_i = __pyx_t_8;
7136
7137 /* "cpp_common.pxd":86
7138 * s_proc.kind = RAPIDFUZZ_UINT64
7139 * for i in range(s_proc.length):
7140 * elem = seq[i] # <<<<<<<<<<<<<<
7141 * # this is required so e.g. a list of char can be compared to a string
7142 * if isinstance(elem, str) and len(elem) == 1:
7143 */
7144 __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)
7145 __Pyx_GOTREF(__pyx_t_9);
7146 __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_9);
7147 __pyx_t_9 = 0;
7148
7149 /* "cpp_common.pxd":88
7150 * elem = seq[i]
7151 * # this is required so e.g. a list of char can be compared to a string
7152 * if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
7153 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
7154 * else:
7155 */
7156 __pyx_t_10 = PyUnicode_Check(__pyx_v_elem);
7157 __pyx_t_11 = (__pyx_t_10 != 0);
7158 if (__pyx_t_11) {
7159 } else {
7160 __pyx_t_2 = __pyx_t_11;
7161 goto __pyx_L13_bool_binop_done;
7162 }
7163 __pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 88, __pyx_L4_error)
7164 __pyx_t_11 = ((__pyx_t_1 == 1) != 0);
7165 __pyx_t_2 = __pyx_t_11;
7166 __pyx_L13_bool_binop_done:;
7167 if (__pyx_t_2) {
7168
7169 /* "cpp_common.pxd":89
7170 * # this is required so e.g. a list of char can be compared to a string
7171 * if isinstance(elem, str) and len(elem) == 1:
7172 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem # <<<<<<<<<<<<<<
7173 * else:
7174 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
7175 */
7176 __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)
7177 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_12));
7178
7179 /* "cpp_common.pxd":88
7180 * elem = seq[i]
7181 * # this is required so e.g. a list of char can be compared to a string
7182 * if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
7183 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
7184 * else:
7185 */
7186 goto __pyx_L12;
7187 }
7188
7189 /* "cpp_common.pxd":91
7190 * (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
7191 * else:
7192 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem) # <<<<<<<<<<<<<<
7193 * except Exception as e:
7194 * free(s_proc.data)
7195 */
7196 /*else*/ {
7197 __pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 91, __pyx_L4_error)
7198 (((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_13);
7199 }
7200 __pyx_L12:;
7201 }
7202
7203 /* "cpp_common.pxd":83
7204 * raise MemoryError
7205 *
7206 * try: # <<<<<<<<<<<<<<
7207 * s_proc.kind = RAPIDFUZZ_UINT64
7208 * for i in range(s_proc.length):
7209 */
7210 }
7211 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7212 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7213 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7214 goto __pyx_L9_try_end;
7215 __pyx_L4_error:;
7216 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7217
7218 /* "cpp_common.pxd":92
7219 * else:
7220 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
7221 * except Exception as e: # <<<<<<<<<<<<<<
7222 * free(s_proc.data)
7223 * s_proc.data = NULL
7224 */
7225 __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7226 if (__pyx_t_14) {
7227 __Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
7228 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 92, __pyx_L6_except_error)
7229 __Pyx_GOTREF(__pyx_t_9);
7230 __Pyx_GOTREF(__pyx_t_15);
7231 __Pyx_GOTREF(__pyx_t_16);
7232 __Pyx_INCREF(__pyx_t_15);
7233 __pyx_v_e = __pyx_t_15;
7234 /*try:*/ {
7235
7236 /* "cpp_common.pxd":93
7237 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
7238 * except Exception as e:
7239 * free(s_proc.data) # <<<<<<<<<<<<<<
7240 * s_proc.data = NULL
7241 * raise
7242 */
7243 free(__pyx_v_s_proc.data);
7244
7245 /* "cpp_common.pxd":94
7246 * except Exception as e:
7247 * free(s_proc.data)
7248 * s_proc.data = NULL # <<<<<<<<<<<<<<
7249 * raise
7250 *
7251 */
7252 __pyx_v_s_proc.data = NULL;
7253
7254 /* "cpp_common.pxd":95
7255 * free(s_proc.data)
7256 * s_proc.data = NULL
7257 * raise # <<<<<<<<<<<<<<
7258 *
7259 * s_proc.allocated = True
7260 */
7261 __Pyx_GIVEREF(__pyx_t_9);
7262 __Pyx_GIVEREF(__pyx_t_15);
7263 __Pyx_XGIVEREF(__pyx_t_16);
7264 __Pyx_ErrRestoreWithState(__pyx_t_9, __pyx_t_15, __pyx_t_16);
7265 __pyx_t_9 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
7266 __PYX_ERR(1, 95, __pyx_L20_error)
7267 }
7268
7269 /* "cpp_common.pxd":92
7270 * else:
7271 * (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
7272 * except Exception as e: # <<<<<<<<<<<<<<
7273 * free(s_proc.data)
7274 * s_proc.data = NULL
7275 */
7276 /*finally:*/ {
7277 __pyx_L20_error:;
7278 /*exception exit:*/{
7279 __Pyx_PyThreadState_declare
7280 __Pyx_PyThreadState_assign
7281 __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
7282 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
7283 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);
7284 __Pyx_XGOTREF(__pyx_t_19);
7285 __Pyx_XGOTREF(__pyx_t_20);
7286 __Pyx_XGOTREF(__pyx_t_21);
7287 __Pyx_XGOTREF(__pyx_t_22);
7288 __Pyx_XGOTREF(__pyx_t_23);
7289 __Pyx_XGOTREF(__pyx_t_24);
7290 __pyx_t_14 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
7291 {
7292 __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
7293 }
7294 if (PY_MAJOR_VERSION >= 3) {
7295 __Pyx_XGIVEREF(__pyx_t_22);
7296 __Pyx_XGIVEREF(__pyx_t_23);
7297 __Pyx_XGIVEREF(__pyx_t_24);
7298 __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
7299 }
7300 __Pyx_XGIVEREF(__pyx_t_19);
7301 __Pyx_XGIVEREF(__pyx_t_20);
7302 __Pyx_XGIVEREF(__pyx_t_21);
7303 __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
7304 __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
7305 __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
7306 goto __pyx_L6_except_error;
7307 }
7308 }
7309 }
7310 goto __pyx_L6_except_error;
7311 __pyx_L6_except_error:;
7312
7313 /* "cpp_common.pxd":83
7314 * raise MemoryError
7315 *
7316 * try: # <<<<<<<<<<<<<<
7317 * s_proc.kind = RAPIDFUZZ_UINT64
7318 * for i in range(s_proc.length):
7319 */
7320 __Pyx_XGIVEREF(__pyx_t_3);
7321 __Pyx_XGIVEREF(__pyx_t_4);
7322 __Pyx_XGIVEREF(__pyx_t_5);
7323 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
7324 goto __pyx_L1_error;
7325 __pyx_L9_try_end:;
7326 }
7327
7328 /* "cpp_common.pxd":97
7329 * raise
7330 *
7331 * s_proc.allocated = True # <<<<<<<<<<<<<<
7332 * return move(s_proc)
7333 */
7334 __pyx_v_s_proc.allocated = 1;
7335
7336 /* "cpp_common.pxd":98
7337 *
7338 * s_proc.allocated = True
7339 * return move(s_proc) # <<<<<<<<<<<<<<
7340 */
7341 __pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
7342 goto __pyx_L0;
7343
7344 /* "cpp_common.pxd":74
7345 *
7346 *
7347 * cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
7348 * cdef proc_string s_proc
7349 * s_proc.length = <size_t>len(seq)
7350 */
7351
7352 /* function exit code */
7353 __pyx_L1_error:;
7354 __Pyx_XDECREF(__pyx_t_9);
7355 __Pyx_XDECREF(__pyx_t_15);
7356 __Pyx_XDECREF(__pyx_t_16);
7357 __Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
7358 __Pyx_pretend_to_initialize(&__pyx_r);
7359 __pyx_L0:;
7360 __Pyx_XDECREF(__pyx_v_elem);
7361 __Pyx_XDECREF(__pyx_v_e);
7362 __Pyx_RefNannyFinishContext();
7363 return __pyx_r;
7364 }
7365
7366 /* "EnumBase":13
7367 * @cython.internal
7368 * cdef class __Pyx_EnumMeta(type):
7369 * def __init__(cls, name, parents, dct): # <<<<<<<<<<<<<<
7370 * type.__init__(cls, name, parents, dct)
7371 * cls.__members__ = __Pyx_OrderedDict()
7372 */
7373
7374 /* Python wrapper */
7375 static int __pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__(PyObject * __pyx_v_cls,PyObject * __pyx_args,PyObject * __pyx_kwds)7376 static int __pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7377 PyObject *__pyx_v_name = 0;
7378 PyObject *__pyx_v_parents = 0;
7379 PyObject *__pyx_v_dct = 0;
7380 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7381 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
7382 int __pyx_lineno = 0;
7383 const char *__pyx_filename = NULL;
7384 int __pyx_clineno = 0;
7385 int __pyx_r;
7386 __Pyx_RefNannyDeclarations
7387 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
7388 {
7389 #if CYTHON_USE_MODULE_STATE
7390 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_parents,&__pyx_n_s_dct,0};
7391 #else
7392 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_parents,&__pyx_n_s_dct,0};
7393 #endif
7394 PyObject* values[3] = {0,0,0};
7395 if (__pyx_kwds) {
7396 Py_ssize_t kw_args;
7397 switch (__pyx_nargs) {
7398 case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
7399 CYTHON_FALLTHROUGH;
7400 case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
7401 CYTHON_FALLTHROUGH;
7402 case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
7403 CYTHON_FALLTHROUGH;
7404 case 0: break;
7405 default: goto __pyx_L5_argtuple_error;
7406 }
7407 kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
7408 switch (__pyx_nargs) {
7409 case 0:
7410 if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) kw_args--;
7411 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 13, __pyx_L3_error)
7412 else goto __pyx_L5_argtuple_error;
7413 CYTHON_FALLTHROUGH;
7414 case 1:
7415 if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_parents)) != 0)) kw_args--;
7416 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 13, __pyx_L3_error)
7417 else {
7418 __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(2, 13, __pyx_L3_error)
7419 }
7420 CYTHON_FALLTHROUGH;
7421 case 2:
7422 if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dct)) != 0)) kw_args--;
7423 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 13, __pyx_L3_error)
7424 else {
7425 __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(2, 13, __pyx_L3_error)
7426 }
7427 }
7428 if (unlikely(kw_args > 0)) {
7429 const Py_ssize_t kwd_pos_args = __pyx_nargs;
7430 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(2, 13, __pyx_L3_error)
7431 }
7432 } else if (unlikely(__pyx_nargs != 3)) {
7433 goto __pyx_L5_argtuple_error;
7434 } else {
7435 values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
7436 values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
7437 values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
7438 }
7439 __pyx_v_name = values[0];
7440 __pyx_v_parents = values[1];
7441 __pyx_v_dct = values[2];
7442 }
7443 goto __pyx_L4_argument_unpacking_done;
7444 __pyx_L5_argtuple_error:;
7445 __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(2, 13, __pyx_L3_error)
7446 __pyx_L3_error:;
7447 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7448 __Pyx_RefNannyFinishContext();
7449 return -1;
7450 __pyx_L4_argument_unpacking_done:;
7451 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_cls), __pyx_v_name, __pyx_v_parents, __pyx_v_dct);
7452
7453 /* function exit code */
7454 __Pyx_RefNannyFinishContext();
7455 return __pyx_r;
7456 }
7457
__pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(struct __pyx_obj___Pyx_EnumMeta * __pyx_v_cls,PyObject * __pyx_v_name,PyObject * __pyx_v_parents,PyObject * __pyx_v_dct)7458 static int __pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_parents, PyObject *__pyx_v_dct) {
7459 int __pyx_r;
7460 __Pyx_RefNannyDeclarations
7461 PyObject *__pyx_t_1 = NULL;
7462 PyObject *__pyx_t_2 = NULL;
7463 PyObject *__pyx_t_3 = NULL;
7464 int __pyx_t_4;
7465 int __pyx_lineno = 0;
7466 const char *__pyx_filename = NULL;
7467 int __pyx_clineno = 0;
7468 __Pyx_RefNannySetupContext("__init__", 0);
7469
7470 /* "EnumBase":14
7471 * cdef class __Pyx_EnumMeta(type):
7472 * def __init__(cls, name, parents, dct):
7473 * type.__init__(cls, name, parents, dct) # <<<<<<<<<<<<<<
7474 * cls.__members__ = __Pyx_OrderedDict()
7475 * def __iter__(cls):
7476 */
7477 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyType_Type)), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 14, __pyx_L1_error)
7478 __Pyx_GOTREF(__pyx_t_2);
7479 __pyx_t_3 = NULL;
7480 __pyx_t_4 = 0;
7481 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7482 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7483 if (likely(__pyx_t_3)) {
7484 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7485 __Pyx_INCREF(__pyx_t_3);
7486 __Pyx_INCREF(function);
7487 __Pyx_DECREF_SET(__pyx_t_2, function);
7488 __pyx_t_4 = 1;
7489 }
7490 }
7491 {
7492 PyObject *__pyx_callargs[5] = {__pyx_t_3, ((PyObject *)__pyx_v_cls), __pyx_v_name, __pyx_v_parents, __pyx_v_dct};
7493 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4);
7494 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7495 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
7496 __Pyx_GOTREF(__pyx_t_1);
7497 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7498 }
7499 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7500
7501 /* "EnumBase":15
7502 * def __init__(cls, name, parents, dct):
7503 * type.__init__(cls, name, parents, dct)
7504 * cls.__members__ = __Pyx_OrderedDict() # <<<<<<<<<<<<<<
7505 * def __iter__(cls):
7506 * return iter(cls.__members__.values())
7507 */
7508 __Pyx_INCREF(__Pyx_OrderedDict);
7509 __pyx_t_2 = __Pyx_OrderedDict; __pyx_t_3 = NULL;
7510 __pyx_t_4 = 0;
7511 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7512 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7513 if (likely(__pyx_t_3)) {
7514 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7515 __Pyx_INCREF(__pyx_t_3);
7516 __Pyx_INCREF(function);
7517 __Pyx_DECREF_SET(__pyx_t_2, function);
7518 __pyx_t_4 = 1;
7519 }
7520 }
7521 {
7522 PyObject *__pyx_callargs[1] = {__pyx_t_3, };
7523 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
7524 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7525 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
7526 __Pyx_GOTREF(__pyx_t_1);
7527 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7528 }
7529 if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_members, __pyx_t_1) < 0) __PYX_ERR(2, 15, __pyx_L1_error)
7530 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7531
7532 /* "EnumBase":13
7533 * @cython.internal
7534 * cdef class __Pyx_EnumMeta(type):
7535 * def __init__(cls, name, parents, dct): # <<<<<<<<<<<<<<
7536 * type.__init__(cls, name, parents, dct)
7537 * cls.__members__ = __Pyx_OrderedDict()
7538 */
7539
7540 /* function exit code */
7541 __pyx_r = 0;
7542 goto __pyx_L0;
7543 __pyx_L1_error:;
7544 __Pyx_XDECREF(__pyx_t_1);
7545 __Pyx_XDECREF(__pyx_t_2);
7546 __Pyx_XDECREF(__pyx_t_3);
7547 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7548 __pyx_r = -1;
7549 __pyx_L0:;
7550 __Pyx_RefNannyFinishContext();
7551 return __pyx_r;
7552 }
7553
7554 /* "EnumBase":16
7555 * type.__init__(cls, name, parents, dct)
7556 * cls.__members__ = __Pyx_OrderedDict()
7557 * def __iter__(cls): # <<<<<<<<<<<<<<
7558 * return iter(cls.__members__.values())
7559 * def __getitem__(cls, name):
7560 */
7561
7562 /* Python wrapper */
7563 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__(PyObject *__pyx_v_cls); /*proto*/
__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__(PyObject * __pyx_v_cls)7564 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__(PyObject *__pyx_v_cls) {
7565 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
7566 PyObject *__pyx_r = 0;
7567 __Pyx_RefNannyDeclarations
7568 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
7569 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_cls));
7570
7571 /* function exit code */
7572 __Pyx_RefNannyFinishContext();
7573 return __pyx_r;
7574 }
7575
__pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(struct __pyx_obj___Pyx_EnumMeta * __pyx_v_cls)7576 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls) {
7577 PyObject *__pyx_r = NULL;
7578 __Pyx_RefNannyDeclarations
7579 PyObject *__pyx_t_1 = NULL;
7580 PyObject *__pyx_t_2 = NULL;
7581 PyObject *__pyx_t_3 = NULL;
7582 int __pyx_t_4;
7583 int __pyx_lineno = 0;
7584 const char *__pyx_filename = NULL;
7585 int __pyx_clineno = 0;
7586 __Pyx_RefNannySetupContext("__iter__", 0);
7587
7588 /* "EnumBase":17
7589 * cls.__members__ = __Pyx_OrderedDict()
7590 * def __iter__(cls):
7591 * return iter(cls.__members__.values()) # <<<<<<<<<<<<<<
7592 * def __getitem__(cls, name):
7593 * return cls.__members__[name]
7594 */
7595 __Pyx_XDECREF(__pyx_r);
7596 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_members); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 17, __pyx_L1_error)
7597 __Pyx_GOTREF(__pyx_t_2);
7598 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 17, __pyx_L1_error)
7599 __Pyx_GOTREF(__pyx_t_3);
7600 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7601 __pyx_t_2 = NULL;
7602 __pyx_t_4 = 0;
7603 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7604 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
7605 if (likely(__pyx_t_2)) {
7606 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7607 __Pyx_INCREF(__pyx_t_2);
7608 __Pyx_INCREF(function);
7609 __Pyx_DECREF_SET(__pyx_t_3, function);
7610 __pyx_t_4 = 1;
7611 }
7612 }
7613 {
7614 PyObject *__pyx_callargs[1] = {__pyx_t_2, };
7615 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
7616 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7617 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
7618 __Pyx_GOTREF(__pyx_t_1);
7619 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7620 }
7621 __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 17, __pyx_L1_error)
7622 __Pyx_GOTREF(__pyx_t_3);
7623 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7624 __pyx_r = __pyx_t_3;
7625 __pyx_t_3 = 0;
7626 goto __pyx_L0;
7627
7628 /* "EnumBase":16
7629 * type.__init__(cls, name, parents, dct)
7630 * cls.__members__ = __Pyx_OrderedDict()
7631 * def __iter__(cls): # <<<<<<<<<<<<<<
7632 * return iter(cls.__members__.values())
7633 * def __getitem__(cls, name):
7634 */
7635
7636 /* function exit code */
7637 __pyx_L1_error:;
7638 __Pyx_XDECREF(__pyx_t_1);
7639 __Pyx_XDECREF(__pyx_t_2);
7640 __Pyx_XDECREF(__pyx_t_3);
7641 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7642 __pyx_r = NULL;
7643 __pyx_L0:;
7644 __Pyx_XGIVEREF(__pyx_r);
7645 __Pyx_RefNannyFinishContext();
7646 return __pyx_r;
7647 }
7648
7649 /* "EnumBase":18
7650 * def __iter__(cls):
7651 * return iter(cls.__members__.values())
7652 * def __getitem__(cls, name): # <<<<<<<<<<<<<<
7653 * return cls.__members__[name]
7654 *
7655 */
7656
7657 /* Python wrapper */
7658 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__(PyObject *__pyx_v_cls, PyObject *__pyx_v_name); /*proto*/
__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__(PyObject * __pyx_v_cls,PyObject * __pyx_v_name)7659 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__(PyObject *__pyx_v_cls, PyObject *__pyx_v_name) {
7660 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
7661 PyObject *__pyx_r = 0;
7662 __Pyx_RefNannyDeclarations
7663 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
7664 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_cls), ((PyObject *)__pyx_v_name));
7665
7666 /* function exit code */
7667 __Pyx_RefNannyFinishContext();
7668 return __pyx_r;
7669 }
7670
__pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(struct __pyx_obj___Pyx_EnumMeta * __pyx_v_cls,PyObject * __pyx_v_name)7671 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name) {
7672 PyObject *__pyx_r = NULL;
7673 __Pyx_RefNannyDeclarations
7674 PyObject *__pyx_t_1 = NULL;
7675 PyObject *__pyx_t_2 = NULL;
7676 int __pyx_lineno = 0;
7677 const char *__pyx_filename = NULL;
7678 int __pyx_clineno = 0;
7679 __Pyx_RefNannySetupContext("__getitem__", 0);
7680
7681 /* "EnumBase":19
7682 * return iter(cls.__members__.values())
7683 * def __getitem__(cls, name):
7684 * return cls.__members__[name] # <<<<<<<<<<<<<<
7685 *
7686 *
7687 */
7688 __Pyx_XDECREF(__pyx_r);
7689 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_members); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error)
7690 __Pyx_GOTREF(__pyx_t_1);
7691 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 19, __pyx_L1_error)
7692 __Pyx_GOTREF(__pyx_t_2);
7693 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7694 __pyx_r = __pyx_t_2;
7695 __pyx_t_2 = 0;
7696 goto __pyx_L0;
7697
7698 /* "EnumBase":18
7699 * def __iter__(cls):
7700 * return iter(cls.__members__.values())
7701 * def __getitem__(cls, name): # <<<<<<<<<<<<<<
7702 * return cls.__members__[name]
7703 *
7704 */
7705
7706 /* function exit code */
7707 __pyx_L1_error:;
7708 __Pyx_XDECREF(__pyx_t_1);
7709 __Pyx_XDECREF(__pyx_t_2);
7710 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7711 __pyx_r = NULL;
7712 __pyx_L0:;
7713 __Pyx_XGIVEREF(__pyx_r);
7714 __Pyx_RefNannyFinishContext();
7715 return __pyx_r;
7716 }
7717
7718 /* "(tree fragment)":1
7719 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
7720 * cdef tuple state
7721 * cdef object _dict
7722 */
7723
7724 /* Python wrapper */
7725 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__(PyObject *__pyx_v_self,
7726 #if CYTHON_METH_FASTCALL
7727 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7728 #else
7729 PyObject *__pyx_args, PyObject *__pyx_kwds
7730 #endif
7731 ); /*proto*/
7732 static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__(PyObject * __pyx_v_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)7733 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__(PyObject *__pyx_v_self,
7734 #if CYTHON_METH_FASTCALL
7735 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7736 #else
7737 PyObject *__pyx_args, PyObject *__pyx_kwds
7738 #endif
7739 ) {
7740 #if !CYTHON_METH_FASTCALL
7741 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7742 #endif
7743 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7744 PyObject *__pyx_r = 0;
7745 __Pyx_RefNannyDeclarations
7746 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
7747 if (unlikely(__pyx_nargs > 0)) {
7748 __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
7749 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
7750 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_self));
7751
7752 /* function exit code */
7753 __Pyx_RefNannyFinishContext();
7754 return __pyx_r;
7755 }
7756
__pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(struct __pyx_obj___Pyx_EnumMeta * __pyx_v_self)7757 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self) {
7758 PyObject *__pyx_v_state = 0;
7759 PyObject *__pyx_v__dict = 0;
7760 int __pyx_v_use_setstate;
7761 PyObject *__pyx_r = NULL;
7762 __Pyx_RefNannyDeclarations
7763 PyObject *__pyx_t_1 = NULL;
7764 int __pyx_t_2;
7765 int __pyx_t_3;
7766 PyObject *__pyx_t_4 = NULL;
7767 PyObject *__pyx_t_5 = NULL;
7768 int __pyx_lineno = 0;
7769 const char *__pyx_filename = NULL;
7770 int __pyx_clineno = 0;
7771 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
7772
7773 /* "(tree fragment)":5
7774 * cdef object _dict
7775 * cdef bint use_setstate
7776 * state = () # <<<<<<<<<<<<<<
7777 * _dict = getattr(self, '__dict__', None)
7778 * if _dict is not None:
7779 */
7780 __Pyx_INCREF(__pyx_empty_tuple);
7781 __pyx_v_state = __pyx_empty_tuple;
7782
7783 /* "(tree fragment)":6
7784 * cdef bint use_setstate
7785 * state = ()
7786 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
7787 * if _dict is not None:
7788 * state += (_dict,)
7789 */
7790 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
7791 __Pyx_GOTREF(__pyx_t_1);
7792 __pyx_v__dict = __pyx_t_1;
7793 __pyx_t_1 = 0;
7794
7795 /* "(tree fragment)":7
7796 * state = ()
7797 * _dict = getattr(self, '__dict__', None)
7798 * if _dict is not None: # <<<<<<<<<<<<<<
7799 * state += (_dict,)
7800 * use_setstate = True
7801 */
7802 __pyx_t_2 = (__pyx_v__dict != Py_None);
7803 __pyx_t_3 = (__pyx_t_2 != 0);
7804 if (__pyx_t_3) {
7805
7806 /* "(tree fragment)":8
7807 * _dict = getattr(self, '__dict__', None)
7808 * if _dict is not None:
7809 * state += (_dict,) # <<<<<<<<<<<<<<
7810 * use_setstate = True
7811 * else:
7812 */
7813 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
7814 __Pyx_GOTREF(__pyx_t_1);
7815 __Pyx_INCREF(__pyx_v__dict);
7816 __Pyx_GIVEREF(__pyx_v__dict);
7817 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
7818 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
7819 __Pyx_GOTREF(__pyx_t_4);
7820 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7821 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
7822 __pyx_t_4 = 0;
7823
7824 /* "(tree fragment)":9
7825 * if _dict is not None:
7826 * state += (_dict,)
7827 * use_setstate = True # <<<<<<<<<<<<<<
7828 * else:
7829 * use_setstate = False
7830 */
7831 __pyx_v_use_setstate = 1;
7832
7833 /* "(tree fragment)":7
7834 * state = ()
7835 * _dict = getattr(self, '__dict__', None)
7836 * if _dict is not None: # <<<<<<<<<<<<<<
7837 * state += (_dict,)
7838 * use_setstate = True
7839 */
7840 goto __pyx_L3;
7841 }
7842
7843 /* "(tree fragment)":11
7844 * use_setstate = True
7845 * else:
7846 * use_setstate = False # <<<<<<<<<<<<<<
7847 * if use_setstate:
7848 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, None), state
7849 */
7850 /*else*/ {
7851 __pyx_v_use_setstate = 0;
7852 }
7853 __pyx_L3:;
7854
7855 /* "(tree fragment)":12
7856 * else:
7857 * use_setstate = False
7858 * if use_setstate: # <<<<<<<<<<<<<<
7859 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, None), state
7860 * else:
7861 */
7862 __pyx_t_3 = (__pyx_v_use_setstate != 0);
7863 if (__pyx_t_3) {
7864
7865 /* "(tree fragment)":13
7866 * use_setstate = False
7867 * if use_setstate:
7868 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, None), state # <<<<<<<<<<<<<<
7869 * else:
7870 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state)
7871 */
7872 __Pyx_XDECREF(__pyx_r);
7873 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
7874 __Pyx_GOTREF(__pyx_t_4);
7875 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
7876 __Pyx_GOTREF(__pyx_t_1);
7877 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7878 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7879 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7880 __Pyx_INCREF(__pyx_int_228825662);
7881 __Pyx_GIVEREF(__pyx_int_228825662);
7882 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_228825662);
7883 __Pyx_INCREF(Py_None);
7884 __Pyx_GIVEREF(Py_None);
7885 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
7886 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
7887 __Pyx_GOTREF(__pyx_t_5);
7888 __Pyx_GIVEREF(__pyx_t_4);
7889 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
7890 __Pyx_GIVEREF(__pyx_t_1);
7891 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
7892 __Pyx_INCREF(__pyx_v_state);
7893 __Pyx_GIVEREF(__pyx_v_state);
7894 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
7895 __pyx_t_4 = 0;
7896 __pyx_t_1 = 0;
7897 __pyx_r = __pyx_t_5;
7898 __pyx_t_5 = 0;
7899 goto __pyx_L0;
7900
7901 /* "(tree fragment)":12
7902 * else:
7903 * use_setstate = False
7904 * if use_setstate: # <<<<<<<<<<<<<<
7905 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, None), state
7906 * else:
7907 */
7908 }
7909
7910 /* "(tree fragment)":15
7911 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, None), state
7912 * else:
7913 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state) # <<<<<<<<<<<<<<
7914 * def __setstate_cython__(self, __pyx_state):
7915 * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state)
7916 */
7917 /*else*/ {
7918 __Pyx_XDECREF(__pyx_r);
7919 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
7920 __Pyx_GOTREF(__pyx_t_5);
7921 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
7922 __Pyx_GOTREF(__pyx_t_1);
7923 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7924 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7925 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7926 __Pyx_INCREF(__pyx_int_228825662);
7927 __Pyx_GIVEREF(__pyx_int_228825662);
7928 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_228825662);
7929 __Pyx_INCREF(__pyx_v_state);
7930 __Pyx_GIVEREF(__pyx_v_state);
7931 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
7932 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
7933 __Pyx_GOTREF(__pyx_t_4);
7934 __Pyx_GIVEREF(__pyx_t_5);
7935 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
7936 __Pyx_GIVEREF(__pyx_t_1);
7937 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
7938 __pyx_t_5 = 0;
7939 __pyx_t_1 = 0;
7940 __pyx_r = __pyx_t_4;
7941 __pyx_t_4 = 0;
7942 goto __pyx_L0;
7943 }
7944
7945 /* "(tree fragment)":1
7946 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
7947 * cdef tuple state
7948 * cdef object _dict
7949 */
7950
7951 /* function exit code */
7952 __pyx_L1_error:;
7953 __Pyx_XDECREF(__pyx_t_1);
7954 __Pyx_XDECREF(__pyx_t_4);
7955 __Pyx_XDECREF(__pyx_t_5);
7956 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7957 __pyx_r = NULL;
7958 __pyx_L0:;
7959 __Pyx_XDECREF(__pyx_v_state);
7960 __Pyx_XDECREF(__pyx_v__dict);
7961 __Pyx_XGIVEREF(__pyx_r);
7962 __Pyx_RefNannyFinishContext();
7963 return __pyx_r;
7964 }
7965
7966 /* "(tree fragment)":16
7967 * else:
7968 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state)
7969 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
7970 * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state)
7971 */
7972
7973 /* Python wrapper */
7974 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__(PyObject *__pyx_v_self,
7975 #if CYTHON_METH_FASTCALL
7976 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7977 #else
7978 PyObject *__pyx_args, PyObject *__pyx_kwds
7979 #endif
7980 ); /*proto*/
7981 static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)7982 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__(PyObject *__pyx_v_self,
7983 #if CYTHON_METH_FASTCALL
7984 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7985 #else
7986 PyObject *__pyx_args, PyObject *__pyx_kwds
7987 #endif
7988 ) {
7989 PyObject *__pyx_v___pyx_state = 0;
7990 #if !CYTHON_METH_FASTCALL
7991 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7992 #endif
7993 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7994 int __pyx_lineno = 0;
7995 const char *__pyx_filename = NULL;
7996 int __pyx_clineno = 0;
7997 PyObject *__pyx_r = 0;
7998 __Pyx_RefNannyDeclarations
7999 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8000 {
8001 #if CYTHON_USE_MODULE_STATE
8002 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
8003 #else
8004 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
8005 #endif
8006 PyObject* values[1] = {0};
8007 if (__pyx_kwds) {
8008 Py_ssize_t kw_args;
8009 switch (__pyx_nargs) {
8010 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8011 CYTHON_FALLTHROUGH;
8012 case 0: break;
8013 default: goto __pyx_L5_argtuple_error;
8014 }
8015 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8016 switch (__pyx_nargs) {
8017 case 0:
8018 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--;
8019 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 16, __pyx_L3_error)
8020 else goto __pyx_L5_argtuple_error;
8021 }
8022 if (unlikely(kw_args > 0)) {
8023 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8024 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(2, 16, __pyx_L3_error)
8025 }
8026 } else if (unlikely(__pyx_nargs != 1)) {
8027 goto __pyx_L5_argtuple_error;
8028 } else {
8029 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8030 }
8031 __pyx_v___pyx_state = values[0];
8032 }
8033 goto __pyx_L4_argument_unpacking_done;
8034 __pyx_L5_argtuple_error:;
8035 __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 16, __pyx_L3_error)
8036 __pyx_L3_error:;
8037 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8038 __Pyx_RefNannyFinishContext();
8039 return NULL;
8040 __pyx_L4_argument_unpacking_done:;
8041 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_self), __pyx_v___pyx_state);
8042
8043 /* function exit code */
8044 __Pyx_RefNannyFinishContext();
8045 return __pyx_r;
8046 }
8047
__pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(struct __pyx_obj___Pyx_EnumMeta * __pyx_v_self,PyObject * __pyx_v___pyx_state)8048 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8049 PyObject *__pyx_r = NULL;
8050 __Pyx_RefNannyDeclarations
8051 PyObject *__pyx_t_1 = NULL;
8052 int __pyx_lineno = 0;
8053 const char *__pyx_filename = NULL;
8054 int __pyx_clineno = 0;
8055 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8056
8057 /* "(tree fragment)":17
8058 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state)
8059 * def __setstate_cython__(self, __pyx_state):
8060 * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
8061 */
8062 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(2, 17, __pyx_L1_error)
8063 __pyx_t_1 = __pyx_unpickle___Pyx_EnumMeta__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
8064 __Pyx_GOTREF(__pyx_t_1);
8065 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8066
8067 /* "(tree fragment)":16
8068 * else:
8069 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state)
8070 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8071 * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state)
8072 */
8073
8074 /* function exit code */
8075 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8076 goto __pyx_L0;
8077 __pyx_L1_error:;
8078 __Pyx_XDECREF(__pyx_t_1);
8079 __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8080 __pyx_r = NULL;
8081 __pyx_L0:;
8082 __Pyx_XGIVEREF(__pyx_r);
8083 __Pyx_RefNannyFinishContext();
8084 return __pyx_r;
8085 }
8086
8087 /* "EnumBase":24
8088 * cdef object __Pyx_EnumBase
8089 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta):
8090 * def __new__(cls, value, name=None): # <<<<<<<<<<<<<<
8091 * for v in cls:
8092 * if v == value:
8093 */
8094
8095 /* Python wrapper */
8096 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__(PyObject *__pyx_self,
8097 #if CYTHON_METH_FASTCALL
8098 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8099 #else
8100 PyObject *__pyx_args, PyObject *__pyx_kwds
8101 #endif
8102 ); /*proto*/
8103 static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumBase_1__new__ = {"__new__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)8104 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__(PyObject *__pyx_self,
8105 #if CYTHON_METH_FASTCALL
8106 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8107 #else
8108 PyObject *__pyx_args, PyObject *__pyx_kwds
8109 #endif
8110 ) {
8111 PyObject *__pyx_v_cls = 0;
8112 PyObject *__pyx_v_value = 0;
8113 PyObject *__pyx_v_name = 0;
8114 #if !CYTHON_METH_FASTCALL
8115 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8116 #endif
8117 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8118 int __pyx_lineno = 0;
8119 const char *__pyx_filename = NULL;
8120 int __pyx_clineno = 0;
8121 PyObject *__pyx_r = 0;
8122 __Pyx_RefNannyDeclarations
8123 __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
8124 {
8125 #if CYTHON_USE_MODULE_STATE
8126 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,&__pyx_n_s_name,0};
8127 #else
8128 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,&__pyx_n_s_name,0};
8129 #endif
8130 PyObject* values[3] = {0,0,0};
8131 values[2] = ((PyObject *)((PyObject *)Py_None));
8132 if (__pyx_kwds) {
8133 Py_ssize_t kw_args;
8134 switch (__pyx_nargs) {
8135 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
8136 CYTHON_FALLTHROUGH;
8137 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
8138 CYTHON_FALLTHROUGH;
8139 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8140 CYTHON_FALLTHROUGH;
8141 case 0: break;
8142 default: goto __pyx_L5_argtuple_error;
8143 }
8144 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8145 switch (__pyx_nargs) {
8146 case 0:
8147 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cls)) != 0)) kw_args--;
8148 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 24, __pyx_L3_error)
8149 else goto __pyx_L5_argtuple_error;
8150 CYTHON_FALLTHROUGH;
8151 case 1:
8152 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) kw_args--;
8153 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 24, __pyx_L3_error)
8154 else {
8155 __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, 1); __PYX_ERR(2, 24, __pyx_L3_error)
8156 }
8157 CYTHON_FALLTHROUGH;
8158 case 2:
8159 if (kw_args > 0) {
8160 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name);
8161 if (value) { values[2] = value; kw_args--; }
8162 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 24, __pyx_L3_error)
8163 }
8164 }
8165 if (unlikely(kw_args > 0)) {
8166 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8167 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__new__") < 0)) __PYX_ERR(2, 24, __pyx_L3_error)
8168 }
8169 } else {
8170 switch (__pyx_nargs) {
8171 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
8172 CYTHON_FALLTHROUGH;
8173 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
8174 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8175 break;
8176 default: goto __pyx_L5_argtuple_error;
8177 }
8178 }
8179 __pyx_v_cls = values[0];
8180 __pyx_v_value = values[1];
8181 __pyx_v_name = values[2];
8182 }
8183 goto __pyx_L4_argument_unpacking_done;
8184 __pyx_L5_argtuple_error:;
8185 __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, __pyx_nargs); __PYX_ERR(2, 24, __pyx_L3_error)
8186 __pyx_L3_error:;
8187 __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8188 __Pyx_RefNannyFinishContext();
8189 return NULL;
8190 __pyx_L4_argument_unpacking_done:;
8191 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(__pyx_self, __pyx_v_cls, __pyx_v_value, __pyx_v_name);
8192
8193 /* function exit code */
8194 __Pyx_RefNannyFinishContext();
8195 return __pyx_r;
8196 }
8197
__pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_cls,PyObject * __pyx_v_value,PyObject * __pyx_v_name)8198 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value, PyObject *__pyx_v_name) {
8199 PyObject *__pyx_v_v = NULL;
8200 PyObject *__pyx_v_res = NULL;
8201 PyObject *__pyx_r = NULL;
8202 __Pyx_RefNannyDeclarations
8203 PyObject *__pyx_t_1 = NULL;
8204 Py_ssize_t __pyx_t_2;
8205 PyObject *(*__pyx_t_3)(PyObject *);
8206 PyObject *__pyx_t_4 = NULL;
8207 int __pyx_t_5;
8208 int __pyx_t_6;
8209 PyObject *__pyx_t_7 = NULL;
8210 int __pyx_t_8;
8211 int __pyx_t_9;
8212 int __pyx_lineno = 0;
8213 const char *__pyx_filename = NULL;
8214 int __pyx_clineno = 0;
8215 __Pyx_RefNannySetupContext("__new__", 0);
8216
8217 /* "EnumBase":25
8218 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta):
8219 * def __new__(cls, value, name=None):
8220 * for v in cls: # <<<<<<<<<<<<<<
8221 * if v == value:
8222 * return v
8223 */
8224 if (likely(PyList_CheckExact(__pyx_v_cls)) || PyTuple_CheckExact(__pyx_v_cls)) {
8225 __pyx_t_1 = __pyx_v_cls; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
8226 __pyx_t_3 = NULL;
8227 } else {
8228 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_cls); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 25, __pyx_L1_error)
8229 __Pyx_GOTREF(__pyx_t_1);
8230 __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 25, __pyx_L1_error)
8231 }
8232 for (;;) {
8233 if (likely(!__pyx_t_3)) {
8234 if (likely(PyList_CheckExact(__pyx_t_1))) {
8235 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
8236 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8237 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(2, 25, __pyx_L1_error)
8238 #else
8239 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 25, __pyx_L1_error)
8240 __Pyx_GOTREF(__pyx_t_4);
8241 #endif
8242 } else {
8243 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
8244 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8245 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(2, 25, __pyx_L1_error)
8246 #else
8247 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 25, __pyx_L1_error)
8248 __Pyx_GOTREF(__pyx_t_4);
8249 #endif
8250 }
8251 } else {
8252 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
8253 if (unlikely(!__pyx_t_4)) {
8254 PyObject* exc_type = PyErr_Occurred();
8255 if (exc_type) {
8256 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8257 else __PYX_ERR(2, 25, __pyx_L1_error)
8258 }
8259 break;
8260 }
8261 __Pyx_GOTREF(__pyx_t_4);
8262 }
8263 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
8264 __pyx_t_4 = 0;
8265
8266 /* "EnumBase":26
8267 * def __new__(cls, value, name=None):
8268 * for v in cls:
8269 * if v == value: # <<<<<<<<<<<<<<
8270 * return v
8271 * if name is None:
8272 */
8273 __pyx_t_4 = PyObject_RichCompare(__pyx_v_v, __pyx_v_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 26, __pyx_L1_error)
8274 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(2, 26, __pyx_L1_error)
8275 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8276 if (__pyx_t_5) {
8277
8278 /* "EnumBase":27
8279 * for v in cls:
8280 * if v == value:
8281 * return v # <<<<<<<<<<<<<<
8282 * if name is None:
8283 * raise ValueError("Unknown enum value: '%s'" % value)
8284 */
8285 __Pyx_XDECREF(__pyx_r);
8286 __Pyx_INCREF(__pyx_v_v);
8287 __pyx_r = __pyx_v_v;
8288 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8289 goto __pyx_L0;
8290
8291 /* "EnumBase":26
8292 * def __new__(cls, value, name=None):
8293 * for v in cls:
8294 * if v == value: # <<<<<<<<<<<<<<
8295 * return v
8296 * if name is None:
8297 */
8298 }
8299
8300 /* "EnumBase":25
8301 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta):
8302 * def __new__(cls, value, name=None):
8303 * for v in cls: # <<<<<<<<<<<<<<
8304 * if v == value:
8305 * return v
8306 */
8307 }
8308 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8309
8310 /* "EnumBase":28
8311 * if v == value:
8312 * return v
8313 * if name is None: # <<<<<<<<<<<<<<
8314 * raise ValueError("Unknown enum value: '%s'" % value)
8315 * res = int.__new__(cls, value)
8316 */
8317 __pyx_t_5 = (__pyx_v_name == Py_None);
8318 __pyx_t_6 = (__pyx_t_5 != 0);
8319 if (unlikely(__pyx_t_6)) {
8320
8321 /* "EnumBase":29
8322 * return v
8323 * if name is None:
8324 * raise ValueError("Unknown enum value: '%s'" % value) # <<<<<<<<<<<<<<
8325 * res = int.__new__(cls, value)
8326 * res.name = name
8327 */
8328 __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_enum_value_s, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 29, __pyx_L1_error)
8329 __Pyx_GOTREF(__pyx_t_1);
8330 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 29, __pyx_L1_error)
8331 __Pyx_GOTREF(__pyx_t_4);
8332 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8333 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8334 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8335 __PYX_ERR(2, 29, __pyx_L1_error)
8336
8337 /* "EnumBase":28
8338 * if v == value:
8339 * return v
8340 * if name is None: # <<<<<<<<<<<<<<
8341 * raise ValueError("Unknown enum value: '%s'" % value)
8342 * res = int.__new__(cls, value)
8343 */
8344 }
8345
8346 /* "EnumBase":30
8347 * if name is None:
8348 * raise ValueError("Unknown enum value: '%s'" % value)
8349 * res = int.__new__(cls, value) # <<<<<<<<<<<<<<
8350 * res.name = name
8351 * setattr(cls, name, res)
8352 */
8353 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyInt_Type)), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 30, __pyx_L1_error)
8354 __Pyx_GOTREF(__pyx_t_1);
8355 __pyx_t_7 = NULL;
8356 __pyx_t_8 = 0;
8357 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
8358 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
8359 if (likely(__pyx_t_7)) {
8360 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8361 __Pyx_INCREF(__pyx_t_7);
8362 __Pyx_INCREF(function);
8363 __Pyx_DECREF_SET(__pyx_t_1, function);
8364 __pyx_t_8 = 1;
8365 }
8366 }
8367 {
8368 PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_cls, __pyx_v_value};
8369 __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8);
8370 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8371 if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 30, __pyx_L1_error)
8372 __Pyx_GOTREF(__pyx_t_4);
8373 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8374 }
8375 __pyx_v_res = __pyx_t_4;
8376 __pyx_t_4 = 0;
8377
8378 /* "EnumBase":31
8379 * raise ValueError("Unknown enum value: '%s'" % value)
8380 * res = int.__new__(cls, value)
8381 * res.name = name # <<<<<<<<<<<<<<
8382 * setattr(cls, name, res)
8383 * cls.__members__[name] = res
8384 */
8385 if (__Pyx_PyObject_SetAttrStr(__pyx_v_res, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(2, 31, __pyx_L1_error)
8386
8387 /* "EnumBase":32
8388 * res = int.__new__(cls, value)
8389 * res.name = name
8390 * setattr(cls, name, res) # <<<<<<<<<<<<<<
8391 * cls.__members__[name] = res
8392 * return res
8393 */
8394 __pyx_t_9 = PyObject_SetAttr(__pyx_v_cls, __pyx_v_name, __pyx_v_res); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 32, __pyx_L1_error)
8395
8396 /* "EnumBase":33
8397 * res.name = name
8398 * setattr(cls, name, res)
8399 * cls.__members__[name] = res # <<<<<<<<<<<<<<
8400 * return res
8401 * def __repr__(self):
8402 */
8403 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_members); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 33, __pyx_L1_error)
8404 __Pyx_GOTREF(__pyx_t_4);
8405 if (unlikely((PyObject_SetItem(__pyx_t_4, __pyx_v_name, __pyx_v_res) < 0))) __PYX_ERR(2, 33, __pyx_L1_error)
8406 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8407
8408 /* "EnumBase":34
8409 * setattr(cls, name, res)
8410 * cls.__members__[name] = res
8411 * return res # <<<<<<<<<<<<<<
8412 * def __repr__(self):
8413 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
8414 */
8415 __Pyx_XDECREF(__pyx_r);
8416 __Pyx_INCREF(__pyx_v_res);
8417 __pyx_r = __pyx_v_res;
8418 goto __pyx_L0;
8419
8420 /* "EnumBase":24
8421 * cdef object __Pyx_EnumBase
8422 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta):
8423 * def __new__(cls, value, name=None): # <<<<<<<<<<<<<<
8424 * for v in cls:
8425 * if v == value:
8426 */
8427
8428 /* function exit code */
8429 __pyx_L1_error:;
8430 __Pyx_XDECREF(__pyx_t_1);
8431 __Pyx_XDECREF(__pyx_t_4);
8432 __Pyx_XDECREF(__pyx_t_7);
8433 __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8434 __pyx_r = NULL;
8435 __pyx_L0:;
8436 __Pyx_XDECREF(__pyx_v_v);
8437 __Pyx_XDECREF(__pyx_v_res);
8438 __Pyx_XGIVEREF(__pyx_r);
8439 __Pyx_RefNannyFinishContext();
8440 return __pyx_r;
8441 }
8442
8443 /* "EnumBase":35
8444 * cls.__members__[name] = res
8445 * return res
8446 * def __repr__(self): # <<<<<<<<<<<<<<
8447 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
8448 * def __str__(self):
8449 */
8450
8451 /* Python wrapper */
8452 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__(PyObject *__pyx_self,
8453 #if CYTHON_METH_FASTCALL
8454 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8455 #else
8456 PyObject *__pyx_args, PyObject *__pyx_kwds
8457 #endif
8458 ); /*proto*/
8459 static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumBase_3__repr__ = {"__repr__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)8460 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__(PyObject *__pyx_self,
8461 #if CYTHON_METH_FASTCALL
8462 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8463 #else
8464 PyObject *__pyx_args, PyObject *__pyx_kwds
8465 #endif
8466 ) {
8467 PyObject *__pyx_v_self = 0;
8468 #if !CYTHON_METH_FASTCALL
8469 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8470 #endif
8471 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8472 int __pyx_lineno = 0;
8473 const char *__pyx_filename = NULL;
8474 int __pyx_clineno = 0;
8475 PyObject *__pyx_r = 0;
8476 __Pyx_RefNannyDeclarations
8477 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
8478 {
8479 #if CYTHON_USE_MODULE_STATE
8480 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
8481 #else
8482 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
8483 #endif
8484 PyObject* values[1] = {0};
8485 if (__pyx_kwds) {
8486 Py_ssize_t kw_args;
8487 switch (__pyx_nargs) {
8488 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8489 CYTHON_FALLTHROUGH;
8490 case 0: break;
8491 default: goto __pyx_L5_argtuple_error;
8492 }
8493 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8494 switch (__pyx_nargs) {
8495 case 0:
8496 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) kw_args--;
8497 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 35, __pyx_L3_error)
8498 else goto __pyx_L5_argtuple_error;
8499 }
8500 if (unlikely(kw_args > 0)) {
8501 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8502 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__repr__") < 0)) __PYX_ERR(2, 35, __pyx_L3_error)
8503 }
8504 } else if (unlikely(__pyx_nargs != 1)) {
8505 goto __pyx_L5_argtuple_error;
8506 } else {
8507 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8508 }
8509 __pyx_v_self = values[0];
8510 }
8511 goto __pyx_L4_argument_unpacking_done;
8512 __pyx_L5_argtuple_error:;
8513 __Pyx_RaiseArgtupleInvalid("__repr__", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 35, __pyx_L3_error)
8514 __pyx_L3_error:;
8515 __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8516 __Pyx_RefNannyFinishContext();
8517 return NULL;
8518 __pyx_L4_argument_unpacking_done:;
8519 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(__pyx_self, __pyx_v_self);
8520
8521 /* function exit code */
8522 __Pyx_RefNannyFinishContext();
8523 return __pyx_r;
8524 }
8525
__pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self)8526 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
8527 PyObject *__pyx_r = NULL;
8528 __Pyx_RefNannyDeclarations
8529 PyObject *__pyx_t_1 = NULL;
8530 PyObject *__pyx_t_2 = NULL;
8531 PyObject *__pyx_t_3 = NULL;
8532 int __pyx_lineno = 0;
8533 const char *__pyx_filename = NULL;
8534 int __pyx_clineno = 0;
8535 __Pyx_RefNannySetupContext("__repr__", 0);
8536
8537 /* "EnumBase":36
8538 * return res
8539 * def __repr__(self):
8540 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) # <<<<<<<<<<<<<<
8541 * def __str__(self):
8542 * return "%s.%s" % (self.__class__.__name__, self.name)
8543 */
8544 __Pyx_XDECREF(__pyx_r);
8545 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 36, __pyx_L1_error)
8546 __Pyx_GOTREF(__pyx_t_1);
8547 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 36, __pyx_L1_error)
8548 __Pyx_GOTREF(__pyx_t_2);
8549 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8550 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 36, __pyx_L1_error)
8551 __Pyx_GOTREF(__pyx_t_1);
8552 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 36, __pyx_L1_error)
8553 __Pyx_GOTREF(__pyx_t_3);
8554 __Pyx_GIVEREF(__pyx_t_2);
8555 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
8556 __Pyx_GIVEREF(__pyx_t_1);
8557 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8558 __Pyx_INCREF(__pyx_v_self);
8559 __Pyx_GIVEREF(__pyx_v_self);
8560 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self);
8561 __pyx_t_2 = 0;
8562 __pyx_t_1 = 0;
8563 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_d, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 36, __pyx_L1_error)
8564 __Pyx_GOTREF(__pyx_t_1);
8565 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8566 __pyx_r = __pyx_t_1;
8567 __pyx_t_1 = 0;
8568 goto __pyx_L0;
8569
8570 /* "EnumBase":35
8571 * cls.__members__[name] = res
8572 * return res
8573 * def __repr__(self): # <<<<<<<<<<<<<<
8574 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
8575 * def __str__(self):
8576 */
8577
8578 /* function exit code */
8579 __pyx_L1_error:;
8580 __Pyx_XDECREF(__pyx_t_1);
8581 __Pyx_XDECREF(__pyx_t_2);
8582 __Pyx_XDECREF(__pyx_t_3);
8583 __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8584 __pyx_r = NULL;
8585 __pyx_L0:;
8586 __Pyx_XGIVEREF(__pyx_r);
8587 __Pyx_RefNannyFinishContext();
8588 return __pyx_r;
8589 }
8590
8591 /* "EnumBase":37
8592 * def __repr__(self):
8593 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
8594 * def __str__(self): # <<<<<<<<<<<<<<
8595 * return "%s.%s" % (self.__class__.__name__, self.name)
8596 *
8597 */
8598
8599 /* Python wrapper */
8600 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__(PyObject *__pyx_self,
8601 #if CYTHON_METH_FASTCALL
8602 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8603 #else
8604 PyObject *__pyx_args, PyObject *__pyx_kwds
8605 #endif
8606 ); /*proto*/
8607 static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumBase_5__str__ = {"__str__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)8608 static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__(PyObject *__pyx_self,
8609 #if CYTHON_METH_FASTCALL
8610 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8611 #else
8612 PyObject *__pyx_args, PyObject *__pyx_kwds
8613 #endif
8614 ) {
8615 PyObject *__pyx_v_self = 0;
8616 #if !CYTHON_METH_FASTCALL
8617 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8618 #endif
8619 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8620 int __pyx_lineno = 0;
8621 const char *__pyx_filename = NULL;
8622 int __pyx_clineno = 0;
8623 PyObject *__pyx_r = 0;
8624 __Pyx_RefNannyDeclarations
8625 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
8626 {
8627 #if CYTHON_USE_MODULE_STATE
8628 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
8629 #else
8630 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
8631 #endif
8632 PyObject* values[1] = {0};
8633 if (__pyx_kwds) {
8634 Py_ssize_t kw_args;
8635 switch (__pyx_nargs) {
8636 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8637 CYTHON_FALLTHROUGH;
8638 case 0: break;
8639 default: goto __pyx_L5_argtuple_error;
8640 }
8641 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8642 switch (__pyx_nargs) {
8643 case 0:
8644 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) kw_args--;
8645 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 37, __pyx_L3_error)
8646 else goto __pyx_L5_argtuple_error;
8647 }
8648 if (unlikely(kw_args > 0)) {
8649 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8650 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__str__") < 0)) __PYX_ERR(2, 37, __pyx_L3_error)
8651 }
8652 } else if (unlikely(__pyx_nargs != 1)) {
8653 goto __pyx_L5_argtuple_error;
8654 } else {
8655 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8656 }
8657 __pyx_v_self = values[0];
8658 }
8659 goto __pyx_L4_argument_unpacking_done;
8660 __pyx_L5_argtuple_error:;
8661 __Pyx_RaiseArgtupleInvalid("__str__", 1, 1, 1, __pyx_nargs); __PYX_ERR(2, 37, __pyx_L3_error)
8662 __pyx_L3_error:;
8663 __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8664 __Pyx_RefNannyFinishContext();
8665 return NULL;
8666 __pyx_L4_argument_unpacking_done:;
8667 __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(__pyx_self, __pyx_v_self);
8668
8669 /* function exit code */
8670 __Pyx_RefNannyFinishContext();
8671 return __pyx_r;
8672 }
8673
__pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self)8674 static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
8675 PyObject *__pyx_r = NULL;
8676 __Pyx_RefNannyDeclarations
8677 PyObject *__pyx_t_1 = NULL;
8678 PyObject *__pyx_t_2 = NULL;
8679 PyObject *__pyx_t_3 = NULL;
8680 int __pyx_lineno = 0;
8681 const char *__pyx_filename = NULL;
8682 int __pyx_clineno = 0;
8683 __Pyx_RefNannySetupContext("__str__", 0);
8684
8685 /* "EnumBase":38
8686 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
8687 * def __str__(self):
8688 * return "%s.%s" % (self.__class__.__name__, self.name) # <<<<<<<<<<<<<<
8689 *
8690 * if PY_VERSION_HEX >= 0x03040000:
8691 */
8692 __Pyx_XDECREF(__pyx_r);
8693 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
8694 __Pyx_GOTREF(__pyx_t_1);
8695 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 38, __pyx_L1_error)
8696 __Pyx_GOTREF(__pyx_t_2);
8697 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8698 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
8699 __Pyx_GOTREF(__pyx_t_1);
8700 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 38, __pyx_L1_error)
8701 __Pyx_GOTREF(__pyx_t_3);
8702 __Pyx_GIVEREF(__pyx_t_2);
8703 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
8704 __Pyx_GIVEREF(__pyx_t_1);
8705 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8706 __pyx_t_2 = 0;
8707 __pyx_t_1 = 0;
8708 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
8709 __Pyx_GOTREF(__pyx_t_1);
8710 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8711 __pyx_r = __pyx_t_1;
8712 __pyx_t_1 = 0;
8713 goto __pyx_L0;
8714
8715 /* "EnumBase":37
8716 * def __repr__(self):
8717 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
8718 * def __str__(self): # <<<<<<<<<<<<<<
8719 * return "%s.%s" % (self.__class__.__name__, self.name)
8720 *
8721 */
8722
8723 /* function exit code */
8724 __pyx_L1_error:;
8725 __Pyx_XDECREF(__pyx_t_1);
8726 __Pyx_XDECREF(__pyx_t_2);
8727 __Pyx_XDECREF(__pyx_t_3);
8728 __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8729 __pyx_r = NULL;
8730 __pyx_L0:;
8731 __Pyx_XGIVEREF(__pyx_r);
8732 __Pyx_RefNannyFinishContext();
8733 return __pyx_r;
8734 }
8735
8736 /* "(tree fragment)":1
8737 * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
8738 * cdef object __pyx_PickleError
8739 * cdef object __pyx_result
8740 */
8741
8742 /* Python wrapper */
8743 static PyObject *__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta(PyObject *__pyx_self,
8744 #if CYTHON_METH_FASTCALL
8745 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8746 #else
8747 PyObject *__pyx_args, PyObject *__pyx_kwds
8748 #endif
8749 ); /*proto*/
8750 static PyMethodDef __pyx_mdef_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta = {"__pyx_unpickle___Pyx_EnumMeta", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta(PyObject * __pyx_self,PyObject * const * __pyx_args,Py_ssize_t __pyx_nargs,PyObject * __pyx_kwds)8751 static PyObject *__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta(PyObject *__pyx_self,
8752 #if CYTHON_METH_FASTCALL
8753 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8754 #else
8755 PyObject *__pyx_args, PyObject *__pyx_kwds
8756 #endif
8757 ) {
8758 PyObject *__pyx_v___pyx_type = 0;
8759 long __pyx_v___pyx_checksum;
8760 PyObject *__pyx_v___pyx_state = 0;
8761 #if !CYTHON_METH_FASTCALL
8762 CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8763 #endif
8764 CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8765 int __pyx_lineno = 0;
8766 const char *__pyx_filename = NULL;
8767 int __pyx_clineno = 0;
8768 PyObject *__pyx_r = 0;
8769 __Pyx_RefNannyDeclarations
8770 __Pyx_RefNannySetupContext("__pyx_unpickle___Pyx_EnumMeta (wrapper)", 0);
8771 {
8772 #if CYTHON_USE_MODULE_STATE
8773 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
8774 #else
8775 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
8776 #endif
8777 PyObject* values[3] = {0,0,0};
8778 if (__pyx_kwds) {
8779 Py_ssize_t kw_args;
8780 switch (__pyx_nargs) {
8781 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
8782 CYTHON_FALLTHROUGH;
8783 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
8784 CYTHON_FALLTHROUGH;
8785 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8786 CYTHON_FALLTHROUGH;
8787 case 0: break;
8788 default: goto __pyx_L5_argtuple_error;
8789 }
8790 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8791 switch (__pyx_nargs) {
8792 case 0:
8793 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) kw_args--;
8794 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
8795 else goto __pyx_L5_argtuple_error;
8796 CYTHON_FALLTHROUGH;
8797 case 1:
8798 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
8799 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
8800 else {
8801 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle___Pyx_EnumMeta", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
8802 }
8803 CYTHON_FALLTHROUGH;
8804 case 2:
8805 if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--;
8806 else if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
8807 else {
8808 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle___Pyx_EnumMeta", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
8809 }
8810 }
8811 if (unlikely(kw_args > 0)) {
8812 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8813 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle___Pyx_EnumMeta") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
8814 }
8815 } else if (unlikely(__pyx_nargs != 3)) {
8816 goto __pyx_L5_argtuple_error;
8817 } else {
8818 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8819 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
8820 values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
8821 }
8822 __pyx_v___pyx_type = values[0];
8823 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
8824 __pyx_v___pyx_state = values[2];
8825 }
8826 goto __pyx_L4_argument_unpacking_done;
8827 __pyx_L5_argtuple_error:;
8828 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle___Pyx_EnumMeta", 1, 3, 3, __pyx_nargs); __PYX_ERR(2, 1, __pyx_L3_error)
8829 __pyx_L3_error:;
8830 __Pyx_AddTraceback("EnumBase.__pyx_unpickle___Pyx_EnumMeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
8831 __Pyx_RefNannyFinishContext();
8832 return NULL;
8833 __pyx_L4_argument_unpacking_done:;
8834 __pyx_r = __pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
8835
8836 /* function exit code */
8837 __Pyx_RefNannyFinishContext();
8838 return __pyx_r;
8839 }
8840
__pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)8841 static PyObject *__pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
8842 PyObject *__pyx_v___pyx_PickleError = 0;
8843 PyObject *__pyx_v___pyx_result = 0;
8844 PyObject *__pyx_r = NULL;
8845 __Pyx_RefNannyDeclarations
8846 int __pyx_t_1;
8847 PyObject *__pyx_t_2 = NULL;
8848 PyObject *__pyx_t_3 = NULL;
8849 PyObject *__pyx_t_4 = NULL;
8850 int __pyx_t_5;
8851 int __pyx_t_6;
8852 int __pyx_lineno = 0;
8853 const char *__pyx_filename = NULL;
8854 int __pyx_clineno = 0;
8855 __Pyx_RefNannySetupContext("__pyx_unpickle___Pyx_EnumMeta", 0);
8856
8857 /* "(tree fragment)":4
8858 * cdef object __pyx_PickleError
8859 * cdef object __pyx_result
8860 * if __pyx_checksum != 0xda39a3e: # <<<<<<<<<<<<<<
8861 * from pickle import PickleError as __pyx_PickleError
8862 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum
8863 */
8864 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xda39a3e) != 0);
8865 if (__pyx_t_1) {
8866
8867 /* "(tree fragment)":5
8868 * cdef object __pyx_result
8869 * if __pyx_checksum != 0xda39a3e:
8870 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
8871 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum
8872 * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type)
8873 */
8874 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
8875 __Pyx_GOTREF(__pyx_t_2);
8876 __Pyx_INCREF(__pyx_n_s_PickleError);
8877 __Pyx_GIVEREF(__pyx_n_s_PickleError);
8878 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
8879 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
8880 __Pyx_GOTREF(__pyx_t_3);
8881 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8882 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
8883 __Pyx_GOTREF(__pyx_t_2);
8884 __Pyx_INCREF(__pyx_t_2);
8885 __pyx_v___pyx_PickleError = __pyx_t_2;
8886 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8887 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8888
8889 /* "(tree fragment)":6
8890 * if __pyx_checksum != 0xda39a3e:
8891 * from pickle import PickleError as __pyx_PickleError
8892 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum # <<<<<<<<<<<<<<
8893 * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type)
8894 * if __pyx_state is not None:
8895 */
8896 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
8897 __Pyx_GOTREF(__pyx_t_3);
8898 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xda, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
8899 __Pyx_GOTREF(__pyx_t_2);
8900 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8901 __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_2, 0, 0);
8902 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8903 __PYX_ERR(2, 6, __pyx_L1_error)
8904
8905 /* "(tree fragment)":4
8906 * cdef object __pyx_PickleError
8907 * cdef object __pyx_result
8908 * if __pyx_checksum != 0xda39a3e: # <<<<<<<<<<<<<<
8909 * from pickle import PickleError as __pyx_PickleError
8910 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum
8911 */
8912 }
8913
8914 /* "(tree fragment)":7
8915 * from pickle import PickleError as __pyx_PickleError
8916 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum
8917 * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) # <<<<<<<<<<<<<<
8918 * if __pyx_state is not None:
8919 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state)
8920 */
8921 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype___Pyx_EnumMeta), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
8922 __Pyx_GOTREF(__pyx_t_3);
8923 __pyx_t_4 = NULL;
8924 __pyx_t_5 = 0;
8925 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
8926 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8927 if (likely(__pyx_t_4)) {
8928 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8929 __Pyx_INCREF(__pyx_t_4);
8930 __Pyx_INCREF(function);
8931 __Pyx_DECREF_SET(__pyx_t_3, function);
8932 __pyx_t_5 = 1;
8933 }
8934 }
8935 {
8936 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type};
8937 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
8938 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8939 if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
8940 __Pyx_GOTREF(__pyx_t_2);
8941 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8942 }
8943 __pyx_v___pyx_result = __pyx_t_2;
8944 __pyx_t_2 = 0;
8945
8946 /* "(tree fragment)":8
8947 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum
8948 * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type)
8949 * if __pyx_state is not None: # <<<<<<<<<<<<<<
8950 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state)
8951 * return __pyx_result
8952 */
8953 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
8954 __pyx_t_6 = (__pyx_t_1 != 0);
8955 if (__pyx_t_6) {
8956
8957 /* "(tree fragment)":9
8958 * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type)
8959 * if __pyx_state is not None:
8960 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
8961 * return __pyx_result
8962 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state):
8963 */
8964 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(2, 9, __pyx_L1_error)
8965 __pyx_t_2 = __pyx_unpickle___Pyx_EnumMeta__set_state(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 9, __pyx_L1_error)
8966 __Pyx_GOTREF(__pyx_t_2);
8967 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8968
8969 /* "(tree fragment)":8
8970 * raise __pyx_PickleError, "Incompatible checksums (%s vs 0xda39a3e = ())" % __pyx_checksum
8971 * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type)
8972 * if __pyx_state is not None: # <<<<<<<<<<<<<<
8973 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state)
8974 * return __pyx_result
8975 */
8976 }
8977
8978 /* "(tree fragment)":10
8979 * if __pyx_state is not None:
8980 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state)
8981 * return __pyx_result # <<<<<<<<<<<<<<
8982 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state):
8983 * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
8984 */
8985 __Pyx_XDECREF(__pyx_r);
8986 __Pyx_INCREF(__pyx_v___pyx_result);
8987 __pyx_r = __pyx_v___pyx_result;
8988 goto __pyx_L0;
8989
8990 /* "(tree fragment)":1
8991 * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
8992 * cdef object __pyx_PickleError
8993 * cdef object __pyx_result
8994 */
8995
8996 /* function exit code */
8997 __pyx_L1_error:;
8998 __Pyx_XDECREF(__pyx_t_2);
8999 __Pyx_XDECREF(__pyx_t_3);
9000 __Pyx_XDECREF(__pyx_t_4);
9001 __Pyx_AddTraceback("EnumBase.__pyx_unpickle___Pyx_EnumMeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
9002 __pyx_r = NULL;
9003 __pyx_L0:;
9004 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
9005 __Pyx_XDECREF(__pyx_v___pyx_result);
9006 __Pyx_XGIVEREF(__pyx_r);
9007 __Pyx_RefNannyFinishContext();
9008 return __pyx_r;
9009 }
9010
9011 /* "(tree fragment)":11
9012 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state)
9013 * return __pyx_result
9014 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
9015 * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
9016 * __pyx_result.__dict__.update(__pyx_state[0])
9017 */
9018
__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)9019 static PyObject *__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
9020 PyObject *__pyx_r = NULL;
9021 __Pyx_RefNannyDeclarations
9022 int __pyx_t_1;
9023 Py_ssize_t __pyx_t_2;
9024 int __pyx_t_3;
9025 int __pyx_t_4;
9026 PyObject *__pyx_t_5 = NULL;
9027 PyObject *__pyx_t_6 = NULL;
9028 PyObject *__pyx_t_7 = NULL;
9029 PyObject *__pyx_t_8 = NULL;
9030 int __pyx_t_9;
9031 int __pyx_lineno = 0;
9032 const char *__pyx_filename = NULL;
9033 int __pyx_clineno = 0;
9034 __Pyx_RefNannySetupContext("__pyx_unpickle___Pyx_EnumMeta__set_state", 0);
9035
9036 /* "(tree fragment)":12
9037 * return __pyx_result
9038 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state):
9039 * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
9040 * __pyx_result.__dict__.update(__pyx_state[0])
9041 */
9042 if (unlikely(__pyx_v___pyx_state == Py_None)) {
9043 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
9044 __PYX_ERR(2, 12, __pyx_L1_error)
9045 }
9046 __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(2, 12, __pyx_L1_error)
9047 __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
9048 if (__pyx_t_3) {
9049 } else {
9050 __pyx_t_1 = __pyx_t_3;
9051 goto __pyx_L4_bool_binop_done;
9052 }
9053 __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 12, __pyx_L1_error)
9054 __pyx_t_4 = (__pyx_t_3 != 0);
9055 __pyx_t_1 = __pyx_t_4;
9056 __pyx_L4_bool_binop_done:;
9057 if (__pyx_t_1) {
9058
9059 /* "(tree fragment)":13
9060 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state):
9061 * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
9062 * __pyx_result.__dict__.update(__pyx_state[0]) # <<<<<<<<<<<<<<
9063 */
9064 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 13, __pyx_L1_error)
9065 __Pyx_GOTREF(__pyx_t_6);
9066 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 13, __pyx_L1_error)
9067 __Pyx_GOTREF(__pyx_t_7);
9068 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9069 if (unlikely(__pyx_v___pyx_state == Py_None)) {
9070 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9071 __PYX_ERR(2, 13, __pyx_L1_error)
9072 }
9073 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 13, __pyx_L1_error)
9074 __Pyx_GOTREF(__pyx_t_6);
9075 __pyx_t_8 = NULL;
9076 __pyx_t_9 = 0;
9077 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
9078 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
9079 if (likely(__pyx_t_8)) {
9080 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9081 __Pyx_INCREF(__pyx_t_8);
9082 __Pyx_INCREF(function);
9083 __Pyx_DECREF_SET(__pyx_t_7, function);
9084 __pyx_t_9 = 1;
9085 }
9086 }
9087 {
9088 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6};
9089 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
9090 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9091 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9092 if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
9093 __Pyx_GOTREF(__pyx_t_5);
9094 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9095 }
9096 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9097
9098 /* "(tree fragment)":12
9099 * return __pyx_result
9100 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state):
9101 * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
9102 * __pyx_result.__dict__.update(__pyx_state[0])
9103 */
9104 }
9105
9106 /* "(tree fragment)":11
9107 * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state)
9108 * return __pyx_result
9109 * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
9110 * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
9111 * __pyx_result.__dict__.update(__pyx_state[0])
9112 */
9113
9114 /* function exit code */
9115 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9116 goto __pyx_L0;
9117 __pyx_L1_error:;
9118 __Pyx_XDECREF(__pyx_t_5);
9119 __Pyx_XDECREF(__pyx_t_6);
9120 __Pyx_XDECREF(__pyx_t_7);
9121 __Pyx_XDECREF(__pyx_t_8);
9122 __Pyx_AddTraceback("EnumBase.__pyx_unpickle___Pyx_EnumMeta__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
9123 __pyx_r = 0;
9124 __pyx_L0:;
9125 __Pyx_XGIVEREF(__pyx_r);
9126 __Pyx_RefNannyFinishContext();
9127 return __pyx_r;
9128 }
9129
__pyx_tp_traverse___Pyx_EnumMeta(PyObject * o,visitproc v,void * a)9130 static int __pyx_tp_traverse___Pyx_EnumMeta(PyObject *o, visitproc v, void *a) {
9131 int e;
9132 if (!(&PyType_Type)->tp_traverse); else { e = (&PyType_Type)->tp_traverse(o,v,a); if (e) return e; }
9133 return 0;
9134 }
9135
__pyx_tp_clear___Pyx_EnumMeta(PyObject * o)9136 static int __pyx_tp_clear___Pyx_EnumMeta(PyObject *o) {
9137 if (!(&PyType_Type)->tp_clear); else (&PyType_Type)->tp_clear(o);
9138 return 0;
9139 }
__pyx_sq_item___Pyx_EnumMeta(PyObject * o,Py_ssize_t i)9140 static PyObject *__pyx_sq_item___Pyx_EnumMeta(PyObject *o, Py_ssize_t i) {
9141 PyObject *r;
9142 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
9143 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
9144 Py_DECREF(x);
9145 return r;
9146 }
9147
9148 static PyMethodDef __pyx_methods___Pyx_EnumMeta[] = {
9149 {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9150 {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9151 {0, 0, 0, 0}
9152 };
9153 #if CYTHON_USE_TYPE_SPECS
9154 static PyType_Slot __Pyx_EnumMeta_slots[] = {
9155 {Py_sq_item, (void *)__pyx_sq_item___Pyx_EnumMeta},
9156 {Py_mp_subscript, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__},
9157 {Py_tp_traverse, (void *)__pyx_tp_traverse___Pyx_EnumMeta},
9158 {Py_tp_clear, (void *)__pyx_tp_clear___Pyx_EnumMeta},
9159 {Py_tp_iter, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__},
9160 {Py_tp_methods, (void *)__pyx_methods___Pyx_EnumMeta},
9161 {Py_tp_init, (void *)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__},
9162 {0, 0},
9163 };
9164 static PyType_Spec __Pyx_EnumMeta_spec = {
9165 "cpp_string_metric.__Pyx_EnumMeta",
9166 sizeof(struct __pyx_obj___Pyx_EnumMeta),
9167 0,
9168 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
9169 __Pyx_EnumMeta_slots,
9170 };
9171 #else
9172
9173 static PySequenceMethods __pyx_tp_as_sequence___Pyx_EnumMeta = {
9174 0, /*sq_length*/
9175 0, /*sq_concat*/
9176 0, /*sq_repeat*/
9177 __pyx_sq_item___Pyx_EnumMeta, /*sq_item*/
9178 0, /*sq_slice*/
9179 0, /*sq_ass_item*/
9180 0, /*sq_ass_slice*/
9181 0, /*sq_contains*/
9182 0, /*sq_inplace_concat*/
9183 0, /*sq_inplace_repeat*/
9184 };
9185
9186 static PyMappingMethods __pyx_tp_as_mapping___Pyx_EnumMeta = {
9187 0, /*mp_length*/
9188 __pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__, /*mp_subscript*/
9189 0, /*mp_ass_subscript*/
9190 };
9191
9192 static PyTypeObject __Pyx_EnumMeta = {
9193 PyVarObject_HEAD_INIT(0, 0)
9194 "cpp_string_metric.""__Pyx_EnumMeta", /*tp_name*/
9195 sizeof(struct __pyx_obj___Pyx_EnumMeta), /*tp_basicsize*/
9196 0, /*tp_itemsize*/
9197 0, /*tp_dealloc*/
9198 #if PY_VERSION_HEX < 0x030800b4
9199 0, /*tp_print*/
9200 #endif
9201 #if PY_VERSION_HEX >= 0x030800b4
9202 0, /*tp_vectorcall_offset*/
9203 #endif
9204 0, /*tp_getattr*/
9205 0, /*tp_setattr*/
9206 #if PY_MAJOR_VERSION < 3
9207 0, /*tp_compare*/
9208 #endif
9209 #if PY_MAJOR_VERSION >= 3
9210 0, /*tp_as_async*/
9211 #endif
9212 0, /*tp_repr*/
9213 0, /*tp_as_number*/
9214 &__pyx_tp_as_sequence___Pyx_EnumMeta, /*tp_as_sequence*/
9215 &__pyx_tp_as_mapping___Pyx_EnumMeta, /*tp_as_mapping*/
9216 0, /*tp_hash*/
9217 0, /*tp_call*/
9218 0, /*tp_str*/
9219 0, /*tp_getattro*/
9220 0, /*tp_setattro*/
9221 0, /*tp_as_buffer*/
9222 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9223 0, /*tp_doc*/
9224 __pyx_tp_traverse___Pyx_EnumMeta, /*tp_traverse*/
9225 __pyx_tp_clear___Pyx_EnumMeta, /*tp_clear*/
9226 0, /*tp_richcompare*/
9227 0, /*tp_weaklistoffset*/
9228 __pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__, /*tp_iter*/
9229 0, /*tp_iternext*/
9230 __pyx_methods___Pyx_EnumMeta, /*tp_methods*/
9231 0, /*tp_members*/
9232 0, /*tp_getset*/
9233 0, /*tp_base*/
9234 0, /*tp_dict*/
9235 0, /*tp_descr_get*/
9236 0, /*tp_descr_set*/
9237 #if !CYTHON_USE_TYPE_SPECS
9238 0, /*tp_dictoffset*/
9239 #endif
9240 __pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__, /*tp_init*/
9241 0, /*tp_alloc*/
9242 0, /*tp_new*/
9243 0, /*tp_free*/
9244 0, /*tp_is_gc*/
9245 0, /*tp_bases*/
9246 0, /*tp_mro*/
9247 0, /*tp_cache*/
9248 0, /*tp_subclasses*/
9249 0, /*tp_weaklist*/
9250 0, /*tp_del*/
9251 0, /*tp_version_tag*/
9252 #if PY_VERSION_HEX >= 0x030400a1
9253 0, /*tp_finalize*/
9254 #endif
9255 #if PY_VERSION_HEX >= 0x030800b1
9256 0, /*tp_vectorcall*/
9257 #endif
9258 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9259 0, /*tp_print*/
9260 #endif
9261 #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
9262 0, /*tp_pypy_flags*/
9263 #endif
9264 };
9265 #endif
9266
9267 static PyMethodDef __pyx_methods[] = {
9268 {0, 0, 0, 0}
9269 };
9270 #ifndef CYTHON_SMALL_CODE
9271 #if defined(__clang__)
9272 #define CYTHON_SMALL_CODE
9273 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
9274 #define CYTHON_SMALL_CODE __attribute__((cold))
9275 #else
9276 #define CYTHON_SMALL_CODE
9277 #endif
9278 #endif
9279 /* #### Code section: pystring_table ### */
9280
9281 static __Pyx_StringTabEntry __pyx_string_tab[] = {
9282 #if CYTHON_USE_MODULE_STATE
9283 {0, __pyx_k_Calculates_a_normalized_levensh, sizeof(__pyx_k_Calculates_a_normalized_levensh), 0, 1, 0, 0},
9284 {0, __pyx_k_Calculates_the_minimum_number_o, sizeof(__pyx_k_Calculates_the_minimum_number_o), 0, 1, 0, 0},
9285 {0, __pyx_k_Delete, sizeof(__pyx_k_Delete), 0, 0, 1, 1},
9286 {0, __pyx_k_EnumBase, sizeof(__pyx_k_EnumBase), 0, 0, 1, 1},
9287 {0, __pyx_k_Incompatible_checksums_s_vs_0xda, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xda), 0, 0, 1, 0},
9288 {0, __pyx_k_Insert, sizeof(__pyx_k_Insert), 0, 0, 1, 1},
9289 {0, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1},
9290 {0, __pyx_k_LevenshteinEditType, sizeof(__pyx_k_LevenshteinEditType), 0, 0, 1, 1},
9291 {0, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
9292 {0, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1},
9293 {0, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1},
9294 {0, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
9295 {0, __pyx_k_Pyx_EnumBase, sizeof(__pyx_k_Pyx_EnumBase), 0, 0, 1, 1},
9296 {0, __pyx_k_Pyx_EnumBase___new, sizeof(__pyx_k_Pyx_EnumBase___new), 0, 0, 1, 1},
9297 {0, __pyx_k_Pyx_EnumBase___repr, sizeof(__pyx_k_Pyx_EnumBase___repr), 0, 0, 1, 1},
9298 {0, __pyx_k_Pyx_EnumBase___str, sizeof(__pyx_k_Pyx_EnumBase___str), 0, 0, 1, 1},
9299 {0, __pyx_k_Pyx_EnumMeta___reduce_cython, sizeof(__pyx_k_Pyx_EnumMeta___reduce_cython), 0, 0, 1, 1},
9300 {0, __pyx_k_Pyx_EnumMeta___setstate_cython, sizeof(__pyx_k_Pyx_EnumMeta___setstate_cython), 0, 0, 1, 1},
9301 {0, __pyx_k_Replace, sizeof(__pyx_k_Replace), 0, 0, 1, 1},
9302 {0, __pyx_k_Return_list_of_3_tuples_describ, sizeof(__pyx_k_Return_list_of_3_tuples_describ), 0, 1, 0, 0},
9303 {0, __pyx_k_Unknown_enum_value_s, sizeof(__pyx_k_Unknown_enum_value_s), 0, 0, 1, 0},
9304 {0, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
9305 {0, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 1, 1},
9306 {0, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
9307 {0, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
9308 {0, __pyx_k_c_max, sizeof(__pyx_k_c_max), 0, 0, 1, 1},
9309 {0, __pyx_k_c_score_cutoff, sizeof(__pyx_k_c_score_cutoff), 0, 0, 1, 1},
9310 {0, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
9311 {0, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
9312 {0, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9313 {0, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
9314 {0, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
9315 {0, __pyx_k_cpp_string_metric, sizeof(__pyx_k_cpp_string_metric), 0, 0, 1, 1},
9316 {0, __pyx_k_cpp_string_metric_pyx, sizeof(__pyx_k_cpp_string_metric_pyx), 0, 0, 1, 0},
9317 {0, __pyx_k_dct, sizeof(__pyx_k_dct), 0, 0, 1, 1},
9318 {0, __pyx_k_default_process, sizeof(__pyx_k_default_process), 0, 0, 1, 1},
9319 {0, __pyx_k_delete, sizeof(__pyx_k_delete), 0, 1, 0, 1},
9320 {0, __pyx_k_deletion, sizeof(__pyx_k_deletion), 0, 0, 1, 1},
9321 {0, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
9322 {0, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
9323 {0, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
9324 {0, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
9325 {0, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
9326 {0, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1},
9327 {0, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
9328 {0, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9329 {0, __pyx_k_hamming, sizeof(__pyx_k_hamming), 0, 0, 1, 1},
9330 {0, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9331 {0, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
9332 {0, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1},
9333 {0, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 1, 0, 1},
9334 {0, __pyx_k_insertion, sizeof(__pyx_k_insertion), 0, 0, 1, 1},
9335 {0, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
9336 {0, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
9337 {0, __pyx_k_jaro_similarity, sizeof(__pyx_k_jaro_similarity), 0, 0, 1, 1},
9338 {0, __pyx_k_jaro_winkler_similarity, sizeof(__pyx_k_jaro_winkler_similarity), 0, 0, 1, 1},
9339 {0, __pyx_k_levenshtein, sizeof(__pyx_k_levenshtein), 0, 0, 1, 1},
9340 {0, __pyx_k_levenshtein_editops, sizeof(__pyx_k_levenshtein_editops), 0, 0, 1, 1},
9341 {0, __pyx_k_levenshtein_editops_line_248, sizeof(__pyx_k_levenshtein_editops_line_248), 0, 1, 0, 0},
9342 {0, __pyx_k_levenshtein_line_50, sizeof(__pyx_k_levenshtein_line_50), 0, 1, 0, 0},
9343 {0, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9344 {0, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
9345 {0, __pyx_k_members, sizeof(__pyx_k_members), 0, 0, 1, 1},
9346 {0, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
9347 {0, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
9348 {0, __pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 0, 1, 1},
9349 {0, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9350 {0, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
9351 {0, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
9352 {0, __pyx_k_normalized_hamming, sizeof(__pyx_k_normalized_hamming), 0, 0, 1, 1},
9353 {0, __pyx_k_normalized_levenshtein, sizeof(__pyx_k_normalized_levenshtein), 0, 0, 1, 1},
9354 {0, __pyx_k_normalized_levenshtein_line_295, sizeof(__pyx_k_normalized_levenshtein_line_295), 0, 1, 0, 0},
9355 {0, __pyx_k_parents, sizeof(__pyx_k_parents), 0, 0, 1, 1},
9356 {0, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
9357 {0, __pyx_k_prefix_weight, sizeof(__pyx_k_prefix_weight), 0, 0, 1, 1},
9358 {0, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
9359 {0, __pyx_k_processor, sizeof(__pyx_k_processor), 0, 0, 1, 1},
9360 {0, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
9361 {0, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
9362 {0, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
9363 {0, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9364 {0, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
9365 {0, __pyx_k_pyx_unpickle___Pyx_EnumMeta, sizeof(__pyx_k_pyx_unpickle___Pyx_EnumMeta), 0, 0, 1, 1},
9366 {0, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
9367 {0, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
9368 {0, __pyx_k_rapidfuzz_utils, sizeof(__pyx_k_rapidfuzz_utils), 0, 0, 1, 1},
9369 {0, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9370 {0, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9371 {0, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9372 {0, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 1, 0, 1},
9373 {0, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
9374 {0, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
9375 {0, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1},
9376 {0, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1},
9377 {0, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
9378 {0, __pyx_k_s_s_d, sizeof(__pyx_k_s_s_d), 0, 0, 1, 0},
9379 {0, __pyx_k_score_cutoff, sizeof(__pyx_k_score_cutoff), 0, 0, 1, 1},
9380 {0, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
9381 {0, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1},
9382 {0, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9383 {0, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9384 {0, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
9385 {0, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
9386 {0, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9387 {0, __pyx_k_substitution, sizeof(__pyx_k_substitution), 0, 0, 1, 1},
9388 {0, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
9389 {0, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9390 {0, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
9391 {0, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
9392 {0, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
9393 {0, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
9394 {0, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
9395 {0, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
9396 {0, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 0, 1, 1},
9397 #else
9398 {&__pyx_kp_u_Calculates_a_normalized_levensh, __pyx_k_Calculates_a_normalized_levensh, sizeof(__pyx_k_Calculates_a_normalized_levensh), 0, 1, 0, 0},
9399 {&__pyx_kp_u_Calculates_the_minimum_number_o, __pyx_k_Calculates_the_minimum_number_o, sizeof(__pyx_k_Calculates_the_minimum_number_o), 0, 1, 0, 0},
9400 {&__pyx_n_s_Delete, __pyx_k_Delete, sizeof(__pyx_k_Delete), 0, 0, 1, 1},
9401 {&__pyx_n_s_EnumBase, __pyx_k_EnumBase, sizeof(__pyx_k_EnumBase), 0, 0, 1, 1},
9402 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xda, __pyx_k_Incompatible_checksums_s_vs_0xda, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xda), 0, 0, 1, 0},
9403 {&__pyx_n_s_Insert, __pyx_k_Insert, sizeof(__pyx_k_Insert), 0, 0, 1, 1},
9404 {&__pyx_n_s_IntEnum, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1},
9405 {&__pyx_n_s_LevenshteinEditType, __pyx_k_LevenshteinEditType, sizeof(__pyx_k_LevenshteinEditType), 0, 0, 1, 1},
9406 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
9407 {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1},
9408 {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1},
9409 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
9410 {&__pyx_n_s_Pyx_EnumBase, __pyx_k_Pyx_EnumBase, sizeof(__pyx_k_Pyx_EnumBase), 0, 0, 1, 1},
9411 {&__pyx_n_s_Pyx_EnumBase___new, __pyx_k_Pyx_EnumBase___new, sizeof(__pyx_k_Pyx_EnumBase___new), 0, 0, 1, 1},
9412 {&__pyx_n_s_Pyx_EnumBase___repr, __pyx_k_Pyx_EnumBase___repr, sizeof(__pyx_k_Pyx_EnumBase___repr), 0, 0, 1, 1},
9413 {&__pyx_n_s_Pyx_EnumBase___str, __pyx_k_Pyx_EnumBase___str, sizeof(__pyx_k_Pyx_EnumBase___str), 0, 0, 1, 1},
9414 {&__pyx_n_s_Pyx_EnumMeta___reduce_cython, __pyx_k_Pyx_EnumMeta___reduce_cython, sizeof(__pyx_k_Pyx_EnumMeta___reduce_cython), 0, 0, 1, 1},
9415 {&__pyx_n_s_Pyx_EnumMeta___setstate_cython, __pyx_k_Pyx_EnumMeta___setstate_cython, sizeof(__pyx_k_Pyx_EnumMeta___setstate_cython), 0, 0, 1, 1},
9416 {&__pyx_n_s_Replace, __pyx_k_Replace, sizeof(__pyx_k_Replace), 0, 0, 1, 1},
9417 {&__pyx_kp_u_Return_list_of_3_tuples_describ, __pyx_k_Return_list_of_3_tuples_describ, sizeof(__pyx_k_Return_list_of_3_tuples_describ), 0, 1, 0, 0},
9418 {&__pyx_kp_s_Unknown_enum_value_s, __pyx_k_Unknown_enum_value_s, sizeof(__pyx_k_Unknown_enum_value_s), 0, 0, 1, 0},
9419 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
9420 {&__pyx_n_s__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 1, 1},
9421 {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
9422 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
9423 {&__pyx_n_s_c_max, __pyx_k_c_max, sizeof(__pyx_k_c_max), 0, 0, 1, 1},
9424 {&__pyx_n_s_c_score_cutoff, __pyx_k_c_score_cutoff, sizeof(__pyx_k_c_score_cutoff), 0, 0, 1, 1},
9425 {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
9426 {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
9427 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9428 {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
9429 {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
9430 {&__pyx_n_s_cpp_string_metric, __pyx_k_cpp_string_metric, sizeof(__pyx_k_cpp_string_metric), 0, 0, 1, 1},
9431 {&__pyx_kp_s_cpp_string_metric_pyx, __pyx_k_cpp_string_metric_pyx, sizeof(__pyx_k_cpp_string_metric_pyx), 0, 0, 1, 0},
9432 {&__pyx_n_s_dct, __pyx_k_dct, sizeof(__pyx_k_dct), 0, 0, 1, 1},
9433 {&__pyx_n_s_default_process, __pyx_k_default_process, sizeof(__pyx_k_default_process), 0, 0, 1, 1},
9434 {&__pyx_n_u_delete, __pyx_k_delete, sizeof(__pyx_k_delete), 0, 1, 0, 1},
9435 {&__pyx_n_s_deletion, __pyx_k_deletion, sizeof(__pyx_k_deletion), 0, 0, 1, 1},
9436 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
9437 {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
9438 {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
9439 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
9440 {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
9441 {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1},
9442 {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
9443 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9444 {&__pyx_n_s_hamming, __pyx_k_hamming, sizeof(__pyx_k_hamming), 0, 0, 1, 1},
9445 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9446 {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
9447 {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1},
9448 {&__pyx_n_u_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 1, 0, 1},
9449 {&__pyx_n_s_insertion, __pyx_k_insertion, sizeof(__pyx_k_insertion), 0, 0, 1, 1},
9450 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
9451 {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
9452 {&__pyx_n_s_jaro_similarity, __pyx_k_jaro_similarity, sizeof(__pyx_k_jaro_similarity), 0, 0, 1, 1},
9453 {&__pyx_n_s_jaro_winkler_similarity, __pyx_k_jaro_winkler_similarity, sizeof(__pyx_k_jaro_winkler_similarity), 0, 0, 1, 1},
9454 {&__pyx_n_s_levenshtein, __pyx_k_levenshtein, sizeof(__pyx_k_levenshtein), 0, 0, 1, 1},
9455 {&__pyx_n_s_levenshtein_editops, __pyx_k_levenshtein_editops, sizeof(__pyx_k_levenshtein_editops), 0, 0, 1, 1},
9456 {&__pyx_kp_u_levenshtein_editops_line_248, __pyx_k_levenshtein_editops_line_248, sizeof(__pyx_k_levenshtein_editops_line_248), 0, 1, 0, 0},
9457 {&__pyx_kp_u_levenshtein_line_50, __pyx_k_levenshtein_line_50, sizeof(__pyx_k_levenshtein_line_50), 0, 1, 0, 0},
9458 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9459 {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
9460 {&__pyx_n_s_members, __pyx_k_members, sizeof(__pyx_k_members), 0, 0, 1, 1},
9461 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
9462 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
9463 {&__pyx_n_s_mro_entries, __pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 0, 1, 1},
9464 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9465 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
9466 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
9467 {&__pyx_n_s_normalized_hamming, __pyx_k_normalized_hamming, sizeof(__pyx_k_normalized_hamming), 0, 0, 1, 1},
9468 {&__pyx_n_s_normalized_levenshtein, __pyx_k_normalized_levenshtein, sizeof(__pyx_k_normalized_levenshtein), 0, 0, 1, 1},
9469 {&__pyx_kp_u_normalized_levenshtein_line_295, __pyx_k_normalized_levenshtein_line_295, sizeof(__pyx_k_normalized_levenshtein_line_295), 0, 1, 0, 0},
9470 {&__pyx_n_s_parents, __pyx_k_parents, sizeof(__pyx_k_parents), 0, 0, 1, 1},
9471 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
9472 {&__pyx_n_s_prefix_weight, __pyx_k_prefix_weight, sizeof(__pyx_k_prefix_weight), 0, 0, 1, 1},
9473 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
9474 {&__pyx_n_s_processor, __pyx_k_processor, sizeof(__pyx_k_processor), 0, 0, 1, 1},
9475 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
9476 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
9477 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
9478 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9479 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
9480 {&__pyx_n_s_pyx_unpickle___Pyx_EnumMeta, __pyx_k_pyx_unpickle___Pyx_EnumMeta, sizeof(__pyx_k_pyx_unpickle___Pyx_EnumMeta), 0, 0, 1, 1},
9481 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
9482 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
9483 {&__pyx_n_s_rapidfuzz_utils, __pyx_k_rapidfuzz_utils, sizeof(__pyx_k_rapidfuzz_utils), 0, 0, 1, 1},
9484 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9485 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9486 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9487 {&__pyx_n_u_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 1, 0, 1},
9488 {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
9489 {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
9490 {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1},
9491 {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1},
9492 {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
9493 {&__pyx_kp_s_s_s_d, __pyx_k_s_s_d, sizeof(__pyx_k_s_s_d), 0, 0, 1, 0},
9494 {&__pyx_n_s_score_cutoff, __pyx_k_score_cutoff, sizeof(__pyx_k_score_cutoff), 0, 0, 1, 1},
9495 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
9496 {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1},
9497 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9498 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9499 {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
9500 {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
9501 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9502 {&__pyx_n_s_substitution, __pyx_k_substitution, sizeof(__pyx_k_substitution), 0, 0, 1, 1},
9503 {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
9504 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9505 {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
9506 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
9507 {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
9508 {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
9509 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
9510 {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
9511 {&__pyx_n_s_weights, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 0, 1, 1},
9512 #endif
9513 {0, 0, 0, 0, 0, 0, 0}
9514 };
9515 /* #### Code section: cached_builtins ### */
__Pyx_InitCachedBuiltins(void)9516 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
9517 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 241, __pyx_L1_error)
9518 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 33, __pyx_L1_error)
9519 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 29, __pyx_L1_error)
9520 return 0;
9521 __pyx_L1_error:;
9522 return -1;
9523 }
9524 /* #### Code section: cached_constants ### */
9525
__Pyx_InitCachedConstants(void)9526 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9527 __Pyx_RefNannyDeclarations
9528 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9529
9530 /* "cpp_string_metric.pyx":50
9531 * vector[LevenshteinEditOp] levenshtein_editops_default_process(const proc_string& s1, const proc_string& s2) nogil except +
9532 *
9533 * def levenshtein(s1, s2, *, weights=(1,1,1), processor=None, max=None): # <<<<<<<<<<<<<<
9534 * """
9535 * Calculates the minimum number of insertions, deletions, and substitutions
9536 */
9537 __pyx_tuple_ = PyTuple_Pack(3, __pyx_int_1, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 50, __pyx_L1_error)
9538 __Pyx_GOTREF(__pyx_tuple_);
9539 __Pyx_GIVEREF(__pyx_tuple_);
9540 __pyx_tuple__9 = PyTuple_Pack(9, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_weights, __pyx_n_s_processor, __pyx_n_s_max, __pyx_n_s_insertion, __pyx_n_s_deletion, __pyx_n_s_substitution, __pyx_n_s_c_max); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 50, __pyx_L1_error)
9541 __Pyx_GOTREF(__pyx_tuple__9);
9542 __Pyx_GIVEREF(__pyx_tuple__9);
9543 __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_levenshtein, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 50, __pyx_L1_error)
9544
9545 /* "cpp_string_metric.pyx":248
9546 * return result_list
9547 *
9548 * def levenshtein_editops(s1, s2, *, processor=None): # <<<<<<<<<<<<<<
9549 * """
9550 * Return list of 3-tuples describing how to turn s1 into s2.
9551 */
9552 __pyx_tuple__10 = PyTuple_Pack(3, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_processor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 248, __pyx_L1_error)
9553 __Pyx_GOTREF(__pyx_tuple__10);
9554 __Pyx_GIVEREF(__pyx_tuple__10);
9555 __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 1, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_levenshtein_editops, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 248, __pyx_L1_error)
9556
9557 /* "cpp_string_metric.pyx":295
9558 * )
9559 *
9560 * def normalized_levenshtein(s1, s2, *, weights=(1,1,1), processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
9561 * """
9562 * Calculates a normalized levenshtein distance using custom
9563 */
9564 __pyx_tuple__11 = PyTuple_Pack(9, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_weights, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_insertion, __pyx_n_s_deletion, __pyx_n_s_substitution, __pyx_n_s_c_score_cutoff); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 295, __pyx_L1_error)
9565 __Pyx_GOTREF(__pyx_tuple__11);
9566 __Pyx_GIVEREF(__pyx_tuple__11);
9567 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_normalized_levenshtein, 295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 295, __pyx_L1_error)
9568
9569 /* "cpp_string_metric.pyx":399
9570 *
9571 *
9572 * def hamming(s1, s2, *, processor=None, max=None): # <<<<<<<<<<<<<<
9573 * """
9574 * Calculates the Hamming distance between two strings.
9575 */
9576 __pyx_tuple__12 = PyTuple_Pack(5, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_processor, __pyx_n_s_max, __pyx_n_s_c_max); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 399, __pyx_L1_error)
9577 __Pyx_GOTREF(__pyx_tuple__12);
9578 __Pyx_GIVEREF(__pyx_tuple__12);
9579 __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_hamming, 399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 399, __pyx_L1_error)
9580
9581 /* "cpp_string_metric.pyx":446
9582 *
9583 *
9584 * def normalized_hamming(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
9585 * """
9586 * Calculates a normalized hamming distance
9587 */
9588 __pyx_tuple__13 = PyTuple_Pack(5, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_c_score_cutoff); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 446, __pyx_L1_error)
9589 __Pyx_GOTREF(__pyx_tuple__13);
9590 __Pyx_GIVEREF(__pyx_tuple__13);
9591 __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_normalized_hamming, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 446, __pyx_L1_error)
9592
9593 /* "cpp_string_metric.pyx":493
9594 *
9595 *
9596 * def jaro_similarity(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
9597 * """
9598 * Calculates the jaro similarity
9599 */
9600 __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_c_score_cutoff); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 493, __pyx_L1_error)
9601 __Pyx_GOTREF(__pyx_tuple__14);
9602 __Pyx_GIVEREF(__pyx_tuple__14);
9603 __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_jaro_similarity, 493, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 493, __pyx_L1_error)
9604
9605 /* "cpp_string_metric.pyx":532
9606 *
9607 *
9608 * def jaro_winkler_similarity(s1, s2, *, double prefix_weight=0.1, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
9609 * """
9610 * Calculates the jaro winkler similarity
9611 */
9612 __pyx_tuple__15 = PyTuple_Pack(6, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_prefix_weight, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_c_score_cutoff); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 532, __pyx_L1_error)
9613 __Pyx_GOTREF(__pyx_tuple__15);
9614 __Pyx_GIVEREF(__pyx_tuple__15);
9615 __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cpp_string_metric_pyx, __pyx_n_s_jaro_winkler_similarity, 532, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 532, __pyx_L1_error)
9616
9617 /* "(tree fragment)":1
9618 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9619 * cdef tuple state
9620 * cdef object _dict
9621 */
9622 __pyx_tuple__16 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 1, __pyx_L1_error)
9623 __Pyx_GOTREF(__pyx_tuple__16);
9624 __Pyx_GIVEREF(__pyx_tuple__16);
9625 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(2, 1, __pyx_L1_error)
9626
9627 /* "(tree fragment)":16
9628 * else:
9629 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state)
9630 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9631 * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state)
9632 */
9633 __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 16, __pyx_L1_error)
9634 __Pyx_GOTREF(__pyx_tuple__18);
9635 __Pyx_GIVEREF(__pyx_tuple__18);
9636 __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(2, 16, __pyx_L1_error)
9637
9638 /* "EnumBase":24
9639 * cdef object __Pyx_EnumBase
9640 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta):
9641 * def __new__(cls, value, name=None): # <<<<<<<<<<<<<<
9642 * for v in cls:
9643 * if v == value:
9644 */
9645 __pyx_tuple__20 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_name, __pyx_n_s_v, __pyx_n_s_res); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 24, __pyx_L1_error)
9646 __Pyx_GOTREF(__pyx_tuple__20);
9647 __Pyx_GIVEREF(__pyx_tuple__20);
9648 __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_new, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(2, 24, __pyx_L1_error)
9649 __pyx_tuple__22 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 24, __pyx_L1_error)
9650 __Pyx_GOTREF(__pyx_tuple__22);
9651 __Pyx_GIVEREF(__pyx_tuple__22);
9652
9653 /* "EnumBase":35
9654 * cls.__members__[name] = res
9655 * return res
9656 * def __repr__(self): # <<<<<<<<<<<<<<
9657 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
9658 * def __str__(self):
9659 */
9660 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 35, __pyx_L1_error)
9661 __Pyx_GOTREF(__pyx_tuple__23);
9662 __Pyx_GIVEREF(__pyx_tuple__23);
9663 __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(2, 35, __pyx_L1_error)
9664
9665 /* "EnumBase":37
9666 * def __repr__(self):
9667 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
9668 * def __str__(self): # <<<<<<<<<<<<<<
9669 * return "%s.%s" % (self.__class__.__name__, self.name)
9670 *
9671 */
9672 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 37, __pyx_L1_error)
9673 __Pyx_GOTREF(__pyx_tuple__25);
9674 __Pyx_GIVEREF(__pyx_tuple__25);
9675 __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(2, 37, __pyx_L1_error)
9676
9677 /* "(tree fragment)":1
9678 * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
9679 * cdef object __pyx_PickleError
9680 * cdef object __pyx_result
9681 */
9682 __pyx_tuple__27 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 1, __pyx_L1_error)
9683 __Pyx_GOTREF(__pyx_tuple__27);
9684 __Pyx_GIVEREF(__pyx_tuple__27);
9685 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(2, 1, __pyx_L1_error)
9686 __Pyx_RefNannyFinishContext();
9687 return 0;
9688 __pyx_L1_error:;
9689 __Pyx_RefNannyFinishContext();
9690 return -1;
9691 }
9692 /* #### Code section: init_globals ### */
9693
__Pyx_InitGlobals(void)9694 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
9695 #if CYTHON_USE_MODULE_STATE
9696 if (__Pyx_InitString(__pyx_string_tab[0], &__pyx_kp_u_Calculates_a_normalized_levensh) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9697 if (__Pyx_InitString(__pyx_string_tab[1], &__pyx_kp_u_Calculates_the_minimum_number_o) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9698 if (__Pyx_InitString(__pyx_string_tab[2], &__pyx_n_s_Delete) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9699 if (__Pyx_InitString(__pyx_string_tab[3], &__pyx_n_s_EnumBase) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9700 if (__Pyx_InitString(__pyx_string_tab[4], &__pyx_kp_s_Incompatible_checksums_s_vs_0xda) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9701 if (__Pyx_InitString(__pyx_string_tab[5], &__pyx_n_s_Insert) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9702 if (__Pyx_InitString(__pyx_string_tab[6], &__pyx_n_s_IntEnum) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9703 if (__Pyx_InitString(__pyx_string_tab[7], &__pyx_n_s_LevenshteinEditType) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9704 if (__Pyx_InitString(__pyx_string_tab[8], &__pyx_n_s_MemoryError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9705 if (__Pyx_InitString(__pyx_string_tab[9], &__pyx_n_s_None) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9706 if (__Pyx_InitString(__pyx_string_tab[10], &__pyx_n_s_OrderedDict) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9707 if (__Pyx_InitString(__pyx_string_tab[11], &__pyx_n_s_PickleError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9708 if (__Pyx_InitString(__pyx_string_tab[12], &__pyx_n_s_Pyx_EnumBase) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9709 if (__Pyx_InitString(__pyx_string_tab[13], &__pyx_n_s_Pyx_EnumBase___new) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9710 if (__Pyx_InitString(__pyx_string_tab[14], &__pyx_n_s_Pyx_EnumBase___repr) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9711 if (__Pyx_InitString(__pyx_string_tab[15], &__pyx_n_s_Pyx_EnumBase___str) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9712 if (__Pyx_InitString(__pyx_string_tab[16], &__pyx_n_s_Pyx_EnumMeta___reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9713 if (__Pyx_InitString(__pyx_string_tab[17], &__pyx_n_s_Pyx_EnumMeta___setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9714 if (__Pyx_InitString(__pyx_string_tab[18], &__pyx_n_s_Replace) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9715 if (__Pyx_InitString(__pyx_string_tab[19], &__pyx_kp_u_Return_list_of_3_tuples_describ) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9716 if (__Pyx_InitString(__pyx_string_tab[20], &__pyx_kp_s_Unknown_enum_value_s) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9717 if (__Pyx_InitString(__pyx_string_tab[21], &__pyx_n_s_ValueError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9718 if (__Pyx_InitString(__pyx_string_tab[22], &__pyx_n_s__29) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9719 if (__Pyx_InitString(__pyx_string_tab[23], &__pyx_n_s_array) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9720 if (__Pyx_InitString(__pyx_string_tab[24], &__pyx_n_s_asyncio_coroutines) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9721 if (__Pyx_InitString(__pyx_string_tab[25], &__pyx_n_s_c_max) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9722 if (__Pyx_InitString(__pyx_string_tab[26], &__pyx_n_s_c_score_cutoff) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9723 if (__Pyx_InitString(__pyx_string_tab[27], &__pyx_n_s_class) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9724 if (__Pyx_InitString(__pyx_string_tab[28], &__pyx_n_s_class_getitem) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9725 if (__Pyx_InitString(__pyx_string_tab[29], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9726 if (__Pyx_InitString(__pyx_string_tab[30], &__pyx_n_s_cls) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9727 if (__Pyx_InitString(__pyx_string_tab[31], &__pyx_n_s_collections) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9728 if (__Pyx_InitString(__pyx_string_tab[32], &__pyx_n_s_cpp_string_metric) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9729 if (__Pyx_InitString(__pyx_string_tab[33], &__pyx_kp_s_cpp_string_metric_pyx) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9730 if (__Pyx_InitString(__pyx_string_tab[34], &__pyx_n_s_dct) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9731 if (__Pyx_InitString(__pyx_string_tab[35], &__pyx_n_s_default_process) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9732 if (__Pyx_InitString(__pyx_string_tab[36], &__pyx_n_u_delete) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9733 if (__Pyx_InitString(__pyx_string_tab[37], &__pyx_n_s_deletion) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9734 if (__Pyx_InitString(__pyx_string_tab[38], &__pyx_n_s_dict) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9735 if (__Pyx_InitString(__pyx_string_tab[39], &__pyx_n_s_dict_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9736 if (__Pyx_InitString(__pyx_string_tab[40], &__pyx_kp_u_disable) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9737 if (__Pyx_InitString(__pyx_string_tab[41], &__pyx_n_s_doc) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9738 if (__Pyx_InitString(__pyx_string_tab[42], &__pyx_kp_u_enable) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9739 if (__Pyx_InitString(__pyx_string_tab[43], &__pyx_n_s_enum) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9740 if (__Pyx_InitString(__pyx_string_tab[44], &__pyx_kp_u_gc) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9741 if (__Pyx_InitString(__pyx_string_tab[45], &__pyx_n_s_getstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9742 if (__Pyx_InitString(__pyx_string_tab[46], &__pyx_n_s_hamming) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9743 if (__Pyx_InitString(__pyx_string_tab[47], &__pyx_n_s_import) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9744 if (__Pyx_InitString(__pyx_string_tab[48], &__pyx_n_s_init) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9745 if (__Pyx_InitString(__pyx_string_tab[49], &__pyx_n_s_init_subclass) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9746 if (__Pyx_InitString(__pyx_string_tab[50], &__pyx_n_u_insert) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9747 if (__Pyx_InitString(__pyx_string_tab[51], &__pyx_n_s_insertion) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9748 if (__Pyx_InitString(__pyx_string_tab[52], &__pyx_n_s_is_coroutine) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9749 if (__Pyx_InitString(__pyx_string_tab[53], &__pyx_kp_u_isenabled) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9750 if (__Pyx_InitString(__pyx_string_tab[54], &__pyx_n_s_jaro_similarity) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9751 if (__Pyx_InitString(__pyx_string_tab[55], &__pyx_n_s_jaro_winkler_similarity) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9752 if (__Pyx_InitString(__pyx_string_tab[56], &__pyx_n_s_levenshtein) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9753 if (__Pyx_InitString(__pyx_string_tab[57], &__pyx_n_s_levenshtein_editops) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9754 if (__Pyx_InitString(__pyx_string_tab[58], &__pyx_kp_u_levenshtein_editops_line_248) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9755 if (__Pyx_InitString(__pyx_string_tab[59], &__pyx_kp_u_levenshtein_line_50) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9756 if (__Pyx_InitString(__pyx_string_tab[60], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9757 if (__Pyx_InitString(__pyx_string_tab[61], &__pyx_n_s_max) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9758 if (__Pyx_InitString(__pyx_string_tab[62], &__pyx_n_s_members) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9759 if (__Pyx_InitString(__pyx_string_tab[63], &__pyx_n_s_metaclass) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9760 if (__Pyx_InitString(__pyx_string_tab[64], &__pyx_n_s_module) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9761 if (__Pyx_InitString(__pyx_string_tab[65], &__pyx_n_s_mro_entries) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9762 if (__Pyx_InitString(__pyx_string_tab[66], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9763 if (__Pyx_InitString(__pyx_string_tab[67], &__pyx_n_s_name_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9764 if (__Pyx_InitString(__pyx_string_tab[68], &__pyx_n_s_new) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9765 if (__Pyx_InitString(__pyx_string_tab[69], &__pyx_n_s_normalized_hamming) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9766 if (__Pyx_InitString(__pyx_string_tab[70], &__pyx_n_s_normalized_levenshtein) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9767 if (__Pyx_InitString(__pyx_string_tab[71], &__pyx_kp_u_normalized_levenshtein_line_295) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9768 if (__Pyx_InitString(__pyx_string_tab[72], &__pyx_n_s_parents) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9769 if (__Pyx_InitString(__pyx_string_tab[73], &__pyx_n_s_pickle) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9770 if (__Pyx_InitString(__pyx_string_tab[74], &__pyx_n_s_prefix_weight) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9771 if (__Pyx_InitString(__pyx_string_tab[75], &__pyx_n_s_prepare) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9772 if (__Pyx_InitString(__pyx_string_tab[76], &__pyx_n_s_processor) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9773 if (__Pyx_InitString(__pyx_string_tab[77], &__pyx_n_s_pyx_PickleError) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9774 if (__Pyx_InitString(__pyx_string_tab[78], &__pyx_n_s_pyx_checksum) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9775 if (__Pyx_InitString(__pyx_string_tab[79], &__pyx_n_s_pyx_result) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9776 if (__Pyx_InitString(__pyx_string_tab[80], &__pyx_n_s_pyx_state) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9777 if (__Pyx_InitString(__pyx_string_tab[81], &__pyx_n_s_pyx_type) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9778 if (__Pyx_InitString(__pyx_string_tab[82], &__pyx_n_s_pyx_unpickle___Pyx_EnumMeta) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9779 if (__Pyx_InitString(__pyx_string_tab[83], &__pyx_n_s_qualname) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9780 if (__Pyx_InitString(__pyx_string_tab[84], &__pyx_n_s_range) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9781 if (__Pyx_InitString(__pyx_string_tab[85], &__pyx_n_s_rapidfuzz_utils) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9782 if (__Pyx_InitString(__pyx_string_tab[86], &__pyx_n_s_reduce) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9783 if (__Pyx_InitString(__pyx_string_tab[87], &__pyx_n_s_reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9784 if (__Pyx_InitString(__pyx_string_tab[88], &__pyx_n_s_reduce_ex) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9785 if (__Pyx_InitString(__pyx_string_tab[89], &__pyx_n_u_replace) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9786 if (__Pyx_InitString(__pyx_string_tab[90], &__pyx_n_s_repr) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9787 if (__Pyx_InitString(__pyx_string_tab[91], &__pyx_n_s_res) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9788 if (__Pyx_InitString(__pyx_string_tab[92], &__pyx_n_s_s1) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9789 if (__Pyx_InitString(__pyx_string_tab[93], &__pyx_n_s_s2) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9790 if (__Pyx_InitString(__pyx_string_tab[94], &__pyx_kp_s_s_s) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9791 if (__Pyx_InitString(__pyx_string_tab[95], &__pyx_kp_s_s_s_d) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9792 if (__Pyx_InitString(__pyx_string_tab[96], &__pyx_n_s_score_cutoff) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9793 if (__Pyx_InitString(__pyx_string_tab[97], &__pyx_n_s_self) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9794 if (__Pyx_InitString(__pyx_string_tab[98], &__pyx_n_s_set_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9795 if (__Pyx_InitString(__pyx_string_tab[99], &__pyx_n_s_setstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9796 if (__Pyx_InitString(__pyx_string_tab[100], &__pyx_n_s_setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9797 if (__Pyx_InitString(__pyx_string_tab[101], &__pyx_n_s_state) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9798 if (__Pyx_InitString(__pyx_string_tab[102], &__pyx_n_s_str) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9799 if (__Pyx_InitString(__pyx_string_tab[103], &__pyx_kp_s_stringsource) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9800 if (__Pyx_InitString(__pyx_string_tab[104], &__pyx_n_s_substitution) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9801 if (__Pyx_InitString(__pyx_string_tab[105], &__pyx_n_s_super) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9802 if (__Pyx_InitString(__pyx_string_tab[106], &__pyx_n_s_test) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9803 if (__Pyx_InitString(__pyx_string_tab[107], &__pyx_n_s_typecode) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9804 if (__Pyx_InitString(__pyx_string_tab[108], &__pyx_n_s_update) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9805 if (__Pyx_InitString(__pyx_string_tab[109], &__pyx_n_s_use_setstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9806 if (__Pyx_InitString(__pyx_string_tab[110], &__pyx_n_s_v) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9807 if (__Pyx_InitString(__pyx_string_tab[111], &__pyx_n_s_value) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9808 if (__Pyx_InitString(__pyx_string_tab[112], &__pyx_n_s_values) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9809 if (__Pyx_InitString(__pyx_string_tab[113], &__pyx_n_s_weights) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9810 #endif
9811 #if !CYTHON_USE_MODULE_STATE
9812 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9813 #endif
9814 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
9815 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9816 __pyx_int_228825662 = PyInt_FromLong(228825662L); if (unlikely(!__pyx_int_228825662)) __PYX_ERR(0, 1, __pyx_L1_error)
9817 return 0;
9818 __pyx_L1_error:;
9819 return -1;
9820 }
9821 /* #### Code section: init_module ### */
9822
9823 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
9824 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
9825 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
9826 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
9827 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
9828 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
9829 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
9830
__Pyx_modinit_global_init_code(void)9831 static int __Pyx_modinit_global_init_code(void) {
9832 __Pyx_RefNannyDeclarations
9833 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
9834 /*--- Global init code ---*/
9835 __Pyx_OrderedDict = Py_None; Py_INCREF(Py_None);
9836 __Pyx_EnumBase = Py_None; Py_INCREF(Py_None);
9837 __Pyx_globals = ((PyObject*)Py_None); Py_INCREF(Py_None);
9838 __Pyx_RefNannyFinishContext();
9839 return 0;
9840 }
9841
__Pyx_modinit_variable_export_code(void)9842 static int __Pyx_modinit_variable_export_code(void) {
9843 __Pyx_RefNannyDeclarations
9844 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
9845 /*--- Variable export code ---*/
9846 __Pyx_RefNannyFinishContext();
9847 return 0;
9848 }
9849
__Pyx_modinit_function_export_code(void)9850 static int __Pyx_modinit_function_export_code(void) {
9851 __Pyx_RefNannyDeclarations
9852 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
9853 /*--- Function export code ---*/
9854 __Pyx_RefNannyFinishContext();
9855 return 0;
9856 }
9857
__Pyx_modinit_type_init_code(void)9858 static int __Pyx_modinit_type_init_code(void) {
9859 __Pyx_RefNannyDeclarations
9860 PyObject *__pyx_t_1 = NULL;
9861 int __pyx_lineno = 0;
9862 const char *__pyx_filename = NULL;
9863 int __pyx_clineno = 0;
9864 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
9865 /*--- Type init code ---*/
9866 #if CYTHON_USE_TYPE_SPECS
9867 __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(&PyType_Type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
9868 __Pyx_GOTREF(__pyx_t_1);
9869 __pyx_ptype___Pyx_EnumMeta = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__Pyx_EnumMeta_spec, __pyx_t_1);
9870 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9871 if (unlikely(!__pyx_ptype___Pyx_EnumMeta)) __PYX_ERR(2, 12, __pyx_L1_error)
9872 if (__Pyx_fix_up_extension_type_from_spec(&__Pyx_EnumMeta_spec, __pyx_ptype___Pyx_EnumMeta) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
9873 #else
9874 __pyx_ptype___Pyx_EnumMeta = &__Pyx_EnumMeta;
9875 #endif
9876 #if !CYTHON_COMPILING_IN_LIMITED_API
9877 __pyx_ptype___Pyx_EnumMeta->tp_dealloc = (&PyType_Type)->tp_dealloc;
9878 __pyx_ptype___Pyx_EnumMeta->tp_base = (&PyType_Type);
9879 __pyx_ptype___Pyx_EnumMeta->tp_new = (&PyType_Type)->tp_new;
9880 #endif
9881 #if !CYTHON_USE_TYPE_SPECS
9882 if (__Pyx_PyType_Ready(__pyx_ptype___Pyx_EnumMeta) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
9883 #endif
9884 #if PY_MAJOR_VERSION < 3
9885 __pyx_ptype___Pyx_EnumMeta->tp_print = 0;
9886 #endif
9887 #if !CYTHON_COMPILING_IN_LIMITED_API
9888 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype___Pyx_EnumMeta->tp_dictoffset && __pyx_ptype___Pyx_EnumMeta->tp_getattro == PyObject_GenericGetAttr)) {
9889 __pyx_ptype___Pyx_EnumMeta->tp_getattro = __Pyx_PyObject_GenericGetAttr;
9890 }
9891 #endif
9892 #if !CYTHON_COMPILING_IN_LIMITED_API
9893 if (__Pyx_setup_reduce((PyObject *) __pyx_ptype___Pyx_EnumMeta) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
9894 #endif
9895 __Pyx_RefNannyFinishContext();
9896 return 0;
9897 __pyx_L1_error:;
9898 __Pyx_XDECREF(__pyx_t_1);
9899 __Pyx_RefNannyFinishContext();
9900 return -1;
9901 }
9902
__Pyx_modinit_type_import_code(void)9903 static int __Pyx_modinit_type_import_code(void) {
9904 __Pyx_RefNannyDeclarations
9905 PyObject *__pyx_t_1 = NULL;
9906 int __pyx_lineno = 0;
9907 const char *__pyx_filename = NULL;
9908 int __pyx_clineno = 0;
9909 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
9910 /*--- Type import code ---*/
9911 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
9912 __Pyx_GOTREF(__pyx_t_1);
9913 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
9914 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
9915 sizeof(PyTypeObject),
9916 #elif CYTHON_COMPILING_IN_LIMITED_API
9917 sizeof(PyTypeObject),
9918 #else
9919 sizeof(PyHeapTypeObject),
9920 #endif
9921 __Pyx_ImportType_CheckSize_Warn);
9922 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
9923 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9924 __Pyx_RefNannyFinishContext();
9925 return 0;
9926 __pyx_L1_error:;
9927 __Pyx_XDECREF(__pyx_t_1);
9928 __Pyx_RefNannyFinishContext();
9929 return -1;
9930 }
9931
__Pyx_modinit_variable_import_code(void)9932 static int __Pyx_modinit_variable_import_code(void) {
9933 __Pyx_RefNannyDeclarations
9934 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
9935 /*--- Variable import code ---*/
9936 __Pyx_RefNannyFinishContext();
9937 return 0;
9938 }
9939
__Pyx_modinit_function_import_code(void)9940 static int __Pyx_modinit_function_import_code(void) {
9941 __Pyx_RefNannyDeclarations
9942 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
9943 /*--- Function import code ---*/
9944 __Pyx_RefNannyFinishContext();
9945 return 0;
9946 }
9947
9948
9949 #if PY_MAJOR_VERSION >= 3
9950 #if CYTHON_PEP489_MULTI_PHASE_INIT
9951 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
9952 static int __pyx_pymod_exec_cpp_string_metric(PyObject* module); /*proto*/
9953 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
9954 {Py_mod_create, (void*)__pyx_pymod_create},
9955 {Py_mod_exec, (void*)__pyx_pymod_exec_cpp_string_metric},
9956 {0, NULL}
9957 };
9958 #endif
9959
9960 #ifdef __cplusplus
9961 namespace {
9962 struct PyModuleDef __pyx_moduledef =
9963 #else
9964 static struct PyModuleDef __pyx_moduledef =
9965 #endif
9966 {
9967 PyModuleDef_HEAD_INIT,
9968 "cpp_string_metric",
9969 0, /* m_doc */
9970 #if CYTHON_PEP489_MULTI_PHASE_INIT
9971 0, /* m_size */
9972 #elif CYTHON_USE_MODULE_STATE
9973 sizeof(__pyx_mstate), /* m_size */
9974 #else
9975 -1, /* m_size */
9976 #endif
9977 __pyx_methods /* m_methods */,
9978 #if CYTHON_PEP489_MULTI_PHASE_INIT
9979 __pyx_moduledef_slots, /* m_slots */
9980 #else
9981 NULL, /* m_reload */
9982 #endif
9983 #if CYTHON_USE_MODULE_STATE
9984 __pyx_m_traverse, /* m_traverse */
9985 __pyx_m_clear, /* m_clear */
9986 NULL /* m_free */
9987 #else
9988 NULL, /* m_traverse */
9989 NULL, /* m_clear */
9990 NULL /* m_free */
9991 #endif
9992 };
9993 #ifdef __cplusplus
9994 } /* anonymous namespace */
9995 #endif
9996 #endif
9997
9998 #ifndef CYTHON_NO_PYINIT_EXPORT
9999 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
10000 #elif PY_MAJOR_VERSION < 3
10001 #ifdef __cplusplus
10002 #define __Pyx_PyMODINIT_FUNC extern "C" void
10003 #else
10004 #define __Pyx_PyMODINIT_FUNC void
10005 #endif
10006 #else
10007 #ifdef __cplusplus
10008 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
10009 #else
10010 #define __Pyx_PyMODINIT_FUNC PyObject *
10011 #endif
10012 #endif
10013
10014
10015 #if PY_MAJOR_VERSION < 3
10016 __Pyx_PyMODINIT_FUNC initcpp_string_metric(void) CYTHON_SMALL_CODE; /*proto*/
initcpp_string_metric(void)10017 __Pyx_PyMODINIT_FUNC initcpp_string_metric(void)
10018 #else
10019 __Pyx_PyMODINIT_FUNC PyInit_cpp_string_metric(void) CYTHON_SMALL_CODE; /*proto*/
10020 __Pyx_PyMODINIT_FUNC PyInit_cpp_string_metric(void)
10021 #if CYTHON_PEP489_MULTI_PHASE_INIT
10022 {
10023 return PyModuleDef_Init(&__pyx_moduledef);
10024 }
10025 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
10026 #if PY_VERSION_HEX >= 0x030700A1
10027 static PY_INT64_T main_interpreter_id = -1;
10028 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
10029 if (main_interpreter_id == -1) {
10030 main_interpreter_id = current_id;
10031 return (unlikely(current_id == -1)) ? -1 : 0;
10032 } else if (unlikely(main_interpreter_id != current_id))
10033 #else
10034 static PyInterpreterState *main_interpreter = NULL;
10035 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
10036 if (!main_interpreter) {
10037 main_interpreter = current_interpreter;
10038 } else if (unlikely(main_interpreter != current_interpreter))
10039 #endif
10040 {
10041 PyErr_SetString(
10042 PyExc_ImportError,
10043 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
10044 return -1;
10045 }
10046 return 0;
10047 }
10048 #if CYTHON_COMPILING_IN_LIMITED_API
10049 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)
10050 #else
10051 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)
10052 #endif
10053 {
10054 PyObject *value = PyObject_GetAttrString(spec, from_name);
10055 int result = 0;
10056 if (likely(value)) {
10057 if (allow_none || value != Py_None) {
10058 #if CYTHON_COMPILING_IN_LIMITED_API
10059 result = PyModule_AddObject(module, to_name, value);
10060 #else
10061 result = PyDict_SetItemString(moddict, to_name, value);
10062 #endif
10063 }
10064 Py_DECREF(value);
10065 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
10066 PyErr_Clear();
10067 } else {
10068 result = -1;
10069 }
10070 return result;
10071 }
10072 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
10073 PyObject *module = NULL, *moddict, *modname;
10074 CYTHON_UNUSED_VAR(def);
10075 if (__Pyx_check_single_interpreter())
10076 return NULL;
10077 if (__pyx_m)
10078 return __Pyx_NewRef(__pyx_m);
10079 modname = PyObject_GetAttrString(spec, "name");
10080 if (unlikely(!modname)) goto bad;
10081 module = PyModule_NewObject(modname);
10082 Py_DECREF(modname);
10083 if (unlikely(!module)) goto bad;
10084 #if CYTHON_COMPILING_IN_LIMITED_API
10085 moddict = module;
10086 #else
10087 moddict = PyModule_GetDict(module);
10088 if (unlikely(!moddict)) goto bad;
10089 #endif
10090 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
10091 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
10092 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
10093 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
10094 return module;
10095 bad:
10096 Py_XDECREF(module);
10097 return NULL;
10098 }
10099
10100
10101 static CYTHON_SMALL_CODE int __pyx_pymod_exec_cpp_string_metric(PyObject *__pyx_pyinit_module)
10102 #endif
10103 #endif
10104 {
10105 __Pyx_TraceDeclarations
10106 PyObject *__pyx_t_1 = NULL;
10107 PyObject *__pyx_t_2 = NULL;
10108 PyObject *__pyx_t_3 = NULL;
10109 PyObject *__pyx_t_4 = NULL;
10110 int __pyx_t_5;
10111 PyObject *__pyx_t_6 = NULL;
10112 int __pyx_lineno = 0;
10113 const char *__pyx_filename = NULL;
10114 int __pyx_clineno = 0;
10115 __Pyx_RefNannyDeclarations
10116 #if CYTHON_PEP489_MULTI_PHASE_INIT
10117 if (__pyx_m) {
10118 if (__pyx_m == __pyx_pyinit_module) return 0;
10119 PyErr_SetString(PyExc_RuntimeError, "Module 'cpp_string_metric' has already been imported. Re-initialisation is not supported.");
10120 return -1;
10121 }
10122 #elif PY_MAJOR_VERSION >= 3
10123 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
10124 #endif
10125 /*--- Module creation code ---*/
10126 #if CYTHON_PEP489_MULTI_PHASE_INIT
10127 __pyx_m = __pyx_pyinit_module;
10128 Py_INCREF(__pyx_m);
10129 #else
10130 #if PY_MAJOR_VERSION < 3
10131 __pyx_m = Py_InitModule4("cpp_string_metric", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
10132 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
10133 #elif CYTHON_COMPILING_IN_LIMITED_API
10134 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
10135 __Pyx_GOTREF(__pyx_t_1);
10136 if (unlikely((PyState_AddModule(__pyx_t_1, &__pyx_moduledef) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10137 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10138 #else
10139 __pyx_m = PyModule_Create(&__pyx_moduledef);
10140 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
10141 #endif
10142 #endif
10143 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
10144 Py_INCREF(__pyx_d);
10145 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
10146 Py_INCREF(__pyx_b);
10147 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
10148 Py_INCREF(__pyx_cython_runtime);
10149 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
10150 #if CYTHON_REFNANNY
10151 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
10152 if (!__Pyx_RefNanny) {
10153 PyErr_Clear();
10154 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
10155 if (!__Pyx_RefNanny)
10156 Py_FatalError("failed to import 'refnanny' module");
10157 }
10158 #endif
10159 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cpp_string_metric(void)", 0);
10160 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10161 #ifdef __Pxy_PyFrame_Initialize_Offsets
10162 __Pxy_PyFrame_Initialize_Offsets();
10163 #endif
10164 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
10165 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
10166 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
10167 #ifdef __Pyx_CyFunction_USED
10168 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10169 #endif
10170 #ifdef __Pyx_FusedFunction_USED
10171 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10172 #endif
10173 #ifdef __Pyx_Coroutine_USED
10174 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10175 #endif
10176 #ifdef __Pyx_Generator_USED
10177 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10178 #endif
10179 #ifdef __Pyx_AsyncGen_USED
10180 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10181 #endif
10182 #ifdef __Pyx_StopAsyncIteration_USED
10183 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10184 #endif
10185 /*--- Library function declarations ---*/
10186 /*--- Threads initialization code ---*/
10187 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
10188 PyEval_InitThreads();
10189 #endif
10190 /*--- Initialize various global constants etc. ---*/
10191 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10192 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
10193 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10194 #endif
10195 if (__pyx_module_is_main_cpp_string_metric) {
10196 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10197 }
10198 #if PY_MAJOR_VERSION >= 3
10199 {
10200 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
10201 if (!PyDict_GetItemString(modules, "cpp_string_metric")) {
10202 if (unlikely((PyDict_SetItemString(modules, "cpp_string_metric", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10203 }
10204 }
10205 #endif
10206 /*--- Builtin init code ---*/
10207 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10208 /*--- Constants init code ---*/
10209 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10210 /*--- Global type/function init code ---*/
10211 (void)__Pyx_modinit_global_init_code();
10212 (void)__Pyx_modinit_variable_export_code();
10213 (void)__Pyx_modinit_function_export_code();
10214 if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10215 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10216 (void)__Pyx_modinit_variable_import_code();
10217 (void)__Pyx_modinit_function_import_code();
10218 /*--- Execution code ---*/
10219 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
10220 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10221 #endif
10222 __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_cpp_string_metric(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
10223
10224 /* "cpp_string_metric.pyx":4
10225 * # cython: language_level=3, binding=True, linetrace=True
10226 *
10227 * from rapidfuzz.utils import default_process # <<<<<<<<<<<<<<
10228 * from cpp_common cimport proc_string, is_valid_string, convert_string, hash_array, hash_sequence
10229 * from array import array
10230 */
10231 __Pyx_TraceLine(4,0,__PYX_ERR(0, 4, __pyx_L1_error))
10232 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
10233 __Pyx_GOTREF(__pyx_t_1);
10234 __Pyx_INCREF(__pyx_n_s_default_process);
10235 __Pyx_GIVEREF(__pyx_n_s_default_process);
10236 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_default_process);
10237 __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)
10238 __Pyx_GOTREF(__pyx_t_2);
10239 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10240 __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)
10241 __Pyx_GOTREF(__pyx_t_1);
10242 if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_process, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
10243 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10244 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10245
10246 /* "cpp_string_metric.pyx":6
10247 * from rapidfuzz.utils import default_process
10248 * from cpp_common cimport proc_string, is_valid_string, convert_string, hash_array, hash_sequence
10249 * from array import array # <<<<<<<<<<<<<<
10250 * from libcpp.utility cimport move
10251 * from libcpp.vector cimport vector
10252 */
10253 __Pyx_TraceLine(6,0,__PYX_ERR(0, 6, __pyx_L1_error))
10254 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
10255 __Pyx_GOTREF(__pyx_t_2);
10256 __Pyx_INCREF(__pyx_n_s_array);
10257 __Pyx_GIVEREF(__pyx_n_s_array);
10258 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_array);
10259 __pyx_t_1 = __Pyx_Import(__pyx_n_s_array, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
10260 __Pyx_GOTREF(__pyx_t_1);
10261 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10262 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
10263 __Pyx_GOTREF(__pyx_t_2);
10264 if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
10265 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10266 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10267
10268 /* "cpp_string_metric.pyx":12
10269 * from cpython.ref cimport Py_INCREF
10270 *
10271 * cdef inline proc_string conv_sequence(seq) except *: # <<<<<<<<<<<<<<
10272 * if is_valid_string(seq):
10273 * return move(convert_string(seq))
10274 */
10275 __Pyx_TraceLine(12,0,__PYX_ERR(0, 12, __pyx_L1_error))
10276
10277
10278 /* "cpp_string_metric.pyx":50
10279 * vector[LevenshteinEditOp] levenshtein_editops_default_process(const proc_string& s1, const proc_string& s2) nogil except +
10280 *
10281 * def levenshtein(s1, s2, *, weights=(1,1,1), processor=None, max=None): # <<<<<<<<<<<<<<
10282 * """
10283 * Calculates the minimum number of insertions, deletions, and substitutions
10284 */
10285 __Pyx_TraceLine(50,0,__PYX_ERR(0, 50, __pyx_L1_error))
10286 __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
10287 __Pyx_GOTREF(__pyx_t_1);
10288 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_weights, ((PyObject*)__pyx_tuple_)) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10289 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10290 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10291 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_1levenshtein, 0, __pyx_n_s_levenshtein, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
10292 __Pyx_GOTREF(__pyx_t_2);
10293 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_1);
10294 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10295 if (PyDict_SetItem(__pyx_d, __pyx_n_s_levenshtein, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10296 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10297
10298 /* "cpp_string_metric.pyx":229
10299 * return levenshtein_no_process(conv_sequence(s1), conv_sequence(s2), insertion, deletion, substitution, c_max)
10300 *
10301 * cdef str levenshtein_edit_type_to_str(LevenshteinEditType edit_type): # <<<<<<<<<<<<<<
10302 * if edit_type == LevenshteinEditType.Insert:
10303 * return "insert"
10304 */
10305 __Pyx_TraceLine(229,0,__PYX_ERR(0, 229, __pyx_L1_error))
10306
10307
10308 /* "cpp_string_metric.pyx":238
10309 * return "replace"
10310 *
10311 * cdef list levenshtein_editops_to_list(vector[LevenshteinEditOp] ops): # <<<<<<<<<<<<<<
10312 * cdef size_t op_count = ops.size()
10313 * cdef list result_list = PyList_New(<Py_ssize_t>op_count)
10314 */
10315 __Pyx_TraceLine(238,0,__PYX_ERR(0, 238, __pyx_L1_error))
10316
10317
10318 /* "cpp_string_metric.pyx":248
10319 * return result_list
10320 *
10321 * def levenshtein_editops(s1, s2, *, processor=None): # <<<<<<<<<<<<<<
10322 * """
10323 * Return list of 3-tuples describing how to turn s1 into s2.
10324 */
10325 __Pyx_TraceLine(248,0,__PYX_ERR(0, 248, __pyx_L1_error))
10326 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
10327 __Pyx_GOTREF(__pyx_t_2);
10328 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
10329 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_3levenshtein_editops, 0, __pyx_n_s_levenshtein_editops, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
10330 __Pyx_GOTREF(__pyx_t_1);
10331 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_1, __pyx_t_2);
10332 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10333 if (PyDict_SetItem(__pyx_d, __pyx_n_s_levenshtein_editops, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
10334 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10335
10336 /* "cpp_string_metric.pyx":295
10337 * )
10338 *
10339 * def normalized_levenshtein(s1, s2, *, weights=(1,1,1), processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
10340 * """
10341 * Calculates a normalized levenshtein distance using custom
10342 */
10343 __Pyx_TraceLine(295,0,__PYX_ERR(0, 295, __pyx_L1_error))
10344 __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
10345 __Pyx_GOTREF(__pyx_t_1);
10346 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_weights, ((PyObject*)__pyx_tuple_)) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
10347 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
10348 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_score_cutoff, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
10349 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_5normalized_levenshtein, 0, __pyx_n_s_normalized_levenshtein, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
10350 __Pyx_GOTREF(__pyx_t_2);
10351 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_1);
10352 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10353 if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalized_levenshtein, __pyx_t_2) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
10354 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10355
10356 /* "cpp_string_metric.pyx":399
10357 *
10358 *
10359 * def hamming(s1, s2, *, processor=None, max=None): # <<<<<<<<<<<<<<
10360 * """
10361 * Calculates the Hamming distance between two strings.
10362 */
10363 __Pyx_TraceLine(399,0,__PYX_ERR(0, 399, __pyx_L1_error))
10364 __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error)
10365 __Pyx_GOTREF(__pyx_t_2);
10366 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
10367 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
10368 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_7hamming, 0, __pyx_n_s_hamming, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10369 __Pyx_GOTREF(__pyx_t_1);
10370 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_1, __pyx_t_2);
10371 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10372 if (PyDict_SetItem(__pyx_d, __pyx_n_s_hamming, __pyx_t_1) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
10373 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10374
10375 /* "cpp_string_metric.pyx":446
10376 *
10377 *
10378 * def normalized_hamming(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
10379 * """
10380 * Calculates a normalized hamming distance
10381 */
10382 __Pyx_TraceLine(446,0,__PYX_ERR(0, 446, __pyx_L1_error))
10383 __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
10384 __Pyx_GOTREF(__pyx_t_1);
10385 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
10386 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_score_cutoff, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
10387 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_9normalized_hamming, 0, __pyx_n_s_normalized_hamming, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
10388 __Pyx_GOTREF(__pyx_t_2);
10389 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_1);
10390 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10391 if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalized_hamming, __pyx_t_2) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
10392 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10393
10394 /* "cpp_string_metric.pyx":493
10395 *
10396 *
10397 * def jaro_similarity(s1, s2, *, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
10398 * """
10399 * Calculates the jaro similarity
10400 */
10401 __Pyx_TraceLine(493,0,__PYX_ERR(0, 493, __pyx_L1_error))
10402 __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error)
10403 __Pyx_GOTREF(__pyx_t_2);
10404 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
10405 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_score_cutoff, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
10406 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_11jaro_similarity, 0, __pyx_n_s_jaro_similarity, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)
10407 __Pyx_GOTREF(__pyx_t_1);
10408 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_1, __pyx_t_2);
10409 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10410 if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaro_similarity, __pyx_t_1) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
10411 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10412
10413 /* "cpp_string_metric.pyx":532
10414 *
10415 *
10416 * def jaro_winkler_similarity(s1, s2, *, double prefix_weight=0.1, processor=None, score_cutoff=None): # <<<<<<<<<<<<<<
10417 * """
10418 * Calculates the jaro winkler similarity
10419 */
10420 __Pyx_TraceLine(532,0,__PYX_ERR(0, 532, __pyx_L1_error))
10421 __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error)
10422 __Pyx_GOTREF(__pyx_t_1);
10423 __pyx_t_2 = PyFloat_FromDouble(((double)0.1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
10424 __Pyx_GOTREF(__pyx_t_2);
10425 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_prefix_weight, __pyx_t_2) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
10426 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10427 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processor, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
10428 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_score_cutoff, ((PyObject *)Py_None)) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
10429 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_17cpp_string_metric_13jaro_winkler_similarity, 0, __pyx_n_s_jaro_winkler_similarity, NULL, __pyx_n_s_cpp_string_metric, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
10430 __Pyx_GOTREF(__pyx_t_2);
10431 __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_2, __pyx_t_1);
10432 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10433 if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaro_winkler_similarity, __pyx_t_2) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
10434 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10435
10436 /* "cpp_string_metric.pyx":1
10437 * # distutils: language=c++ # <<<<<<<<<<<<<<
10438 * # cython: language_level=3, binding=True, linetrace=True
10439 *
10440 */
10441 __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
10442 __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
10443 __Pyx_GOTREF(__pyx_t_2);
10444 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_levenshtein_line_50, __pyx_kp_u_Calculates_the_minimum_number_o) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10445 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_levenshtein_editops_line_248, __pyx_kp_u_Return_list_of_3_tuples_describ) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10446 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_normalized_levenshtein_line_295, __pyx_kp_u_Calculates_a_normalized_levensh) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10447 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10448 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10449
10450 /* "EnumBase":9
10451 *
10452 * cdef object __Pyx_OrderedDict
10453 * from collections import OrderedDict as __Pyx_OrderedDict # <<<<<<<<<<<<<<
10454 *
10455 * @cython.internal
10456 */
10457 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 9, __pyx_L1_error)
10458 __Pyx_GOTREF(__pyx_t_2);
10459 __Pyx_INCREF(__pyx_n_s_OrderedDict);
10460 __Pyx_GIVEREF(__pyx_n_s_OrderedDict);
10461 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_OrderedDict);
10462 __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
10463 __Pyx_GOTREF(__pyx_t_1);
10464 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10465 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 9, __pyx_L1_error)
10466 __Pyx_GOTREF(__pyx_t_2);
10467 __Pyx_INCREF(__pyx_t_2);
10468 __Pyx_XGOTREF(__Pyx_OrderedDict);
10469 __Pyx_DECREF_SET(__Pyx_OrderedDict, __pyx_t_2);
10470 __Pyx_GIVEREF(__pyx_t_2);
10471 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10472 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10473
10474 /* "(tree fragment)":1
10475 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10476 * cdef tuple state
10477 * cdef object _dict
10478 */
10479 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Pyx_EnumMeta___reduce_cython, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
10480 __Pyx_GOTREF(__pyx_t_1);
10481 if (PyDict_SetItem((PyObject *)__pyx_ptype___Pyx_EnumMeta->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
10482 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10483 PyType_Modified(__pyx_ptype___Pyx_EnumMeta);
10484
10485 /* "(tree fragment)":16
10486 * else:
10487 * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xda39a3e, state)
10488 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10489 * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state)
10490 */
10491 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Pyx_EnumMeta___setstate_cython, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 16, __pyx_L1_error)
10492 __Pyx_GOTREF(__pyx_t_1);
10493 if (PyDict_SetItem((PyObject *)__pyx_ptype___Pyx_EnumMeta->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_1) < 0) __PYX_ERR(2, 16, __pyx_L1_error)
10494 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10495 PyType_Modified(__pyx_ptype___Pyx_EnumMeta);
10496
10497 /* "EnumBase":23
10498 *
10499 * cdef object __Pyx_EnumBase
10500 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta): # <<<<<<<<<<<<<<
10501 * def __new__(cls, value, name=None):
10502 * for v in cls:
10503 */
10504 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 23, __pyx_L1_error)
10505 __Pyx_GOTREF(__pyx_t_1);
10506 __Pyx_INCREF((PyObject *)(&PyInt_Type));
10507 __Pyx_GIVEREF((PyObject *)(&PyInt_Type));
10508 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyInt_Type)));
10509 __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 23, __pyx_L1_error)
10510 __Pyx_GOTREF(__pyx_t_2);
10511 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 23, __pyx_L1_error)
10512 __Pyx_GOTREF(__pyx_t_3);
10513 __pyx_t_4 = __Pyx_Py3MetaclassPrepare(((PyObject *)__pyx_ptype___Pyx_EnumMeta), __pyx_t_2, __pyx_n_s_Pyx_EnumBase, __pyx_n_s_Pyx_EnumBase, __pyx_t_3, __pyx_n_s_EnumBase, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 23, __pyx_L1_error)
10514 __Pyx_GOTREF(__pyx_t_4);
10515 if (__pyx_t_2 != __pyx_t_1) {
10516 if (unlikely((PyDict_SetItemString(__pyx_t_4, "__orig_bases__", __pyx_t_1) < 0))) __PYX_ERR(2, 23, __pyx_L1_error)
10517 }
10518 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10519
10520 /* "EnumBase":24
10521 * cdef object __Pyx_EnumBase
10522 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta):
10523 * def __new__(cls, value, name=None): # <<<<<<<<<<<<<<
10524 * for v in cls:
10525 * if v == value:
10526 */
10527 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Pyx_EnumBase___new, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 24, __pyx_L1_error)
10528 __Pyx_GOTREF(__pyx_t_1);
10529 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__22);
10530 if (__Pyx_SetNewInClass(__pyx_t_4, __pyx_n_s_new, __pyx_t_1) < 0) __PYX_ERR(2, 24, __pyx_L1_error)
10531 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10532
10533 /* "EnumBase":35
10534 * cls.__members__[name] = res
10535 * return res
10536 * def __repr__(self): # <<<<<<<<<<<<<<
10537 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
10538 * def __str__(self):
10539 */
10540 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_3__repr__, 0, __pyx_n_s_Pyx_EnumBase___repr, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 35, __pyx_L1_error)
10541 __Pyx_GOTREF(__pyx_t_1);
10542 if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_repr, __pyx_t_1) < 0) __PYX_ERR(2, 35, __pyx_L1_error)
10543 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10544
10545 /* "EnumBase":37
10546 * def __repr__(self):
10547 * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self)
10548 * def __str__(self): # <<<<<<<<<<<<<<
10549 * return "%s.%s" % (self.__class__.__name__, self.name)
10550 *
10551 */
10552 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_5__str__, 0, __pyx_n_s_Pyx_EnumBase___str, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 37, __pyx_L1_error)
10553 __Pyx_GOTREF(__pyx_t_1);
10554 if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_str, __pyx_t_1) < 0) __PYX_ERR(2, 37, __pyx_L1_error)
10555 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10556
10557 /* "EnumBase":23
10558 *
10559 * cdef object __Pyx_EnumBase
10560 * class __Pyx_EnumBase(int, metaclass=__Pyx_EnumMeta): # <<<<<<<<<<<<<<
10561 * def __new__(cls, value, name=None):
10562 * for v in cls:
10563 */
10564 __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject *)__pyx_ptype___Pyx_EnumMeta), __pyx_n_s_Pyx_EnumBase, __pyx_t_2, __pyx_t_4, __pyx_t_3, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 23, __pyx_L1_error)
10565 __Pyx_GOTREF(__pyx_t_1);
10566 __Pyx_XGOTREF(__Pyx_EnumBase);
10567 __Pyx_DECREF_SET(__Pyx_EnumBase, __pyx_t_1);
10568 __Pyx_GIVEREF(__pyx_t_1);
10569 __pyx_t_1 = 0;
10570 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10571 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10572 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10573
10574 /* "EnumBase":40
10575 * return "%s.%s" % (self.__class__.__name__, self.name)
10576 *
10577 * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<<
10578 * from enum import IntEnum as __Pyx_EnumBase
10579 *
10580 */
10581 __pyx_t_5 = ((PY_VERSION_HEX >= 0x03040000) != 0);
10582 if (__pyx_t_5) {
10583
10584 /* "EnumBase":41
10585 *
10586 * if PY_VERSION_HEX >= 0x03040000:
10587 * from enum import IntEnum as __Pyx_EnumBase # <<<<<<<<<<<<<<
10588 *
10589 */
10590 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 41, __pyx_L1_error)
10591 __Pyx_GOTREF(__pyx_t_2);
10592 __Pyx_INCREF(__pyx_n_s_IntEnum);
10593 __Pyx_GIVEREF(__pyx_n_s_IntEnum);
10594 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_IntEnum);
10595 __pyx_t_3 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 41, __pyx_L1_error)
10596 __Pyx_GOTREF(__pyx_t_3);
10597 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10598 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_IntEnum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 41, __pyx_L1_error)
10599 __Pyx_GOTREF(__pyx_t_2);
10600 __Pyx_INCREF(__pyx_t_2);
10601 __Pyx_XGOTREF(__Pyx_EnumBase);
10602 __Pyx_DECREF_SET(__Pyx_EnumBase, __pyx_t_2);
10603 __Pyx_GIVEREF(__pyx_t_2);
10604 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10605 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10606
10607 /* "EnumBase":40
10608 * return "%s.%s" % (self.__class__.__name__, self.name)
10609 *
10610 * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<<
10611 * from enum import IntEnum as __Pyx_EnumBase
10612 *
10613 */
10614 }
10615
10616 /* "(tree fragment)":1
10617 * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
10618 * cdef object __pyx_PickleError
10619 * cdef object __pyx_result
10620 */
10621 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta, 0, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1, __pyx_L1_error)
10622 __Pyx_GOTREF(__pyx_t_3);
10623 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, __pyx_t_3) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
10624 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10625
10626 /* "CppScopedEnumType":70
10627 *
10628 *
10629 * cdef dict __Pyx_globals = globals() # <<<<<<<<<<<<<<
10630 *
10631 * if PY_VERSION_HEX >= 0x03040000:
10632 */
10633 __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 70, __pyx_L1_error)
10634 __Pyx_GOTREF(__pyx_t_3);
10635 if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_3))) __PYX_ERR(2, 70, __pyx_L1_error)
10636 __Pyx_XGOTREF(__Pyx_globals);
10637 __Pyx_DECREF_SET(__Pyx_globals, ((PyObject*)__pyx_t_3));
10638 __Pyx_GIVEREF(__pyx_t_3);
10639 __pyx_t_3 = 0;
10640
10641 /* "CppScopedEnumType":72
10642 * cdef dict __Pyx_globals = globals()
10643 *
10644 * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<<
10645 *
10646 * __Pyx_globals["LevenshteinEditType"] = __Pyx_EnumBase('LevenshteinEditType', __Pyx_OrderedDict([
10647 */
10648 __pyx_t_5 = ((PY_VERSION_HEX >= 0x03040000) != 0);
10649 if (__pyx_t_5) {
10650
10651 /* "CppScopedEnumType":75
10652 *
10653 * __Pyx_globals["LevenshteinEditType"] = __Pyx_EnumBase('LevenshteinEditType', __Pyx_OrderedDict([
10654 * ('None', <int>(LevenshteinEditType.None)), # <<<<<<<<<<<<<<
10655 * ('Replace', <int>(LevenshteinEditType.Replace)),
10656 * ('Insert', <int>(LevenshteinEditType.Insert)),
10657 */
10658 __pyx_t_3 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::None)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 75, __pyx_L1_error)
10659 __Pyx_GOTREF(__pyx_t_3);
10660 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 75, __pyx_L1_error)
10661 __Pyx_GOTREF(__pyx_t_2);
10662 __Pyx_INCREF(__pyx_n_s_None);
10663 __Pyx_GIVEREF(__pyx_n_s_None);
10664 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_None);
10665 __Pyx_GIVEREF(__pyx_t_3);
10666 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
10667 __pyx_t_3 = 0;
10668
10669 /* "CppScopedEnumType":76
10670 * __Pyx_globals["LevenshteinEditType"] = __Pyx_EnumBase('LevenshteinEditType', __Pyx_OrderedDict([
10671 * ('None', <int>(LevenshteinEditType.None)),
10672 * ('Replace', <int>(LevenshteinEditType.Replace)), # <<<<<<<<<<<<<<
10673 * ('Insert', <int>(LevenshteinEditType.Insert)),
10674 * ('Delete', <int>(LevenshteinEditType.Delete)),
10675 */
10676 __pyx_t_3 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::Replace)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 76, __pyx_L1_error)
10677 __Pyx_GOTREF(__pyx_t_3);
10678 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 76, __pyx_L1_error)
10679 __Pyx_GOTREF(__pyx_t_4);
10680 __Pyx_INCREF(__pyx_n_s_Replace);
10681 __Pyx_GIVEREF(__pyx_n_s_Replace);
10682 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Replace);
10683 __Pyx_GIVEREF(__pyx_t_3);
10684 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
10685 __pyx_t_3 = 0;
10686
10687 /* "CppScopedEnumType":77
10688 * ('None', <int>(LevenshteinEditType.None)),
10689 * ('Replace', <int>(LevenshteinEditType.Replace)),
10690 * ('Insert', <int>(LevenshteinEditType.Insert)), # <<<<<<<<<<<<<<
10691 * ('Delete', <int>(LevenshteinEditType.Delete)),
10692 * ]))
10693 */
10694 __pyx_t_3 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::Insert)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 77, __pyx_L1_error)
10695 __Pyx_GOTREF(__pyx_t_3);
10696 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 77, __pyx_L1_error)
10697 __Pyx_GOTREF(__pyx_t_1);
10698 __Pyx_INCREF(__pyx_n_s_Insert);
10699 __Pyx_GIVEREF(__pyx_n_s_Insert);
10700 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Insert);
10701 __Pyx_GIVEREF(__pyx_t_3);
10702 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
10703 __pyx_t_3 = 0;
10704
10705 /* "CppScopedEnumType":78
10706 * ('Replace', <int>(LevenshteinEditType.Replace)),
10707 * ('Insert', <int>(LevenshteinEditType.Insert)),
10708 * ('Delete', <int>(LevenshteinEditType.Delete)), # <<<<<<<<<<<<<<
10709 * ]))
10710 *
10711 */
10712 __pyx_t_3 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::Delete)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 78, __pyx_L1_error)
10713 __Pyx_GOTREF(__pyx_t_3);
10714 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 78, __pyx_L1_error)
10715 __Pyx_GOTREF(__pyx_t_6);
10716 __Pyx_INCREF(__pyx_n_s_Delete);
10717 __Pyx_GIVEREF(__pyx_n_s_Delete);
10718 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Delete);
10719 __Pyx_GIVEREF(__pyx_t_3);
10720 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
10721 __pyx_t_3 = 0;
10722
10723 /* "CppScopedEnumType":74
10724 * if PY_VERSION_HEX >= 0x03040000:
10725 *
10726 * __Pyx_globals["LevenshteinEditType"] = __Pyx_EnumBase('LevenshteinEditType', __Pyx_OrderedDict([ # <<<<<<<<<<<<<<
10727 * ('None', <int>(LevenshteinEditType.None)),
10728 * ('Replace', <int>(LevenshteinEditType.Replace)),
10729 */
10730 __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 74, __pyx_L1_error)
10731 __Pyx_GOTREF(__pyx_t_3);
10732 __Pyx_GIVEREF(__pyx_t_2);
10733 PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
10734 __Pyx_GIVEREF(__pyx_t_4);
10735 PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
10736 __Pyx_GIVEREF(__pyx_t_1);
10737 PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
10738 __Pyx_GIVEREF(__pyx_t_6);
10739 PyList_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
10740 __pyx_t_2 = 0;
10741 __pyx_t_4 = 0;
10742 __pyx_t_1 = 0;
10743 __pyx_t_6 = 0;
10744 __pyx_t_6 = __Pyx_PyObject_CallOneArg(__Pyx_OrderedDict, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 74, __pyx_L1_error)
10745 __Pyx_GOTREF(__pyx_t_6);
10746 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10747 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 74, __pyx_L1_error)
10748 __Pyx_GOTREF(__pyx_t_3);
10749 __Pyx_INCREF(__pyx_n_s_LevenshteinEditType);
10750 __Pyx_GIVEREF(__pyx_n_s_LevenshteinEditType);
10751 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_LevenshteinEditType);
10752 __Pyx_GIVEREF(__pyx_t_6);
10753 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
10754 __pyx_t_6 = 0;
10755 __pyx_t_6 = __Pyx_PyObject_Call(__Pyx_EnumBase, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 74, __pyx_L1_error)
10756 __Pyx_GOTREF(__pyx_t_6);
10757 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10758 if (unlikely(__Pyx_globals == Py_None)) {
10759 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10760 __PYX_ERR(2, 74, __pyx_L1_error)
10761 }
10762 if (unlikely((PyDict_SetItem(__Pyx_globals, __pyx_n_s_LevenshteinEditType, __pyx_t_6) < 0))) __PYX_ERR(2, 74, __pyx_L1_error)
10763 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10764
10765 /* "CppScopedEnumType":72
10766 * cdef dict __Pyx_globals = globals()
10767 *
10768 * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<<
10769 *
10770 * __Pyx_globals["LevenshteinEditType"] = __Pyx_EnumBase('LevenshteinEditType', __Pyx_OrderedDict([
10771 */
10772 goto __pyx_L3;
10773 }
10774
10775 /* "CppScopedEnumType":82
10776 *
10777 * else:
10778 * __Pyx_globals["LevenshteinEditType"] = type('LevenshteinEditType', (__Pyx_EnumBase,), {}) # <<<<<<<<<<<<<<
10779 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.None), 'None')
10780 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Replace), 'Replace')
10781 */
10782 /*else*/ {
10783 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 82, __pyx_L1_error)
10784 __Pyx_GOTREF(__pyx_t_6);
10785 __Pyx_INCREF(__Pyx_EnumBase);
10786 __Pyx_GIVEREF(__Pyx_EnumBase);
10787 PyTuple_SET_ITEM(__pyx_t_6, 0, __Pyx_EnumBase);
10788 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 82, __pyx_L1_error)
10789 __Pyx_GOTREF(__pyx_t_3);
10790 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 82, __pyx_L1_error)
10791 __Pyx_GOTREF(__pyx_t_1);
10792 __Pyx_INCREF(__pyx_n_s_LevenshteinEditType);
10793 __Pyx_GIVEREF(__pyx_n_s_LevenshteinEditType);
10794 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_LevenshteinEditType);
10795 __Pyx_GIVEREF(__pyx_t_6);
10796 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
10797 __Pyx_GIVEREF(__pyx_t_3);
10798 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
10799 __pyx_t_6 = 0;
10800 __pyx_t_3 = 0;
10801 __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyType_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 82, __pyx_L1_error)
10802 __Pyx_GOTREF(__pyx_t_3);
10803 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10804 if (unlikely(__Pyx_globals == Py_None)) {
10805 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10806 __PYX_ERR(2, 82, __pyx_L1_error)
10807 }
10808 if (unlikely((PyDict_SetItem(__Pyx_globals, __pyx_n_s_LevenshteinEditType, __pyx_t_3) < 0))) __PYX_ERR(2, 82, __pyx_L1_error)
10809 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10810
10811 /* "CppScopedEnumType":83
10812 * else:
10813 * __Pyx_globals["LevenshteinEditType"] = type('LevenshteinEditType', (__Pyx_EnumBase,), {})
10814 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.None), 'None') # <<<<<<<<<<<<<<
10815 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Replace), 'Replace')
10816 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Insert), 'Insert')
10817 */
10818 if (unlikely(__Pyx_globals == Py_None)) {
10819 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10820 __PYX_ERR(2, 83, __pyx_L1_error)
10821 }
10822 __pyx_t_3 = __Pyx_PyDict_GetItem(__Pyx_globals, __pyx_n_s_LevenshteinEditType); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 83, __pyx_L1_error)
10823 __Pyx_GOTREF(__pyx_t_3);
10824 __pyx_t_1 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::None)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 83, __pyx_L1_error)
10825 __Pyx_GOTREF(__pyx_t_1);
10826 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 83, __pyx_L1_error)
10827 __Pyx_GOTREF(__pyx_t_6);
10828 __Pyx_GIVEREF(__pyx_t_1);
10829 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
10830 __Pyx_INCREF(__pyx_n_s_None);
10831 __Pyx_GIVEREF(__pyx_n_s_None);
10832 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_None);
10833 __pyx_t_1 = 0;
10834 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 83, __pyx_L1_error)
10835 __Pyx_GOTREF(__pyx_t_1);
10836 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10837 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10838 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10839
10840 /* "CppScopedEnumType":84
10841 * __Pyx_globals["LevenshteinEditType"] = type('LevenshteinEditType', (__Pyx_EnumBase,), {})
10842 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.None), 'None')
10843 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Replace), 'Replace') # <<<<<<<<<<<<<<
10844 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Insert), 'Insert')
10845 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Delete), 'Delete')
10846 */
10847 if (unlikely(__Pyx_globals == Py_None)) {
10848 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10849 __PYX_ERR(2, 84, __pyx_L1_error)
10850 }
10851 __pyx_t_1 = __Pyx_PyDict_GetItem(__Pyx_globals, __pyx_n_s_LevenshteinEditType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 84, __pyx_L1_error)
10852 __Pyx_GOTREF(__pyx_t_1);
10853 __pyx_t_6 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::Replace)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 84, __pyx_L1_error)
10854 __Pyx_GOTREF(__pyx_t_6);
10855 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 84, __pyx_L1_error)
10856 __Pyx_GOTREF(__pyx_t_3);
10857 __Pyx_GIVEREF(__pyx_t_6);
10858 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
10859 __Pyx_INCREF(__pyx_n_s_Replace);
10860 __Pyx_GIVEREF(__pyx_n_s_Replace);
10861 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_Replace);
10862 __pyx_t_6 = 0;
10863 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 84, __pyx_L1_error)
10864 __Pyx_GOTREF(__pyx_t_6);
10865 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10866 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10867 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10868
10869 /* "CppScopedEnumType":85
10870 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.None), 'None')
10871 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Replace), 'Replace')
10872 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Insert), 'Insert') # <<<<<<<<<<<<<<
10873 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Delete), 'Delete')
10874 *
10875 */
10876 if (unlikely(__Pyx_globals == Py_None)) {
10877 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10878 __PYX_ERR(2, 85, __pyx_L1_error)
10879 }
10880 __pyx_t_6 = __Pyx_PyDict_GetItem(__Pyx_globals, __pyx_n_s_LevenshteinEditType); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 85, __pyx_L1_error)
10881 __Pyx_GOTREF(__pyx_t_6);
10882 __pyx_t_3 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::Insert)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 85, __pyx_L1_error)
10883 __Pyx_GOTREF(__pyx_t_3);
10884 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 85, __pyx_L1_error)
10885 __Pyx_GOTREF(__pyx_t_1);
10886 __Pyx_GIVEREF(__pyx_t_3);
10887 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
10888 __Pyx_INCREF(__pyx_n_s_Insert);
10889 __Pyx_GIVEREF(__pyx_n_s_Insert);
10890 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Insert);
10891 __pyx_t_3 = 0;
10892 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 85, __pyx_L1_error)
10893 __Pyx_GOTREF(__pyx_t_3);
10894 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10895 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10896 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10897
10898 /* "CppScopedEnumType":86
10899 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Replace), 'Replace')
10900 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Insert), 'Insert')
10901 * __Pyx_globals["LevenshteinEditType"](<int>(LevenshteinEditType.Delete), 'Delete') # <<<<<<<<<<<<<<
10902 *
10903 */
10904 if (unlikely(__Pyx_globals == Py_None)) {
10905 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
10906 __PYX_ERR(2, 86, __pyx_L1_error)
10907 }
10908 __pyx_t_3 = __Pyx_PyDict_GetItem(__Pyx_globals, __pyx_n_s_LevenshteinEditType); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 86, __pyx_L1_error)
10909 __Pyx_GOTREF(__pyx_t_3);
10910 __pyx_t_1 = __Pyx_PyInt_From_int(((int)rapidfuzz::LevenshteinEditType::Delete)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 86, __pyx_L1_error)
10911 __Pyx_GOTREF(__pyx_t_1);
10912 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 86, __pyx_L1_error)
10913 __Pyx_GOTREF(__pyx_t_6);
10914 __Pyx_GIVEREF(__pyx_t_1);
10915 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
10916 __Pyx_INCREF(__pyx_n_s_Delete);
10917 __Pyx_GIVEREF(__pyx_n_s_Delete);
10918 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_Delete);
10919 __pyx_t_1 = 0;
10920 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 86, __pyx_L1_error)
10921 __Pyx_GOTREF(__pyx_t_1);
10922 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10923 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10924 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10925 }
10926 __pyx_L3:;
10927 __Pyx_TraceReturn(Py_None, 0);
10928
10929 /*--- Wrapped vars code ---*/
10930
10931 goto __pyx_L0;
10932 __pyx_L1_error:;
10933 __Pyx_XDECREF(__pyx_t_1);
10934 __Pyx_XDECREF(__pyx_t_2);
10935 __Pyx_XDECREF(__pyx_t_3);
10936 __Pyx_XDECREF(__pyx_t_4);
10937 __Pyx_XDECREF(__pyx_t_6);
10938 if (__pyx_m) {
10939 if (__pyx_d) {
10940 __Pyx_AddTraceback("init cpp_string_metric", __pyx_clineno, __pyx_lineno, __pyx_filename);
10941 }
10942 #if !CYTHON_COMPILING_IN_LIMITED_API
10943 Py_CLEAR(__pyx_m);
10944 #endif
10945 } else if (!PyErr_Occurred()) {
10946 PyErr_SetString(PyExc_ImportError, "init cpp_string_metric");
10947 }
10948 __pyx_L0:;
10949 __Pyx_RefNannyFinishContext();
10950 #if CYTHON_PEP489_MULTI_PHASE_INIT
10951 return (__pyx_m != NULL) ? 0 : -1;
10952 #elif PY_MAJOR_VERSION >= 3
10953 return __pyx_m;
10954 #else
10955 return;
10956 #endif
10957 }
10958 /* #### Code section: cleanup_globals ### */
10959 /* #### Code section: cleanup_module ### */
10960 /* #### Code section: main_method ### */
10961 /* #### Code section: utility_code_pragmas ### */
10962 #if _MSC_VER
10963 #pragma warning( push )
10964 #pragma warning( disable : 4127 )
10965 #endif
10966
10967
10968
10969 /* #### Code section: utility_code_def ### */
10970
10971 /* --- Runtime support code --- */
10972 /* Refnanny */
10973 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)10974 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10975 PyObject *m = NULL, *p = NULL;
10976 void *r = NULL;
10977 m = PyImport_ImportModule(modname);
10978 if (!m) goto end;
10979 p = PyObject_GetAttrString(m, "RefNannyAPI");
10980 if (!p) goto end;
10981 r = PyLong_AsVoidPtr(p);
10982 end:
10983 Py_XDECREF(p);
10984 Py_XDECREF(m);
10985 return (__Pyx_RefNannyAPIStruct *)r;
10986 }
10987 #endif
10988
10989 /* PyErrExceptionMatches */
10990 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)10991 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
10992 Py_ssize_t i, n;
10993 n = PyTuple_GET_SIZE(tuple);
10994 #if PY_MAJOR_VERSION >= 3
10995 for (i=0; i<n; i++) {
10996 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
10997 }
10998 #endif
10999 for (i=0; i<n; i++) {
11000 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
11001 }
11002 return 0;
11003 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)11004 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
11005 PyObject *exc_type = tstate->curexc_type;
11006 if (exc_type == err) return 1;
11007 if (unlikely(!exc_type)) return 0;
11008 if (unlikely(PyTuple_Check(err)))
11009 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
11010 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
11011 }
11012 #endif
11013
11014 /* PyErrFetchRestore */
11015 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)11016 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11017 PyObject *tmp_type, *tmp_value, *tmp_tb;
11018 tmp_type = tstate->curexc_type;
11019 tmp_value = tstate->curexc_value;
11020 tmp_tb = tstate->curexc_traceback;
11021 tstate->curexc_type = type;
11022 tstate->curexc_value = value;
11023 tstate->curexc_traceback = tb;
11024 Py_XDECREF(tmp_type);
11025 Py_XDECREF(tmp_value);
11026 Py_XDECREF(tmp_tb);
11027 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)11028 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11029 *type = tstate->curexc_type;
11030 *value = tstate->curexc_value;
11031 *tb = tstate->curexc_traceback;
11032 tstate->curexc_type = 0;
11033 tstate->curexc_value = 0;
11034 tstate->curexc_traceback = 0;
11035 }
11036 #endif
11037
11038 /* PyObjectGetAttrStr */
11039 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)11040 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
11041 PyTypeObject* tp = Py_TYPE(obj);
11042 if (likely(tp->tp_getattro))
11043 return tp->tp_getattro(obj, attr_name);
11044 #if PY_MAJOR_VERSION < 3
11045 if (likely(tp->tp_getattr))
11046 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
11047 #endif
11048 return PyObject_GetAttr(obj, attr_name);
11049 }
11050 #endif
11051
11052 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)11053 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
11054 __Pyx_PyThreadState_declare
11055 __Pyx_PyThreadState_assign
11056 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
11057 __Pyx_PyErr_Clear();
11058 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)11059 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
11060 PyObject *result;
11061 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
11062 PyTypeObject* tp = Py_TYPE(obj);
11063 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
11064 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
11065 }
11066 #endif
11067 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
11068 if (unlikely(!result)) {
11069 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
11070 }
11071 return result;
11072 }
11073
11074 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)11075 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
11076 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
11077 if (unlikely(!result) && !PyErr_Occurred()) {
11078 PyErr_Format(PyExc_NameError,
11079 #if PY_MAJOR_VERSION >= 3
11080 "name '%U' is not defined", name);
11081 #else
11082 "name '%.200s' is not defined", PyString_AS_STRING(name));
11083 #endif
11084 }
11085 return result;
11086 }
11087
11088 /* Profile */
11089 #if CYTHON_PROFILE
__Pyx_TraceSetupAndCall(PyCodeObject ** code,PyFrameObject ** frame,PyThreadState * tstate,const char * funcname,const char * srcfile,int firstlineno)11090 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
11091 PyFrameObject** frame,
11092 PyThreadState* tstate,
11093 const char *funcname,
11094 const char *srcfile,
11095 int firstlineno) {
11096 PyObject *type, *value, *traceback;
11097 int retval;
11098 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
11099 if (*code == NULL) {
11100 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
11101 if (*code == NULL) return 0;
11102 }
11103 *frame = PyFrame_New(
11104 tstate, /*PyThreadState *tstate*/
11105 *code, /*PyCodeObject *code*/
11106 __pyx_d, /*PyObject *globals*/
11107 0 /*PyObject *locals*/
11108 );
11109 if (*frame == NULL) return 0;
11110 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
11111 Py_INCREF(Py_None);
11112 (*frame)->f_trace = Py_None;
11113 }
11114 #if PY_VERSION_HEX < 0x030400B1
11115 } else {
11116 (*frame)->f_tstate = tstate;
11117 #endif
11118 }
11119 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
11120 retval = 1;
11121 tstate->tracing++;
11122 __Pyx_SetTracing(tstate, 0);
11123 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
11124 #if CYTHON_TRACE
11125 if (tstate->c_tracefunc)
11126 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
11127 if (retval && tstate->c_profilefunc)
11128 #endif
11129 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
11130 __Pyx_SetTracing(tstate, (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)));
11131 tstate->tracing--;
11132 if (retval) {
11133 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
11134 return __Pyx_IsTracing(tstate, 0, 0) && retval;
11135 } else {
11136 Py_XDECREF(type);
11137 Py_XDECREF(value);
11138 Py_XDECREF(traceback);
11139 return -1;
11140 }
11141 }
__Pyx_createFrameCodeObject(const char * funcname,const char * srcfile,int firstlineno)11142 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
11143 PyCodeObject *py_code = 0;
11144 #if PY_MAJOR_VERSION >= 3
11145 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
11146 if (likely(py_code)) {
11147 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
11148 }
11149 #else
11150 PyObject *py_srcfile = 0;
11151 PyObject *py_funcname = 0;
11152 py_funcname = PyString_FromString(funcname);
11153 if (unlikely(!py_funcname)) goto bad;
11154 py_srcfile = PyString_FromString(srcfile);
11155 if (unlikely(!py_srcfile)) goto bad;
11156 py_code = PyCode_New(
11157 0,
11158 0,
11159 0,
11160 CO_OPTIMIZED | CO_NEWLOCALS,
11161 __pyx_empty_bytes, /*PyObject *code,*/
11162 __pyx_empty_tuple, /*PyObject *consts,*/
11163 __pyx_empty_tuple, /*PyObject *names,*/
11164 __pyx_empty_tuple, /*PyObject *varnames,*/
11165 __pyx_empty_tuple, /*PyObject *freevars,*/
11166 __pyx_empty_tuple, /*PyObject *cellvars,*/
11167 py_srcfile, /*PyObject *filename,*/
11168 py_funcname, /*PyObject *name,*/
11169 firstlineno,
11170 __pyx_empty_bytes /*PyObject *lnotab*/
11171 );
11172 bad:
11173 Py_XDECREF(py_srcfile);
11174 Py_XDECREF(py_funcname);
11175 #endif
11176 return py_code;
11177 }
11178 #endif
11179
11180 /* PyDictVersioning */
11181 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)11182 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
11183 PyObject *dict = Py_TYPE(obj)->tp_dict;
11184 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
11185 }
__Pyx_get_object_dict_version(PyObject * obj)11186 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
11187 PyObject **dictptr = NULL;
11188 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
11189 if (offset) {
11190 #if CYTHON_COMPILING_IN_CPYTHON
11191 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
11192 #else
11193 dictptr = _PyObject_GetDictPtr(obj);
11194 #endif
11195 }
11196 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
11197 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)11198 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
11199 PyObject *dict = Py_TYPE(obj)->tp_dict;
11200 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
11201 return 0;
11202 return obj_dict_version == __Pyx_get_object_dict_version(obj);
11203 }
11204 #endif
11205
11206 /* GetModuleGlobalName */
11207 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)11208 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
11209 #else
11210 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
11211 #endif
11212 {
11213 PyObject *result;
11214 #if !CYTHON_AVOID_BORROWED_REFS
11215 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
11216 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
11217 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11218 if (likely(result)) {
11219 return __Pyx_NewRef(result);
11220 } else if (unlikely(PyErr_Occurred())) {
11221 return NULL;
11222 }
11223 #elif CYTHON_COMPILING_IN_LIMITED_API
11224 if (unlikely(!__pyx_m)) {
11225 return NULL;
11226 }
11227 result = PyObject_GetAttr(__pyx_m, name);
11228 if (likely(result)) {
11229 return result;
11230 }
11231 #else
11232 result = PyDict_GetItem(__pyx_d, name);
11233 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11234 if (likely(result)) {
11235 return __Pyx_NewRef(result);
11236 }
11237 #endif
11238 #else
11239 result = PyObject_GetItem(__pyx_d, name);
11240 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11241 if (likely(result)) {
11242 return __Pyx_NewRef(result);
11243 }
11244 PyErr_Clear();
11245 #endif
11246 return __Pyx_GetBuiltinName(name);
11247 }
11248
11249 /* TupleAndListFromArray */
11250 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_copy_object_array(PyObject * const * CYTHON_RESTRICT src,PyObject ** CYTHON_RESTRICT dest,Py_ssize_t length)11251 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
11252 PyObject *v;
11253 Py_ssize_t i;
11254 for (i = 0; i < length; i++) {
11255 v = dest[i] = src[i];
11256 Py_INCREF(v);
11257 }
11258 }
11259 static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject * const * src,Py_ssize_t n)11260 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
11261 {
11262 PyObject *res;
11263 if (n <= 0) {
11264 Py_INCREF(__pyx_empty_tuple);
11265 return __pyx_empty_tuple;
11266 }
11267 res = PyTuple_New(n);
11268 if (unlikely(res == NULL)) return NULL;
11269 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
11270 return res;
11271 }
11272 static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject * const * src,Py_ssize_t n)11273 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
11274 {
11275 PyObject *res;
11276 if (n <= 0) {
11277 return PyList_New(0);
11278 }
11279 res = PyList_New(n);
11280 if (unlikely(res == NULL)) return NULL;
11281 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
11282 return res;
11283 }
11284 #endif
11285
11286 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)11287 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
11288 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
11289 return PyObject_RichCompareBool(s1, s2, equals);
11290 #else
11291 if (s1 == s2) {
11292 return (equals == Py_EQ);
11293 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
11294 const char *ps1, *ps2;
11295 Py_ssize_t length = PyBytes_GET_SIZE(s1);
11296 if (length != PyBytes_GET_SIZE(s2))
11297 return (equals == Py_NE);
11298 ps1 = PyBytes_AS_STRING(s1);
11299 ps2 = PyBytes_AS_STRING(s2);
11300 if (ps1[0] != ps2[0]) {
11301 return (equals == Py_NE);
11302 } else if (length == 1) {
11303 return (equals == Py_EQ);
11304 } else {
11305 int result;
11306 #if CYTHON_USE_UNICODE_INTERNALS
11307 Py_hash_t hash1, hash2;
11308 hash1 = ((PyBytesObject*)s1)->ob_shash;
11309 hash2 = ((PyBytesObject*)s2)->ob_shash;
11310 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
11311 return (equals == Py_NE);
11312 }
11313 #endif
11314 result = memcmp(ps1, ps2, (size_t)length);
11315 return (equals == Py_EQ) ? (result == 0) : (result != 0);
11316 }
11317 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
11318 return (equals == Py_NE);
11319 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
11320 return (equals == Py_NE);
11321 } else {
11322 int result;
11323 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
11324 if (!py_result)
11325 return -1;
11326 result = __Pyx_PyObject_IsTrue(py_result);
11327 Py_DECREF(py_result);
11328 return result;
11329 }
11330 #endif
11331 }
11332
11333 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)11334 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
11335 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
11336 return PyObject_RichCompareBool(s1, s2, equals);
11337 #else
11338 #if PY_MAJOR_VERSION < 3
11339 PyObject* owned_ref = NULL;
11340 #endif
11341 int s1_is_unicode, s2_is_unicode;
11342 if (s1 == s2) {
11343 goto return_eq;
11344 }
11345 s1_is_unicode = PyUnicode_CheckExact(s1);
11346 s2_is_unicode = PyUnicode_CheckExact(s2);
11347 #if PY_MAJOR_VERSION < 3
11348 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
11349 owned_ref = PyUnicode_FromObject(s2);
11350 if (unlikely(!owned_ref))
11351 return -1;
11352 s2 = owned_ref;
11353 s2_is_unicode = 1;
11354 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
11355 owned_ref = PyUnicode_FromObject(s1);
11356 if (unlikely(!owned_ref))
11357 return -1;
11358 s1 = owned_ref;
11359 s1_is_unicode = 1;
11360 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
11361 return __Pyx_PyBytes_Equals(s1, s2, equals);
11362 }
11363 #endif
11364 if (s1_is_unicode & s2_is_unicode) {
11365 Py_ssize_t length;
11366 int kind;
11367 void *data1, *data2;
11368 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
11369 return -1;
11370 length = __Pyx_PyUnicode_GET_LENGTH(s1);
11371 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
11372 goto return_ne;
11373 }
11374 #if CYTHON_USE_UNICODE_INTERNALS
11375 {
11376 Py_hash_t hash1, hash2;
11377 #if CYTHON_PEP393_ENABLED
11378 hash1 = ((PyASCIIObject*)s1)->hash;
11379 hash2 = ((PyASCIIObject*)s2)->hash;
11380 #else
11381 hash1 = ((PyUnicodeObject*)s1)->hash;
11382 hash2 = ((PyUnicodeObject*)s2)->hash;
11383 #endif
11384 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
11385 goto return_ne;
11386 }
11387 }
11388 #endif
11389 kind = __Pyx_PyUnicode_KIND(s1);
11390 if (kind != __Pyx_PyUnicode_KIND(s2)) {
11391 goto return_ne;
11392 }
11393 data1 = __Pyx_PyUnicode_DATA(s1);
11394 data2 = __Pyx_PyUnicode_DATA(s2);
11395 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
11396 goto return_ne;
11397 } else if (length == 1) {
11398 goto return_eq;
11399 } else {
11400 int result = memcmp(data1, data2, (size_t)(length * kind));
11401 #if PY_MAJOR_VERSION < 3
11402 Py_XDECREF(owned_ref);
11403 #endif
11404 return (equals == Py_EQ) ? (result == 0) : (result != 0);
11405 }
11406 } else if ((s1 == Py_None) & s2_is_unicode) {
11407 goto return_ne;
11408 } else if ((s2 == Py_None) & s1_is_unicode) {
11409 goto return_ne;
11410 } else {
11411 int result;
11412 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
11413 #if PY_MAJOR_VERSION < 3
11414 Py_XDECREF(owned_ref);
11415 #endif
11416 if (!py_result)
11417 return -1;
11418 result = __Pyx_PyObject_IsTrue(py_result);
11419 Py_DECREF(py_result);
11420 return result;
11421 }
11422 return_eq:
11423 #if PY_MAJOR_VERSION < 3
11424 Py_XDECREF(owned_ref);
11425 #endif
11426 return (equals == Py_EQ);
11427 return_ne:
11428 #if PY_MAJOR_VERSION < 3
11429 Py_XDECREF(owned_ref);
11430 #endif
11431 return (equals == Py_NE);
11432 #endif
11433 }
11434
11435 /* fastcall */
11436 #if CYTHON_METH_FASTCALL
__Pyx_GetKwValue_FASTCALL(PyObject * kwnames,PyObject * const * kwvalues,PyObject * s)11437 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
11438 {
11439 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
11440 for (i = 0; i < n; i++)
11441 {
11442 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
11443 }
11444 for (i = 0; i < n; i++)
11445 {
11446 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
11447 if (unlikely(eq != 0)) {
11448 if (unlikely(eq < 0)) return NULL; // error
11449 return kwvalues[i];
11450 }
11451 }
11452 return NULL; // not found (no exception set)
11453 }
11454 #endif
11455
11456 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)11457 static void __Pyx_RaiseArgtupleInvalid(
11458 const char* func_name,
11459 int exact,
11460 Py_ssize_t num_min,
11461 Py_ssize_t num_max,
11462 Py_ssize_t num_found)
11463 {
11464 Py_ssize_t num_expected;
11465 const char *more_or_less;
11466 if (num_found < num_min) {
11467 num_expected = num_min;
11468 more_or_less = "at least";
11469 } else {
11470 num_expected = num_max;
11471 more_or_less = "at most";
11472 }
11473 if (exact) {
11474 more_or_less = "exactly";
11475 }
11476 PyErr_Format(PyExc_TypeError,
11477 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
11478 func_name, more_or_less, num_expected,
11479 (num_expected == 1) ? "" : "s", num_found);
11480 }
11481
11482 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)11483 static void __Pyx_RaiseDoubleKeywordsError(
11484 const char* func_name,
11485 PyObject* kw_name)
11486 {
11487 PyErr_Format(PyExc_TypeError,
11488 #if PY_MAJOR_VERSION >= 3
11489 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
11490 #else
11491 "%s() got multiple values for keyword argument '%s'", func_name,
11492 PyString_AsString(kw_name));
11493 #endif
11494 }
11495
11496 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject * const * kwvalues,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)11497 static int __Pyx_ParseOptionalKeywords(
11498 PyObject *kwds,
11499 PyObject *const *kwvalues,
11500 PyObject **argnames[],
11501 PyObject *kwds2,
11502 PyObject *values[],
11503 Py_ssize_t num_pos_args,
11504 const char* function_name)
11505 {
11506 PyObject *key = 0, *value = 0;
11507 Py_ssize_t pos = 0;
11508 PyObject*** name;
11509 PyObject*** first_kw_arg = argnames + num_pos_args;
11510 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
11511 while (1) {
11512 if (kwds_is_tuple) {
11513 if (pos >= PyTuple_GET_SIZE(kwds)) break;
11514 key = PyTuple_GET_ITEM(kwds, pos);
11515 value = kwvalues[pos];
11516 pos++;
11517 }
11518 else
11519 {
11520 if (!PyDict_Next(kwds, &pos, &key, &value)) break;
11521 }
11522 name = first_kw_arg;
11523 while (*name && (**name != key)) name++;
11524 if (*name) {
11525 values[name-argnames] = value;
11526 continue;
11527 }
11528 name = first_kw_arg;
11529 #if PY_MAJOR_VERSION < 3
11530 if (likely(PyString_Check(key))) {
11531 while (*name) {
11532 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
11533 && _PyString_Eq(**name, key)) {
11534 values[name-argnames] = value;
11535 break;
11536 }
11537 name++;
11538 }
11539 if (*name) continue;
11540 else {
11541 PyObject*** argname = argnames;
11542 while (argname != first_kw_arg) {
11543 if ((**argname == key) || (
11544 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
11545 && _PyString_Eq(**argname, key))) {
11546 goto arg_passed_twice;
11547 }
11548 argname++;
11549 }
11550 }
11551 } else
11552 #endif
11553 if (likely(PyUnicode_Check(key))) {
11554 while (*name) {
11555 int cmp = (
11556 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11557 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
11558 #endif
11559 PyUnicode_Compare(**name, key)
11560 );
11561 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11562 if (cmp == 0) {
11563 values[name-argnames] = value;
11564 break;
11565 }
11566 name++;
11567 }
11568 if (*name) continue;
11569 else {
11570 PyObject*** argname = argnames;
11571 while (argname != first_kw_arg) {
11572 int cmp = (**argname == key) ? 0 :
11573 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11574 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
11575 #endif
11576 PyUnicode_Compare(**argname, key);
11577 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11578 if (cmp == 0) goto arg_passed_twice;
11579 argname++;
11580 }
11581 }
11582 } else
11583 goto invalid_keyword_type;
11584 if (kwds2) {
11585 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
11586 } else {
11587 goto invalid_keyword;
11588 }
11589 }
11590 return 0;
11591 arg_passed_twice:
11592 __Pyx_RaiseDoubleKeywordsError(function_name, key);
11593 goto bad;
11594 invalid_keyword_type:
11595 PyErr_Format(PyExc_TypeError,
11596 "%.200s() keywords must be strings", function_name);
11597 goto bad;
11598 invalid_keyword:
11599 #if PY_MAJOR_VERSION < 3
11600 PyErr_Format(PyExc_TypeError,
11601 "%.200s() got an unexpected keyword argument '%.200s'",
11602 function_name, PyString_AsString(key));
11603 #else
11604 PyErr_Format(PyExc_TypeError,
11605 "%s() got an unexpected keyword argument '%U'",
11606 function_name, key);
11607 #endif
11608 bad:
11609 return -1;
11610 }
11611
11612 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)11613 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
11614 PyErr_Format(PyExc_ValueError,
11615 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
11616 }
11617
11618 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)11619 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
11620 PyErr_Format(PyExc_ValueError,
11621 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
11622 index, (index == 1) ? "" : "s");
11623 }
11624
11625 /* IterFinish */
__Pyx_IterFinish(void)11626 static CYTHON_INLINE int __Pyx_IterFinish(void) {
11627 #if CYTHON_FAST_THREAD_STATE
11628 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11629 PyObject* exc_type = tstate->curexc_type;
11630 if (unlikely(exc_type)) {
11631 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
11632 PyObject *exc_value, *exc_tb;
11633 exc_value = tstate->curexc_value;
11634 exc_tb = tstate->curexc_traceback;
11635 tstate->curexc_type = 0;
11636 tstate->curexc_value = 0;
11637 tstate->curexc_traceback = 0;
11638 Py_DECREF(exc_type);
11639 Py_XDECREF(exc_value);
11640 Py_XDECREF(exc_tb);
11641 return 0;
11642 } else {
11643 return -1;
11644 }
11645 }
11646 return 0;
11647 #else
11648 if (unlikely(PyErr_Occurred())) {
11649 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
11650 PyErr_Clear();
11651 return 0;
11652 } else {
11653 return -1;
11654 }
11655 }
11656 return 0;
11657 #endif
11658 }
11659
11660 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)11661 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
11662 if (unlikely(retval)) {
11663 Py_DECREF(retval);
11664 __Pyx_RaiseTooManyValuesError(expected);
11665 return -1;
11666 } else {
11667 return __Pyx_IterFinish();
11668 }
11669 return 0;
11670 }
11671
11672 /* PyFunctionFastCall */
11673 #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)11674 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11675 PyObject *globals) {
11676 PyFrameObject *f;
11677 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11678 PyObject **fastlocals;
11679 Py_ssize_t i;
11680 PyObject *result;
11681 assert(globals != NULL);
11682 /* XXX Perhaps we should create a specialized
11683 PyFrame_New() that doesn't take locals, but does
11684 take builtins without sanity checking them.
11685 */
11686 assert(tstate != NULL);
11687 f = PyFrame_New(tstate, co, globals, NULL);
11688 if (f == NULL) {
11689 return NULL;
11690 }
11691 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11692 for (i = 0; i < na; i++) {
11693 Py_INCREF(*args);
11694 fastlocals[i] = *args++;
11695 }
11696 result = PyEval_EvalFrameEx(f,0);
11697 ++tstate->recursion_depth;
11698 Py_DECREF(f);
11699 --tstate->recursion_depth;
11700 return result;
11701 }
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)11702 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
11703 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
11704 PyObject *globals = PyFunction_GET_GLOBALS(func);
11705 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
11706 PyObject *closure;
11707 #if PY_MAJOR_VERSION >= 3
11708 PyObject *kwdefs;
11709 #endif
11710 PyObject *kwtuple, **k;
11711 PyObject **d;
11712 Py_ssize_t nd;
11713 Py_ssize_t nk;
11714 PyObject *result;
11715 assert(kwargs == NULL || PyDict_Check(kwargs));
11716 nk = kwargs ? PyDict_Size(kwargs) : 0;
11717 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
11718 return NULL;
11719 }
11720 if (
11721 #if PY_MAJOR_VERSION >= 3
11722 co->co_kwonlyargcount == 0 &&
11723 #endif
11724 likely(kwargs == NULL || nk == 0) &&
11725 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
11726 if (argdefs == NULL && co->co_argcount == nargs) {
11727 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
11728 goto done;
11729 }
11730 else if (nargs == 0 && argdefs != NULL
11731 && co->co_argcount == Py_SIZE(argdefs)) {
11732 /* function called with no arguments, but all parameters have
11733 a default value: use default values as arguments .*/
11734 args = &PyTuple_GET_ITEM(argdefs, 0);
11735 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
11736 goto done;
11737 }
11738 }
11739 if (kwargs != NULL) {
11740 Py_ssize_t pos, i;
11741 kwtuple = PyTuple_New(2 * nk);
11742 if (kwtuple == NULL) {
11743 result = NULL;
11744 goto done;
11745 }
11746 k = &PyTuple_GET_ITEM(kwtuple, 0);
11747 pos = i = 0;
11748 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11749 Py_INCREF(k[i]);
11750 Py_INCREF(k[i+1]);
11751 i += 2;
11752 }
11753 nk = i / 2;
11754 }
11755 else {
11756 kwtuple = NULL;
11757 k = NULL;
11758 }
11759 closure = PyFunction_GET_CLOSURE(func);
11760 #if PY_MAJOR_VERSION >= 3
11761 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11762 #endif
11763 if (argdefs != NULL) {
11764 d = &PyTuple_GET_ITEM(argdefs, 0);
11765 nd = Py_SIZE(argdefs);
11766 }
11767 else {
11768 d = NULL;
11769 nd = 0;
11770 }
11771 #if PY_MAJOR_VERSION >= 3
11772 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11773 args, (int)nargs,
11774 k, (int)nk,
11775 d, (int)nd, kwdefs, closure);
11776 #else
11777 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11778 args, (int)nargs,
11779 k, (int)nk,
11780 d, (int)nd, closure);
11781 #endif
11782 Py_XDECREF(kwtuple);
11783 done:
11784 Py_LeaveRecursiveCall();
11785 return result;
11786 }
11787 #endif
11788
11789 /* PyObjectCall */
11790 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)11791 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
11792 PyObject *result;
11793 ternaryfunc call = Py_TYPE(func)->tp_call;
11794 if (unlikely(!call))
11795 return PyObject_Call(func, arg, kw);
11796 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11797 return NULL;
11798 result = (*call)(func, arg, kw);
11799 Py_LeaveRecursiveCall();
11800 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11801 PyErr_SetString(
11802 PyExc_SystemError,
11803 "NULL result without error in PyObject_Call");
11804 }
11805 return result;
11806 }
11807 #endif
11808
11809 /* PyObjectCallMethO */
11810 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)11811 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11812 PyObject *self, *result;
11813 PyCFunction cfunc;
11814 cfunc = PyCFunction_GET_FUNCTION(func);
11815 self = PyCFunction_GET_SELF(func);
11816 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11817 return NULL;
11818 result = cfunc(self, arg);
11819 Py_LeaveRecursiveCall();
11820 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11821 PyErr_SetString(
11822 PyExc_SystemError,
11823 "NULL result without error in PyObject_Call");
11824 }
11825 return result;
11826 }
11827 #endif
11828
11829 /* PyObjectFastCall */
__Pyx_PyObject_FastCall_fallback(PyObject * func,PyObject ** args,size_t nargs,PyObject * kwargs)11830 static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
11831 PyObject *argstuple;
11832 PyObject *result;
11833 size_t i;
11834 argstuple = PyTuple_New((Py_ssize_t)nargs);
11835 if (unlikely(!argstuple)) return NULL;
11836 for (i = 0; i < nargs; i++) {
11837 Py_INCREF(args[i]);
11838 PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]);
11839 }
11840 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
11841 Py_DECREF(argstuple);
11842 return result;
11843 }
__Pyx_PyObject_FastCallDict(PyObject * func,PyObject ** args,size_t _nargs,PyObject * kwargs)11844 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
11845 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
11846 #if CYTHON_COMPILING_IN_CPYTHON
11847 if (nargs == 0 && kwargs == NULL) {
11848 #ifdef __Pyx_CyFunction_USED
11849 if (__Pyx_IsCyOrPyCFunction(func))
11850 #else
11851 if (PyCFunction_Check(func))
11852 #endif
11853 {
11854 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
11855 return __Pyx_PyObject_CallMethO(func, NULL);
11856 }
11857 }
11858 }
11859 else if (nargs == 1 && kwargs == NULL) {
11860 if (PyCFunction_Check(func))
11861 {
11862 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
11863 return __Pyx_PyObject_CallMethO(func, args[0]);
11864 }
11865 }
11866 }
11867 #endif
11868 #if PY_VERSION_HEX < 0x030800B1
11869 #if CYTHON_FAST_PYCCALL
11870 if (PyCFunction_Check(func)) {
11871 if (kwargs) {
11872 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
11873 } else {
11874 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
11875 }
11876 }
11877 #if PY_VERSION_HEX >= 0x030700A1
11878 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
11879 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
11880 }
11881 #endif
11882 #endif
11883 #if CYTHON_FAST_PYCALL
11884 if (PyFunction_Check(func)) {
11885 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
11886 }
11887 #endif
11888 #endif
11889 #if CYTHON_VECTORCALL
11890 vectorcallfunc f = _PyVectorcall_Function(func);
11891 if (f) {
11892 return f(func, args, (size_t)nargs, kwargs);
11893 }
11894 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
11895 if (__Pyx_CyFunction_CheckExact(func)) {
11896 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
11897 if (f) return f(func, args, (size_t)nargs, kwargs);
11898 }
11899 #endif
11900 if (nargs == 0) {
11901 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
11902 }
11903 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
11904 }
11905
11906 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)11907 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
11908 PyObject *r;
11909 if (unlikely(!j)) return NULL;
11910 r = PyObject_GetItem(o, j);
11911 Py_DECREF(j);
11912 return r;
11913 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)11914 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
11915 CYTHON_NCP_UNUSED int wraparound,
11916 CYTHON_NCP_UNUSED int boundscheck) {
11917 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11918 Py_ssize_t wrapped_i = i;
11919 if (wraparound & unlikely(i < 0)) {
11920 wrapped_i += PyList_GET_SIZE(o);
11921 }
11922 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
11923 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
11924 Py_INCREF(r);
11925 return r;
11926 }
11927 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
11928 #else
11929 return PySequence_GetItem(o, i);
11930 #endif
11931 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)11932 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
11933 CYTHON_NCP_UNUSED int wraparound,
11934 CYTHON_NCP_UNUSED int boundscheck) {
11935 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11936 Py_ssize_t wrapped_i = i;
11937 if (wraparound & unlikely(i < 0)) {
11938 wrapped_i += PyTuple_GET_SIZE(o);
11939 }
11940 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
11941 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
11942 Py_INCREF(r);
11943 return r;
11944 }
11945 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
11946 #else
11947 return PySequence_GetItem(o, i);
11948 #endif
11949 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)11950 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
11951 CYTHON_NCP_UNUSED int wraparound,
11952 CYTHON_NCP_UNUSED int boundscheck) {
11953 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
11954 if (is_list || PyList_CheckExact(o)) {
11955 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
11956 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
11957 PyObject *r = PyList_GET_ITEM(o, n);
11958 Py_INCREF(r);
11959 return r;
11960 }
11961 }
11962 else if (PyTuple_CheckExact(o)) {
11963 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
11964 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
11965 PyObject *r = PyTuple_GET_ITEM(o, n);
11966 Py_INCREF(r);
11967 return r;
11968 }
11969 } else {
11970 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
11971 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
11972 if (mm && mm->mp_subscript) {
11973 PyObject *r, *key = PyInt_FromSsize_t(i);
11974 if (unlikely(!key)) return NULL;
11975 r = mm->mp_subscript(o, key);
11976 Py_DECREF(key);
11977 return r;
11978 }
11979 if (likely(sm && sm->sq_item)) {
11980 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
11981 Py_ssize_t l = sm->sq_length(o);
11982 if (likely(l >= 0)) {
11983 i += l;
11984 } else {
11985 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
11986 return NULL;
11987 PyErr_Clear();
11988 }
11989 }
11990 return sm->sq_item(o, i);
11991 }
11992 }
11993 #else
11994 if (is_list || PySequence_Check(o)) {
11995 return PySequence_GetItem(o, i);
11996 }
11997 #endif
11998 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
11999 }
12000
12001 /* GetTopmostException */
12002 #if CYTHON_USE_EXC_INFO_STACK
12003 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)12004 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
12005 {
12006 _PyErr_StackItem *exc_info = tstate->exc_info;
12007 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
12008 exc_info->previous_item != NULL)
12009 {
12010 exc_info = exc_info->previous_item;
12011 }
12012 return exc_info;
12013 }
12014 #endif
12015
12016 /* SaveResetException */
12017 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12018 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12019 #if CYTHON_USE_EXC_INFO_STACK
12020 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
12021 *type = exc_info->exc_type;
12022 *value = exc_info->exc_value;
12023 *tb = exc_info->exc_traceback;
12024 #else
12025 *type = tstate->exc_type;
12026 *value = tstate->exc_value;
12027 *tb = tstate->exc_traceback;
12028 #endif
12029 Py_XINCREF(*type);
12030 Py_XINCREF(*value);
12031 Py_XINCREF(*tb);
12032 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)12033 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12034 PyObject *tmp_type, *tmp_value, *tmp_tb;
12035 #if CYTHON_USE_EXC_INFO_STACK
12036 _PyErr_StackItem *exc_info = tstate->exc_info;
12037 tmp_type = exc_info->exc_type;
12038 tmp_value = exc_info->exc_value;
12039 tmp_tb = exc_info->exc_traceback;
12040 exc_info->exc_type = type;
12041 exc_info->exc_value = value;
12042 exc_info->exc_traceback = tb;
12043 #else
12044 tmp_type = tstate->exc_type;
12045 tmp_value = tstate->exc_value;
12046 tmp_tb = tstate->exc_traceback;
12047 tstate->exc_type = type;
12048 tstate->exc_value = value;
12049 tstate->exc_traceback = tb;
12050 #endif
12051 Py_XDECREF(tmp_type);
12052 Py_XDECREF(tmp_value);
12053 Py_XDECREF(tmp_tb);
12054 }
12055 #endif
12056
12057 /* GetException */
12058 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12059 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
12060 #else
12061 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
12062 #endif
12063 {
12064 PyObject *local_type, *local_value, *local_tb;
12065 #if CYTHON_FAST_THREAD_STATE
12066 PyObject *tmp_type, *tmp_value, *tmp_tb;
12067 local_type = tstate->curexc_type;
12068 local_value = tstate->curexc_value;
12069 local_tb = tstate->curexc_traceback;
12070 tstate->curexc_type = 0;
12071 tstate->curexc_value = 0;
12072 tstate->curexc_traceback = 0;
12073 #else
12074 PyErr_Fetch(&local_type, &local_value, &local_tb);
12075 #endif
12076 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
12077 #if CYTHON_FAST_THREAD_STATE
12078 if (unlikely(tstate->curexc_type))
12079 #else
12080 if (unlikely(PyErr_Occurred()))
12081 #endif
12082 goto bad;
12083 #if PY_MAJOR_VERSION >= 3
12084 if (local_tb) {
12085 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
12086 goto bad;
12087 }
12088 #endif
12089 Py_XINCREF(local_tb);
12090 Py_XINCREF(local_type);
12091 Py_XINCREF(local_value);
12092 *type = local_type;
12093 *value = local_value;
12094 *tb = local_tb;
12095 #if CYTHON_FAST_THREAD_STATE
12096 #if CYTHON_USE_EXC_INFO_STACK
12097 {
12098 _PyErr_StackItem *exc_info = tstate->exc_info;
12099 tmp_type = exc_info->exc_type;
12100 tmp_value = exc_info->exc_value;
12101 tmp_tb = exc_info->exc_traceback;
12102 exc_info->exc_type = local_type;
12103 exc_info->exc_value = local_value;
12104 exc_info->exc_traceback = local_tb;
12105 }
12106 #else
12107 tmp_type = tstate->exc_type;
12108 tmp_value = tstate->exc_value;
12109 tmp_tb = tstate->exc_traceback;
12110 tstate->exc_type = local_type;
12111 tstate->exc_value = local_value;
12112 tstate->exc_traceback = local_tb;
12113 #endif
12114 Py_XDECREF(tmp_type);
12115 Py_XDECREF(tmp_value);
12116 Py_XDECREF(tmp_tb);
12117 #else
12118 PyErr_SetExcInfo(local_type, local_value, local_tb);
12119 #endif
12120 return 0;
12121 bad:
12122 *type = 0;
12123 *value = 0;
12124 *tb = 0;
12125 Py_XDECREF(local_type);
12126 Py_XDECREF(local_value);
12127 Py_XDECREF(local_tb);
12128 return -1;
12129 }
12130
12131 /* SwapException */
12132 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12133 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12134 PyObject *tmp_type, *tmp_value, *tmp_tb;
12135 #if CYTHON_USE_EXC_INFO_STACK
12136 _PyErr_StackItem *exc_info = tstate->exc_info;
12137 tmp_type = exc_info->exc_type;
12138 tmp_value = exc_info->exc_value;
12139 tmp_tb = exc_info->exc_traceback;
12140 exc_info->exc_type = *type;
12141 exc_info->exc_value = *value;
12142 exc_info->exc_traceback = *tb;
12143 #else
12144 tmp_type = tstate->exc_type;
12145 tmp_value = tstate->exc_value;
12146 tmp_tb = tstate->exc_traceback;
12147 tstate->exc_type = *type;
12148 tstate->exc_value = *value;
12149 tstate->exc_traceback = *tb;
12150 #endif
12151 *type = tmp_type;
12152 *value = tmp_value;
12153 *tb = tmp_tb;
12154 }
12155 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)12156 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
12157 PyObject *tmp_type, *tmp_value, *tmp_tb;
12158 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
12159 PyErr_SetExcInfo(*type, *value, *tb);
12160 *type = tmp_type;
12161 *value = tmp_value;
12162 *tb = tmp_tb;
12163 }
12164 #endif
12165
12166 /* PyObjectSetAttrStr */
12167 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_SetAttrStr(PyObject * obj,PyObject * attr_name,PyObject * value)12168 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
12169 PyTypeObject* tp = Py_TYPE(obj);
12170 if (likely(tp->tp_setattro))
12171 return tp->tp_setattro(obj, attr_name, value);
12172 #if PY_MAJOR_VERSION < 3
12173 if (likely(tp->tp_setattr))
12174 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
12175 #endif
12176 return PyObject_SetAttr(obj, attr_name, value);
12177 }
12178 #endif
12179
12180 /* PyObjectCallOneArg */
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)12181 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12182 PyObject *args[2] = {NULL, arg};
12183 return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
12184 }
12185
12186 /* ObjectGetItem */
12187 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)12188 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
12189 PyObject *runerr;
12190 Py_ssize_t key_value;
12191 key_value = __Pyx_PyIndex_AsSsize_t(index);
12192 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
12193 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
12194 }
12195 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
12196 __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
12197 PyErr_Clear();
12198 PyErr_Format(PyExc_IndexError,
12199 "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
12200 __Pyx_DECREF_TypeName(index_type_name);
12201 }
12202 return NULL;
12203 }
__Pyx_PyObject_GetItem_Slow(PyObject * obj,PyObject * key)12204 static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
12205 __Pyx_TypeName obj_type_name;
12206 if (likely(PyType_Check(obj))) {
12207 PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
12208 if (meth) {
12209 PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
12210 Py_DECREF(meth);
12211 return result;
12212 }
12213 }
12214 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
12215 PyErr_Format(PyExc_TypeError,
12216 "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
12217 __Pyx_DECREF_TypeName(obj_type_name);
12218 return NULL;
12219 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)12220 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
12221 PyTypeObject *tp = Py_TYPE(obj);
12222 PyMappingMethods *mm = tp->tp_as_mapping;
12223 PySequenceMethods *sm = tp->tp_as_sequence;
12224 if (likely(mm && mm->mp_subscript)) {
12225 return mm->mp_subscript(obj, key);
12226 }
12227 if (likely(sm && sm->sq_item)) {
12228 return __Pyx_PyObject_GetIndex(obj, key);
12229 }
12230 return __Pyx_PyObject_GetItem_Slow(obj, key);
12231 }
12232 #endif
12233
12234 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kw,const char * function_name,int kw_allowed)12235 static int __Pyx_CheckKeywordStrings(
12236 PyObject *kw,
12237 const char* function_name,
12238 int kw_allowed)
12239 {
12240 PyObject* key = 0;
12241 Py_ssize_t pos = 0;
12242 #if CYTHON_COMPILING_IN_PYPY
12243 if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0))
12244 goto invalid_keyword;
12245 return 1;
12246 #else
12247 if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
12248 if (unlikely(PyTuple_GET_SIZE(kw) == 0))
12249 return 1;
12250 if (!kw_allowed) {
12251 key = PyTuple_GET_ITEM(kw, 0);
12252 goto invalid_keyword;
12253 }
12254 #if PY_VERSION_HEX < 0x03090000
12255 for (pos = 0; pos < PyTuple_GET_SIZE(kw); pos++) {
12256 key = PyTuple_GET_ITEM(kw, pos);
12257 if (unlikely(!PyUnicode_Check(key)))
12258 goto invalid_keyword_type;
12259 }
12260 #endif
12261 return 1;
12262 }
12263 while (PyDict_Next(kw, &pos, &key, 0)) {
12264 #if PY_MAJOR_VERSION < 3
12265 if (unlikely(!PyString_Check(key)))
12266 #endif
12267 if (unlikely(!PyUnicode_Check(key)))
12268 goto invalid_keyword_type;
12269 }
12270 if (!kw_allowed && unlikely(key))
12271 goto invalid_keyword;
12272 return 1;
12273 invalid_keyword_type:
12274 PyErr_Format(PyExc_TypeError,
12275 "%.200s() keywords must be strings", function_name);
12276 return 0;
12277 #endif
12278 invalid_keyword:
12279 #if PY_MAJOR_VERSION < 3
12280 PyErr_Format(PyExc_TypeError,
12281 "%.200s() got an unexpected keyword argument '%.200s'",
12282 function_name, PyString_AsString(key));
12283 #else
12284 PyErr_Format(PyExc_TypeError,
12285 "%s() got an unexpected keyword argument '%U'",
12286 function_name, key);
12287 #endif
12288 return 0;
12289 }
12290
12291 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)12292 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
12293 __Pyx_PyThreadState_declare
12294 __Pyx_PyThreadState_assign
12295 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12296 return NULL;
12297 __Pyx_PyErr_Clear();
12298 Py_INCREF(d);
12299 return d;
12300 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)12301 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
12302 PyObject *r;
12303 #if CYTHON_USE_TYPE_SLOTS
12304 if (likely(PyString_Check(n))) {
12305 r = __Pyx_PyObject_GetAttrStrNoError(o, n);
12306 if (unlikely(!r) && likely(!PyErr_Occurred())) {
12307 r = __Pyx_NewRef(d);
12308 }
12309 return r;
12310 }
12311 #endif
12312 r = PyObject_GetAttr(o, n);
12313 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
12314 }
12315
12316 /* RaiseUnexpectedTypeError */
12317 static int
__Pyx_RaiseUnexpectedTypeError(const char * expected,PyObject * obj)12318 __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
12319 {
12320 __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
12321 PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
12322 expected, obj_type_name);
12323 __Pyx_DECREF_TypeName(obj_type_name);
12324 return 0;
12325 }
12326
12327 /* RaiseException */
12328 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)12329 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12330 __Pyx_PyThreadState_declare
12331 CYTHON_UNUSED_VAR(cause);
12332 Py_XINCREF(type);
12333 if (!value || value == Py_None)
12334 value = NULL;
12335 else
12336 Py_INCREF(value);
12337 if (!tb || tb == Py_None)
12338 tb = NULL;
12339 else {
12340 Py_INCREF(tb);
12341 if (!PyTraceBack_Check(tb)) {
12342 PyErr_SetString(PyExc_TypeError,
12343 "raise: arg 3 must be a traceback or None");
12344 goto raise_error;
12345 }
12346 }
12347 if (PyType_Check(type)) {
12348 #if CYTHON_COMPILING_IN_PYPY
12349 if (!value) {
12350 Py_INCREF(Py_None);
12351 value = Py_None;
12352 }
12353 #endif
12354 PyErr_NormalizeException(&type, &value, &tb);
12355 } else {
12356 if (value) {
12357 PyErr_SetString(PyExc_TypeError,
12358 "instance exception may not have a separate value");
12359 goto raise_error;
12360 }
12361 value = type;
12362 type = (PyObject*) Py_TYPE(type);
12363 Py_INCREF(type);
12364 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
12365 PyErr_SetString(PyExc_TypeError,
12366 "raise: exception class must be a subclass of BaseException");
12367 goto raise_error;
12368 }
12369 }
12370 __Pyx_PyThreadState_assign
12371 __Pyx_ErrRestore(type, value, tb);
12372 return;
12373 raise_error:
12374 Py_XDECREF(value);
12375 Py_XDECREF(type);
12376 Py_XDECREF(tb);
12377 return;
12378 }
12379 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)12380 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12381 PyObject* owned_instance = NULL;
12382 if (tb == Py_None) {
12383 tb = 0;
12384 } else if (tb && !PyTraceBack_Check(tb)) {
12385 PyErr_SetString(PyExc_TypeError,
12386 "raise: arg 3 must be a traceback or None");
12387 goto bad;
12388 }
12389 if (value == Py_None)
12390 value = 0;
12391 if (PyExceptionInstance_Check(type)) {
12392 if (value) {
12393 PyErr_SetString(PyExc_TypeError,
12394 "instance exception may not have a separate value");
12395 goto bad;
12396 }
12397 value = type;
12398 type = (PyObject*) Py_TYPE(value);
12399 } else if (PyExceptionClass_Check(type)) {
12400 PyObject *instance_class = NULL;
12401 if (value && PyExceptionInstance_Check(value)) {
12402 instance_class = (PyObject*) Py_TYPE(value);
12403 if (instance_class != type) {
12404 int is_subclass = PyObject_IsSubclass(instance_class, type);
12405 if (!is_subclass) {
12406 instance_class = NULL;
12407 } else if (unlikely(is_subclass == -1)) {
12408 goto bad;
12409 } else {
12410 type = instance_class;
12411 }
12412 }
12413 }
12414 if (!instance_class) {
12415 PyObject *args;
12416 if (!value)
12417 args = PyTuple_New(0);
12418 else if (PyTuple_Check(value)) {
12419 Py_INCREF(value);
12420 args = value;
12421 } else
12422 args = PyTuple_Pack(1, value);
12423 if (!args)
12424 goto bad;
12425 owned_instance = PyObject_Call(type, args, NULL);
12426 Py_DECREF(args);
12427 if (!owned_instance)
12428 goto bad;
12429 value = owned_instance;
12430 if (!PyExceptionInstance_Check(value)) {
12431 PyErr_Format(PyExc_TypeError,
12432 "calling %R should have returned an instance of "
12433 "BaseException, not %R",
12434 type, Py_TYPE(value));
12435 goto bad;
12436 }
12437 }
12438 } else {
12439 PyErr_SetString(PyExc_TypeError,
12440 "raise: exception class must be a subclass of BaseException");
12441 goto bad;
12442 }
12443 if (cause) {
12444 PyObject *fixed_cause;
12445 if (cause == Py_None) {
12446 fixed_cause = NULL;
12447 } else if (PyExceptionClass_Check(cause)) {
12448 fixed_cause = PyObject_CallObject(cause, NULL);
12449 if (fixed_cause == NULL)
12450 goto bad;
12451 } else if (PyExceptionInstance_Check(cause)) {
12452 fixed_cause = cause;
12453 Py_INCREF(fixed_cause);
12454 } else {
12455 PyErr_SetString(PyExc_TypeError,
12456 "exception causes must derive from "
12457 "BaseException");
12458 goto bad;
12459 }
12460 PyException_SetCause(value, fixed_cause);
12461 }
12462 PyErr_SetObject(type, value);
12463 if (tb) {
12464 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
12465 PyObject *tmp_type, *tmp_value, *tmp_tb;
12466 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12467 Py_INCREF(tb);
12468 PyErr_Restore(tmp_type, tmp_value, tb);
12469 Py_XDECREF(tmp_tb);
12470 #else
12471 PyThreadState *tstate = __Pyx_PyThreadState_Current;
12472 PyObject* tmp_tb = tstate->curexc_traceback;
12473 if (tb != tmp_tb) {
12474 Py_INCREF(tb);
12475 tstate->curexc_traceback = tb;
12476 Py_XDECREF(tmp_tb);
12477 }
12478 #endif
12479 }
12480 bad:
12481 Py_XDECREF(owned_instance);
12482 return;
12483 }
12484 #endif
12485
12486 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)12487 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
12488 PyObject *module = 0;
12489 PyObject *empty_dict = 0;
12490 PyObject *empty_list = 0;
12491 #if PY_MAJOR_VERSION < 3
12492 PyObject *py_import;
12493 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
12494 if (unlikely(!py_import))
12495 goto bad;
12496 if (!from_list) {
12497 empty_list = PyList_New(0);
12498 if (unlikely(!empty_list))
12499 goto bad;
12500 from_list = empty_list;
12501 }
12502 #endif
12503 empty_dict = PyDict_New();
12504 if (unlikely(!empty_dict))
12505 goto bad;
12506 {
12507 #if PY_MAJOR_VERSION >= 3
12508 if (level == -1) {
12509 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
12510 #if CYTHON_COMPILING_IN_LIMITED_API
12511 module = PyImport_ImportModuleLevelObject(
12512 name, empty_dict, empty_dict, from_list, 1);
12513 #else
12514 module = PyImport_ImportModuleLevelObject(
12515 name, __pyx_d, empty_dict, from_list, 1);
12516 #endif
12517 if (unlikely(!module)) {
12518 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
12519 goto bad;
12520 PyErr_Clear();
12521 }
12522 }
12523 level = 0;
12524 }
12525 #endif
12526 if (!module) {
12527 #if PY_MAJOR_VERSION < 3
12528 PyObject *py_level = PyInt_FromLong(level);
12529 if (unlikely(!py_level))
12530 goto bad;
12531 module = PyObject_CallFunctionObjArgs(py_import,
12532 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
12533 Py_DECREF(py_level);
12534 #else
12535 #if CYTHON_COMPILING_IN_LIMITED_API
12536 module = PyImport_ImportModuleLevelObject(
12537 name, empty_dict, empty_dict, from_list, level);
12538 #else
12539 module = PyImport_ImportModuleLevelObject(
12540 name, __pyx_d, empty_dict, from_list, level);
12541 #endif
12542 #endif
12543 }
12544 }
12545 bad:
12546 Py_XDECREF(empty_dict);
12547 Py_XDECREF(empty_list);
12548 #if PY_MAJOR_VERSION < 3
12549 Py_XDECREF(py_import);
12550 #endif
12551 return module;
12552 }
12553
12554 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)12555 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
12556 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
12557 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
12558 PyErr_Format(PyExc_ImportError,
12559 #if PY_MAJOR_VERSION < 3
12560 "cannot import name %.230s", PyString_AS_STRING(name));
12561 #else
12562 "cannot import name %S", name);
12563 #endif
12564 }
12565 return value;
12566 }
12567
12568 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)12569 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
12570 #if CYTHON_USE_TYPE_SLOTS
12571 #if PY_MAJOR_VERSION >= 3
12572 if (likely(PyUnicode_Check(n)))
12573 #else
12574 if (likely(PyString_Check(n)))
12575 #endif
12576 return __Pyx_PyObject_GetAttrStr(o, n);
12577 #endif
12578 return PyObject_GetAttr(o, n);
12579 }
12580
12581 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)12582 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
12583 PyObject *r;
12584 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
12585 PyErr_SetString(PyExc_TypeError,
12586 "hasattr(): attribute name must be string");
12587 return -1;
12588 }
12589 r = __Pyx_GetAttr(o, n);
12590 if (!r) {
12591 PyErr_Clear();
12592 return 0;
12593 } else {
12594 Py_DECREF(r);
12595 return 1;
12596 }
12597 }
12598
12599 /* FixUpExtensionType */
12600 #if CYTHON_USE_TYPE_SPECS
__Pyx_fix_up_extension_type_from_spec(PyType_Spec * spec,PyTypeObject * type)12601 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
12602 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
12603 (void) spec;
12604 (void) type;
12605 #else
12606 const PyType_Slot *slot = spec->slots;
12607 while (slot && slot->slot && slot->slot != Py_tp_members)
12608 slot++;
12609 if (slot && slot->slot == Py_tp_members) {
12610 int changed = 0;
12611 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
12612 const
12613 #endif
12614 PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
12615 while (memb && memb->name) {
12616 if (memb->name[0] == '_' && memb->name[1] == '_') {
12617 #if PY_VERSION_HEX < 0x030900b1
12618 if (strcmp(memb->name, "__weaklistoffset__") == 0) {
12619 assert(memb->type == T_PYSSIZET);
12620 assert(memb->flags == READONLY);
12621 type->tp_weaklistoffset = memb->offset;
12622 changed = 1;
12623 }
12624 else if (strcmp(memb->name, "__dictoffset__") == 0) {
12625 assert(memb->type == T_PYSSIZET);
12626 assert(memb->flags == READONLY);
12627 type->tp_dictoffset = memb->offset;
12628 changed = 1;
12629 }
12630 #if CYTHON_METH_FASTCALL
12631 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
12632 assert(memb->type == T_PYSSIZET);
12633 assert(memb->flags == READONLY);
12634 #if PY_VERSION_HEX >= 0x030800b4
12635 type->tp_vectorcall_offset = memb->offset;
12636 #else
12637 type->tp_print = (printfunc) memb->offset;
12638 #endif
12639 changed = 1;
12640 }
12641 #endif
12642 #else
12643 if ((0));
12644 #endif
12645 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
12646 else if (strcmp(memb->name, "__module__") == 0) {
12647 PyObject *descr;
12648 assert(memb->type == T_OBJECT);
12649 assert(memb->flags == 0 || memb->flags == READONLY);
12650 descr = PyDescr_NewMember(type, memb);
12651 if (unlikely(!descr))
12652 return -1;
12653 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
12654 Py_DECREF(descr);
12655 return -1;
12656 }
12657 Py_DECREF(descr);
12658 changed = 1;
12659 }
12660 #endif
12661 }
12662 memb++;
12663 }
12664 if (changed)
12665 PyType_Modified(type);
12666 }
12667 #endif
12668 return 0;
12669 }
12670 #endif
12671
12672 /* PyObjectCallNoArg */
__Pyx_PyObject_CallNoArg(PyObject * func)12673 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
12674 PyObject *arg = NULL;
12675 return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
12676 }
12677
12678 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)12679 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
12680 PyObject *attr;
12681 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
12682 __Pyx_TypeName type_name;
12683 PyTypeObject *tp = Py_TYPE(obj);
12684 PyObject *descr;
12685 descrgetfunc f = NULL;
12686 PyObject **dictptr, *dict;
12687 int meth_found = 0;
12688 assert (*method == NULL);
12689 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
12690 attr = __Pyx_PyObject_GetAttrStr(obj, name);
12691 goto try_unpack;
12692 }
12693 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
12694 return 0;
12695 }
12696 descr = _PyType_Lookup(tp, name);
12697 if (likely(descr != NULL)) {
12698 Py_INCREF(descr);
12699 #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
12700 if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
12701 #elif PY_MAJOR_VERSION >= 3
12702 #ifdef __Pyx_CyFunction_USED
12703 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
12704 #else
12705 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
12706 #endif
12707 #else
12708 #ifdef __Pyx_CyFunction_USED
12709 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
12710 #else
12711 if (likely(PyFunction_Check(descr)))
12712 #endif
12713 #endif
12714 {
12715 meth_found = 1;
12716 } else {
12717 f = Py_TYPE(descr)->tp_descr_get;
12718 if (f != NULL && PyDescr_IsData(descr)) {
12719 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
12720 Py_DECREF(descr);
12721 goto try_unpack;
12722 }
12723 }
12724 }
12725 dictptr = _PyObject_GetDictPtr(obj);
12726 if (dictptr != NULL && (dict = *dictptr) != NULL) {
12727 Py_INCREF(dict);
12728 attr = __Pyx_PyDict_GetItemStr(dict, name);
12729 if (attr != NULL) {
12730 Py_INCREF(attr);
12731 Py_DECREF(dict);
12732 Py_XDECREF(descr);
12733 goto try_unpack;
12734 }
12735 Py_DECREF(dict);
12736 }
12737 if (meth_found) {
12738 *method = descr;
12739 return 1;
12740 }
12741 if (f != NULL) {
12742 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
12743 Py_DECREF(descr);
12744 goto try_unpack;
12745 }
12746 if (likely(descr != NULL)) {
12747 *method = descr;
12748 return 0;
12749 }
12750 type_name = __Pyx_PyType_GetName(tp);
12751 PyErr_Format(PyExc_AttributeError,
12752 #if PY_MAJOR_VERSION >= 3
12753 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
12754 type_name, name);
12755 #else
12756 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
12757 type_name, PyString_AS_STRING(name));
12758 #endif
12759 __Pyx_DECREF_TypeName(type_name);
12760 return 0;
12761 #else
12762 attr = __Pyx_PyObject_GetAttrStr(obj, name);
12763 goto try_unpack;
12764 #endif
12765 try_unpack:
12766 #if CYTHON_UNPACK_METHODS
12767 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
12768 PyObject *function = PyMethod_GET_FUNCTION(attr);
12769 Py_INCREF(function);
12770 Py_DECREF(attr);
12771 *method = function;
12772 return 1;
12773 }
12774 #endif
12775 *method = attr;
12776 return 0;
12777 }
12778
12779 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)12780 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
12781 PyObject *method = NULL, *result = NULL;
12782 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
12783 if (likely(is_method)) {
12784 result = __Pyx_PyObject_CallOneArg(method, obj);
12785 Py_DECREF(method);
12786 return result;
12787 }
12788 if (unlikely(!method)) goto bad;
12789 result = __Pyx_PyObject_CallNoArg(method);
12790 Py_DECREF(method);
12791 bad:
12792 return result;
12793 }
12794
12795 /* ValidateBasesTuple */
12796 #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
__Pyx_validate_bases_tuple(const char * type_name,Py_ssize_t dictoffset,PyObject * bases)12797 static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
12798 Py_ssize_t i, n = PyTuple_GET_SIZE(bases);
12799 for (i = 1; i < n; i++)
12800 {
12801 PyObject *b0 = PyTuple_GET_ITEM(bases, i);
12802 PyTypeObject *b;
12803 #if PY_MAJOR_VERSION < 3
12804 if (PyClass_Check(b0))
12805 {
12806 PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
12807 PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
12808 return -1;
12809 }
12810 #endif
12811 b = (PyTypeObject*) b0;
12812 if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
12813 {
12814 __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
12815 PyErr_Format(PyExc_TypeError,
12816 "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
12817 __Pyx_DECREF_TypeName(b_name);
12818 return -1;
12819 }
12820 if (dictoffset == 0 && b->tp_dictoffset)
12821 {
12822 __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
12823 PyErr_Format(PyExc_TypeError,
12824 "extension type '%.200s' has no __dict__ slot, "
12825 "but base type '" __Pyx_FMT_TYPENAME "' has: "
12826 "either add 'cdef dict __dict__' to the extension type "
12827 "or add '__slots__ = [...]' to the base type",
12828 type_name, b_name);
12829 __Pyx_DECREF_TypeName(b_name);
12830 return -1;
12831 }
12832 }
12833 return 0;
12834 }
12835 #endif
12836
12837 /* PyType_Ready */
__Pyx_PyType_Ready(PyTypeObject * t)12838 static int __Pyx_PyType_Ready(PyTypeObject *t) {
12839 #if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION)
12840 (void)__Pyx_PyObject_CallMethod0;
12841 #if CYTHON_USE_TYPE_SPECS
12842 (void)__Pyx_validate_bases_tuple;
12843 #endif
12844 return PyType_Ready(t);
12845 #else
12846 int r;
12847 if (t->tp_bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, t->tp_bases) == -1))
12848 return -1;
12849 #if PY_VERSION_HEX >= 0x03050000
12850 {
12851 int gc_was_enabled;
12852 #if PY_VERSION_HEX >= 0x030A00b1
12853 gc_was_enabled = PyGC_Disable();
12854 (void)__Pyx_PyObject_CallMethod0;
12855 #else
12856 PyObject *ret, *py_status;
12857 PyObject *gc = NULL;
12858 #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
12859 gc = PyImport_GetModule(__pyx_kp_u_gc);
12860 #endif
12861 if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
12862 if (unlikely(!gc)) return -1;
12863 py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled);
12864 if (unlikely(!py_status)) {
12865 Py_DECREF(gc);
12866 return -1;
12867 }
12868 gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
12869 Py_DECREF(py_status);
12870 if (gc_was_enabled > 0) {
12871 ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable);
12872 if (unlikely(!ret)) {
12873 Py_DECREF(gc);
12874 return -1;
12875 }
12876 Py_DECREF(ret);
12877 } else if (unlikely(gc_was_enabled == -1)) {
12878 Py_DECREF(gc);
12879 return -1;
12880 }
12881 #endif
12882 t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
12883 #else
12884 (void)__Pyx_PyObject_CallMethod0;
12885 #endif
12886 r = PyType_Ready(t);
12887 #if PY_VERSION_HEX >= 0x03050000
12888 t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
12889 #if PY_VERSION_HEX >= 0x030A00b1
12890 if (gc_was_enabled)
12891 PyGC_Enable();
12892 #else
12893 if (gc_was_enabled) {
12894 PyObject *tp, *v, *tb;
12895 PyErr_Fetch(&tp, &v, &tb);
12896 ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable);
12897 if (likely(ret || r == -1)) {
12898 Py_XDECREF(ret);
12899 PyErr_Restore(tp, v, tb);
12900 } else {
12901 Py_XDECREF(tp);
12902 Py_XDECREF(v);
12903 Py_XDECREF(tb);
12904 r = -1;
12905 }
12906 }
12907 Py_DECREF(gc);
12908 #endif
12909 }
12910 #endif
12911 return r;
12912 #endif
12913 }
12914
12915 /* PyObject_GenericGetAttrNoDict */
12916 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)12917 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
12918 __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
12919 PyErr_Format(PyExc_AttributeError,
12920 #if PY_MAJOR_VERSION >= 3
12921 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
12922 type_name, attr_name);
12923 #else
12924 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
12925 type_name, PyString_AS_STRING(attr_name));
12926 #endif
12927 __Pyx_DECREF_TypeName(type_name);
12928 return NULL;
12929 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)12930 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12931 PyObject *descr;
12932 PyTypeObject *tp = Py_TYPE(obj);
12933 if (unlikely(!PyString_Check(attr_name))) {
12934 return PyObject_GenericGetAttr(obj, attr_name);
12935 }
12936 assert(!tp->tp_dictoffset);
12937 descr = _PyType_Lookup(tp, attr_name);
12938 if (unlikely(!descr)) {
12939 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12940 }
12941 Py_INCREF(descr);
12942 #if PY_MAJOR_VERSION < 3
12943 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12944 #endif
12945 {
12946 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12947 if (unlikely(f)) {
12948 PyObject *res = f(descr, obj, (PyObject *)tp);
12949 Py_DECREF(descr);
12950 return res;
12951 }
12952 }
12953 return descr;
12954 }
12955 #endif
12956
12957 /* PyObject_GenericGetAttr */
12958 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)12959 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
12960 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
12961 return PyObject_GenericGetAttr(obj, attr_name);
12962 }
12963 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12964 }
12965 #endif
12966
12967 /* SetupReduce */
12968 #if !CYTHON_COMPILING_IN_LIMITED_API
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)12969 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
12970 int ret;
12971 PyObject *name_attr;
12972 name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2);
12973 if (likely(name_attr)) {
12974 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
12975 } else {
12976 ret = -1;
12977 }
12978 if (unlikely(ret < 0)) {
12979 PyErr_Clear();
12980 ret = 0;
12981 }
12982 Py_XDECREF(name_attr);
12983 return ret;
12984 }
__Pyx_setup_reduce(PyObject * type_obj)12985 static int __Pyx_setup_reduce(PyObject* type_obj) {
12986 int ret = 0;
12987 PyObject *object_reduce = NULL;
12988 PyObject *object_reduce_ex = NULL;
12989 PyObject *reduce = NULL;
12990 PyObject *reduce_ex = NULL;
12991 PyObject *reduce_cython = NULL;
12992 PyObject *setstate = NULL;
12993 PyObject *setstate_cython = NULL;
12994 #if CYTHON_USE_PYTYPE_LOOKUP
12995 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12996 #else
12997 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12998 #endif
12999 #if CYTHON_USE_PYTYPE_LOOKUP
13000 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
13001 #else
13002 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
13003 #endif
13004 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
13005 if (reduce_ex == object_reduce_ex) {
13006 #if CYTHON_USE_PYTYPE_LOOKUP
13007 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
13008 #else
13009 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
13010 #endif
13011 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
13012 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
13013 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
13014 if (likely(reduce_cython)) {
13015 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
13016 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
13017 } else if (reduce == object_reduce || PyErr_Occurred()) {
13018 goto __PYX_BAD;
13019 }
13020 setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate);
13021 if (!setstate) PyErr_Clear();
13022 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
13023 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
13024 if (likely(setstate_cython)) {
13025 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
13026 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
13027 } else if (!setstate || PyErr_Occurred()) {
13028 goto __PYX_BAD;
13029 }
13030 }
13031 PyType_Modified((PyTypeObject*)type_obj);
13032 }
13033 }
13034 goto __PYX_GOOD;
13035 __PYX_BAD:
13036 if (!PyErr_Occurred()) {
13037 __Pyx_TypeName type_obj_name =
13038 __Pyx_PyType_GetName((PyTypeObject*)type_obj);
13039 PyErr_Format(PyExc_RuntimeError,
13040 "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
13041 __Pyx_DECREF_TypeName(type_obj_name);
13042 }
13043 ret = -1;
13044 __PYX_GOOD:
13045 #if !CYTHON_USE_PYTYPE_LOOKUP
13046 Py_XDECREF(object_reduce);
13047 Py_XDECREF(object_reduce_ex);
13048 #endif
13049 Py_XDECREF(reduce);
13050 Py_XDECREF(reduce_ex);
13051 Py_XDECREF(reduce_cython);
13052 Py_XDECREF(setstate);
13053 Py_XDECREF(setstate_cython);
13054 return ret;
13055 }
13056 #endif
13057
13058 /* TypeImport */
13059 #ifndef __PYX_HAVE_RT_ImportType
13060 #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)13061 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
13062 size_t size, enum __Pyx_ImportType_CheckSize check_size)
13063 {
13064 PyObject *result = 0;
13065 char warning[200];
13066 Py_ssize_t basicsize;
13067 #if CYTHON_COMPILING_IN_LIMITED_API
13068 PyObject *py_basicsize;
13069 #endif
13070 result = PyObject_GetAttrString(module, class_name);
13071 if (!result)
13072 goto bad;
13073 if (!PyType_Check(result)) {
13074 PyErr_Format(PyExc_TypeError,
13075 "%.200s.%.200s is not a type object",
13076 module_name, class_name);
13077 goto bad;
13078 }
13079 #if !CYTHON_COMPILING_IN_LIMITED_API
13080 basicsize = ((PyTypeObject *)result)->tp_basicsize;
13081 #else
13082 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
13083 if (!py_basicsize)
13084 goto bad;
13085 basicsize = PyLong_AsSsize_t(py_basicsize);
13086 Py_DECREF(py_basicsize);
13087 py_basicsize = 0;
13088 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
13089 goto bad;
13090 #endif
13091 if ((size_t)basicsize < size) {
13092 PyErr_Format(PyExc_ValueError,
13093 "%.200s.%.200s size changed, may indicate binary incompatibility. "
13094 "Expected %zd from C header, got %zd from PyObject",
13095 module_name, class_name, size, basicsize);
13096 goto bad;
13097 }
13098 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
13099 PyErr_Format(PyExc_ValueError,
13100 "%.200s.%.200s size changed, may indicate binary incompatibility. "
13101 "Expected %zd from C header, got %zd from PyObject",
13102 module_name, class_name, size, basicsize);
13103 goto bad;
13104 }
13105 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
13106 PyOS_snprintf(warning, sizeof(warning),
13107 "%s.%s size changed, may indicate binary incompatibility. "
13108 "Expected %zd from C header, got %zd from PyObject",
13109 module_name, class_name, size, basicsize);
13110 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
13111 }
13112 return (PyTypeObject *)result;
13113 bad:
13114 Py_XDECREF(result);
13115 return NULL;
13116 }
13117 #endif
13118
13119 /* FetchCommonType */
__Pyx_FetchSharedCythonABIModule(void)13120 static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
13121 PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME);
13122 if (!abi_module) return NULL;
13123 Py_INCREF(abi_module);
13124 return abi_module;
13125 }
__Pyx_VerifyCachedType(PyObject * cached_type,const char * name,Py_ssize_t basicsize,Py_ssize_t expected_basicsize)13126 static int __Pyx_VerifyCachedType(PyObject *cached_type,
13127 const char *name,
13128 Py_ssize_t basicsize,
13129 Py_ssize_t expected_basicsize) {
13130 if (!PyType_Check(cached_type)) {
13131 PyErr_Format(PyExc_TypeError,
13132 "Shared Cython type %.200s is not a type object", name);
13133 return -1;
13134 }
13135 if (basicsize != expected_basicsize) {
13136 PyErr_Format(PyExc_TypeError,
13137 "Shared Cython type %.200s has the wrong size, try recompiling",
13138 name);
13139 return -1;
13140 }
13141 return 0;
13142 }
13143 #if !CYTHON_USE_TYPE_SPECS
__Pyx_FetchCommonType(PyTypeObject * type)13144 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
13145 PyObject* abi_module;
13146 PyTypeObject *cached_type = NULL;
13147 abi_module = __Pyx_FetchSharedCythonABIModule();
13148 if (!abi_module) return NULL;
13149 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, type->tp_name);
13150 if (cached_type) {
13151 if (__Pyx_VerifyCachedType(
13152 (PyObject *)cached_type,
13153 type->tp_name,
13154 cached_type->tp_basicsize,
13155 type->tp_basicsize) < 0) {
13156 goto bad;
13157 }
13158 goto done;
13159 }
13160 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
13161 PyErr_Clear();
13162 if (PyType_Ready(type) < 0) goto bad;
13163 if (PyObject_SetAttrString(abi_module, type->tp_name, (PyObject *)type) < 0)
13164 goto bad;
13165 Py_INCREF(type);
13166 cached_type = type;
13167 done:
13168 Py_DECREF(abi_module);
13169 return cached_type;
13170 bad:
13171 Py_XDECREF(cached_type);
13172 cached_type = NULL;
13173 goto done;
13174 }
13175 #else
__Pyx_FetchCommonTypeFromSpec(PyObject * module,PyType_Spec * spec,PyObject * bases)13176 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
13177 PyObject *abi_module, *cached_type = NULL;
13178 abi_module = __Pyx_FetchSharedCythonABIModule();
13179 if (!abi_module) return NULL;
13180 cached_type = PyObject_GetAttrString(abi_module, spec->name);
13181 if (cached_type) {
13182 Py_ssize_t basicsize;
13183 #if CYTHON_COMPILING_IN_LIMITED_API
13184 PyObject *py_basicsize;
13185 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
13186 if (unlikely(!py_basicsize)) goto bad;
13187 basicsize = PyLong_AsSsize_t(py_basicsize);
13188 Py_DECREF(py_basicsize);
13189 py_basicsize = 0;
13190 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
13191 #else
13192 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
13193 #endif
13194 if (__Pyx_VerifyCachedType(
13195 cached_type,
13196 spec->name,
13197 basicsize,
13198 spec->basicsize) < 0) {
13199 goto bad;
13200 }
13201 goto done;
13202 }
13203 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
13204 PyErr_Clear();
13205 (void) module;
13206 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
13207 if (unlikely(!cached_type)) goto bad;
13208 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
13209 if (PyObject_SetAttrString(abi_module, spec->name, cached_type) < 0) goto bad;
13210 done:
13211 Py_DECREF(abi_module);
13212 assert(cached_type == NULL || PyType_Check(cached_type));
13213 return (PyTypeObject *) cached_type;
13214 bad:
13215 Py_XDECREF(cached_type);
13216 cached_type = NULL;
13217 goto done;
13218 }
13219 #endif
13220
13221 /* PyVectorcallFastCallDict */
13222 #if CYTHON_METH_FASTCALL
__Pyx_PyVectorcall_FastCallDict_kw(PyObject * func,__pyx_vectorcallfunc vc,PyObject * const * args,size_t nargs,PyObject * kw)13223 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
13224 {
13225 PyObject *res = NULL;
13226 PyObject *kwnames;
13227 PyObject **newargs;
13228 PyObject **kwvalues;
13229 Py_ssize_t i, pos;
13230 size_t j;
13231 PyObject *key, *value;
13232 unsigned long keys_are_strings;
13233 Py_ssize_t nkw = PyDict_GET_SIZE(kw);
13234 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
13235 if (unlikely(newargs == NULL)) {
13236 PyErr_NoMemory();
13237 return NULL;
13238 }
13239 for (j = 0; j < nargs; j++) newargs[j] = args[j];
13240 kwnames = PyTuple_New(nkw);
13241 if (unlikely(kwnames == NULL)) {
13242 PyMem_Free(newargs);
13243 return NULL;
13244 }
13245 kwvalues = newargs + nargs;
13246 pos = i = 0;
13247 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
13248 while (PyDict_Next(kw, &pos, &key, &value)) {
13249 keys_are_strings &= Py_TYPE(key)->tp_flags;
13250 Py_INCREF(key);
13251 Py_INCREF(value);
13252 PyTuple_SET_ITEM(kwnames, i, key);
13253 kwvalues[i] = value;
13254 i++;
13255 }
13256 if (unlikely(!keys_are_strings)) {
13257 PyErr_SetString(PyExc_TypeError, "keywords must be strings");
13258 goto cleanup;
13259 }
13260 res = vc(func, newargs, nargs, kwnames);
13261 cleanup:
13262 Py_DECREF(kwnames);
13263 for (i = 0; i < nkw; i++)
13264 Py_DECREF(kwvalues[i]);
13265 PyMem_Free(newargs);
13266 return res;
13267 }
__Pyx_PyVectorcall_FastCallDict(PyObject * func,__pyx_vectorcallfunc vc,PyObject * const * args,size_t nargs,PyObject * kw)13268 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
13269 {
13270 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
13271 return vc(func, args, nargs, NULL);
13272 }
13273 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
13274 }
13275 #endif
13276
13277 /* CythonFunctionShared */
__Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject * f,PyObject * classobj)13278 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
13279 #if PY_VERSION_HEX < 0x030900B1
13280 __Pyx_Py_XDECREF_SET(
13281 __Pyx_CyFunction_GetClassObj(f),
13282 ((classobj) ? __Pyx_NewRef(classobj) : NULL));
13283 #else
13284 __Pyx_Py_XDECREF_SET(
13285 ((PyCMethodObject *) (f))->mm_class,
13286 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
13287 #endif
13288 }
13289 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,void * closure)13290 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
13291 {
13292 CYTHON_UNUSED_VAR(closure);
13293 if (unlikely(op->func_doc == NULL)) {
13294 if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
13295 #if PY_MAJOR_VERSION >= 3
13296 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
13297 #else
13298 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
13299 #endif
13300 if (unlikely(op->func_doc == NULL))
13301 return NULL;
13302 } else {
13303 Py_INCREF(Py_None);
13304 return Py_None;
13305 }
13306 }
13307 Py_INCREF(op->func_doc);
13308 return op->func_doc;
13309 }
13310 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,void * context)13311 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
13312 {
13313 CYTHON_UNUSED_VAR(context);
13314 if (value == NULL) {
13315 value = Py_None;
13316 }
13317 Py_INCREF(value);
13318 __Pyx_Py_XDECREF_SET(op->func_doc, value);
13319 return 0;
13320 }
13321 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,void * context)13322 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
13323 {
13324 CYTHON_UNUSED_VAR(context);
13325 if (unlikely(op->func_name == NULL)) {
13326 #if PY_MAJOR_VERSION >= 3
13327 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
13328 #else
13329 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
13330 #endif
13331 if (unlikely(op->func_name == NULL))
13332 return NULL;
13333 }
13334 Py_INCREF(op->func_name);
13335 return op->func_name;
13336 }
13337 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,void * context)13338 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
13339 {
13340 CYTHON_UNUSED_VAR(context);
13341 #if PY_MAJOR_VERSION >= 3
13342 if (unlikely(value == NULL || !PyUnicode_Check(value)))
13343 #else
13344 if (unlikely(value == NULL || !PyString_Check(value)))
13345 #endif
13346 {
13347 PyErr_SetString(PyExc_TypeError,
13348 "__name__ must be set to a string object");
13349 return -1;
13350 }
13351 Py_INCREF(value);
13352 __Pyx_Py_XDECREF_SET(op->func_name, value);
13353 return 0;
13354 }
13355 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,void * context)13356 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
13357 {
13358 CYTHON_UNUSED_VAR(context);
13359 Py_INCREF(op->func_qualname);
13360 return op->func_qualname;
13361 }
13362 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,void * context)13363 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
13364 {
13365 CYTHON_UNUSED_VAR(context);
13366 #if PY_MAJOR_VERSION >= 3
13367 if (unlikely(value == NULL || !PyUnicode_Check(value)))
13368 #else
13369 if (unlikely(value == NULL || !PyString_Check(value)))
13370 #endif
13371 {
13372 PyErr_SetString(PyExc_TypeError,
13373 "__qualname__ must be set to a string object");
13374 return -1;
13375 }
13376 Py_INCREF(value);
13377 __Pyx_Py_XDECREF_SET(op->func_qualname, value);
13378 return 0;
13379 }
13380 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,void * context)13381 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
13382 {
13383 CYTHON_UNUSED_VAR(context);
13384 if (unlikely(op->func_dict == NULL)) {
13385 op->func_dict = PyDict_New();
13386 if (unlikely(op->func_dict == NULL))
13387 return NULL;
13388 }
13389 Py_INCREF(op->func_dict);
13390 return op->func_dict;
13391 }
13392 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,void * context)13393 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
13394 {
13395 CYTHON_UNUSED_VAR(context);
13396 if (unlikely(value == NULL)) {
13397 PyErr_SetString(PyExc_TypeError,
13398 "function's dictionary may not be deleted");
13399 return -1;
13400 }
13401 if (unlikely(!PyDict_Check(value))) {
13402 PyErr_SetString(PyExc_TypeError,
13403 "setting function's dictionary to a non-dict");
13404 return -1;
13405 }
13406 Py_INCREF(value);
13407 __Pyx_Py_XDECREF_SET(op->func_dict, value);
13408 return 0;
13409 }
13410 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,void * context)13411 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
13412 {
13413 CYTHON_UNUSED_VAR(context);
13414 Py_INCREF(op->func_globals);
13415 return op->func_globals;
13416 }
13417 static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject * op,void * context)13418 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
13419 {
13420 CYTHON_UNUSED_VAR(op);
13421 CYTHON_UNUSED_VAR(context);
13422 Py_INCREF(Py_None);
13423 return Py_None;
13424 }
13425 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,void * context)13426 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
13427 {
13428 PyObject* result = (op->func_code) ? op->func_code : Py_None;
13429 CYTHON_UNUSED_VAR(context);
13430 Py_INCREF(result);
13431 return result;
13432 }
13433 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)13434 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
13435 int result = 0;
13436 PyObject *res = op->defaults_getter((PyObject *) op);
13437 if (unlikely(!res))
13438 return -1;
13439 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13440 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
13441 Py_INCREF(op->defaults_tuple);
13442 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
13443 Py_INCREF(op->defaults_kwdict);
13444 #else
13445 op->defaults_tuple = PySequence_ITEM(res, 0);
13446 if (unlikely(!op->defaults_tuple)) result = -1;
13447 else {
13448 op->defaults_kwdict = PySequence_ITEM(res, 1);
13449 if (unlikely(!op->defaults_kwdict)) result = -1;
13450 }
13451 #endif
13452 Py_DECREF(res);
13453 return result;
13454 }
13455 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,void * context)13456 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
13457 CYTHON_UNUSED_VAR(context);
13458 if (!value) {
13459 value = Py_None;
13460 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
13461 PyErr_SetString(PyExc_TypeError,
13462 "__defaults__ must be set to a tuple object");
13463 return -1;
13464 }
13465 Py_INCREF(value);
13466 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
13467 return 0;
13468 }
13469 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,void * context)13470 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
13471 PyObject* result = op->defaults_tuple;
13472 CYTHON_UNUSED_VAR(context);
13473 if (unlikely(!result)) {
13474 if (op->defaults_getter) {
13475 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
13476 result = op->defaults_tuple;
13477 } else {
13478 result = Py_None;
13479 }
13480 }
13481 Py_INCREF(result);
13482 return result;
13483 }
13484 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,void * context)13485 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
13486 CYTHON_UNUSED_VAR(context);
13487 if (!value) {
13488 value = Py_None;
13489 } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
13490 PyErr_SetString(PyExc_TypeError,
13491 "__kwdefaults__ must be set to a dict object");
13492 return -1;
13493 }
13494 Py_INCREF(value);
13495 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
13496 return 0;
13497 }
13498 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,void * context)13499 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
13500 PyObject* result = op->defaults_kwdict;
13501 CYTHON_UNUSED_VAR(context);
13502 if (unlikely(!result)) {
13503 if (op->defaults_getter) {
13504 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
13505 result = op->defaults_kwdict;
13506 } else {
13507 result = Py_None;
13508 }
13509 }
13510 Py_INCREF(result);
13511 return result;
13512 }
13513 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,void * context)13514 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
13515 CYTHON_UNUSED_VAR(context);
13516 if (!value || value == Py_None) {
13517 value = NULL;
13518 } else if (unlikely(!PyDict_Check(value))) {
13519 PyErr_SetString(PyExc_TypeError,
13520 "__annotations__ must be set to a dict object");
13521 return -1;
13522 }
13523 Py_XINCREF(value);
13524 __Pyx_Py_XDECREF_SET(op->func_annotations, value);
13525 return 0;
13526 }
13527 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,void * context)13528 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
13529 PyObject* result = op->func_annotations;
13530 CYTHON_UNUSED_VAR(context);
13531 if (unlikely(!result)) {
13532 result = PyDict_New();
13533 if (unlikely(!result)) return NULL;
13534 op->func_annotations = result;
13535 }
13536 Py_INCREF(result);
13537 return result;
13538 }
13539 static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject * op,void * context)13540 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
13541 int is_coroutine;
13542 CYTHON_UNUSED_VAR(context);
13543 if (op->func_is_coroutine) {
13544 return __Pyx_NewRef(op->func_is_coroutine);
13545 }
13546 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
13547 #if PY_VERSION_HEX >= 0x03050000
13548 if (is_coroutine) {
13549 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
13550 fromlist = PyList_New(1);
13551 if (unlikely(!fromlist)) return NULL;
13552 Py_INCREF(marker);
13553 PyList_SET_ITEM(fromlist, 0, marker);
13554 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
13555 Py_DECREF(fromlist);
13556 if (unlikely(!module)) goto ignore;
13557 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
13558 Py_DECREF(module);
13559 if (likely(op->func_is_coroutine)) {
13560 return __Pyx_NewRef(op->func_is_coroutine);
13561 }
13562 ignore:
13563 PyErr_Clear();
13564 }
13565 #endif
13566 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
13567 return __Pyx_NewRef(op->func_is_coroutine);
13568 }
13569 static PyGetSetDef __pyx_CyFunction_getsets[] = {
13570 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
13571 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
13572 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
13573 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
13574 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
13575 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
13576 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
13577 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13578 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13579 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13580 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13581 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13582 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13583 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
13584 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
13585 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
13586 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
13587 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
13588 {0, 0, 0, 0, 0}
13589 };
13590 static PyMemberDef __pyx_CyFunction_members[] = {
13591 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
13592 #if CYTHON_USE_TYPE_SPECS
13593 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
13594 #if CYTHON_METH_FASTCALL
13595 #if CYTHON_BACKPORT_VECTORCALL
13596 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
13597 #else
13598 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
13599 #endif
13600 #endif
13601 #if PY_VERSION_HEX < 0x030500A0
13602 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
13603 #else
13604 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
13605 #endif
13606 #endif
13607 {0, 0, 0, 0, 0}
13608 };
13609 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,PyObject * args)13610 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
13611 {
13612 CYTHON_UNUSED_VAR(args);
13613 #if PY_MAJOR_VERSION >= 3
13614 Py_INCREF(m->func_qualname);
13615 return m->func_qualname;
13616 #else
13617 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
13618 #endif
13619 }
13620 static PyMethodDef __pyx_CyFunction_methods[] = {
13621 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
13622 {0, 0, 0, 0}
13623 };
13624 #if PY_VERSION_HEX < 0x030500A0
13625 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
13626 #else
13627 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
13628 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)13629 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
13630 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13631 PyCFunctionObject *cf = (PyCFunctionObject*) op;
13632 if (unlikely(op == NULL))
13633 return NULL;
13634 op->flags = flags;
13635 __Pyx_CyFunction_weakreflist(op) = NULL;
13636 cf->m_ml = ml;
13637 cf->m_self = (PyObject *) op;
13638 Py_XINCREF(closure);
13639 op->func_closure = closure;
13640 Py_XINCREF(module);
13641 cf->m_module = module;
13642 op->func_dict = NULL;
13643 op->func_name = NULL;
13644 Py_INCREF(qualname);
13645 op->func_qualname = qualname;
13646 op->func_doc = NULL;
13647 #if PY_VERSION_HEX < 0x030900B1
13648 op->func_classobj = NULL;
13649 #else
13650 ((PyCMethodObject*)op)->mm_class = NULL;
13651 #endif
13652 op->func_globals = globals;
13653 Py_INCREF(op->func_globals);
13654 Py_XINCREF(code);
13655 op->func_code = code;
13656 op->defaults_pyobjects = 0;
13657 op->defaults_size = 0;
13658 op->defaults = NULL;
13659 op->defaults_tuple = NULL;
13660 op->defaults_kwdict = NULL;
13661 op->defaults_getter = NULL;
13662 op->func_annotations = NULL;
13663 op->func_is_coroutine = NULL;
13664 #if CYTHON_METH_FASTCALL
13665 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
13666 case METH_NOARGS:
13667 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
13668 break;
13669 case METH_O:
13670 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
13671 break;
13672 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
13673 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
13674 break;
13675 case METH_FASTCALL | METH_KEYWORDS:
13676 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
13677 break;
13678 case METH_VARARGS | METH_KEYWORDS:
13679 __Pyx_CyFunction_func_vectorcall(op) = NULL;
13680 break;
13681 default:
13682 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
13683 Py_DECREF(op);
13684 return NULL;
13685 }
13686 #endif
13687 return (PyObject *) op;
13688 }
13689 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)13690 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
13691 {
13692 Py_CLEAR(m->func_closure);
13693 Py_CLEAR(((PyCFunctionObject*)m)->m_module);
13694 Py_CLEAR(m->func_dict);
13695 Py_CLEAR(m->func_name);
13696 Py_CLEAR(m->func_qualname);
13697 Py_CLEAR(m->func_doc);
13698 Py_CLEAR(m->func_globals);
13699 Py_CLEAR(m->func_code);
13700 #if PY_VERSION_HEX < 0x030900B1
13701 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
13702 #else
13703 {
13704 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
13705 ((PyCMethodObject *) (m))->mm_class = NULL;
13706 Py_XDECREF(cls);
13707 }
13708 #endif
13709 Py_CLEAR(m->defaults_tuple);
13710 Py_CLEAR(m->defaults_kwdict);
13711 Py_CLEAR(m->func_annotations);
13712 Py_CLEAR(m->func_is_coroutine);
13713 if (m->defaults) {
13714 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13715 int i;
13716 for (i = 0; i < m->defaults_pyobjects; i++)
13717 Py_XDECREF(pydefaults[i]);
13718 PyObject_Free(m->defaults);
13719 m->defaults = NULL;
13720 }
13721 return 0;
13722 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)13723 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
13724 {
13725 if (__Pyx_CyFunction_weakreflist(m) != NULL)
13726 PyObject_ClearWeakRefs((PyObject *) m);
13727 __Pyx_CyFunction_clear(m);
13728 __Pyx_PyHeapTypeObject_GC_Del(m);
13729 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)13730 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13731 {
13732 PyObject_GC_UnTrack(m);
13733 __Pyx__CyFunction_dealloc(m);
13734 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)13735 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13736 {
13737 Py_VISIT(m->func_closure);
13738 Py_VISIT(((PyCFunctionObject*)m)->m_module);
13739 Py_VISIT(m->func_dict);
13740 Py_VISIT(m->func_name);
13741 Py_VISIT(m->func_qualname);
13742 Py_VISIT(m->func_doc);
13743 Py_VISIT(m->func_globals);
13744 Py_VISIT(m->func_code);
13745 Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
13746 Py_VISIT(m->defaults_tuple);
13747 Py_VISIT(m->defaults_kwdict);
13748 Py_VISIT(m->func_is_coroutine);
13749 if (m->defaults) {
13750 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13751 int i;
13752 for (i = 0; i < m->defaults_pyobjects; i++)
13753 Py_VISIT(pydefaults[i]);
13754 }
13755 return 0;
13756 }
13757 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)13758 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13759 {
13760 #if PY_MAJOR_VERSION >= 3
13761 return PyUnicode_FromFormat("<cyfunction %U at %p>",
13762 op->func_qualname, (void *)op);
13763 #else
13764 return PyString_FromFormat("<cyfunction %s at %p>",
13765 PyString_AsString(op->func_qualname), (void *)op);
13766 #endif
13767 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)13768 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
13769 PyCFunctionObject* f = (PyCFunctionObject*)func;
13770 PyCFunction meth = f->m_ml->ml_meth;
13771 Py_ssize_t size;
13772 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
13773 case METH_VARARGS:
13774 if (likely(kw == NULL || PyDict_Size(kw) == 0))
13775 return (*meth)(self, arg);
13776 break;
13777 case METH_VARARGS | METH_KEYWORDS:
13778 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
13779 case METH_NOARGS:
13780 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13781 size = PyTuple_GET_SIZE(arg);
13782 if (likely(size == 0))
13783 return (*meth)(self, NULL);
13784 PyErr_Format(PyExc_TypeError,
13785 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13786 f->m_ml->ml_name, size);
13787 return NULL;
13788 }
13789 break;
13790 case METH_O:
13791 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13792 size = PyTuple_GET_SIZE(arg);
13793 if (likely(size == 1)) {
13794 PyObject *result, *arg0;
13795 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13796 arg0 = PyTuple_GET_ITEM(arg, 0);
13797 #else
13798 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
13799 #endif
13800 result = (*meth)(self, arg0);
13801 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
13802 Py_DECREF(arg0);
13803 #endif
13804 return result;
13805 }
13806 PyErr_Format(PyExc_TypeError,
13807 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13808 f->m_ml->ml_name, size);
13809 return NULL;
13810 }
13811 break;
13812 default:
13813 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
13814 return NULL;
13815 }
13816 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
13817 f->m_ml->ml_name);
13818 return NULL;
13819 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)13820 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13821 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
13822 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)13823 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
13824 PyObject *result;
13825 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
13826 #if CYTHON_METH_FASTCALL
13827 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
13828 if (vc) {
13829 #if CYTHON_ASSUME_SAFE_MACROS
13830 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
13831 #else
13832 (void) &__Pyx_PyVectorcall_FastCallDict;
13833 return PyVectorcall_Call(func, args, kw);
13834 #endif
13835 }
13836 #endif
13837 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13838 Py_ssize_t argc;
13839 PyObject *new_args;
13840 PyObject *self;
13841 argc = PyTuple_GET_SIZE(args);
13842 new_args = PyTuple_GetSlice(args, 1, argc);
13843 if (unlikely(!new_args))
13844 return NULL;
13845 self = PyTuple_GetItem(args, 0);
13846 if (unlikely(!self)) {
13847 Py_DECREF(new_args);
13848 return NULL;
13849 }
13850 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
13851 Py_DECREF(new_args);
13852 } else {
13853 result = __Pyx_CyFunction_Call(func, args, kw);
13854 }
13855 return result;
13856 }
13857 #if CYTHON_METH_FASTCALL
__Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject * cyfunc,Py_ssize_t nargs,PyObject * kwnames)13858 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
13859 {
13860 int ret = 0;
13861 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13862 if (unlikely(nargs < 1)) {
13863 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
13864 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
13865 return -1;
13866 }
13867 ret = 1;
13868 }
13869 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
13870 PyErr_Format(PyExc_TypeError,
13871 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
13872 return -1;
13873 }
13874 return ret;
13875 }
__Pyx_CyFunction_Vectorcall_NOARGS(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)13876 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13877 {
13878 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13879 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13880 #if CYTHON_BACKPORT_VECTORCALL
13881 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13882 #else
13883 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13884 #endif
13885 PyObject *self;
13886 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
13887 case 1:
13888 self = args[0];
13889 args += 1;
13890 nargs -= 1;
13891 break;
13892 case 0:
13893 self = ((PyCFunctionObject*)cyfunc)->m_self;
13894 break;
13895 default:
13896 return NULL;
13897 }
13898 if (unlikely(nargs != 0)) {
13899 PyErr_Format(PyExc_TypeError,
13900 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13901 def->ml_name, nargs);
13902 return NULL;
13903 }
13904 return def->ml_meth(self, NULL);
13905 }
__Pyx_CyFunction_Vectorcall_O(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)13906 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13907 {
13908 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13909 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13910 #if CYTHON_BACKPORT_VECTORCALL
13911 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13912 #else
13913 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13914 #endif
13915 PyObject *self;
13916 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
13917 case 1:
13918 self = args[0];
13919 args += 1;
13920 nargs -= 1;
13921 break;
13922 case 0:
13923 self = ((PyCFunctionObject*)cyfunc)->m_self;
13924 break;
13925 default:
13926 return NULL;
13927 }
13928 if (unlikely(nargs != 1)) {
13929 PyErr_Format(PyExc_TypeError,
13930 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13931 def->ml_name, nargs);
13932 return NULL;
13933 }
13934 return def->ml_meth(self, args[0]);
13935 }
__Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)13936 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13937 {
13938 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13939 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13940 #if CYTHON_BACKPORT_VECTORCALL
13941 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13942 #else
13943 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13944 #endif
13945 PyObject *self;
13946 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
13947 case 1:
13948 self = args[0];
13949 args += 1;
13950 nargs -= 1;
13951 break;
13952 case 0:
13953 self = ((PyCFunctionObject*)cyfunc)->m_self;
13954 break;
13955 default:
13956 return NULL;
13957 }
13958 return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
13959 }
__Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject * func,PyObject * const * args,size_t nargsf,PyObject * kwnames)13960 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13961 {
13962 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13963 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13964 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
13965 #if CYTHON_BACKPORT_VECTORCALL
13966 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13967 #else
13968 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13969 #endif
13970 PyObject *self;
13971 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
13972 case 1:
13973 self = args[0];
13974 args += 1;
13975 nargs -= 1;
13976 break;
13977 case 0:
13978 self = ((PyCFunctionObject*)cyfunc)->m_self;
13979 break;
13980 default:
13981 return NULL;
13982 }
13983 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, nargs, kwnames);
13984 }
13985 #endif
13986 #if CYTHON_USE_TYPE_SPECS
13987 static PyType_Slot __pyx_CyFunctionType_slots[] = {
13988 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
13989 {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
13990 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
13991 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
13992 {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
13993 {Py_tp_methods, (void *)__pyx_CyFunction_methods},
13994 {Py_tp_members, (void *)__pyx_CyFunction_members},
13995 {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
13996 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
13997 {0, 0},
13998 };
13999 static PyType_Spec __pyx_CyFunctionType_spec = {
14000 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
14001 sizeof(__pyx_CyFunctionObject),
14002 0,
14003 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
14004 Py_TPFLAGS_METHOD_DESCRIPTOR |
14005 #endif
14006 #ifdef _Py_TPFLAGS_HAVE_VECTORCALL
14007 _Py_TPFLAGS_HAVE_VECTORCALL |
14008 #endif
14009 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
14010 __pyx_CyFunctionType_slots
14011 };
14012 #else
14013 static PyTypeObject __pyx_CyFunctionType_type = {
14014 PyVarObject_HEAD_INIT(0, 0)
14015 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
14016 sizeof(__pyx_CyFunctionObject),
14017 0,
14018 (destructor) __Pyx_CyFunction_dealloc,
14019 #if !CYTHON_METH_FASTCALL
14020 0,
14021 #elif CYTHON_BACKPORT_VECTORCALL
14022 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
14023 #else
14024 offsetof(PyCFunctionObject, vectorcall),
14025 #endif
14026 0,
14027 0,
14028 #if PY_MAJOR_VERSION < 3
14029 0,
14030 #else
14031 0,
14032 #endif
14033 (reprfunc) __Pyx_CyFunction_repr,
14034 0,
14035 0,
14036 0,
14037 0,
14038 __Pyx_CyFunction_CallAsMethod,
14039 0,
14040 0,
14041 0,
14042 0,
14043 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
14044 Py_TPFLAGS_METHOD_DESCRIPTOR |
14045 #endif
14046 #ifdef _Py_TPFLAGS_HAVE_VECTORCALL
14047 _Py_TPFLAGS_HAVE_VECTORCALL |
14048 #endif
14049 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
14050 0,
14051 (traverseproc) __Pyx_CyFunction_traverse,
14052 (inquiry) __Pyx_CyFunction_clear,
14053 0,
14054 #if PY_VERSION_HEX < 0x030500A0
14055 offsetof(__pyx_CyFunctionObject, func_weakreflist),
14056 #else
14057 offsetof(PyCFunctionObject, m_weakreflist),
14058 #endif
14059 0,
14060 0,
14061 __pyx_CyFunction_methods,
14062 __pyx_CyFunction_members,
14063 __pyx_CyFunction_getsets,
14064 0,
14065 0,
14066 __Pyx_PyMethod_New,
14067 0,
14068 offsetof(__pyx_CyFunctionObject, func_dict),
14069 0,
14070 0,
14071 0,
14072 0,
14073 0,
14074 0,
14075 0,
14076 0,
14077 0,
14078 0,
14079 0,
14080 0,
14081 #if PY_VERSION_HEX >= 0x030400a1
14082 0,
14083 #endif
14084 #if PY_VERSION_HEX >= 0x030800b1
14085 0,
14086 #endif
14087 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
14088 0,
14089 #endif
14090 #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
14091 0,
14092 #endif
14093 };
14094 #endif
__pyx_CyFunction_init(PyObject * module)14095 static int __pyx_CyFunction_init(PyObject *module) {
14096 #if CYTHON_USE_TYPE_SPECS
14097 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
14098 #else
14099 (void) module;
14100 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
14101 #endif
14102 if (unlikely(__pyx_CyFunctionType == NULL)) {
14103 return -1;
14104 }
14105 return 0;
14106 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)14107 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
14108 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14109 m->defaults = PyObject_Malloc(size);
14110 if (unlikely(!m->defaults))
14111 return PyErr_NoMemory();
14112 memset(m->defaults, 0, size);
14113 m->defaults_pyobjects = pyobjects;
14114 m->defaults_size = size;
14115 return m->defaults;
14116 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)14117 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
14118 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14119 m->defaults_tuple = tuple;
14120 Py_INCREF(tuple);
14121 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)14122 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
14123 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14124 m->defaults_kwdict = dict;
14125 Py_INCREF(dict);
14126 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)14127 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
14128 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14129 m->func_annotations = dict;
14130 Py_INCREF(dict);
14131 }
14132
14133 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)14134 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
14135 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
14136 PyObject *op = __Pyx_CyFunction_Init(
14137 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
14138 ml, flags, qualname, closure, module, globals, code
14139 );
14140 if (likely(op)) {
14141 PyObject_GC_Track(op);
14142 }
14143 return op;
14144 }
14145
14146 /* Py3UpdateBases */
14147 static PyObject*
__Pyx_PEP560_update_bases(PyObject * bases)14148 __Pyx_PEP560_update_bases(PyObject *bases)
14149 {
14150 Py_ssize_t i, j, size_bases;
14151 PyObject *base, *meth, *new_base, *result, *new_bases = NULL;
14152 size_bases = PyTuple_GET_SIZE(bases);
14153 for (i = 0; i < size_bases; i++) {
14154 base = PyTuple_GET_ITEM(bases, i);
14155 if (PyType_Check(base)) {
14156 if (new_bases) {
14157 if (PyList_Append(new_bases, base) < 0) {
14158 goto error;
14159 }
14160 }
14161 continue;
14162 }
14163 meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_n_s_mro_entries);
14164 if (!meth && PyErr_Occurred()) {
14165 goto error;
14166 }
14167 if (!meth) {
14168 if (new_bases) {
14169 if (PyList_Append(new_bases, base) < 0) {
14170 goto error;
14171 }
14172 }
14173 continue;
14174 }
14175 new_base = __Pyx_PyObject_CallOneArg(meth, bases);
14176 Py_DECREF(meth);
14177 if (!new_base) {
14178 goto error;
14179 }
14180 if (!PyTuple_Check(new_base)) {
14181 PyErr_SetString(PyExc_TypeError,
14182 "__mro_entries__ must return a tuple");
14183 Py_DECREF(new_base);
14184 goto error;
14185 }
14186 if (!new_bases) {
14187 if (!(new_bases = PyList_New(i))) {
14188 goto error;
14189 }
14190 for (j = 0; j < i; j++) {
14191 base = PyTuple_GET_ITEM(bases, j);
14192 PyList_SET_ITEM(new_bases, j, base);
14193 Py_INCREF(base);
14194 }
14195 }
14196 j = PyList_GET_SIZE(new_bases);
14197 if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
14198 goto error;
14199 }
14200 Py_DECREF(new_base);
14201 }
14202 if (!new_bases) {
14203 Py_INCREF(bases);
14204 return bases;
14205 }
14206 result = PyList_AsTuple(new_bases);
14207 Py_DECREF(new_bases);
14208 return result;
14209 error:
14210 Py_XDECREF(new_bases);
14211 return NULL;
14212 }
14213
14214 /* SetNewInClass */
__Pyx_SetNewInClass(PyObject * ns,PyObject * name,PyObject * value)14215 static int __Pyx_SetNewInClass(PyObject *ns, PyObject *name, PyObject *value) {
14216 #ifdef __Pyx_CyFunction_USED
14217 int ret;
14218 if (__Pyx_CyFunction_Check(value)) {
14219 PyObject *staticnew = PyStaticMethod_New(value);
14220 if (unlikely(!staticnew)) return -1;
14221 ret = __Pyx_SetNameInClass(ns, name, staticnew);
14222 Py_DECREF(staticnew);
14223 return ret;
14224 }
14225 #endif
14226 return __Pyx_SetNameInClass(ns, name, value);
14227 }
14228
14229 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)14230 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
14231 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
14232 for (i=0; i < nbases; i++) {
14233 PyTypeObject *tmptype;
14234 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
14235 tmptype = Py_TYPE(tmp);
14236 #if PY_MAJOR_VERSION < 3
14237 if (tmptype == &PyClass_Type)
14238 continue;
14239 #endif
14240 if (!metaclass) {
14241 metaclass = tmptype;
14242 continue;
14243 }
14244 if (PyType_IsSubtype(metaclass, tmptype))
14245 continue;
14246 if (PyType_IsSubtype(tmptype, metaclass)) {
14247 metaclass = tmptype;
14248 continue;
14249 }
14250 PyErr_SetString(PyExc_TypeError,
14251 "metaclass conflict: "
14252 "the metaclass of a derived class "
14253 "must be a (non-strict) subclass "
14254 "of the metaclasses of all its bases");
14255 return NULL;
14256 }
14257 if (!metaclass) {
14258 #if PY_MAJOR_VERSION < 3
14259 metaclass = &PyClass_Type;
14260 #else
14261 metaclass = &PyType_Type;
14262 #endif
14263 }
14264 Py_INCREF((PyObject*) metaclass);
14265 return (PyObject*) metaclass;
14266 }
14267
14268 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)14269 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
14270 PyObject *args[3] = {NULL, arg1, arg2};
14271 return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
14272 }
14273
14274 /* PyObjectLookupSpecial */
14275 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__Pyx__PyObject_LookupSpecial(PyObject * obj,PyObject * attr_name,int with_error)14276 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
14277 PyObject *res;
14278 PyTypeObject *tp = Py_TYPE(obj);
14279 #if PY_MAJOR_VERSION < 3
14280 if (unlikely(PyInstance_Check(obj)))
14281 return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name);
14282 #endif
14283 res = _PyType_Lookup(tp, attr_name);
14284 if (likely(res)) {
14285 descrgetfunc f = Py_TYPE(res)->tp_descr_get;
14286 if (!f) {
14287 Py_INCREF(res);
14288 } else {
14289 res = f(res, obj, (PyObject *)tp);
14290 }
14291 } else if (with_error) {
14292 PyErr_SetObject(PyExc_AttributeError, attr_name);
14293 }
14294 return res;
14295 }
14296 #endif
14297
14298 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)14299 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
14300 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
14301 PyObject *ns;
14302 if (metaclass) {
14303 PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_n_s_prepare);
14304 if (prep) {
14305 PyObject *pargs[3] = {NULL, name, bases};
14306 ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
14307 Py_DECREF(prep);
14308 } else {
14309 if (unlikely(PyErr_Occurred()))
14310 return NULL;
14311 ns = PyDict_New();
14312 }
14313 } else {
14314 ns = PyDict_New();
14315 }
14316 if (unlikely(!ns))
14317 return NULL;
14318 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
14319 #if PY_VERSION_HEX >= 0x03030000
14320 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
14321 #else
14322 CYTHON_MAYBE_UNUSED_VAR(qualname);
14323 #endif
14324 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
14325 return ns;
14326 bad:
14327 Py_DECREF(ns);
14328 return NULL;
14329 }
14330 #if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS
__Pyx_SetNamesPEP487(PyObject * type_obj)14331 static int __Pyx_SetNamesPEP487(PyObject *type_obj) {
14332 PyTypeObject *type = (PyTypeObject*) type_obj;
14333 PyObject *names_to_set, *key, *value, *set_name, *tmp;
14334 Py_ssize_t i = 0;
14335 #if CYTHON_USE_TYPE_SLOTS
14336 names_to_set = PyDict_Copy(type->tp_dict);
14337 #else
14338 {
14339 PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict);
14340 names_to_set = NULL;
14341 if (likely(d)) {
14342 PyObject *names_to_set = PyDict_New();
14343 int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1;
14344 Py_DECREF(d);
14345 if (unlikely(ret < 0))
14346 Py_CLEAR(names_to_set);
14347 }
14348 }
14349 #endif
14350 if (unlikely(names_to_set == NULL))
14351 goto bad;
14352 while (PyDict_Next(names_to_set, &i, &key, &value)) {
14353 set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name);
14354 if (unlikely(set_name != NULL)) {
14355 tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key);
14356 Py_DECREF(set_name);
14357 if (unlikely(tmp == NULL)) {
14358 __Pyx_TypeName value_type_name =
14359 __Pyx_PyType_GetName(Py_TYPE(value));
14360 __Pyx_TypeName type_name = __Pyx_PyType_GetName(type);
14361 PyErr_Format(PyExc_RuntimeError,
14362 #if PY_MAJOR_VERSION >= 3
14363 "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'",
14364 value_type_name, key, type_name);
14365 #else
14366 "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'",
14367 value_type_name,
14368 PyString_Check(key) ? PyString_AS_STRING(key) : "?",
14369 type_name);
14370 #endif
14371 goto bad;
14372 } else {
14373 Py_DECREF(tmp);
14374 }
14375 }
14376 else if (unlikely(PyErr_Occurred())) {
14377 goto bad;
14378 }
14379 }
14380 Py_DECREF(names_to_set);
14381 return 0;
14382 bad:
14383 Py_XDECREF(names_to_set);
14384 return -1;
14385 }
__Pyx_InitSubclassPEP487(PyObject * type_obj,PyObject * mkw)14386 static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) {
14387 #if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14388 PyTypeObject *type = (PyTypeObject*) type_obj;
14389 PyObject *mro = type->tp_mro;
14390 Py_ssize_t i, nbases;
14391 if (unlikely(!mro)) goto done;
14392 (void) &__Pyx_GetBuiltinName;
14393 Py_INCREF(mro);
14394 nbases = PyTuple_GET_SIZE(mro);
14395 assert(PyTuple_GET_ITEM(mro, 0) == type_obj);
14396 for (i = 1; i < nbases-1; i++) {
14397 PyObject *base, *dict, *meth;
14398 base = PyTuple_GET_ITEM(mro, i);
14399 dict = ((PyTypeObject *)base)->tp_dict;
14400 meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass);
14401 if (unlikely(meth)) {
14402 descrgetfunc f = Py_TYPE(meth)->tp_descr_get;
14403 PyObject *res;
14404 Py_INCREF(meth);
14405 if (likely(f)) {
14406 res = f(meth, NULL, type_obj);
14407 Py_DECREF(meth);
14408 if (unlikely(!res)) goto bad;
14409 meth = res;
14410 }
14411 res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw);
14412 Py_DECREF(meth);
14413 if (unlikely(!res)) goto bad;
14414 Py_DECREF(res);
14415 goto done;
14416 } else if (unlikely(PyErr_Occurred())) {
14417 goto bad;
14418 }
14419 }
14420 done:
14421 Py_XDECREF(mro);
14422 return type_obj;
14423 bad:
14424 Py_XDECREF(mro);
14425 Py_DECREF(type_obj);
14426 return NULL;
14427 #else
14428 PyObject *super_type, *super, *func, *res;
14429 #if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type)
14430 super_type = __Pyx_GetBuiltinName(__pyx_n_s_super);
14431 #else
14432 super_type = (PyObject*) &PySuper_Type;
14433 (void) &__Pyx_GetBuiltinName;
14434 #endif
14435 super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL;
14436 #if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type)
14437 Py_XDECREF(super_type);
14438 #endif
14439 if (unlikely(!super)) {
14440 Py_CLEAR(type_obj);
14441 goto done;
14442 }
14443 func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass);
14444 Py_DECREF(super);
14445 if (likely(!func)) {
14446 if (unlikely(PyErr_Occurred()))
14447 Py_CLEAR(type_obj);
14448 goto done;
14449 }
14450 res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw);
14451 Py_DECREF(func);
14452 if (unlikely(!res))
14453 Py_CLEAR(type_obj);
14454 Py_XDECREF(res);
14455 done:
14456 return type_obj;
14457 #endif
14458 }
14459 #endif
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)14460 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
14461 PyObject *dict, PyObject *mkw,
14462 int calculate_metaclass, int allow_py2_metaclass) {
14463 PyObject *result;
14464 PyObject *owned_metaclass = NULL;
14465 PyObject *margs[4] = {NULL, name, bases, dict};
14466 if (allow_py2_metaclass) {
14467 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
14468 if (owned_metaclass) {
14469 metaclass = owned_metaclass;
14470 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
14471 PyErr_Clear();
14472 } else {
14473 return NULL;
14474 }
14475 }
14476 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
14477 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
14478 Py_XDECREF(owned_metaclass);
14479 if (unlikely(!metaclass))
14480 return NULL;
14481 owned_metaclass = metaclass;
14482 }
14483 result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET,
14484 #if PY_VERSION_HEX < 0x030600A4
14485 (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw
14486 #else
14487 mkw
14488 #endif
14489 );
14490 Py_XDECREF(owned_metaclass);
14491 #if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS
14492 if (likely(result) && likely(PyType_Check(result))) {
14493 if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) {
14494 Py_CLEAR(result);
14495 } else {
14496 result = __Pyx_InitSubclassPEP487(result, mkw);
14497 }
14498 }
14499 #else
14500 (void) &__Pyx_GetBuiltinName;
14501 #endif
14502 return result;
14503 }
14504
14505 /* Globals */
__Pyx_Globals(void)14506 static PyObject* __Pyx_Globals(void) {
14507 return __Pyx_NewRef(__pyx_d);
14508 }
14509
14510 /* DictGetItem */
14511 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)14512 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
14513 PyObject *value;
14514 value = PyDict_GetItemWithError(d, key);
14515 if (unlikely(!value)) {
14516 if (!PyErr_Occurred()) {
14517 if (unlikely(PyTuple_Check(key))) {
14518 PyObject* args = PyTuple_Pack(1, key);
14519 if (likely(args)) {
14520 PyErr_SetObject(PyExc_KeyError, args);
14521 Py_DECREF(args);
14522 }
14523 } else {
14524 PyErr_SetObject(PyExc_KeyError, key);
14525 }
14526 }
14527 return NULL;
14528 }
14529 Py_INCREF(value);
14530 return value;
14531 }
14532 #endif
14533
14534 /* CLineInTraceback */
14535 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)14536 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
14537 PyObject *use_cline;
14538 PyObject *ptype, *pvalue, *ptraceback;
14539 #if CYTHON_COMPILING_IN_CPYTHON
14540 PyObject **cython_runtime_dict;
14541 #endif
14542 if (unlikely(!__pyx_cython_runtime)) {
14543 return c_line;
14544 }
14545 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
14546 #if CYTHON_COMPILING_IN_CPYTHON
14547 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
14548 if (likely(cython_runtime_dict)) {
14549 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
14550 use_cline, *cython_runtime_dict,
14551 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
14552 } else
14553 #endif
14554 {
14555 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
14556 if (use_cline_obj) {
14557 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
14558 Py_DECREF(use_cline_obj);
14559 } else {
14560 PyErr_Clear();
14561 use_cline = NULL;
14562 }
14563 }
14564 if (!use_cline) {
14565 c_line = 0;
14566 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
14567 }
14568 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
14569 c_line = 0;
14570 }
14571 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
14572 return c_line;
14573 }
14574 #endif
14575
14576 /* CodeObjectCache */
14577 #if !CYTHON_COMPILING_IN_LIMITED_API
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)14578 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
14579 int start = 0, mid = 0, end = count - 1;
14580 if (end >= 0 && code_line > entries[end].code_line) {
14581 return count;
14582 }
14583 while (start < end) {
14584 mid = start + (end - start) / 2;
14585 if (code_line < entries[mid].code_line) {
14586 end = mid;
14587 } else if (code_line > entries[mid].code_line) {
14588 start = mid + 1;
14589 } else {
14590 return mid;
14591 }
14592 }
14593 if (code_line <= entries[mid].code_line) {
14594 return mid;
14595 } else {
14596 return mid + 1;
14597 }
14598 }
__pyx_find_code_object(int code_line)14599 static PyCodeObject *__pyx_find_code_object(int code_line) {
14600 PyCodeObject* code_object;
14601 int pos;
14602 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
14603 return NULL;
14604 }
14605 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14606 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
14607 return NULL;
14608 }
14609 code_object = __pyx_code_cache.entries[pos].code_object;
14610 Py_INCREF(code_object);
14611 return code_object;
14612 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)14613 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
14614 int pos, i;
14615 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
14616 if (unlikely(!code_line)) {
14617 return;
14618 }
14619 if (unlikely(!entries)) {
14620 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
14621 if (likely(entries)) {
14622 __pyx_code_cache.entries = entries;
14623 __pyx_code_cache.max_count = 64;
14624 __pyx_code_cache.count = 1;
14625 entries[0].code_line = code_line;
14626 entries[0].code_object = code_object;
14627 Py_INCREF(code_object);
14628 }
14629 return;
14630 }
14631 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14632 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
14633 PyCodeObject* tmp = entries[pos].code_object;
14634 entries[pos].code_object = code_object;
14635 Py_DECREF(tmp);
14636 return;
14637 }
14638 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
14639 int new_max = __pyx_code_cache.max_count + 64;
14640 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
14641 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
14642 if (unlikely(!entries)) {
14643 return;
14644 }
14645 __pyx_code_cache.entries = entries;
14646 __pyx_code_cache.max_count = new_max;
14647 }
14648 for (i=__pyx_code_cache.count; i>pos; i--) {
14649 entries[i] = entries[i-1];
14650 }
14651 entries[pos].code_line = code_line;
14652 entries[pos].code_object = code_object;
14653 __pyx_code_cache.count++;
14654 Py_INCREF(code_object);
14655 }
14656 #endif
14657
14658 /* AddTraceback */
14659 #include "compile.h"
14660 #include "frameobject.h"
14661 #include "traceback.h"
14662 #if CYTHON_COMPILING_IN_LIMITED_API
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)14663 static void __Pyx_AddTraceback(const char *funcname, int c_line,
14664 int py_line, const char *filename) {
14665 if (c_line) {
14666 (void) __pyx_cfilenm;
14667 c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
14668 }
14669 _PyTraceback_Add(funcname, filename, c_line ? -c_line : py_line);
14670 }
14671 #else
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)14672 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
14673 const char *funcname, int c_line,
14674 int py_line, const char *filename) {
14675 PyCodeObject *py_code = 0;
14676 PyObject *py_srcfile = 0;
14677 PyObject *py_funcname = 0;
14678 #if PY_MAJOR_VERSION < 3
14679 py_srcfile = PyString_FromString(filename);
14680 #else
14681 py_srcfile = PyUnicode_FromString(filename);
14682 #endif
14683 if (!py_srcfile) goto bad;
14684 if (c_line) {
14685 #if PY_MAJOR_VERSION < 3
14686 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14687 #else
14688 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14689 #endif
14690 }
14691 else {
14692 #if PY_MAJOR_VERSION < 3
14693 py_funcname = PyString_FromString(funcname);
14694 #else
14695 py_funcname = PyUnicode_FromString(funcname);
14696 #endif
14697 }
14698 if (!py_funcname) goto bad;
14699 py_code = __Pyx_PyCode_New(
14700 0,
14701 0,
14702 0,
14703 0,
14704 0,
14705 0,
14706 __pyx_empty_bytes, /*PyObject *code,*/
14707 __pyx_empty_tuple, /*PyObject *consts,*/
14708 __pyx_empty_tuple, /*PyObject *names,*/
14709 __pyx_empty_tuple, /*PyObject *varnames,*/
14710 __pyx_empty_tuple, /*PyObject *freevars,*/
14711 __pyx_empty_tuple, /*PyObject *cellvars,*/
14712 py_srcfile, /*PyObject *filename,*/
14713 py_funcname, /*PyObject *name,*/
14714 py_line,
14715 __pyx_empty_bytes /*PyObject *lnotab*/
14716 );
14717 Py_DECREF(py_srcfile);
14718 Py_DECREF(py_funcname);
14719 return py_code;
14720 bad:
14721 Py_XDECREF(py_srcfile);
14722 Py_XDECREF(py_funcname);
14723 return NULL;
14724 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)14725 static void __Pyx_AddTraceback(const char *funcname, int c_line,
14726 int py_line, const char *filename) {
14727 PyCodeObject *py_code = 0;
14728 PyFrameObject *py_frame = 0;
14729 PyThreadState *tstate = __Pyx_PyThreadState_Current;
14730 if (c_line) {
14731 c_line = __Pyx_CLineForTraceback(tstate, c_line);
14732 }
14733 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
14734 if (!py_code) {
14735 py_code = __Pyx_CreateCodeObjectForTraceback(
14736 funcname, c_line, py_line, filename);
14737 if (!py_code) goto bad;
14738 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
14739 }
14740 py_frame = PyFrame_New(
14741 tstate, /*PyThreadState *tstate,*/
14742 py_code, /*PyCodeObject *code,*/
14743 __pyx_d, /*PyObject *globals,*/
14744 0 /*PyObject *locals*/
14745 );
14746 if (!py_frame) goto bad;
14747 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
14748 PyTraceBack_Here(py_frame);
14749 bad:
14750 Py_XDECREF(py_code);
14751 Py_XDECREF(py_frame);
14752 }
14753 #endif
14754
14755 /* CIntFromPyVerify */
14756 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
14757 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
14758 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
14759 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
14760 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
14761 {\
14762 func_type value = func_value;\
14763 if (sizeof(target_type) < sizeof(func_type)) {\
14764 if (unlikely(value != (func_type) (target_type) value)) {\
14765 func_type zero = 0;\
14766 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
14767 return (target_type) -1;\
14768 if (is_unsigned && unlikely(value < zero))\
14769 goto raise_neg_overflow;\
14770 else\
14771 goto raise_overflow;\
14772 }\
14773 }\
14774 return (target_type) value;\
14775 }
14776
14777 /* UnicodeAsUCS4 */
__Pyx_PyUnicode_AsPy_UCS4(PyObject * x)14778 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
14779 Py_ssize_t length;
14780 #if CYTHON_PEP393_ENABLED
14781 length = PyUnicode_GET_LENGTH(x);
14782 if (likely(length == 1)) {
14783 return PyUnicode_READ_CHAR(x, 0);
14784 }
14785 #else
14786 length = PyUnicode_GET_SIZE(x);
14787 if (likely(length == 1)) {
14788 return PyUnicode_AS_UNICODE(x)[0];
14789 }
14790 #if Py_UNICODE_SIZE == 2
14791 else if (PyUnicode_GET_SIZE(x) == 2) {
14792 Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
14793 if (high_val >= 0xD800 && high_val <= 0xDBFF) {
14794 Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
14795 if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
14796 return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
14797 }
14798 }
14799 }
14800 #endif
14801 #endif
14802 PyErr_Format(PyExc_ValueError,
14803 "only single character unicode strings can be converted to Py_UCS4, "
14804 "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
14805 return (Py_UCS4)-1;
14806 }
14807
14808 /* CIntFromPy */
__Pyx_PyInt_As_size_t(PyObject * x)14809 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
14810 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14811 #pragma GCC diagnostic push
14812 #pragma GCC diagnostic ignored "-Wconversion"
14813 #endif
14814 const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
14815 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14816 #pragma GCC diagnostic pop
14817 #endif
14818 const int is_unsigned = neg_one > const_zero;
14819 #if PY_MAJOR_VERSION < 3
14820 if (likely(PyInt_Check(x))) {
14821 if ((sizeof(size_t) < sizeof(long))) {
14822 __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
14823 } else {
14824 long val = PyInt_AS_LONG(x);
14825 if (is_unsigned && unlikely(val < 0)) {
14826 goto raise_neg_overflow;
14827 }
14828 return (size_t) val;
14829 }
14830 } else
14831 #endif
14832 if (likely(PyLong_Check(x))) {
14833 if (is_unsigned) {
14834 #if CYTHON_USE_PYLONG_INTERNALS
14835 const digit* digits = ((PyLongObject*)x)->ob_digit;
14836 switch (Py_SIZE(x)) {
14837 case 0: return (size_t) 0;
14838 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
14839 case 2:
14840 if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
14841 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14842 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14843 } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
14844 return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14845 }
14846 }
14847 break;
14848 case 3:
14849 if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
14850 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14851 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14852 } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
14853 return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14854 }
14855 }
14856 break;
14857 case 4:
14858 if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
14859 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14860 __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])))
14861 } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
14862 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]));
14863 }
14864 }
14865 break;
14866 }
14867 #endif
14868 #if CYTHON_COMPILING_IN_CPYTHON
14869 if (unlikely(Py_SIZE(x) < 0)) {
14870 goto raise_neg_overflow;
14871 }
14872 #else
14873 {
14874 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14875 if (unlikely(result < 0))
14876 return (size_t) -1;
14877 if (unlikely(result == 1))
14878 goto raise_neg_overflow;
14879 }
14880 #endif
14881 if ((sizeof(size_t) <= sizeof(unsigned long))) {
14882 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
14883 #ifdef HAVE_LONG_LONG
14884 } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
14885 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14886 #endif
14887 }
14888 } else {
14889 #if CYTHON_USE_PYLONG_INTERNALS
14890 const digit* digits = ((PyLongObject*)x)->ob_digit;
14891 switch (Py_SIZE(x)) {
14892 case 0: return (size_t) 0;
14893 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
14894 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
14895 case -2:
14896 if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
14897 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14898 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14899 } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
14900 return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14901 }
14902 }
14903 break;
14904 case 2:
14905 if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
14906 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14907 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14908 } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
14909 return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14910 }
14911 }
14912 break;
14913 case -3:
14914 if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
14915 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14916 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14917 } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
14918 return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14919 }
14920 }
14921 break;
14922 case 3:
14923 if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
14924 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14925 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14926 } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
14927 return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14928 }
14929 }
14930 break;
14931 case -4:
14932 if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
14933 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14934 __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])))
14935 } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
14936 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])));
14937 }
14938 }
14939 break;
14940 case 4:
14941 if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
14942 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14943 __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])))
14944 } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
14945 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])));
14946 }
14947 }
14948 break;
14949 }
14950 #endif
14951 if ((sizeof(size_t) <= sizeof(long))) {
14952 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
14953 #ifdef HAVE_LONG_LONG
14954 } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
14955 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
14956 #endif
14957 }
14958 }
14959 {
14960 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
14961 PyErr_SetString(PyExc_RuntimeError,
14962 "_PyLong_AsByteArray() not available, cannot convert large numbers");
14963 #else
14964 size_t val;
14965 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
14966 #if PY_MAJOR_VERSION < 3
14967 if (likely(v) && !PyLong_Check(v)) {
14968 PyObject *tmp = v;
14969 v = PyNumber_Long(tmp);
14970 Py_DECREF(tmp);
14971 }
14972 #endif
14973 if (likely(v)) {
14974 int one = 1; int is_little = (int)*(unsigned char *)&one;
14975 unsigned char *bytes = (unsigned char *)&val;
14976 int ret = _PyLong_AsByteArray((PyLongObject *)v,
14977 bytes, sizeof(val),
14978 is_little, !is_unsigned);
14979 Py_DECREF(v);
14980 if (likely(!ret))
14981 return val;
14982 }
14983 #endif
14984 return (size_t) -1;
14985 }
14986 } else {
14987 size_t val;
14988 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14989 if (!tmp) return (size_t) -1;
14990 val = __Pyx_PyInt_As_size_t(tmp);
14991 Py_DECREF(tmp);
14992 return val;
14993 }
14994 raise_overflow:
14995 PyErr_SetString(PyExc_OverflowError,
14996 "value too large to convert to size_t");
14997 return (size_t) -1;
14998 raise_neg_overflow:
14999 PyErr_SetString(PyExc_OverflowError,
15000 "can't convert negative value to size_t");
15001 return (size_t) -1;
15002 }
15003
15004 /* CIntFromPy */
__Pyx_PyInt_As_uint64_t(PyObject * x)15005 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
15006 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15007 #pragma GCC diagnostic push
15008 #pragma GCC diagnostic ignored "-Wconversion"
15009 #endif
15010 const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
15011 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15012 #pragma GCC diagnostic pop
15013 #endif
15014 const int is_unsigned = neg_one > const_zero;
15015 #if PY_MAJOR_VERSION < 3
15016 if (likely(PyInt_Check(x))) {
15017 if ((sizeof(uint64_t) < sizeof(long))) {
15018 __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
15019 } else {
15020 long val = PyInt_AS_LONG(x);
15021 if (is_unsigned && unlikely(val < 0)) {
15022 goto raise_neg_overflow;
15023 }
15024 return (uint64_t) val;
15025 }
15026 } else
15027 #endif
15028 if (likely(PyLong_Check(x))) {
15029 if (is_unsigned) {
15030 #if CYTHON_USE_PYLONG_INTERNALS
15031 const digit* digits = ((PyLongObject*)x)->ob_digit;
15032 switch (Py_SIZE(x)) {
15033 case 0: return (uint64_t) 0;
15034 case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
15035 case 2:
15036 if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
15037 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15038 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15039 } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) {
15040 return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
15041 }
15042 }
15043 break;
15044 case 3:
15045 if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
15046 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15047 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15048 } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) {
15049 return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
15050 }
15051 }
15052 break;
15053 case 4:
15054 if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
15055 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15056 __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])))
15057 } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) {
15058 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]));
15059 }
15060 }
15061 break;
15062 }
15063 #endif
15064 #if CYTHON_COMPILING_IN_CPYTHON
15065 if (unlikely(Py_SIZE(x) < 0)) {
15066 goto raise_neg_overflow;
15067 }
15068 #else
15069 {
15070 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15071 if (unlikely(result < 0))
15072 return (uint64_t) -1;
15073 if (unlikely(result == 1))
15074 goto raise_neg_overflow;
15075 }
15076 #endif
15077 if ((sizeof(uint64_t) <= sizeof(unsigned long))) {
15078 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
15079 #ifdef HAVE_LONG_LONG
15080 } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) {
15081 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15082 #endif
15083 }
15084 } else {
15085 #if CYTHON_USE_PYLONG_INTERNALS
15086 const digit* digits = ((PyLongObject*)x)->ob_digit;
15087 switch (Py_SIZE(x)) {
15088 case 0: return (uint64_t) 0;
15089 case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
15090 case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0])
15091 case -2:
15092 if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) {
15093 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15094 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15095 } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
15096 return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
15097 }
15098 }
15099 break;
15100 case 2:
15101 if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
15102 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15103 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15104 } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
15105 return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
15106 }
15107 }
15108 break;
15109 case -3:
15110 if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
15111 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15112 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15113 } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
15114 return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
15115 }
15116 }
15117 break;
15118 case 3:
15119 if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
15120 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15121 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15122 } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
15123 return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
15124 }
15125 }
15126 break;
15127 case -4:
15128 if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
15129 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15130 __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])))
15131 } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
15132 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])));
15133 }
15134 }
15135 break;
15136 case 4:
15137 if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
15138 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15139 __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])))
15140 } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
15141 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])));
15142 }
15143 }
15144 break;
15145 }
15146 #endif
15147 if ((sizeof(uint64_t) <= sizeof(long))) {
15148 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
15149 #ifdef HAVE_LONG_LONG
15150 } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) {
15151 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
15152 #endif
15153 }
15154 }
15155 {
15156 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
15157 PyErr_SetString(PyExc_RuntimeError,
15158 "_PyLong_AsByteArray() not available, cannot convert large numbers");
15159 #else
15160 uint64_t val;
15161 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15162 #if PY_MAJOR_VERSION < 3
15163 if (likely(v) && !PyLong_Check(v)) {
15164 PyObject *tmp = v;
15165 v = PyNumber_Long(tmp);
15166 Py_DECREF(tmp);
15167 }
15168 #endif
15169 if (likely(v)) {
15170 int one = 1; int is_little = (int)*(unsigned char *)&one;
15171 unsigned char *bytes = (unsigned char *)&val;
15172 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15173 bytes, sizeof(val),
15174 is_little, !is_unsigned);
15175 Py_DECREF(v);
15176 if (likely(!ret))
15177 return val;
15178 }
15179 #endif
15180 return (uint64_t) -1;
15181 }
15182 } else {
15183 uint64_t val;
15184 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15185 if (!tmp) return (uint64_t) -1;
15186 val = __Pyx_PyInt_As_uint64_t(tmp);
15187 Py_DECREF(tmp);
15188 return val;
15189 }
15190 raise_overflow:
15191 PyErr_SetString(PyExc_OverflowError,
15192 "value too large to convert to uint64_t");
15193 return (uint64_t) -1;
15194 raise_neg_overflow:
15195 PyErr_SetString(PyExc_OverflowError,
15196 "can't convert negative value to uint64_t");
15197 return (uint64_t) -1;
15198 }
15199
15200 /* ObjectAsUCS4 */
__Pyx__PyObject_AsPy_UCS4_raise_error(long ival)15201 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) {
15202 if (ival < 0) {
15203 if (!PyErr_Occurred())
15204 PyErr_SetString(PyExc_OverflowError,
15205 "cannot convert negative value to Py_UCS4");
15206 } else {
15207 PyErr_SetString(PyExc_OverflowError,
15208 "value too large to convert to Py_UCS4");
15209 }
15210 return (Py_UCS4)-1;
15211 }
__Pyx__PyObject_AsPy_UCS4(PyObject * x)15212 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) {
15213 long ival;
15214 ival = __Pyx_PyInt_As_long(x);
15215 if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) {
15216 return __Pyx__PyObject_AsPy_UCS4_raise_error(ival);
15217 }
15218 return (Py_UCS4)ival;
15219 }
15220
15221 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)15222 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
15223 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15224 #pragma GCC diagnostic push
15225 #pragma GCC diagnostic ignored "-Wconversion"
15226 #endif
15227 const long neg_one = (long) -1, const_zero = (long) 0;
15228 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15229 #pragma GCC diagnostic pop
15230 #endif
15231 const int is_unsigned = neg_one > const_zero;
15232 #if PY_MAJOR_VERSION < 3
15233 if (likely(PyInt_Check(x))) {
15234 if ((sizeof(long) < sizeof(long))) {
15235 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
15236 } else {
15237 long val = PyInt_AS_LONG(x);
15238 if (is_unsigned && unlikely(val < 0)) {
15239 goto raise_neg_overflow;
15240 }
15241 return (long) val;
15242 }
15243 } else
15244 #endif
15245 if (likely(PyLong_Check(x))) {
15246 if (is_unsigned) {
15247 #if CYTHON_USE_PYLONG_INTERNALS
15248 const digit* digits = ((PyLongObject*)x)->ob_digit;
15249 switch (Py_SIZE(x)) {
15250 case 0: return (long) 0;
15251 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
15252 case 2:
15253 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
15254 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15255 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15256 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
15257 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15258 }
15259 }
15260 break;
15261 case 3:
15262 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
15263 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15264 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15265 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
15266 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15267 }
15268 }
15269 break;
15270 case 4:
15271 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
15272 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15273 __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])))
15274 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
15275 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15276 }
15277 }
15278 break;
15279 }
15280 #endif
15281 #if CYTHON_COMPILING_IN_CPYTHON
15282 if (unlikely(Py_SIZE(x) < 0)) {
15283 goto raise_neg_overflow;
15284 }
15285 #else
15286 {
15287 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15288 if (unlikely(result < 0))
15289 return (long) -1;
15290 if (unlikely(result == 1))
15291 goto raise_neg_overflow;
15292 }
15293 #endif
15294 if ((sizeof(long) <= sizeof(unsigned long))) {
15295 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
15296 #ifdef HAVE_LONG_LONG
15297 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
15298 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15299 #endif
15300 }
15301 } else {
15302 #if CYTHON_USE_PYLONG_INTERNALS
15303 const digit* digits = ((PyLongObject*)x)->ob_digit;
15304 switch (Py_SIZE(x)) {
15305 case 0: return (long) 0;
15306 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
15307 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
15308 case -2:
15309 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
15310 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15311 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15312 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
15313 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15314 }
15315 }
15316 break;
15317 case 2:
15318 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
15319 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15320 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15321 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
15322 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15323 }
15324 }
15325 break;
15326 case -3:
15327 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
15328 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15329 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15330 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
15331 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15332 }
15333 }
15334 break;
15335 case 3:
15336 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
15337 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15338 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15339 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
15340 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15341 }
15342 }
15343 break;
15344 case -4:
15345 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
15346 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15347 __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])))
15348 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
15349 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15350 }
15351 }
15352 break;
15353 case 4:
15354 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
15355 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15356 __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])))
15357 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
15358 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15359 }
15360 }
15361 break;
15362 }
15363 #endif
15364 if ((sizeof(long) <= sizeof(long))) {
15365 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
15366 #ifdef HAVE_LONG_LONG
15367 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
15368 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
15369 #endif
15370 }
15371 }
15372 {
15373 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
15374 PyErr_SetString(PyExc_RuntimeError,
15375 "_PyLong_AsByteArray() not available, cannot convert large numbers");
15376 #else
15377 long val;
15378 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15379 #if PY_MAJOR_VERSION < 3
15380 if (likely(v) && !PyLong_Check(v)) {
15381 PyObject *tmp = v;
15382 v = PyNumber_Long(tmp);
15383 Py_DECREF(tmp);
15384 }
15385 #endif
15386 if (likely(v)) {
15387 int one = 1; int is_little = (int)*(unsigned char *)&one;
15388 unsigned char *bytes = (unsigned char *)&val;
15389 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15390 bytes, sizeof(val),
15391 is_little, !is_unsigned);
15392 Py_DECREF(v);
15393 if (likely(!ret))
15394 return val;
15395 }
15396 #endif
15397 return (long) -1;
15398 }
15399 } else {
15400 long val;
15401 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15402 if (!tmp) return (long) -1;
15403 val = __Pyx_PyInt_As_long(tmp);
15404 Py_DECREF(tmp);
15405 return val;
15406 }
15407 raise_overflow:
15408 PyErr_SetString(PyExc_OverflowError,
15409 "value too large to convert to long");
15410 return (long) -1;
15411 raise_neg_overflow:
15412 PyErr_SetString(PyExc_OverflowError,
15413 "can't convert negative value to long");
15414 return (long) -1;
15415 }
15416
15417 /* CIntToPy */
__Pyx_PyInt_From_long(long value)15418 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
15419 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15420 #pragma GCC diagnostic push
15421 #pragma GCC diagnostic ignored "-Wconversion"
15422 #endif
15423 const long neg_one = (long) -1, const_zero = (long) 0;
15424 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15425 #pragma GCC diagnostic pop
15426 #endif
15427 const int is_unsigned = neg_one > const_zero;
15428 if (is_unsigned) {
15429 if (sizeof(long) < sizeof(long)) {
15430 return PyInt_FromLong((long) value);
15431 } else if (sizeof(long) <= sizeof(unsigned long)) {
15432 return PyLong_FromUnsignedLong((unsigned long) value);
15433 #ifdef HAVE_LONG_LONG
15434 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
15435 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15436 #endif
15437 }
15438 } else {
15439 if (sizeof(long) <= sizeof(long)) {
15440 return PyInt_FromLong((long) value);
15441 #ifdef HAVE_LONG_LONG
15442 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
15443 return PyLong_FromLongLong((PY_LONG_LONG) value);
15444 #endif
15445 }
15446 }
15447 {
15448 int one = 1; int little = (int)*(unsigned char *)&one;
15449 unsigned char *bytes = (unsigned char *)&value;
15450 return _PyLong_FromByteArray(bytes, sizeof(long),
15451 little, !is_unsigned);
15452 }
15453 }
15454
15455 /* CIntToPy */
__Pyx_PyInt_From_int(int value)15456 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
15457 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15458 #pragma GCC diagnostic push
15459 #pragma GCC diagnostic ignored "-Wconversion"
15460 #endif
15461 const int neg_one = (int) -1, const_zero = (int) 0;
15462 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15463 #pragma GCC diagnostic pop
15464 #endif
15465 const int is_unsigned = neg_one > const_zero;
15466 if (is_unsigned) {
15467 if (sizeof(int) < sizeof(long)) {
15468 return PyInt_FromLong((long) value);
15469 } else if (sizeof(int) <= sizeof(unsigned long)) {
15470 return PyLong_FromUnsignedLong((unsigned long) value);
15471 #ifdef HAVE_LONG_LONG
15472 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
15473 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15474 #endif
15475 }
15476 } else {
15477 if (sizeof(int) <= sizeof(long)) {
15478 return PyInt_FromLong((long) value);
15479 #ifdef HAVE_LONG_LONG
15480 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
15481 return PyLong_FromLongLong((PY_LONG_LONG) value);
15482 #endif
15483 }
15484 }
15485 {
15486 int one = 1; int little = (int)*(unsigned char *)&one;
15487 unsigned char *bytes = (unsigned char *)&value;
15488 return _PyLong_FromByteArray(bytes, sizeof(int),
15489 little, !is_unsigned);
15490 }
15491 }
15492
15493 /* FormatTypeName */
15494 #if CYTHON_COMPILING_IN_LIMITED_API
15495 static __Pyx_TypeName
__Pyx_PyType_GetName(PyTypeObject * tp)15496 __Pyx_PyType_GetName(PyTypeObject* tp)
15497 {
15498 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
15499 __pyx_n_s_name_2);
15500 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
15501 PyErr_Clear();
15502 Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__29));
15503 }
15504 return name;
15505 }
15506 #endif
15507
15508 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)15509 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
15510 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15511 #pragma GCC diagnostic push
15512 #pragma GCC diagnostic ignored "-Wconversion"
15513 #endif
15514 const int neg_one = (int) -1, const_zero = (int) 0;
15515 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15516 #pragma GCC diagnostic pop
15517 #endif
15518 const int is_unsigned = neg_one > const_zero;
15519 #if PY_MAJOR_VERSION < 3
15520 if (likely(PyInt_Check(x))) {
15521 if ((sizeof(int) < sizeof(long))) {
15522 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
15523 } else {
15524 long val = PyInt_AS_LONG(x);
15525 if (is_unsigned && unlikely(val < 0)) {
15526 goto raise_neg_overflow;
15527 }
15528 return (int) val;
15529 }
15530 } else
15531 #endif
15532 if (likely(PyLong_Check(x))) {
15533 if (is_unsigned) {
15534 #if CYTHON_USE_PYLONG_INTERNALS
15535 const digit* digits = ((PyLongObject*)x)->ob_digit;
15536 switch (Py_SIZE(x)) {
15537 case 0: return (int) 0;
15538 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
15539 case 2:
15540 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
15541 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15542 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15543 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
15544 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15545 }
15546 }
15547 break;
15548 case 3:
15549 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
15550 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15551 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15552 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
15553 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15554 }
15555 }
15556 break;
15557 case 4:
15558 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
15559 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15560 __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])))
15561 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
15562 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15563 }
15564 }
15565 break;
15566 }
15567 #endif
15568 #if CYTHON_COMPILING_IN_CPYTHON
15569 if (unlikely(Py_SIZE(x) < 0)) {
15570 goto raise_neg_overflow;
15571 }
15572 #else
15573 {
15574 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15575 if (unlikely(result < 0))
15576 return (int) -1;
15577 if (unlikely(result == 1))
15578 goto raise_neg_overflow;
15579 }
15580 #endif
15581 if ((sizeof(int) <= sizeof(unsigned long))) {
15582 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
15583 #ifdef HAVE_LONG_LONG
15584 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
15585 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15586 #endif
15587 }
15588 } else {
15589 #if CYTHON_USE_PYLONG_INTERNALS
15590 const digit* digits = ((PyLongObject*)x)->ob_digit;
15591 switch (Py_SIZE(x)) {
15592 case 0: return (int) 0;
15593 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
15594 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
15595 case -2:
15596 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
15597 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15598 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15599 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
15600 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15601 }
15602 }
15603 break;
15604 case 2:
15605 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
15606 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15607 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15608 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
15609 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15610 }
15611 }
15612 break;
15613 case -3:
15614 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
15615 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15616 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15617 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
15618 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15619 }
15620 }
15621 break;
15622 case 3:
15623 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
15624 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15625 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15626 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
15627 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15628 }
15629 }
15630 break;
15631 case -4:
15632 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
15633 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15634 __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])))
15635 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
15636 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15637 }
15638 }
15639 break;
15640 case 4:
15641 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
15642 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15643 __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])))
15644 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
15645 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15646 }
15647 }
15648 break;
15649 }
15650 #endif
15651 if ((sizeof(int) <= sizeof(long))) {
15652 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
15653 #ifdef HAVE_LONG_LONG
15654 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
15655 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
15656 #endif
15657 }
15658 }
15659 {
15660 #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray)
15661 PyErr_SetString(PyExc_RuntimeError,
15662 "_PyLong_AsByteArray() not available, cannot convert large numbers");
15663 #else
15664 int val;
15665 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15666 #if PY_MAJOR_VERSION < 3
15667 if (likely(v) && !PyLong_Check(v)) {
15668 PyObject *tmp = v;
15669 v = PyNumber_Long(tmp);
15670 Py_DECREF(tmp);
15671 }
15672 #endif
15673 if (likely(v)) {
15674 int one = 1; int is_little = (int)*(unsigned char *)&one;
15675 unsigned char *bytes = (unsigned char *)&val;
15676 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15677 bytes, sizeof(val),
15678 is_little, !is_unsigned);
15679 Py_DECREF(v);
15680 if (likely(!ret))
15681 return val;
15682 }
15683 #endif
15684 return (int) -1;
15685 }
15686 } else {
15687 int val;
15688 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15689 if (!tmp) return (int) -1;
15690 val = __Pyx_PyInt_As_int(tmp);
15691 Py_DECREF(tmp);
15692 return val;
15693 }
15694 raise_overflow:
15695 PyErr_SetString(PyExc_OverflowError,
15696 "value too large to convert to int");
15697 return (int) -1;
15698 raise_neg_overflow:
15699 PyErr_SetString(PyExc_OverflowError,
15700 "can't convert negative value to int");
15701 return (int) -1;
15702 }
15703
15704 /* FastTypeChecks */
15705 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)15706 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
15707 while (a) {
15708 a = a->tp_base;
15709 if (a == b)
15710 return 1;
15711 }
15712 return b == &PyBaseObject_Type;
15713 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)15714 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
15715 PyObject *mro;
15716 if (a == b) return 1;
15717 mro = a->tp_mro;
15718 if (likely(mro)) {
15719 Py_ssize_t i, n;
15720 n = PyTuple_GET_SIZE(mro);
15721 for (i = 0; i < n; i++) {
15722 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
15723 return 1;
15724 }
15725 return 0;
15726 }
15727 return __Pyx_InBases(a, b);
15728 }
__Pyx_IsAnySubtype2(PyTypeObject * cls,PyTypeObject * a,PyTypeObject * b)15729 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
15730 PyObject *mro;
15731 if (cls == a || cls == b) return 1;
15732 mro = cls->tp_mro;
15733 if (likely(mro)) {
15734 Py_ssize_t i, n;
15735 n = PyTuple_GET_SIZE(mro);
15736 for (i = 0; i < n; i++) {
15737 PyObject *base = PyTuple_GET_ITEM(mro, i);
15738 if (base == (PyObject *)a || base == (PyObject *)b)
15739 return 1;
15740 }
15741 return 0;
15742 }
15743 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
15744 }
15745 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)15746 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
15747 PyObject *exception, *value, *tb;
15748 int res;
15749 __Pyx_PyThreadState_declare
15750 __Pyx_PyThreadState_assign
15751 __Pyx_ErrFetch(&exception, &value, &tb);
15752 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
15753 if (unlikely(res == -1)) {
15754 PyErr_WriteUnraisable(err);
15755 res = 0;
15756 }
15757 if (!res) {
15758 res = PyObject_IsSubclass(err, exc_type2);
15759 if (unlikely(res == -1)) {
15760 PyErr_WriteUnraisable(err);
15761 res = 0;
15762 }
15763 }
15764 __Pyx_ErrRestore(exception, value, tb);
15765 return res;
15766 }
15767 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)15768 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
15769 if (exc_type1) {
15770 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
15771 } else {
15772 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
15773 }
15774 }
15775 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)15776 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
15777 Py_ssize_t i, n;
15778 assert(PyExceptionClass_Check(exc_type));
15779 n = PyTuple_GET_SIZE(tuple);
15780 #if PY_MAJOR_VERSION >= 3
15781 for (i=0; i<n; i++) {
15782 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
15783 }
15784 #endif
15785 for (i=0; i<n; i++) {
15786 PyObject *t = PyTuple_GET_ITEM(tuple, i);
15787 #if PY_MAJOR_VERSION < 3
15788 if (likely(exc_type == t)) return 1;
15789 #endif
15790 if (likely(PyExceptionClass_Check(t))) {
15791 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
15792 } else {
15793 }
15794 }
15795 return 0;
15796 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)15797 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
15798 if (likely(err == exc_type)) return 1;
15799 if (likely(PyExceptionClass_Check(err))) {
15800 if (likely(PyExceptionClass_Check(exc_type))) {
15801 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
15802 } else if (likely(PyTuple_Check(exc_type))) {
15803 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
15804 } else {
15805 }
15806 }
15807 return PyErr_GivenExceptionMatches(err, exc_type);
15808 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)15809 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
15810 assert(PyExceptionClass_Check(exc_type1));
15811 assert(PyExceptionClass_Check(exc_type2));
15812 if (likely(err == exc_type1 || err == exc_type2)) return 1;
15813 if (likely(PyExceptionClass_Check(err))) {
15814 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
15815 }
15816 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
15817 }
15818 #endif
15819
15820 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)15821 static int __Pyx_check_binary_version(void) {
15822 char ctversion[4], rtversion[4];
15823 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
15824 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
15825 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
15826 char message[200];
15827 PyOS_snprintf(message, sizeof(message),
15828 "compiletime version %s of module '%.100s' "
15829 "does not match runtime version %s",
15830 ctversion, __Pyx_MODULE_NAME, rtversion);
15831 return PyErr_WarnEx(NULL, message, 1);
15832 }
15833 return 0;
15834 }
15835
15836 /* InitStrings */
15837 #if PY_MAJOR_VERSION >= 3
__Pyx_InitString(__Pyx_StringTabEntry t,PyObject ** str)15838 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
15839 if (t.is_unicode | t.is_str) {
15840 if (t.intern) {
15841 *str = PyUnicode_InternFromString(t.s);
15842 } else if (t.encoding) {
15843 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
15844 } else {
15845 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
15846 }
15847 } else {
15848 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
15849 }
15850 if (!*str)
15851 return -1;
15852 if (PyObject_Hash(*str) == -1)
15853 return -1;
15854 return 0;
15855 }
15856 #endif
15857 #if !CYTHON_COMPILING_IN_LIMITED_API
__Pyx_InitStrings(__Pyx_StringTabEntry * t)15858 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
15859 while (t->p) {
15860 #if PY_MAJOR_VERSION >= 3
15861 __Pyx_InitString(*t, t->p);
15862 #else
15863 if (t->is_unicode) {
15864 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
15865 } else if (t->intern) {
15866 *t->p = PyString_InternFromString(t->s);
15867 } else {
15868 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
15869 }
15870 if (!*t->p)
15871 return -1;
15872 if (PyObject_Hash(*t->p) == -1)
15873 return -1;
15874 #endif
15875 ++t;
15876 }
15877 return 0;
15878 }
15879 #endif
15880
__Pyx_PyUnicode_FromString(const char * c_str)15881 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
15882 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
15883 }
__Pyx_PyObject_AsString(PyObject * o)15884 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
15885 Py_ssize_t ignore;
15886 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
15887 }
15888 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
15889 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)15890 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15891 char* defenc_c;
15892 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
15893 if (!defenc) return NULL;
15894 defenc_c = PyBytes_AS_STRING(defenc);
15895 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15896 {
15897 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
15898 char* c;
15899 for (c = defenc_c; c < end; c++) {
15900 if ((unsigned char) (*c) >= 128) {
15901 PyUnicode_AsASCIIString(o);
15902 return NULL;
15903 }
15904 }
15905 }
15906 #endif
15907 *length = PyBytes_GET_SIZE(defenc);
15908 return defenc_c;
15909 }
15910 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)15911 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15912 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
15913 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15914 if (likely(PyUnicode_IS_ASCII(o))) {
15915 *length = PyUnicode_GET_LENGTH(o);
15916 return PyUnicode_AsUTF8(o);
15917 } else {
15918 PyUnicode_AsASCIIString(o);
15919 return NULL;
15920 }
15921 #else
15922 return PyUnicode_AsUTF8AndSize(o, length);
15923 #endif
15924 }
15925 #endif
15926 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)15927 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15928 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
15929 if (
15930 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15931 __Pyx_sys_getdefaultencoding_not_ascii &&
15932 #endif
15933 PyUnicode_Check(o)) {
15934 return __Pyx_PyUnicode_AsStringAndSize(o, length);
15935 } else
15936 #endif
15937 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
15938 if (PyByteArray_Check(o)) {
15939 *length = PyByteArray_GET_SIZE(o);
15940 return PyByteArray_AS_STRING(o);
15941 } else
15942 #endif
15943 {
15944 char* result;
15945 int r = PyBytes_AsStringAndSize(o, &result, length);
15946 if (unlikely(r < 0)) {
15947 return NULL;
15948 } else {
15949 return result;
15950 }
15951 }
15952 }
__Pyx_PyObject_IsTrue(PyObject * x)15953 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
15954 int is_true = x == Py_True;
15955 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
15956 else return PyObject_IsTrue(x);
15957 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)15958 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
15959 int retval;
15960 if (unlikely(!x)) return -1;
15961 retval = __Pyx_PyObject_IsTrue(x);
15962 Py_DECREF(x);
15963 return retval;
15964 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)15965 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
15966 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
15967 #if PY_MAJOR_VERSION >= 3
15968 if (PyLong_Check(result)) {
15969 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
15970 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
15971 "The ability to return an instance of a strict subclass of int is deprecated, "
15972 "and may be removed in a future version of Python.",
15973 result_type_name)) {
15974 __Pyx_DECREF_TypeName(result_type_name);
15975 Py_DECREF(result);
15976 return NULL;
15977 }
15978 __Pyx_DECREF_TypeName(result_type_name);
15979 return result;
15980 }
15981 #endif
15982 PyErr_Format(PyExc_TypeError,
15983 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
15984 type_name, type_name, result_type_name);
15985 __Pyx_DECREF_TypeName(result_type_name);
15986 Py_DECREF(result);
15987 return NULL;
15988 }
__Pyx_PyNumber_IntOrLong(PyObject * x)15989 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
15990 #if CYTHON_USE_TYPE_SLOTS
15991 PyNumberMethods *m;
15992 #endif
15993 const char *name = NULL;
15994 PyObject *res = NULL;
15995 #if PY_MAJOR_VERSION < 3
15996 if (likely(PyInt_Check(x) || PyLong_Check(x)))
15997 #else
15998 if (likely(PyLong_Check(x)))
15999 #endif
16000 return __Pyx_NewRef(x);
16001 #if CYTHON_USE_TYPE_SLOTS
16002 m = Py_TYPE(x)->tp_as_number;
16003 #if PY_MAJOR_VERSION < 3
16004 if (m && m->nb_int) {
16005 name = "int";
16006 res = m->nb_int(x);
16007 }
16008 else if (m && m->nb_long) {
16009 name = "long";
16010 res = m->nb_long(x);
16011 }
16012 #else
16013 if (likely(m && m->nb_int)) {
16014 name = "int";
16015 res = m->nb_int(x);
16016 }
16017 #endif
16018 #else
16019 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
16020 res = PyNumber_Int(x);
16021 }
16022 #endif
16023 if (likely(res)) {
16024 #if PY_MAJOR_VERSION < 3
16025 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
16026 #else
16027 if (unlikely(!PyLong_CheckExact(res))) {
16028 #endif
16029 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
16030 }
16031 }
16032 else if (!PyErr_Occurred()) {
16033 PyErr_SetString(PyExc_TypeError,
16034 "an integer is required");
16035 }
16036 return res;
16037 }
16038 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
16039 Py_ssize_t ival;
16040 PyObject *x;
16041 #if PY_MAJOR_VERSION < 3
16042 if (likely(PyInt_CheckExact(b))) {
16043 if (sizeof(Py_ssize_t) >= sizeof(long))
16044 return PyInt_AS_LONG(b);
16045 else
16046 return PyInt_AsSsize_t(b);
16047 }
16048 #endif
16049 if (likely(PyLong_CheckExact(b))) {
16050 #if CYTHON_USE_PYLONG_INTERNALS
16051 const digit* digits = ((PyLongObject*)b)->ob_digit;
16052 const Py_ssize_t size = Py_SIZE(b);
16053 if (likely(__Pyx_sst_abs(size) <= 1)) {
16054 ival = likely(size) ? digits[0] : 0;
16055 if (size == -1) ival = -ival;
16056 return ival;
16057 } else {
16058 switch (size) {
16059 case 2:
16060 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16061 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16062 }
16063 break;
16064 case -2:
16065 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16066 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16067 }
16068 break;
16069 case 3:
16070 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16071 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16072 }
16073 break;
16074 case -3:
16075 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16076 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16077 }
16078 break;
16079 case 4:
16080 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16081 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]));
16082 }
16083 break;
16084 case -4:
16085 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16086 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]));
16087 }
16088 break;
16089 }
16090 }
16091 #endif
16092 return PyLong_AsSsize_t(b);
16093 }
16094 x = PyNumber_Index(b);
16095 if (!x) return -1;
16096 ival = PyInt_AsSsize_t(x);
16097 Py_DECREF(x);
16098 return ival;
16099 }
16100 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
16101 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
16102 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
16103 #if PY_MAJOR_VERSION < 3
16104 } else if (likely(PyInt_CheckExact(o))) {
16105 return PyInt_AS_LONG(o);
16106 #endif
16107 } else {
16108 Py_ssize_t ival;
16109 PyObject *x;
16110 x = PyNumber_Index(o);
16111 if (!x) return -1;
16112 ival = PyInt_AsLong(x);
16113 Py_DECREF(x);
16114 return ival;
16115 }
16116 }
16117 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
16118 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
16119 }
16120 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
16121 return PyInt_FromSize_t(ival);
16122 }
16123
16124
16125 /* #### Code section: utility_code_pragmas_end ### */
16126 #if _MSV_VER
16127 #pragma warning( pop )
16128 #endif
16129
16130
16131
16132 /* #### Code section: end ### */
16133 #endif /* Py_PYTHON_H */
16134