1 /* Generated by Cython 0.29.25 */
2
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_25"
13 #define CYTHON_HEX_VERSION 0x001D19F0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20 #ifndef __stdcall
21 #define __stdcall
22 #endif
23 #ifndef __cdecl
24 #define __cdecl
25 #endif
26 #ifndef __fastcall
27 #define __fastcall
28 #endif
29 #endif
30 #ifndef DL_IMPORT
31 #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34 #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
40 #endif
41 #endif
42 #ifndef PY_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46 #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
61 #endif
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89 #define CYTHON_COMPILING_IN_PYPY 0
90 #define CYTHON_COMPILING_IN_PYSTON 1
91 #define CYTHON_COMPILING_IN_CPYTHON 0
92 #ifndef CYTHON_USE_TYPE_SLOTS
93 #define CYTHON_USE_TYPE_SLOTS 1
94 #endif
95 #undef CYTHON_USE_PYTYPE_LOOKUP
96 #define CYTHON_USE_PYTYPE_LOOKUP 0
97 #undef CYTHON_USE_ASYNC_SLOTS
98 #define CYTHON_USE_ASYNC_SLOTS 0
99 #undef CYTHON_USE_PYLIST_INTERNALS
100 #define CYTHON_USE_PYLIST_INTERNALS 0
101 #ifndef CYTHON_USE_UNICODE_INTERNALS
102 #define CYTHON_USE_UNICODE_INTERNALS 1
103 #endif
104 #undef CYTHON_USE_UNICODE_WRITER
105 #define CYTHON_USE_UNICODE_WRITER 0
106 #undef CYTHON_USE_PYLONG_INTERNALS
107 #define CYTHON_USE_PYLONG_INTERNALS 0
108 #ifndef CYTHON_AVOID_BORROWED_REFS
109 #define CYTHON_AVOID_BORROWED_REFS 0
110 #endif
111 #ifndef CYTHON_ASSUME_SAFE_MACROS
112 #define CYTHON_ASSUME_SAFE_MACROS 1
113 #endif
114 #ifndef CYTHON_UNPACK_METHODS
115 #define CYTHON_UNPACK_METHODS 1
116 #endif
117 #undef CYTHON_FAST_THREAD_STATE
118 #define CYTHON_FAST_THREAD_STATE 0
119 #undef CYTHON_FAST_PYCALL
120 #define CYTHON_FAST_PYCALL 0
121 #undef CYTHON_PEP489_MULTI_PHASE_INIT
122 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123 #undef CYTHON_USE_TP_FINALIZE
124 #define CYTHON_USE_TP_FINALIZE 0
125 #undef CYTHON_USE_DICT_VERSIONS
126 #define CYTHON_USE_DICT_VERSIONS 0
127 #undef CYTHON_USE_EXC_INFO_STACK
128 #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130 #define CYTHON_COMPILING_IN_PYPY 0
131 #define CYTHON_COMPILING_IN_PYSTON 0
132 #define CYTHON_COMPILING_IN_CPYTHON 1
133 #ifndef CYTHON_USE_TYPE_SLOTS
134 #define CYTHON_USE_TYPE_SLOTS 1
135 #endif
136 #if PY_VERSION_HEX < 0x02070000
137 #undef CYTHON_USE_PYTYPE_LOOKUP
138 #define CYTHON_USE_PYTYPE_LOOKUP 0
139 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140 #define CYTHON_USE_PYTYPE_LOOKUP 1
141 #endif
142 #if PY_MAJOR_VERSION < 3
143 #undef CYTHON_USE_ASYNC_SLOTS
144 #define CYTHON_USE_ASYNC_SLOTS 0
145 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146 #define CYTHON_USE_ASYNC_SLOTS 1
147 #endif
148 #if PY_VERSION_HEX < 0x02070000
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152 #define CYTHON_USE_PYLONG_INTERNALS 1
153 #endif
154 #ifndef CYTHON_USE_PYLIST_INTERNALS
155 #define CYTHON_USE_PYLIST_INTERNALS 1
156 #endif
157 #ifndef CYTHON_USE_UNICODE_INTERNALS
158 #define CYTHON_USE_UNICODE_INTERNALS 1
159 #endif
160 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
161 #undef CYTHON_USE_UNICODE_WRITER
162 #define CYTHON_USE_UNICODE_WRITER 0
163 #elif !defined(CYTHON_USE_UNICODE_WRITER)
164 #define CYTHON_USE_UNICODE_WRITER 1
165 #endif
166 #ifndef CYTHON_AVOID_BORROWED_REFS
167 #define CYTHON_AVOID_BORROWED_REFS 0
168 #endif
169 #ifndef CYTHON_ASSUME_SAFE_MACROS
170 #define CYTHON_ASSUME_SAFE_MACROS 1
171 #endif
172 #ifndef CYTHON_UNPACK_METHODS
173 #define CYTHON_UNPACK_METHODS 1
174 #endif
175 #ifndef CYTHON_FAST_THREAD_STATE
176 #define CYTHON_FAST_THREAD_STATE 1
177 #endif
178 #ifndef CYTHON_FAST_PYCALL
179 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1)
180 #endif
181 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183 #endif
184 #ifndef CYTHON_USE_TP_FINALIZE
185 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186 #endif
187 #ifndef CYTHON_USE_DICT_VERSIONS
188 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189 #endif
190 #ifndef CYTHON_USE_EXC_INFO_STACK
191 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192 #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198 #if PY_MAJOR_VERSION < 3
199 #include "longintrepr.h"
200 #endif
201 #undef SHIFT
202 #undef BASE
203 #undef MASK
204 #ifdef SIZEOF_VOID_P
205 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
206 #endif
207 #endif
208 #ifndef __has_attribute
209 #define __has_attribute(x) 0
210 #endif
211 #ifndef __has_cpp_attribute
212 #define __has_cpp_attribute(x) 0
213 #endif
214 #ifndef CYTHON_RESTRICT
215 #if defined(__GNUC__)
216 #define CYTHON_RESTRICT __restrict__
217 #elif defined(_MSC_VER) && _MSC_VER >= 1400
218 #define CYTHON_RESTRICT __restrict
219 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
220 #define CYTHON_RESTRICT restrict
221 #else
222 #define CYTHON_RESTRICT
223 #endif
224 #endif
225 #ifndef CYTHON_UNUSED
226 # if defined(__GNUC__)
227 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
228 # define CYTHON_UNUSED __attribute__ ((__unused__))
229 # else
230 # define CYTHON_UNUSED
231 # endif
232 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
233 # define CYTHON_UNUSED __attribute__ ((__unused__))
234 # else
235 # define CYTHON_UNUSED
236 # endif
237 #endif
238 #ifndef CYTHON_MAYBE_UNUSED_VAR
239 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)240 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
241 # else
242 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
243 # endif
244 #endif
245 #ifndef CYTHON_NCP_UNUSED
246 # if CYTHON_COMPILING_IN_CPYTHON
247 # define CYTHON_NCP_UNUSED
248 # else
249 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
250 # endif
251 #endif
252 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
253 #ifdef _MSC_VER
254 #ifndef _MSC_STDINT_H_
255 #if _MSC_VER < 1300
256 typedef unsigned char uint8_t;
257 typedef unsigned int uint32_t;
258 #else
259 typedef unsigned __int8 uint8_t;
260 typedef unsigned __int32 uint32_t;
261 #endif
262 #endif
263 #else
264 #include <stdint.h>
265 #endif
266 #ifndef CYTHON_FALLTHROUGH
267 #if defined(__cplusplus) && __cplusplus >= 201103L
268 #if __has_cpp_attribute(fallthrough)
269 #define CYTHON_FALLTHROUGH [[fallthrough]]
270 #elif __has_cpp_attribute(clang::fallthrough)
271 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
272 #elif __has_cpp_attribute(gnu::fallthrough)
273 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
274 #endif
275 #endif
276 #ifndef CYTHON_FALLTHROUGH
277 #if __has_attribute(fallthrough)
278 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
279 #else
280 #define CYTHON_FALLTHROUGH
281 #endif
282 #endif
283 #if defined(__clang__ ) && defined(__apple_build_version__)
284 #if __apple_build_version__ < 7000000
285 #undef CYTHON_FALLTHROUGH
286 #define CYTHON_FALLTHROUGH
287 #endif
288 #endif
289 #endif
290
291 #ifndef CYTHON_INLINE
292 #if defined(__clang__)
293 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
294 #elif defined(__GNUC__)
295 #define CYTHON_INLINE __inline__
296 #elif defined(_MSC_VER)
297 #define CYTHON_INLINE __inline
298 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
299 #define CYTHON_INLINE inline
300 #else
301 #define CYTHON_INLINE
302 #endif
303 #endif
304
305 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
306 #define Py_OptimizeFlag 0
307 #endif
308 #define __PYX_BUILD_PY_SSIZE_T "n"
309 #define CYTHON_FORMAT_SSIZE_T "z"
310 #if PY_MAJOR_VERSION < 3
311 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
312 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
313 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
314 #define __Pyx_DefaultClassType PyClass_Type
315 #else
316 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
317 #define __Pyx_DefaultClassType PyType_Type
318 #if PY_VERSION_HEX >= 0x030B00A1
__Pyx_PyCode_New(int a,int k,int l,int s,int f,PyObject * code,PyObject * c,PyObject * n,PyObject * v,PyObject * fv,PyObject * cell,PyObject * fn,PyObject * name,int fline,PyObject * lnos)319 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
320 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
321 PyObject *fv, PyObject *cell, PyObject* fn,
322 PyObject *name, int fline, PyObject *lnos) {
323 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
324 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
325 const char *fn_cstr=NULL;
326 const char *name_cstr=NULL;
327 PyCodeObject* co=NULL;
328 PyObject *type, *value, *traceback;
329 PyErr_Fetch(&type, &value, &traceback);
330 if (!(kwds=PyDict_New())) goto end;
331 if (!(argcount=PyLong_FromLong(a))) goto end;
332 if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
333 if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
334 if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
335 if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
336 if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
337 if (!(nlocals=PyLong_FromLong(l))) goto end;
338 if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
339 if (!(stacksize=PyLong_FromLong(s))) goto end;
340 if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
341 if (!(flags=PyLong_FromLong(f))) goto end;
342 if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
343 if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
344 if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
345 if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
346 if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
347 if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
348 if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
349 if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
350 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
351 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
352 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
353 if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
354 if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
355 if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
356 Py_XDECREF((PyObject*)co);
357 co = (PyCodeObject*)call_result;
358 call_result = NULL;
359 if (0) {
360 cleanup_code_too:
361 Py_XDECREF((PyObject*)co);
362 co = NULL;
363 }
364 end:
365 Py_XDECREF(kwds);
366 Py_XDECREF(argcount);
367 Py_XDECREF(posonlyargcount);
368 Py_XDECREF(kwonlyargcount);
369 Py_XDECREF(nlocals);
370 Py_XDECREF(stacksize);
371 Py_XDECREF(replace);
372 Py_XDECREF(call_result);
373 Py_XDECREF(empty);
374 if (type) {
375 PyErr_Restore(type, value, traceback);
376 }
377 return co;
378 }
379 #else
380 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
381 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
382 #endif
383 #define __Pyx_DefaultClassType PyType_Type
384 #endif
385 #ifndef Py_TPFLAGS_CHECKTYPES
386 #define Py_TPFLAGS_CHECKTYPES 0
387 #endif
388 #ifndef Py_TPFLAGS_HAVE_INDEX
389 #define Py_TPFLAGS_HAVE_INDEX 0
390 #endif
391 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
392 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
393 #endif
394 #ifndef Py_TPFLAGS_HAVE_FINALIZE
395 #define Py_TPFLAGS_HAVE_FINALIZE 0
396 #endif
397 #ifndef METH_STACKLESS
398 #define METH_STACKLESS 0
399 #endif
400 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
401 #ifndef METH_FASTCALL
402 #define METH_FASTCALL 0x80
403 #endif
404 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
405 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
406 Py_ssize_t nargs, PyObject *kwnames);
407 #else
408 #define __Pyx_PyCFunctionFast _PyCFunctionFast
409 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
410 #endif
411 #if CYTHON_FAST_PYCCALL
412 #define __Pyx_PyFastCFunction_Check(func)\
413 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
414 #else
415 #define __Pyx_PyFastCFunction_Check(func) 0
416 #endif
417 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
418 #define PyObject_Malloc(s) PyMem_Malloc(s)
419 #define PyObject_Free(p) PyMem_Free(p)
420 #define PyObject_Realloc(p) PyMem_Realloc(p)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
423 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
424 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
425 #define PyMem_RawFree(p) PyMem_Free(p)
426 #endif
427 #if CYTHON_COMPILING_IN_PYSTON
428 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
429 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
430 #else
431 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
432 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
433 #endif
434 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
435 #define __Pyx_PyThreadState_Current PyThreadState_GET()
436 #elif PY_VERSION_HEX >= 0x03060000
437 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
438 #elif PY_VERSION_HEX >= 0x03000000
439 #define __Pyx_PyThreadState_Current PyThreadState_GET()
440 #else
441 #define __Pyx_PyThreadState_Current _PyThreadState_Current
442 #endif
443 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
444 #include "pythread.h"
445 #define Py_tss_NEEDS_INIT 0
446 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)447 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
448 *key = PyThread_create_key();
449 return 0;
450 }
PyThread_tss_alloc(void)451 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
452 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
453 *key = Py_tss_NEEDS_INIT;
454 return key;
455 }
PyThread_tss_free(Py_tss_t * key)456 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
457 PyObject_Free(key);
458 }
PyThread_tss_is_created(Py_tss_t * key)459 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
460 return *key != Py_tss_NEEDS_INIT;
461 }
PyThread_tss_delete(Py_tss_t * key)462 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
463 PyThread_delete_key(*key);
464 *key = Py_tss_NEEDS_INIT;
465 }
PyThread_tss_set(Py_tss_t * key,void * value)466 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
467 return PyThread_set_key_value(*key, value);
468 }
PyThread_tss_get(Py_tss_t * key)469 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
470 return PyThread_get_key_value(*key);
471 }
472 #endif
473 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
474 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
475 #else
476 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
477 #endif
478 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
479 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
480 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
481 #else
482 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
483 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
484 #endif
485 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
486 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
487 #else
488 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
489 #endif
490 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
491 #define CYTHON_PEP393_ENABLED 1
492 #if defined(PyUnicode_IS_READY)
493 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
494 0 : _PyUnicode_Ready((PyObject *)(op)))
495 #else
496 #define __Pyx_PyUnicode_READY(op) (0)
497 #endif
498 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
499 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
500 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
501 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
502 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
503 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
504 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
505 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
506 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
507 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
508 #else
509 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
510 #endif
511 #else
512 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
513 #endif
514 #else
515 #define CYTHON_PEP393_ENABLED 0
516 #define PyUnicode_1BYTE_KIND 1
517 #define PyUnicode_2BYTE_KIND 2
518 #define PyUnicode_4BYTE_KIND 4
519 #define __Pyx_PyUnicode_READY(op) (0)
520 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
521 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
522 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
523 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
524 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
525 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
526 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
527 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
528 #endif
529 #if CYTHON_COMPILING_IN_PYPY
530 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
531 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
532 #else
533 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
534 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
535 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
536 #endif
537 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
538 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
539 #endif
540 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
541 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
542 #endif
543 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
544 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
545 #endif
546 #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))
547 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
548 #if PY_MAJOR_VERSION >= 3
549 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
550 #else
551 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
552 #endif
553 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
554 #define PyObject_ASCII(o) PyObject_Repr(o)
555 #endif
556 #if PY_MAJOR_VERSION >= 3
557 #define PyBaseString_Type PyUnicode_Type
558 #define PyStringObject PyUnicodeObject
559 #define PyString_Type PyUnicode_Type
560 #define PyString_Check PyUnicode_Check
561 #define PyString_CheckExact PyUnicode_CheckExact
562 #ifndef PyObject_Unicode
563 #define PyObject_Unicode PyObject_Str
564 #endif
565 #endif
566 #if PY_MAJOR_VERSION >= 3
567 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
568 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
569 #else
570 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
571 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
572 #endif
573 #ifndef PySet_CheckExact
574 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
575 #endif
576 #if PY_VERSION_HEX >= 0x030900A4
577 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
578 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
579 #else
580 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
581 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
582 #endif
583 #if CYTHON_ASSUME_SAFE_MACROS
584 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
585 #else
586 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
587 #endif
588 #if PY_MAJOR_VERSION >= 3
589 #define PyIntObject PyLongObject
590 #define PyInt_Type PyLong_Type
591 #define PyInt_Check(op) PyLong_Check(op)
592 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
593 #define PyInt_FromString PyLong_FromString
594 #define PyInt_FromUnicode PyLong_FromUnicode
595 #define PyInt_FromLong PyLong_FromLong
596 #define PyInt_FromSize_t PyLong_FromSize_t
597 #define PyInt_FromSsize_t PyLong_FromSsize_t
598 #define PyInt_AsLong PyLong_AsLong
599 #define PyInt_AS_LONG PyLong_AS_LONG
600 #define PyInt_AsSsize_t PyLong_AsSsize_t
601 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
602 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
603 #define PyNumber_Int PyNumber_Long
604 #endif
605 #if PY_MAJOR_VERSION >= 3
606 #define PyBoolObject PyLongObject
607 #endif
608 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
609 #ifndef PyUnicode_InternFromString
610 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
611 #endif
612 #endif
613 #if PY_VERSION_HEX < 0x030200A4
614 typedef long Py_hash_t;
615 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
616 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
617 #else
618 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
619 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
620 #endif
621 #if PY_MAJOR_VERSION >= 3
622 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
623 #else
624 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
625 #endif
626 #if CYTHON_USE_ASYNC_SLOTS
627 #if PY_VERSION_HEX >= 0x030500B1
628 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
629 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
630 #else
631 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
632 #endif
633 #else
634 #define __Pyx_PyType_AsAsync(obj) NULL
635 #endif
636 #ifndef __Pyx_PyAsyncMethodsStruct
637 typedef struct {
638 unaryfunc am_await;
639 unaryfunc am_aiter;
640 unaryfunc am_anext;
641 } __Pyx_PyAsyncMethodsStruct;
642 #endif
643
644 #if defined(WIN32) || defined(MS_WINDOWS)
645 #define _USE_MATH_DEFINES
646 #endif
647 #include <math.h>
648 #ifdef NAN
649 #define __PYX_NAN() ((float) NAN)
650 #else
__PYX_NAN()651 static CYTHON_INLINE float __PYX_NAN() {
652 float value;
653 memset(&value, 0xFF, sizeof(value));
654 return value;
655 }
656 #endif
657 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
658 #define __Pyx_truncl trunc
659 #else
660 #define __Pyx_truncl truncl
661 #endif
662
663 #define __PYX_MARK_ERR_POS(f_index, lineno) \
664 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
665 #define __PYX_ERR(f_index, lineno, Ln_error) \
666 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
667
668 #ifndef __PYX_EXTERN_C
669 #ifdef __cplusplus
670 #define __PYX_EXTERN_C extern "C"
671 #else
672 #define __PYX_EXTERN_C extern
673 #endif
674 #endif
675
676 #define __PYX_HAVE__bx__seq___nib
677 #define __PYX_HAVE_API__bx__seq___nib
678 /* Early includes */
679 #ifdef _OPENMP
680 #include <omp.h>
681 #endif /* _OPENMP */
682
683 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
684 #define CYTHON_WITHOUT_ASSERTIONS
685 #endif
686
687 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
688 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
689
690 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
691 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
692 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
693 #define __PYX_DEFAULT_STRING_ENCODING ""
694 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
695 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
696 #define __Pyx_uchar_cast(c) ((unsigned char)c)
697 #define __Pyx_long_cast(x) ((long)x)
698 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
699 (sizeof(type) < sizeof(Py_ssize_t)) ||\
700 (sizeof(type) > sizeof(Py_ssize_t) &&\
701 likely(v < (type)PY_SSIZE_T_MAX ||\
702 v == (type)PY_SSIZE_T_MAX) &&\
703 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
704 v == (type)PY_SSIZE_T_MIN))) ||\
705 (sizeof(type) == sizeof(Py_ssize_t) &&\
706 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
707 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)708 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
709 return (size_t) i < (size_t) limit;
710 }
711 #if defined (__cplusplus) && __cplusplus >= 201103L
712 #include <cstdlib>
713 #define __Pyx_sst_abs(value) std::abs(value)
714 #elif SIZEOF_INT >= SIZEOF_SIZE_T
715 #define __Pyx_sst_abs(value) abs(value)
716 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
717 #define __Pyx_sst_abs(value) labs(value)
718 #elif defined (_MSC_VER)
719 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
720 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
721 #define __Pyx_sst_abs(value) llabs(value)
722 #elif defined (__GNUC__)
723 #define __Pyx_sst_abs(value) __builtin_llabs(value)
724 #else
725 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
726 #endif
727 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
728 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
729 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
730 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
731 #define __Pyx_PyBytes_FromString PyBytes_FromString
732 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
733 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
734 #if PY_MAJOR_VERSION < 3
735 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
736 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
737 #else
738 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
739 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
740 #endif
741 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
742 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
743 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
744 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
745 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
746 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
747 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
748 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
749 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
750 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
751 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
752 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
753 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
754 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
755 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
756 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)757 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
758 const Py_UNICODE *u_end = u;
759 while (*u_end++) ;
760 return (size_t)(u_end - u - 1);
761 }
762 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
763 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
764 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
765 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
766 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
767 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
768 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
769 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
770 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
771 #define __Pyx_PySequence_Tuple(obj)\
772 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
773 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
774 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
775 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
776 #if CYTHON_ASSUME_SAFE_MACROS
777 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
778 #else
779 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
780 #endif
781 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
782 #if PY_MAJOR_VERSION >= 3
783 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
784 #else
785 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
786 #endif
787 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
788 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
789 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)790 static int __Pyx_init_sys_getdefaultencoding_params(void) {
791 PyObject* sys;
792 PyObject* default_encoding = NULL;
793 PyObject* ascii_chars_u = NULL;
794 PyObject* ascii_chars_b = NULL;
795 const char* default_encoding_c;
796 sys = PyImport_ImportModule("sys");
797 if (!sys) goto bad;
798 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
799 Py_DECREF(sys);
800 if (!default_encoding) goto bad;
801 default_encoding_c = PyBytes_AsString(default_encoding);
802 if (!default_encoding_c) goto bad;
803 if (strcmp(default_encoding_c, "ascii") == 0) {
804 __Pyx_sys_getdefaultencoding_not_ascii = 0;
805 } else {
806 char ascii_chars[128];
807 int c;
808 for (c = 0; c < 128; c++) {
809 ascii_chars[c] = c;
810 }
811 __Pyx_sys_getdefaultencoding_not_ascii = 1;
812 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
813 if (!ascii_chars_u) goto bad;
814 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
815 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
816 PyErr_Format(
817 PyExc_ValueError,
818 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
819 default_encoding_c);
820 goto bad;
821 }
822 Py_DECREF(ascii_chars_u);
823 Py_DECREF(ascii_chars_b);
824 }
825 Py_DECREF(default_encoding);
826 return 0;
827 bad:
828 Py_XDECREF(default_encoding);
829 Py_XDECREF(ascii_chars_u);
830 Py_XDECREF(ascii_chars_b);
831 return -1;
832 }
833 #endif
834 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
835 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
836 #else
837 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
838 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
839 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)840 static int __Pyx_init_sys_getdefaultencoding_params(void) {
841 PyObject* sys;
842 PyObject* default_encoding = NULL;
843 char* default_encoding_c;
844 sys = PyImport_ImportModule("sys");
845 if (!sys) goto bad;
846 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
847 Py_DECREF(sys);
848 if (!default_encoding) goto bad;
849 default_encoding_c = PyBytes_AsString(default_encoding);
850 if (!default_encoding_c) goto bad;
851 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
852 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
853 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
854 Py_DECREF(default_encoding);
855 return 0;
856 bad:
857 Py_XDECREF(default_encoding);
858 return -1;
859 }
860 #endif
861 #endif
862
863
864 /* Test for GCC > 2.95 */
865 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
866 #define likely(x) __builtin_expect(!!(x), 1)
867 #define unlikely(x) __builtin_expect(!!(x), 0)
868 #else /* !__GNUC__ or GCC < 2.95 */
869 #define likely(x) (x)
870 #define unlikely(x) (x)
871 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)872 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
873
874 static PyObject *__pyx_m = NULL;
875 static PyObject *__pyx_d;
876 static PyObject *__pyx_b;
877 static PyObject *__pyx_cython_runtime = NULL;
878 static PyObject *__pyx_empty_tuple;
879 static PyObject *__pyx_empty_bytes;
880 static PyObject *__pyx_empty_unicode;
881 static int __pyx_lineno;
882 static int __pyx_clineno = 0;
883 static const char * __pyx_cfilenm= __FILE__;
884 static const char *__pyx_filename;
885
886
887 static const char *__pyx_f[] = {
888 "lib/bx/seq/_nib.pyx",
889 };
890
891 /*--- Type declarations ---*/
892
893 /* --- Runtime support code (head) --- */
894 /* Refnanny.proto */
895 #ifndef CYTHON_REFNANNY
896 #define CYTHON_REFNANNY 0
897 #endif
898 #if CYTHON_REFNANNY
899 typedef struct {
900 void (*INCREF)(void*, PyObject*, int);
901 void (*DECREF)(void*, PyObject*, int);
902 void (*GOTREF)(void*, PyObject*, int);
903 void (*GIVEREF)(void*, PyObject*, int);
904 void* (*SetupContext)(const char*, int, const char*);
905 void (*FinishContext)(void**);
906 } __Pyx_RefNannyAPIStruct;
907 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
908 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
909 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
910 #ifdef WITH_THREAD
911 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
912 if (acquire_gil) {\
913 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
914 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
915 PyGILState_Release(__pyx_gilstate_save);\
916 } else {\
917 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
918 }
919 #else
920 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
921 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
922 #endif
923 #define __Pyx_RefNannyFinishContext()\
924 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
925 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
926 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
927 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
928 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
929 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
930 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
931 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
932 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
933 #else
934 #define __Pyx_RefNannyDeclarations
935 #define __Pyx_RefNannySetupContext(name, acquire_gil)
936 #define __Pyx_RefNannyFinishContext()
937 #define __Pyx_INCREF(r) Py_INCREF(r)
938 #define __Pyx_DECREF(r) Py_DECREF(r)
939 #define __Pyx_GOTREF(r)
940 #define __Pyx_GIVEREF(r)
941 #define __Pyx_XINCREF(r) Py_XINCREF(r)
942 #define __Pyx_XDECREF(r) Py_XDECREF(r)
943 #define __Pyx_XGOTREF(r)
944 #define __Pyx_XGIVEREF(r)
945 #endif
946 #define __Pyx_XDECREF_SET(r, v) do {\
947 PyObject *tmp = (PyObject *) r;\
948 r = v; __Pyx_XDECREF(tmp);\
949 } while (0)
950 #define __Pyx_DECREF_SET(r, v) do {\
951 PyObject *tmp = (PyObject *) r;\
952 r = v; __Pyx_DECREF(tmp);\
953 } while (0)
954 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
955 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
956
957 /* RaiseArgTupleInvalid.proto */
958 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
959 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
960
961 /* RaiseDoubleKeywords.proto */
962 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
963
964 /* ParseKeywords.proto */
965 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
966 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
967 const char* function_name);
968
969 /* None.proto */
970 static CYTHON_INLINE long __Pyx_div_long(long, long);
971
972 /* PyObjectGetAttrStr.proto */
973 #if CYTHON_USE_TYPE_SLOTS
974 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
975 #else
976 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
977 #endif
978
979 /* PyFunctionFastCall.proto */
980 #if CYTHON_FAST_PYCALL
981 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
982 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
983 #if 1 || PY_VERSION_HEX < 0x030600B1
984 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
985 #else
986 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
987 #endif
988 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
989 (sizeof(char [1 - 2*!(cond)]) - 1)
990 #ifndef Py_MEMBER_SIZE
991 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
992 #endif
993 #if CYTHON_FAST_PYCALL
994 static size_t __pyx_pyframe_localsplus_offset = 0;
995 #include "frameobject.h"
996 #define __Pxy_PyFrame_Initialize_Offsets()\
997 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
998 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
999 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1000 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1001 #endif // CYTHON_FAST_PYCALL
1002 #endif
1003
1004 /* PyObjectCall.proto */
1005 #if CYTHON_COMPILING_IN_CPYTHON
1006 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1007 #else
1008 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1009 #endif
1010
1011 /* PyObjectCallMethO.proto */
1012 #if CYTHON_COMPILING_IN_CPYTHON
1013 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1014 #endif
1015
1016 /* PyObjectCallNoArg.proto */
1017 #if CYTHON_COMPILING_IN_CPYTHON
1018 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1019 #else
1020 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1021 #endif
1022
1023 /* PyCFunctionFastCall.proto */
1024 #if CYTHON_FAST_PYCCALL
1025 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1026 #else
1027 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1028 #endif
1029
1030 /* PyObjectCallOneArg.proto */
1031 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1032
1033 /* Import.proto */
1034 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1035
1036 /* PyDictVersioning.proto */
1037 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1038 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1039 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1040 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1041 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1042 (cache_var) = (value);
1043 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1044 static PY_UINT64_T __pyx_dict_version = 0;\
1045 static PyObject *__pyx_dict_cached_value = NULL;\
1046 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1047 (VAR) = __pyx_dict_cached_value;\
1048 } else {\
1049 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1050 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1051 }\
1052 }
1053 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1054 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1055 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1056 #else
1057 #define __PYX_GET_DICT_VERSION(dict) (0)
1058 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1059 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1060 #endif
1061
1062 /* PyThreadStateGet.proto */
1063 #if CYTHON_FAST_THREAD_STATE
1064 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1065 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1066 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1067 #else
1068 #define __Pyx_PyThreadState_declare
1069 #define __Pyx_PyThreadState_assign
1070 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1071 #endif
1072
1073 /* PyErrFetchRestore.proto */
1074 #if CYTHON_FAST_THREAD_STATE
1075 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1076 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1077 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1078 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1079 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1080 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1081 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1082 #if CYTHON_COMPILING_IN_CPYTHON
1083 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1084 #else
1085 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1086 #endif
1087 #else
1088 #define __Pyx_PyErr_Clear() PyErr_Clear()
1089 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1090 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1091 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1092 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1093 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1094 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1095 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1096 #endif
1097
1098 /* CLineInTraceback.proto */
1099 #ifdef CYTHON_CLINE_IN_TRACEBACK
1100 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1101 #else
1102 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1103 #endif
1104
1105 /* CodeObjectCache.proto */
1106 typedef struct {
1107 PyCodeObject* code_object;
1108 int code_line;
1109 } __Pyx_CodeObjectCacheEntry;
1110 struct __Pyx_CodeObjectCache {
1111 int count;
1112 int max_count;
1113 __Pyx_CodeObjectCacheEntry* entries;
1114 };
1115 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1116 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1117 static PyCodeObject *__pyx_find_code_object(int code_line);
1118 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1119
1120 /* AddTraceback.proto */
1121 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1122 int py_line, const char *filename);
1123
1124 /* GCCDiagnostics.proto */
1125 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1126 #define __Pyx_HAS_GCC_DIAGNOSTIC
1127 #endif
1128
1129 /* CIntFromPy.proto */
1130 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1131
1132 /* CIntToPy.proto */
1133 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1134
1135 /* CIntFromPy.proto */
1136 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1137
1138 /* FastTypeChecks.proto */
1139 #if CYTHON_COMPILING_IN_CPYTHON
1140 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1141 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1142 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1143 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1144 #else
1145 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1146 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1147 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1148 #endif
1149 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1150
1151 /* CheckBinaryVersion.proto */
1152 static int __Pyx_check_binary_version(void);
1153
1154 /* InitStrings.proto */
1155 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1156
1157
1158 /* Module declarations from 'cpython.version' */
1159
1160 /* Module declarations from 'bx.seq._nib' */
1161 static char *__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST;
1162 static char *__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND;
1163 #define __Pyx_MODULE_NAME "bx.seq._nib"
1164 extern int __pyx_module_is_main_bx__seq___nib;
1165 int __pyx_module_is_main_bx__seq___nib = 0;
1166
1167 /* Implementation of 'bx.seq._nib' */
1168 static const char __pyx_k_[] = "";
1169 static const char __pyx_k_i[] = "i";
1170 static const char __pyx_k_j[] = "j";
1171 static const char __pyx_k_sys[] = "sys";
1172 static const char __pyx_k_data[] = "data";
1173 static const char __pyx_k_main[] = "__main__";
1174 static const char __pyx_k_name[] = "__name__";
1175 static const char __pyx_k_rval[] = "rval";
1176 static const char __pyx_k_test[] = "__test__";
1177 static const char __pyx_k_start[] = "start";
1178 static const char __pyx_k_decode[] = "decode";
1179 static const char __pyx_k_import[] = "__import__";
1180 static const char __pyx_k_length[] = "length";
1181 static const char __pyx_k_p_data[] = "p_data";
1182 static const char __pyx_k_p_rval[] = "p_rval";
1183 static const char __pyx_k_struct[] = "struct";
1184 static const char __pyx_k_bx_seq__nib[] = "bx.seq._nib";
1185 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1186 static const char __pyx_k_translate_raw_data[] = "translate_raw_data";
1187 static const char __pyx_k_lib_bx_seq__nib_pyx[] = "lib/bx/seq/_nib.pyx";
1188 static PyObject *__pyx_kp_s_;
1189 static PyObject *__pyx_n_s_bx_seq__nib;
1190 static PyObject *__pyx_n_s_cline_in_traceback;
1191 static PyObject *__pyx_n_s_data;
1192 static PyObject *__pyx_n_s_decode;
1193 static PyObject *__pyx_n_s_i;
1194 static PyObject *__pyx_n_s_import;
1195 static PyObject *__pyx_n_s_j;
1196 static PyObject *__pyx_n_s_length;
1197 static PyObject *__pyx_kp_s_lib_bx_seq__nib_pyx;
1198 static PyObject *__pyx_n_s_main;
1199 static PyObject *__pyx_n_s_name;
1200 static PyObject *__pyx_n_s_p_data;
1201 static PyObject *__pyx_n_s_p_rval;
1202 static PyObject *__pyx_n_s_rval;
1203 static PyObject *__pyx_n_s_start;
1204 static PyObject *__pyx_n_s_struct;
1205 static PyObject *__pyx_n_s_sys;
1206 static PyObject *__pyx_n_s_test;
1207 static PyObject *__pyx_n_s_translate_raw_data;
1208 static PyObject *__pyx_pf_2bx_3seq_4_nib_translate_raw_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, int __pyx_v_start, int __pyx_v_length); /* proto */
1209 static PyObject *__pyx_tuple__2;
1210 static PyObject *__pyx_codeobj__3;
1211 /* Late includes */
1212
1213 /* "bx/seq/_nib.pyx":16
1214 * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx"
1215 *
1216 * def translate_raw_data( data, int start, int length ): # <<<<<<<<<<<<<<
1217 * """
1218 * Data is a block read from the file that needs to be unpacked, dealing
1219 */
1220
1221 /* Python wrapper */
1222 static PyObject *__pyx_pw_2bx_3seq_4_nib_1translate_raw_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1223 static char __pyx_doc_2bx_3seq_4_nib_translate_raw_data[] = "\n Data is a block read from the file that needs to be unpacked, dealing\n with end conditions based on start/length.\n ";
1224 static PyMethodDef __pyx_mdef_2bx_3seq_4_nib_1translate_raw_data = {"translate_raw_data", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2bx_3seq_4_nib_1translate_raw_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2bx_3seq_4_nib_translate_raw_data};
__pyx_pw_2bx_3seq_4_nib_1translate_raw_data(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1225 static PyObject *__pyx_pw_2bx_3seq_4_nib_1translate_raw_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1226 PyObject *__pyx_v_data = 0;
1227 int __pyx_v_start;
1228 int __pyx_v_length;
1229 int __pyx_lineno = 0;
1230 const char *__pyx_filename = NULL;
1231 int __pyx_clineno = 0;
1232 PyObject *__pyx_r = 0;
1233 __Pyx_RefNannyDeclarations
1234 __Pyx_RefNannySetupContext("translate_raw_data (wrapper)", 0);
1235 {
1236 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_start,&__pyx_n_s_length,0};
1237 PyObject* values[3] = {0,0,0};
1238 if (unlikely(__pyx_kwds)) {
1239 Py_ssize_t kw_args;
1240 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1241 switch (pos_args) {
1242 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1243 CYTHON_FALLTHROUGH;
1244 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1245 CYTHON_FALLTHROUGH;
1246 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1247 CYTHON_FALLTHROUGH;
1248 case 0: break;
1249 default: goto __pyx_L5_argtuple_error;
1250 }
1251 kw_args = PyDict_Size(__pyx_kwds);
1252 switch (pos_args) {
1253 case 0:
1254 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
1255 else goto __pyx_L5_argtuple_error;
1256 CYTHON_FALLTHROUGH;
1257 case 1:
1258 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
1259 else {
1260 __Pyx_RaiseArgtupleInvalid("translate_raw_data", 1, 3, 3, 1); __PYX_ERR(0, 16, __pyx_L3_error)
1261 }
1262 CYTHON_FALLTHROUGH;
1263 case 2:
1264 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--;
1265 else {
1266 __Pyx_RaiseArgtupleInvalid("translate_raw_data", 1, 3, 3, 2); __PYX_ERR(0, 16, __pyx_L3_error)
1267 }
1268 }
1269 if (unlikely(kw_args > 0)) {
1270 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate_raw_data") < 0)) __PYX_ERR(0, 16, __pyx_L3_error)
1271 }
1272 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
1273 goto __pyx_L5_argtuple_error;
1274 } else {
1275 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1276 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1277 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1278 }
1279 __pyx_v_data = values[0];
1280 __pyx_v_start = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
1281 __pyx_v_length = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_length == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
1282 }
1283 goto __pyx_L4_argument_unpacking_done;
1284 __pyx_L5_argtuple_error:;
1285 __Pyx_RaiseArgtupleInvalid("translate_raw_data", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 16, __pyx_L3_error)
1286 __pyx_L3_error:;
1287 __Pyx_AddTraceback("bx.seq._nib.translate_raw_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
1288 __Pyx_RefNannyFinishContext();
1289 return NULL;
1290 __pyx_L4_argument_unpacking_done:;
1291 __pyx_r = __pyx_pf_2bx_3seq_4_nib_translate_raw_data(__pyx_self, __pyx_v_data, __pyx_v_start, __pyx_v_length);
1292
1293 /* function exit code */
1294 __Pyx_RefNannyFinishContext();
1295 return __pyx_r;
1296 }
1297
__pyx_pf_2bx_3seq_4_nib_translate_raw_data(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_data,int __pyx_v_start,int __pyx_v_length)1298 static PyObject *__pyx_pf_2bx_3seq_4_nib_translate_raw_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, int __pyx_v_start, int __pyx_v_length) {
1299 int __pyx_v_i;
1300 CYTHON_UNUSED int __pyx_v_j;
1301 char *__pyx_v_p_rval;
1302 unsigned char *__pyx_v_p_data;
1303 PyObject *__pyx_v_rval = NULL;
1304 PyObject *__pyx_r = NULL;
1305 __Pyx_RefNannyDeclarations
1306 int __pyx_t_1;
1307 PyObject *__pyx_t_2 = NULL;
1308 long __pyx_t_3;
1309 PyObject *__pyx_t_4 = NULL;
1310 PyObject *__pyx_t_5 = NULL;
1311 int __pyx_lineno = 0;
1312 const char *__pyx_filename = NULL;
1313 int __pyx_clineno = 0;
1314 __Pyx_RefNannySetupContext("translate_raw_data", 0);
1315
1316 /* "bx/seq/_nib.pyx":25
1317 * cdef unsigned char * p_data
1318 *
1319 * if length == 0 : # <<<<<<<<<<<<<<
1320 * return ""
1321 *
1322 */
1323 __pyx_t_1 = ((__pyx_v_length == 0) != 0);
1324 if (__pyx_t_1) {
1325
1326 /* "bx/seq/_nib.pyx":26
1327 *
1328 * if length == 0 :
1329 * return "" # <<<<<<<<<<<<<<
1330 *
1331 * # Allocate string to write into
1332 */
1333 __Pyx_XDECREF(__pyx_r);
1334 __Pyx_INCREF(__pyx_kp_s_);
1335 __pyx_r = __pyx_kp_s_;
1336 goto __pyx_L0;
1337
1338 /* "bx/seq/_nib.pyx":25
1339 * cdef unsigned char * p_data
1340 *
1341 * if length == 0 : # <<<<<<<<<<<<<<
1342 * return ""
1343 *
1344 */
1345 }
1346
1347 /* "bx/seq/_nib.pyx":29
1348 *
1349 * # Allocate string to write into
1350 * rval = PyBytes_FromStringAndSize( NULL, length ) # <<<<<<<<<<<<<<
1351 *
1352 * # Get char pointer access to strings
1353 */
1354 __pyx_t_2 = PyBytes_FromStringAndSize(NULL, __pyx_v_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
1355 __Pyx_GOTREF(__pyx_t_2);
1356 __pyx_v_rval = __pyx_t_2;
1357 __pyx_t_2 = 0;
1358
1359 /* "bx/seq/_nib.pyx":32
1360 *
1361 * # Get char pointer access to strings
1362 * p_rval = PyBytes_AsString( rval ) # <<<<<<<<<<<<<<
1363 * p_data = <unsigned char *> PyBytes_AsString( data )
1364 * i = 0
1365 */
1366 __pyx_v_p_rval = PyBytes_AsString(__pyx_v_rval);
1367
1368 /* "bx/seq/_nib.pyx":33
1369 * # Get char pointer access to strings
1370 * p_rval = PyBytes_AsString( rval )
1371 * p_data = <unsigned char *> PyBytes_AsString( data ) # <<<<<<<<<<<<<<
1372 * i = 0
1373 * # Odd start
1374 */
1375 __pyx_v_p_data = ((unsigned char *)PyBytes_AsString(__pyx_v_data));
1376
1377 /* "bx/seq/_nib.pyx":34
1378 * p_rval = PyBytes_AsString( rval )
1379 * p_data = <unsigned char *> PyBytes_AsString( data )
1380 * i = 0 # <<<<<<<<<<<<<<
1381 * # Odd start
1382 * if start & 1:
1383 */
1384 __pyx_v_i = 0;
1385
1386 /* "bx/seq/_nib.pyx":36
1387 * i = 0
1388 * # Odd start
1389 * if start & 1: # <<<<<<<<<<<<<<
1390 * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ]
1391 * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1392 */
1393 __pyx_t_1 = ((__pyx_v_start & 1) != 0);
1394 if (__pyx_t_1) {
1395
1396 /* "bx/seq/_nib.pyx":38
1397 * if start & 1:
1398 * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ]
1399 * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ] # <<<<<<<<<<<<<<
1400 * p_data = p_data + 1
1401 * i = 1
1402 */
1403 (__pyx_v_p_rval[__pyx_v_i]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND[(__pyx_v_p_data[0])]);
1404
1405 /* "bx/seq/_nib.pyx":39
1406 * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ]
1407 * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1408 * p_data = p_data + 1 # <<<<<<<<<<<<<<
1409 * i = 1
1410 * # Two output values for each input value
1411 */
1412 __pyx_v_p_data = (__pyx_v_p_data + 1);
1413
1414 /* "bx/seq/_nib.pyx":40
1415 * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1416 * p_data = p_data + 1
1417 * i = 1 # <<<<<<<<<<<<<<
1418 * # Two output values for each input value
1419 * for j from 0 <= j < (length-i)/2:
1420 */
1421 __pyx_v_i = 1;
1422
1423 /* "bx/seq/_nib.pyx":36
1424 * i = 0
1425 * # Odd start
1426 * if start & 1: # <<<<<<<<<<<<<<
1427 * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ]
1428 * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1429 */
1430 }
1431
1432 /* "bx/seq/_nib.pyx":42
1433 * i = 1
1434 * # Two output values for each input value
1435 * for j from 0 <= j < (length-i)/2: # <<<<<<<<<<<<<<
1436 * #p_rval[i] = NIB_I2C_TABLE[ ( p_data[0] >> 4 ) & 0xF ];
1437 * #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ];
1438 */
1439 __pyx_t_3 = __Pyx_div_long((__pyx_v_length - __pyx_v_i), 2);
1440 for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {
1441
1442 /* "bx/seq/_nib.pyx":45
1443 * #p_rval[i] = NIB_I2C_TABLE[ ( p_data[0] >> 4 ) & 0xF ];
1444 * #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ];
1445 * p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ] # <<<<<<<<<<<<<<
1446 * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1447 * i = i + 2
1448 */
1449 (__pyx_v_p_rval[__pyx_v_i]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST[(__pyx_v_p_data[0])]);
1450
1451 /* "bx/seq/_nib.pyx":46
1452 * #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ];
1453 * p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ]
1454 * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ] # <<<<<<<<<<<<<<
1455 * i = i + 2
1456 * p_data = p_data + 1
1457 */
1458 (__pyx_v_p_rval[(__pyx_v_i + 1)]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND[(__pyx_v_p_data[0])]);
1459
1460 /* "bx/seq/_nib.pyx":47
1461 * p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ]
1462 * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1463 * i = i + 2 # <<<<<<<<<<<<<<
1464 * p_data = p_data + 1
1465 * # Odd end
1466 */
1467 __pyx_v_i = (__pyx_v_i + 2);
1468
1469 /* "bx/seq/_nib.pyx":48
1470 * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ]
1471 * i = i + 2
1472 * p_data = p_data + 1 # <<<<<<<<<<<<<<
1473 * # Odd end
1474 * if i < length:
1475 */
1476 __pyx_v_p_data = (__pyx_v_p_data + 1);
1477 }
1478
1479 /* "bx/seq/_nib.pyx":50
1480 * p_data = p_data + 1
1481 * # Odd end
1482 * if i < length: # <<<<<<<<<<<<<<
1483 * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ]
1484 *
1485 */
1486 __pyx_t_1 = ((__pyx_v_i < __pyx_v_length) != 0);
1487 if (__pyx_t_1) {
1488
1489 /* "bx/seq/_nib.pyx":51
1490 * # Odd end
1491 * if i < length:
1492 * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ] # <<<<<<<<<<<<<<
1493 *
1494 * if PY_MAJOR_VERSION >= 3:
1495 */
1496 (__pyx_v_p_rval[__pyx_v_i]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST[(__pyx_v_p_data[0])]);
1497
1498 /* "bx/seq/_nib.pyx":50
1499 * p_data = p_data + 1
1500 * # Odd end
1501 * if i < length: # <<<<<<<<<<<<<<
1502 * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ]
1503 *
1504 */
1505 }
1506
1507 /* "bx/seq/_nib.pyx":53
1508 * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ]
1509 *
1510 * if PY_MAJOR_VERSION >= 3: # <<<<<<<<<<<<<<
1511 * return rval.decode()
1512 * else:
1513 */
1514 __pyx_t_1 = ((PY_MAJOR_VERSION >= 3) != 0);
1515 if (__pyx_t_1) {
1516
1517 /* "bx/seq/_nib.pyx":54
1518 *
1519 * if PY_MAJOR_VERSION >= 3:
1520 * return rval.decode() # <<<<<<<<<<<<<<
1521 * else:
1522 * return rval
1523 */
1524 __Pyx_XDECREF(__pyx_r);
1525 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_rval, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
1526 __Pyx_GOTREF(__pyx_t_4);
1527 __pyx_t_5 = NULL;
1528 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
1529 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
1530 if (likely(__pyx_t_5)) {
1531 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
1532 __Pyx_INCREF(__pyx_t_5);
1533 __Pyx_INCREF(function);
1534 __Pyx_DECREF_SET(__pyx_t_4, function);
1535 }
1536 }
1537 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
1538 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1539 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
1540 __Pyx_GOTREF(__pyx_t_2);
1541 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1542 __pyx_r = __pyx_t_2;
1543 __pyx_t_2 = 0;
1544 goto __pyx_L0;
1545
1546 /* "bx/seq/_nib.pyx":53
1547 * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ]
1548 *
1549 * if PY_MAJOR_VERSION >= 3: # <<<<<<<<<<<<<<
1550 * return rval.decode()
1551 * else:
1552 */
1553 }
1554
1555 /* "bx/seq/_nib.pyx":56
1556 * return rval.decode()
1557 * else:
1558 * return rval # <<<<<<<<<<<<<<
1559 */
1560 /*else*/ {
1561 __Pyx_XDECREF(__pyx_r);
1562 __Pyx_INCREF(__pyx_v_rval);
1563 __pyx_r = __pyx_v_rval;
1564 goto __pyx_L0;
1565 }
1566
1567 /* "bx/seq/_nib.pyx":16
1568 * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx"
1569 *
1570 * def translate_raw_data( data, int start, int length ): # <<<<<<<<<<<<<<
1571 * """
1572 * Data is a block read from the file that needs to be unpacked, dealing
1573 */
1574
1575 /* function exit code */
1576 __pyx_L1_error:;
1577 __Pyx_XDECREF(__pyx_t_2);
1578 __Pyx_XDECREF(__pyx_t_4);
1579 __Pyx_XDECREF(__pyx_t_5);
1580 __Pyx_AddTraceback("bx.seq._nib.translate_raw_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
1581 __pyx_r = NULL;
1582 __pyx_L0:;
1583 __Pyx_XDECREF(__pyx_v_rval);
1584 __Pyx_XGIVEREF(__pyx_r);
1585 __Pyx_RefNannyFinishContext();
1586 return __pyx_r;
1587 }
1588
1589 static PyMethodDef __pyx_methods[] = {
1590 {0, 0, 0, 0}
1591 };
1592
1593 #if PY_MAJOR_VERSION >= 3
1594 #if CYTHON_PEP489_MULTI_PHASE_INIT
1595 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
1596 static int __pyx_pymod_exec__nib(PyObject* module); /*proto*/
1597 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
1598 {Py_mod_create, (void*)__pyx_pymod_create},
1599 {Py_mod_exec, (void*)__pyx_pymod_exec__nib},
1600 {0, NULL}
1601 };
1602 #endif
1603
1604 static struct PyModuleDef __pyx_moduledef = {
1605 PyModuleDef_HEAD_INIT,
1606 "_nib",
1607 0, /* m_doc */
1608 #if CYTHON_PEP489_MULTI_PHASE_INIT
1609 0, /* m_size */
1610 #else
1611 -1, /* m_size */
1612 #endif
1613 __pyx_methods /* m_methods */,
1614 #if CYTHON_PEP489_MULTI_PHASE_INIT
1615 __pyx_moduledef_slots, /* m_slots */
1616 #else
1617 NULL, /* m_reload */
1618 #endif
1619 NULL, /* m_traverse */
1620 NULL, /* m_clear */
1621 NULL /* m_free */
1622 };
1623 #endif
1624 #ifndef CYTHON_SMALL_CODE
1625 #if defined(__clang__)
1626 #define CYTHON_SMALL_CODE
1627 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
1628 #define CYTHON_SMALL_CODE __attribute__((cold))
1629 #else
1630 #define CYTHON_SMALL_CODE
1631 #endif
1632 #endif
1633
1634 static __Pyx_StringTabEntry __pyx_string_tab[] = {
1635 {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
1636 {&__pyx_n_s_bx_seq__nib, __pyx_k_bx_seq__nib, sizeof(__pyx_k_bx_seq__nib), 0, 0, 1, 1},
1637 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
1638 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
1639 {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
1640 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
1641 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
1642 {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
1643 {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
1644 {&__pyx_kp_s_lib_bx_seq__nib_pyx, __pyx_k_lib_bx_seq__nib_pyx, sizeof(__pyx_k_lib_bx_seq__nib_pyx), 0, 0, 1, 0},
1645 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
1646 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
1647 {&__pyx_n_s_p_data, __pyx_k_p_data, sizeof(__pyx_k_p_data), 0, 0, 1, 1},
1648 {&__pyx_n_s_p_rval, __pyx_k_p_rval, sizeof(__pyx_k_p_rval), 0, 0, 1, 1},
1649 {&__pyx_n_s_rval, __pyx_k_rval, sizeof(__pyx_k_rval), 0, 0, 1, 1},
1650 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
1651 {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
1652 {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
1653 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
1654 {&__pyx_n_s_translate_raw_data, __pyx_k_translate_raw_data, sizeof(__pyx_k_translate_raw_data), 0, 0, 1, 1},
1655 {0, 0, 0, 0, 0, 0, 0}
1656 };
__Pyx_InitCachedBuiltins(void)1657 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
1658 return 0;
1659 }
1660
__Pyx_InitCachedConstants(void)1661 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
1662 __Pyx_RefNannyDeclarations
1663 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
1664
1665 /* "bx/seq/_nib.pyx":16
1666 * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx"
1667 *
1668 * def translate_raw_data( data, int start, int length ): # <<<<<<<<<<<<<<
1669 * """
1670 * Data is a block read from the file that needs to be unpacked, dealing
1671 */
1672 __pyx_tuple__2 = PyTuple_Pack(8, __pyx_n_s_data, __pyx_n_s_start, __pyx_n_s_length, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_p_rval, __pyx_n_s_p_data, __pyx_n_s_rval); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 16, __pyx_L1_error)
1673 __Pyx_GOTREF(__pyx_tuple__2);
1674 __Pyx_GIVEREF(__pyx_tuple__2);
1675 __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lib_bx_seq__nib_pyx, __pyx_n_s_translate_raw_data, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 16, __pyx_L1_error)
1676 __Pyx_RefNannyFinishContext();
1677 return 0;
1678 __pyx_L1_error:;
1679 __Pyx_RefNannyFinishContext();
1680 return -1;
1681 }
1682
__Pyx_InitGlobals(void)1683 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
1684 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1685 return 0;
1686 __pyx_L1_error:;
1687 return -1;
1688 }
1689
1690 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
1691 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
1692 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
1693 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
1694 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
1695 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
1696 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
1697
__Pyx_modinit_global_init_code(void)1698 static int __Pyx_modinit_global_init_code(void) {
1699 __Pyx_RefNannyDeclarations
1700 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
1701 /*--- Global init code ---*/
1702 __Pyx_RefNannyFinishContext();
1703 return 0;
1704 }
1705
__Pyx_modinit_variable_export_code(void)1706 static int __Pyx_modinit_variable_export_code(void) {
1707 __Pyx_RefNannyDeclarations
1708 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
1709 /*--- Variable export code ---*/
1710 __Pyx_RefNannyFinishContext();
1711 return 0;
1712 }
1713
__Pyx_modinit_function_export_code(void)1714 static int __Pyx_modinit_function_export_code(void) {
1715 __Pyx_RefNannyDeclarations
1716 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
1717 /*--- Function export code ---*/
1718 __Pyx_RefNannyFinishContext();
1719 return 0;
1720 }
1721
__Pyx_modinit_type_init_code(void)1722 static int __Pyx_modinit_type_init_code(void) {
1723 __Pyx_RefNannyDeclarations
1724 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
1725 /*--- Type init code ---*/
1726 __Pyx_RefNannyFinishContext();
1727 return 0;
1728 }
1729
__Pyx_modinit_type_import_code(void)1730 static int __Pyx_modinit_type_import_code(void) {
1731 __Pyx_RefNannyDeclarations
1732 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
1733 /*--- Type import code ---*/
1734 __Pyx_RefNannyFinishContext();
1735 return 0;
1736 }
1737
__Pyx_modinit_variable_import_code(void)1738 static int __Pyx_modinit_variable_import_code(void) {
1739 __Pyx_RefNannyDeclarations
1740 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
1741 /*--- Variable import code ---*/
1742 __Pyx_RefNannyFinishContext();
1743 return 0;
1744 }
1745
__Pyx_modinit_function_import_code(void)1746 static int __Pyx_modinit_function_import_code(void) {
1747 __Pyx_RefNannyDeclarations
1748 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
1749 /*--- Function import code ---*/
1750 __Pyx_RefNannyFinishContext();
1751 return 0;
1752 }
1753
1754
1755 #ifndef CYTHON_NO_PYINIT_EXPORT
1756 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
1757 #elif PY_MAJOR_VERSION < 3
1758 #ifdef __cplusplus
1759 #define __Pyx_PyMODINIT_FUNC extern "C" void
1760 #else
1761 #define __Pyx_PyMODINIT_FUNC void
1762 #endif
1763 #else
1764 #ifdef __cplusplus
1765 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
1766 #else
1767 #define __Pyx_PyMODINIT_FUNC PyObject *
1768 #endif
1769 #endif
1770
1771
1772 #if PY_MAJOR_VERSION < 3
1773 __Pyx_PyMODINIT_FUNC init_nib(void) CYTHON_SMALL_CODE; /*proto*/
init_nib(void)1774 __Pyx_PyMODINIT_FUNC init_nib(void)
1775 #else
1776 __Pyx_PyMODINIT_FUNC PyInit__nib(void) CYTHON_SMALL_CODE; /*proto*/
1777 __Pyx_PyMODINIT_FUNC PyInit__nib(void)
1778 #if CYTHON_PEP489_MULTI_PHASE_INIT
1779 {
1780 return PyModuleDef_Init(&__pyx_moduledef);
1781 }
1782 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
1783 #if PY_VERSION_HEX >= 0x030700A1
1784 static PY_INT64_T main_interpreter_id = -1;
1785 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
1786 if (main_interpreter_id == -1) {
1787 main_interpreter_id = current_id;
1788 return (unlikely(current_id == -1)) ? -1 : 0;
1789 } else if (unlikely(main_interpreter_id != current_id))
1790 #else
1791 static PyInterpreterState *main_interpreter = NULL;
1792 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
1793 if (!main_interpreter) {
1794 main_interpreter = current_interpreter;
1795 } else if (unlikely(main_interpreter != current_interpreter))
1796 #endif
1797 {
1798 PyErr_SetString(
1799 PyExc_ImportError,
1800 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
1801 return -1;
1802 }
1803 return 0;
1804 }
1805 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) {
1806 PyObject *value = PyObject_GetAttrString(spec, from_name);
1807 int result = 0;
1808 if (likely(value)) {
1809 if (allow_none || value != Py_None) {
1810 result = PyDict_SetItemString(moddict, to_name, value);
1811 }
1812 Py_DECREF(value);
1813 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
1814 PyErr_Clear();
1815 } else {
1816 result = -1;
1817 }
1818 return result;
1819 }
1820 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
1821 PyObject *module = NULL, *moddict, *modname;
1822 if (__Pyx_check_single_interpreter())
1823 return NULL;
1824 if (__pyx_m)
1825 return __Pyx_NewRef(__pyx_m);
1826 modname = PyObject_GetAttrString(spec, "name");
1827 if (unlikely(!modname)) goto bad;
1828 module = PyModule_NewObject(modname);
1829 Py_DECREF(modname);
1830 if (unlikely(!module)) goto bad;
1831 moddict = PyModule_GetDict(module);
1832 if (unlikely(!moddict)) goto bad;
1833 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
1834 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
1835 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
1836 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
1837 return module;
1838 bad:
1839 Py_XDECREF(module);
1840 return NULL;
1841 }
1842
1843
1844 static CYTHON_SMALL_CODE int __pyx_pymod_exec__nib(PyObject *__pyx_pyinit_module)
1845 #endif
1846 #endif
1847 {
1848 PyObject *__pyx_t_1 = NULL;
1849 int __pyx_lineno = 0;
1850 const char *__pyx_filename = NULL;
1851 int __pyx_clineno = 0;
1852 __Pyx_RefNannyDeclarations
1853 #if CYTHON_PEP489_MULTI_PHASE_INIT
1854 if (__pyx_m) {
1855 if (__pyx_m == __pyx_pyinit_module) return 0;
1856 PyErr_SetString(PyExc_RuntimeError, "Module '_nib' has already been imported. Re-initialisation is not supported.");
1857 return -1;
1858 }
1859 #elif PY_MAJOR_VERSION >= 3
1860 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
1861 #endif
1862 #if CYTHON_REFNANNY
1863 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
1864 if (!__Pyx_RefNanny) {
1865 PyErr_Clear();
1866 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
1867 if (!__Pyx_RefNanny)
1868 Py_FatalError("failed to import 'refnanny' module");
1869 }
1870 #endif
1871 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__nib(void)", 0);
1872 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1873 #ifdef __Pxy_PyFrame_Initialize_Offsets
1874 __Pxy_PyFrame_Initialize_Offsets();
1875 #endif
1876 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
1877 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
1878 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
1879 #ifdef __Pyx_CyFunction_USED
1880 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1881 #endif
1882 #ifdef __Pyx_FusedFunction_USED
1883 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1884 #endif
1885 #ifdef __Pyx_Coroutine_USED
1886 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1887 #endif
1888 #ifdef __Pyx_Generator_USED
1889 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1890 #endif
1891 #ifdef __Pyx_AsyncGen_USED
1892 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1893 #endif
1894 #ifdef __Pyx_StopAsyncIteration_USED
1895 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1896 #endif
1897 /*--- Library function declarations ---*/
1898 /*--- Threads initialization code ---*/
1899 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
1900 PyEval_InitThreads();
1901 #endif
1902 /*--- Module creation code ---*/
1903 #if CYTHON_PEP489_MULTI_PHASE_INIT
1904 __pyx_m = __pyx_pyinit_module;
1905 Py_INCREF(__pyx_m);
1906 #else
1907 #if PY_MAJOR_VERSION < 3
1908 __pyx_m = Py_InitModule4("_nib", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
1909 #else
1910 __pyx_m = PyModule_Create(&__pyx_moduledef);
1911 #endif
1912 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
1913 #endif
1914 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
1915 Py_INCREF(__pyx_d);
1916 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
1917 Py_INCREF(__pyx_b);
1918 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
1919 Py_INCREF(__pyx_cython_runtime);
1920 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1921 /*--- Initialize various global constants etc. ---*/
1922 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1923 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
1924 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1925 #endif
1926 if (__pyx_module_is_main_bx__seq___nib) {
1927 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1928 }
1929 #if PY_MAJOR_VERSION >= 3
1930 {
1931 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
1932 if (!PyDict_GetItemString(modules, "bx.seq._nib")) {
1933 if (unlikely(PyDict_SetItemString(modules, "bx.seq._nib", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
1934 }
1935 }
1936 #endif
1937 /*--- Builtin init code ---*/
1938 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1939 /*--- Constants init code ---*/
1940 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1941 /*--- Global type/function init code ---*/
1942 (void)__Pyx_modinit_global_init_code();
1943 (void)__Pyx_modinit_variable_export_code();
1944 (void)__Pyx_modinit_function_export_code();
1945 (void)__Pyx_modinit_type_init_code();
1946 (void)__Pyx_modinit_type_import_code();
1947 (void)__Pyx_modinit_variable_import_code();
1948 (void)__Pyx_modinit_function_import_code();
1949 /*--- Execution code ---*/
1950 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
1951 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1952 #endif
1953
1954 /* "bx/seq/_nib.pyx":7
1955 * object PyBytes_FromStringAndSize( char *, Py_ssize_t )
1956 *
1957 * import struct, sys # <<<<<<<<<<<<<<
1958 *
1959 * cdef char * NIB_I2C_TABLE
1960 */
1961 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
1962 __Pyx_GOTREF(__pyx_t_1);
1963 if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
1964 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1965 __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
1966 __Pyx_GOTREF(__pyx_t_1);
1967 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
1968 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1969
1970 /* "bx/seq/_nib.pyx":13
1971 * cdef char * NIB_I2C_TABLE_SECOND
1972 * #NIB_I2C_TABLE = "TCAGNXXXtcagnxxx"
1973 * NIB_I2C_TABLE_FIRST = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # <<<<<<<<<<<<<<
1974 * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx"
1975 *
1976 */
1977 __pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST = ((char *)"TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
1978
1979 /* "bx/seq/_nib.pyx":14
1980 * #NIB_I2C_TABLE = "TCAGNXXXtcagnxxx"
1981 * NIB_I2C_TABLE_FIRST = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
1982 * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx" # <<<<<<<<<<<<<<
1983 *
1984 * def translate_raw_data( data, int start, int length ):
1985 */
1986 __pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND = ((char *)"TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx");
1987
1988 /* "bx/seq/_nib.pyx":16
1989 * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx"
1990 *
1991 * def translate_raw_data( data, int start, int length ): # <<<<<<<<<<<<<<
1992 * """
1993 * Data is a block read from the file that needs to be unpacked, dealing
1994 */
1995 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_3seq_4_nib_1translate_raw_data, NULL, __pyx_n_s_bx_seq__nib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
1996 __Pyx_GOTREF(__pyx_t_1);
1997 if (PyDict_SetItem(__pyx_d, __pyx_n_s_translate_raw_data, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
1998 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1999
2000 /* "bx/seq/_nib.pyx":1
2001 * from cpython.version cimport PY_MAJOR_VERSION # <<<<<<<<<<<<<<
2002 *
2003 * cdef extern from "Python.h":
2004 */
2005 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2006 __Pyx_GOTREF(__pyx_t_1);
2007 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2008 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2009
2010 /*--- Wrapped vars code ---*/
2011
2012 goto __pyx_L0;
2013 __pyx_L1_error:;
2014 __Pyx_XDECREF(__pyx_t_1);
2015 if (__pyx_m) {
2016 if (__pyx_d) {
2017 __Pyx_AddTraceback("init bx.seq._nib", __pyx_clineno, __pyx_lineno, __pyx_filename);
2018 }
2019 Py_CLEAR(__pyx_m);
2020 } else if (!PyErr_Occurred()) {
2021 PyErr_SetString(PyExc_ImportError, "init bx.seq._nib");
2022 }
2023 __pyx_L0:;
2024 __Pyx_RefNannyFinishContext();
2025 #if CYTHON_PEP489_MULTI_PHASE_INIT
2026 return (__pyx_m != NULL) ? 0 : -1;
2027 #elif PY_MAJOR_VERSION >= 3
2028 return __pyx_m;
2029 #else
2030 return;
2031 #endif
2032 }
2033
2034 /* --- Runtime support code --- */
2035 /* Refnanny */
2036 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)2037 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2038 PyObject *m = NULL, *p = NULL;
2039 void *r = NULL;
2040 m = PyImport_ImportModule(modname);
2041 if (!m) goto end;
2042 p = PyObject_GetAttrString(m, "RefNannyAPI");
2043 if (!p) goto end;
2044 r = PyLong_AsVoidPtr(p);
2045 end:
2046 Py_XDECREF(p);
2047 Py_XDECREF(m);
2048 return (__Pyx_RefNannyAPIStruct *)r;
2049 }
2050 #endif
2051
2052 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)2053 static void __Pyx_RaiseArgtupleInvalid(
2054 const char* func_name,
2055 int exact,
2056 Py_ssize_t num_min,
2057 Py_ssize_t num_max,
2058 Py_ssize_t num_found)
2059 {
2060 Py_ssize_t num_expected;
2061 const char *more_or_less;
2062 if (num_found < num_min) {
2063 num_expected = num_min;
2064 more_or_less = "at least";
2065 } else {
2066 num_expected = num_max;
2067 more_or_less = "at most";
2068 }
2069 if (exact) {
2070 more_or_less = "exactly";
2071 }
2072 PyErr_Format(PyExc_TypeError,
2073 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
2074 func_name, more_or_less, num_expected,
2075 (num_expected == 1) ? "" : "s", num_found);
2076 }
2077
2078 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)2079 static void __Pyx_RaiseDoubleKeywordsError(
2080 const char* func_name,
2081 PyObject* kw_name)
2082 {
2083 PyErr_Format(PyExc_TypeError,
2084 #if PY_MAJOR_VERSION >= 3
2085 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
2086 #else
2087 "%s() got multiple values for keyword argument '%s'", func_name,
2088 PyString_AsString(kw_name));
2089 #endif
2090 }
2091
2092 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)2093 static int __Pyx_ParseOptionalKeywords(
2094 PyObject *kwds,
2095 PyObject **argnames[],
2096 PyObject *kwds2,
2097 PyObject *values[],
2098 Py_ssize_t num_pos_args,
2099 const char* function_name)
2100 {
2101 PyObject *key = 0, *value = 0;
2102 Py_ssize_t pos = 0;
2103 PyObject*** name;
2104 PyObject*** first_kw_arg = argnames + num_pos_args;
2105 while (PyDict_Next(kwds, &pos, &key, &value)) {
2106 name = first_kw_arg;
2107 while (*name && (**name != key)) name++;
2108 if (*name) {
2109 values[name-argnames] = value;
2110 continue;
2111 }
2112 name = first_kw_arg;
2113 #if PY_MAJOR_VERSION < 3
2114 if (likely(PyString_Check(key))) {
2115 while (*name) {
2116 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
2117 && _PyString_Eq(**name, key)) {
2118 values[name-argnames] = value;
2119 break;
2120 }
2121 name++;
2122 }
2123 if (*name) continue;
2124 else {
2125 PyObject*** argname = argnames;
2126 while (argname != first_kw_arg) {
2127 if ((**argname == key) || (
2128 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
2129 && _PyString_Eq(**argname, key))) {
2130 goto arg_passed_twice;
2131 }
2132 argname++;
2133 }
2134 }
2135 } else
2136 #endif
2137 if (likely(PyUnicode_Check(key))) {
2138 while (*name) {
2139 int cmp = (**name == key) ? 0 :
2140 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
2141 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
2142 #endif
2143 PyUnicode_Compare(**name, key);
2144 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
2145 if (cmp == 0) {
2146 values[name-argnames] = value;
2147 break;
2148 }
2149 name++;
2150 }
2151 if (*name) continue;
2152 else {
2153 PyObject*** argname = argnames;
2154 while (argname != first_kw_arg) {
2155 int cmp = (**argname == key) ? 0 :
2156 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
2157 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
2158 #endif
2159 PyUnicode_Compare(**argname, key);
2160 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
2161 if (cmp == 0) goto arg_passed_twice;
2162 argname++;
2163 }
2164 }
2165 } else
2166 goto invalid_keyword_type;
2167 if (kwds2) {
2168 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
2169 } else {
2170 goto invalid_keyword;
2171 }
2172 }
2173 return 0;
2174 arg_passed_twice:
2175 __Pyx_RaiseDoubleKeywordsError(function_name, key);
2176 goto bad;
2177 invalid_keyword_type:
2178 PyErr_Format(PyExc_TypeError,
2179 "%.200s() keywords must be strings", function_name);
2180 goto bad;
2181 invalid_keyword:
2182 PyErr_Format(PyExc_TypeError,
2183 #if PY_MAJOR_VERSION < 3
2184 "%.200s() got an unexpected keyword argument '%.200s'",
2185 function_name, PyString_AsString(key));
2186 #else
2187 "%s() got an unexpected keyword argument '%U'",
2188 function_name, key);
2189 #endif
2190 bad:
2191 return -1;
2192 }
2193
2194 /* None */
__Pyx_div_long(long a,long b)2195 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
2196 long q = a / b;
2197 long r = a - q*b;
2198 q -= ((r != 0) & ((r ^ b) < 0));
2199 return q;
2200 }
2201
2202 /* PyObjectGetAttrStr */
2203 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)2204 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2205 PyTypeObject* tp = Py_TYPE(obj);
2206 if (likely(tp->tp_getattro))
2207 return tp->tp_getattro(obj, attr_name);
2208 #if PY_MAJOR_VERSION < 3
2209 if (likely(tp->tp_getattr))
2210 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
2211 #endif
2212 return PyObject_GetAttr(obj, attr_name);
2213 }
2214 #endif
2215
2216 /* PyFunctionFastCall */
2217 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)2218 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2219 PyObject *globals) {
2220 PyFrameObject *f;
2221 PyThreadState *tstate = __Pyx_PyThreadState_Current;
2222 PyObject **fastlocals;
2223 Py_ssize_t i;
2224 PyObject *result;
2225 assert(globals != NULL);
2226 /* XXX Perhaps we should create a specialized
2227 PyFrame_New() that doesn't take locals, but does
2228 take builtins without sanity checking them.
2229 */
2230 assert(tstate != NULL);
2231 f = PyFrame_New(tstate, co, globals, NULL);
2232 if (f == NULL) {
2233 return NULL;
2234 }
2235 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
2236 for (i = 0; i < na; i++) {
2237 Py_INCREF(*args);
2238 fastlocals[i] = *args++;
2239 }
2240 result = PyEval_EvalFrameEx(f,0);
2241 ++tstate->recursion_depth;
2242 Py_DECREF(f);
2243 --tstate->recursion_depth;
2244 return result;
2245 }
2246 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)2247 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
2248 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
2249 PyObject *globals = PyFunction_GET_GLOBALS(func);
2250 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
2251 PyObject *closure;
2252 #if PY_MAJOR_VERSION >= 3
2253 PyObject *kwdefs;
2254 #endif
2255 PyObject *kwtuple, **k;
2256 PyObject **d;
2257 Py_ssize_t nd;
2258 Py_ssize_t nk;
2259 PyObject *result;
2260 assert(kwargs == NULL || PyDict_Check(kwargs));
2261 nk = kwargs ? PyDict_Size(kwargs) : 0;
2262 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
2263 return NULL;
2264 }
2265 if (
2266 #if PY_MAJOR_VERSION >= 3
2267 co->co_kwonlyargcount == 0 &&
2268 #endif
2269 likely(kwargs == NULL || nk == 0) &&
2270 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
2271 if (argdefs == NULL && co->co_argcount == nargs) {
2272 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
2273 goto done;
2274 }
2275 else if (nargs == 0 && argdefs != NULL
2276 && co->co_argcount == Py_SIZE(argdefs)) {
2277 /* function called with no arguments, but all parameters have
2278 a default value: use default values as arguments .*/
2279 args = &PyTuple_GET_ITEM(argdefs, 0);
2280 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2281 goto done;
2282 }
2283 }
2284 if (kwargs != NULL) {
2285 Py_ssize_t pos, i;
2286 kwtuple = PyTuple_New(2 * nk);
2287 if (kwtuple == NULL) {
2288 result = NULL;
2289 goto done;
2290 }
2291 k = &PyTuple_GET_ITEM(kwtuple, 0);
2292 pos = i = 0;
2293 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2294 Py_INCREF(k[i]);
2295 Py_INCREF(k[i+1]);
2296 i += 2;
2297 }
2298 nk = i / 2;
2299 }
2300 else {
2301 kwtuple = NULL;
2302 k = NULL;
2303 }
2304 closure = PyFunction_GET_CLOSURE(func);
2305 #if PY_MAJOR_VERSION >= 3
2306 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2307 #endif
2308 if (argdefs != NULL) {
2309 d = &PyTuple_GET_ITEM(argdefs, 0);
2310 nd = Py_SIZE(argdefs);
2311 }
2312 else {
2313 d = NULL;
2314 nd = 0;
2315 }
2316 #if PY_MAJOR_VERSION >= 3
2317 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2318 args, (int)nargs,
2319 k, (int)nk,
2320 d, (int)nd, kwdefs, closure);
2321 #else
2322 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2323 args, (int)nargs,
2324 k, (int)nk,
2325 d, (int)nd, closure);
2326 #endif
2327 Py_XDECREF(kwtuple);
2328 done:
2329 Py_LeaveRecursiveCall();
2330 return result;
2331 }
2332 #endif
2333 #endif
2334
2335 /* PyObjectCall */
2336 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)2337 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2338 PyObject *result;
2339 ternaryfunc call = Py_TYPE(func)->tp_call;
2340 if (unlikely(!call))
2341 return PyObject_Call(func, arg, kw);
2342 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2343 return NULL;
2344 result = (*call)(func, arg, kw);
2345 Py_LeaveRecursiveCall();
2346 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2347 PyErr_SetString(
2348 PyExc_SystemError,
2349 "NULL result without error in PyObject_Call");
2350 }
2351 return result;
2352 }
2353 #endif
2354
2355 /* PyObjectCallMethO */
2356 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)2357 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
2358 PyObject *self, *result;
2359 PyCFunction cfunc;
2360 cfunc = PyCFunction_GET_FUNCTION(func);
2361 self = PyCFunction_GET_SELF(func);
2362 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2363 return NULL;
2364 result = cfunc(self, arg);
2365 Py_LeaveRecursiveCall();
2366 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2367 PyErr_SetString(
2368 PyExc_SystemError,
2369 "NULL result without error in PyObject_Call");
2370 }
2371 return result;
2372 }
2373 #endif
2374
2375 /* PyObjectCallNoArg */
2376 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)2377 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
2378 #if CYTHON_FAST_PYCALL
2379 if (PyFunction_Check(func)) {
2380 return __Pyx_PyFunction_FastCall(func, NULL, 0);
2381 }
2382 #endif
2383 #ifdef __Pyx_CyFunction_USED
2384 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
2385 #else
2386 if (likely(PyCFunction_Check(func)))
2387 #endif
2388 {
2389 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
2390 return __Pyx_PyObject_CallMethO(func, NULL);
2391 }
2392 }
2393 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
2394 }
2395 #endif
2396
2397 /* PyCFunctionFastCall */
2398 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)2399 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
2400 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
2401 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
2402 PyObject *self = PyCFunction_GET_SELF(func);
2403 int flags = PyCFunction_GET_FLAGS(func);
2404 assert(PyCFunction_Check(func));
2405 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
2406 assert(nargs >= 0);
2407 assert(nargs == 0 || args != NULL);
2408 /* _PyCFunction_FastCallDict() must not be called with an exception set,
2409 because it may clear it (directly or indirectly) and so the
2410 caller loses its exception */
2411 assert(!PyErr_Occurred());
2412 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
2413 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
2414 } else {
2415 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
2416 }
2417 }
2418 #endif
2419
2420 /* PyObjectCallOneArg */
2421 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)2422 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2423 PyObject *result;
2424 PyObject *args = PyTuple_New(1);
2425 if (unlikely(!args)) return NULL;
2426 Py_INCREF(arg);
2427 PyTuple_SET_ITEM(args, 0, arg);
2428 result = __Pyx_PyObject_Call(func, args, NULL);
2429 Py_DECREF(args);
2430 return result;
2431 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)2432 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2433 #if CYTHON_FAST_PYCALL
2434 if (PyFunction_Check(func)) {
2435 return __Pyx_PyFunction_FastCall(func, &arg, 1);
2436 }
2437 #endif
2438 if (likely(PyCFunction_Check(func))) {
2439 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
2440 return __Pyx_PyObject_CallMethO(func, arg);
2441 #if CYTHON_FAST_PYCCALL
2442 } else if (__Pyx_PyFastCFunction_Check(func)) {
2443 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
2444 #endif
2445 }
2446 }
2447 return __Pyx__PyObject_CallOneArg(func, arg);
2448 }
2449 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)2450 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2451 PyObject *result;
2452 PyObject *args = PyTuple_Pack(1, arg);
2453 if (unlikely(!args)) return NULL;
2454 result = __Pyx_PyObject_Call(func, args, NULL);
2455 Py_DECREF(args);
2456 return result;
2457 }
2458 #endif
2459
2460 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)2461 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
2462 PyObject *empty_list = 0;
2463 PyObject *module = 0;
2464 PyObject *global_dict = 0;
2465 PyObject *empty_dict = 0;
2466 PyObject *list;
2467 #if PY_MAJOR_VERSION < 3
2468 PyObject *py_import;
2469 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
2470 if (!py_import)
2471 goto bad;
2472 #endif
2473 if (from_list)
2474 list = from_list;
2475 else {
2476 empty_list = PyList_New(0);
2477 if (!empty_list)
2478 goto bad;
2479 list = empty_list;
2480 }
2481 global_dict = PyModule_GetDict(__pyx_m);
2482 if (!global_dict)
2483 goto bad;
2484 empty_dict = PyDict_New();
2485 if (!empty_dict)
2486 goto bad;
2487 {
2488 #if PY_MAJOR_VERSION >= 3
2489 if (level == -1) {
2490 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
2491 module = PyImport_ImportModuleLevelObject(
2492 name, global_dict, empty_dict, list, 1);
2493 if (!module) {
2494 if (!PyErr_ExceptionMatches(PyExc_ImportError))
2495 goto bad;
2496 PyErr_Clear();
2497 }
2498 }
2499 level = 0;
2500 }
2501 #endif
2502 if (!module) {
2503 #if PY_MAJOR_VERSION < 3
2504 PyObject *py_level = PyInt_FromLong(level);
2505 if (!py_level)
2506 goto bad;
2507 module = PyObject_CallFunctionObjArgs(py_import,
2508 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
2509 Py_DECREF(py_level);
2510 #else
2511 module = PyImport_ImportModuleLevelObject(
2512 name, global_dict, empty_dict, list, level);
2513 #endif
2514 }
2515 }
2516 bad:
2517 #if PY_MAJOR_VERSION < 3
2518 Py_XDECREF(py_import);
2519 #endif
2520 Py_XDECREF(empty_list);
2521 Py_XDECREF(empty_dict);
2522 return module;
2523 }
2524
2525 /* PyDictVersioning */
2526 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)2527 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
2528 PyObject *dict = Py_TYPE(obj)->tp_dict;
2529 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
2530 }
__Pyx_get_object_dict_version(PyObject * obj)2531 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
2532 PyObject **dictptr = NULL;
2533 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
2534 if (offset) {
2535 #if CYTHON_COMPILING_IN_CPYTHON
2536 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
2537 #else
2538 dictptr = _PyObject_GetDictPtr(obj);
2539 #endif
2540 }
2541 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
2542 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)2543 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
2544 PyObject *dict = Py_TYPE(obj)->tp_dict;
2545 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
2546 return 0;
2547 return obj_dict_version == __Pyx_get_object_dict_version(obj);
2548 }
2549 #endif
2550
2551 /* PyErrFetchRestore */
2552 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)2553 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
2554 PyObject *tmp_type, *tmp_value, *tmp_tb;
2555 tmp_type = tstate->curexc_type;
2556 tmp_value = tstate->curexc_value;
2557 tmp_tb = tstate->curexc_traceback;
2558 tstate->curexc_type = type;
2559 tstate->curexc_value = value;
2560 tstate->curexc_traceback = tb;
2561 Py_XDECREF(tmp_type);
2562 Py_XDECREF(tmp_value);
2563 Py_XDECREF(tmp_tb);
2564 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)2565 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
2566 *type = tstate->curexc_type;
2567 *value = tstate->curexc_value;
2568 *tb = tstate->curexc_traceback;
2569 tstate->curexc_type = 0;
2570 tstate->curexc_value = 0;
2571 tstate->curexc_traceback = 0;
2572 }
2573 #endif
2574
2575 /* CLineInTraceback */
2576 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)2577 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
2578 PyObject *use_cline;
2579 PyObject *ptype, *pvalue, *ptraceback;
2580 #if CYTHON_COMPILING_IN_CPYTHON
2581 PyObject **cython_runtime_dict;
2582 #endif
2583 if (unlikely(!__pyx_cython_runtime)) {
2584 return c_line;
2585 }
2586 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
2587 #if CYTHON_COMPILING_IN_CPYTHON
2588 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
2589 if (likely(cython_runtime_dict)) {
2590 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
2591 use_cline, *cython_runtime_dict,
2592 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
2593 } else
2594 #endif
2595 {
2596 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
2597 if (use_cline_obj) {
2598 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
2599 Py_DECREF(use_cline_obj);
2600 } else {
2601 PyErr_Clear();
2602 use_cline = NULL;
2603 }
2604 }
2605 if (!use_cline) {
2606 c_line = 0;
2607 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
2608 }
2609 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
2610 c_line = 0;
2611 }
2612 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
2613 return c_line;
2614 }
2615 #endif
2616
2617 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)2618 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
2619 int start = 0, mid = 0, end = count - 1;
2620 if (end >= 0 && code_line > entries[end].code_line) {
2621 return count;
2622 }
2623 while (start < end) {
2624 mid = start + (end - start) / 2;
2625 if (code_line < entries[mid].code_line) {
2626 end = mid;
2627 } else if (code_line > entries[mid].code_line) {
2628 start = mid + 1;
2629 } else {
2630 return mid;
2631 }
2632 }
2633 if (code_line <= entries[mid].code_line) {
2634 return mid;
2635 } else {
2636 return mid + 1;
2637 }
2638 }
__pyx_find_code_object(int code_line)2639 static PyCodeObject *__pyx_find_code_object(int code_line) {
2640 PyCodeObject* code_object;
2641 int pos;
2642 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
2643 return NULL;
2644 }
2645 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
2646 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
2647 return NULL;
2648 }
2649 code_object = __pyx_code_cache.entries[pos].code_object;
2650 Py_INCREF(code_object);
2651 return code_object;
2652 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)2653 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
2654 int pos, i;
2655 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
2656 if (unlikely(!code_line)) {
2657 return;
2658 }
2659 if (unlikely(!entries)) {
2660 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
2661 if (likely(entries)) {
2662 __pyx_code_cache.entries = entries;
2663 __pyx_code_cache.max_count = 64;
2664 __pyx_code_cache.count = 1;
2665 entries[0].code_line = code_line;
2666 entries[0].code_object = code_object;
2667 Py_INCREF(code_object);
2668 }
2669 return;
2670 }
2671 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
2672 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
2673 PyCodeObject* tmp = entries[pos].code_object;
2674 entries[pos].code_object = code_object;
2675 Py_DECREF(tmp);
2676 return;
2677 }
2678 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
2679 int new_max = __pyx_code_cache.max_count + 64;
2680 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
2681 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
2682 if (unlikely(!entries)) {
2683 return;
2684 }
2685 __pyx_code_cache.entries = entries;
2686 __pyx_code_cache.max_count = new_max;
2687 }
2688 for (i=__pyx_code_cache.count; i>pos; i--) {
2689 entries[i] = entries[i-1];
2690 }
2691 entries[pos].code_line = code_line;
2692 entries[pos].code_object = code_object;
2693 __pyx_code_cache.count++;
2694 Py_INCREF(code_object);
2695 }
2696
2697 /* AddTraceback */
2698 #include "compile.h"
2699 #include "frameobject.h"
2700 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)2701 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
2702 const char *funcname, int c_line,
2703 int py_line, const char *filename) {
2704 PyCodeObject *py_code = NULL;
2705 PyObject *py_funcname = NULL;
2706 #if PY_MAJOR_VERSION < 3
2707 PyObject *py_srcfile = NULL;
2708 py_srcfile = PyString_FromString(filename);
2709 if (!py_srcfile) goto bad;
2710 #endif
2711 if (c_line) {
2712 #if PY_MAJOR_VERSION < 3
2713 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
2714 if (!py_funcname) goto bad;
2715 #else
2716 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
2717 if (!py_funcname) goto bad;
2718 funcname = PyUnicode_AsUTF8(py_funcname);
2719 if (!funcname) goto bad;
2720 #endif
2721 }
2722 else {
2723 #if PY_MAJOR_VERSION < 3
2724 py_funcname = PyString_FromString(funcname);
2725 if (!py_funcname) goto bad;
2726 #endif
2727 }
2728 #if PY_MAJOR_VERSION < 3
2729 py_code = __Pyx_PyCode_New(
2730 0,
2731 0,
2732 0,
2733 0,
2734 0,
2735 __pyx_empty_bytes, /*PyObject *code,*/
2736 __pyx_empty_tuple, /*PyObject *consts,*/
2737 __pyx_empty_tuple, /*PyObject *names,*/
2738 __pyx_empty_tuple, /*PyObject *varnames,*/
2739 __pyx_empty_tuple, /*PyObject *freevars,*/
2740 __pyx_empty_tuple, /*PyObject *cellvars,*/
2741 py_srcfile, /*PyObject *filename,*/
2742 py_funcname, /*PyObject *name,*/
2743 py_line,
2744 __pyx_empty_bytes /*PyObject *lnotab*/
2745 );
2746 Py_DECREF(py_srcfile);
2747 #else
2748 py_code = PyCode_NewEmpty(filename, funcname, py_line);
2749 #endif
2750 Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
2751 return py_code;
2752 bad:
2753 Py_XDECREF(py_funcname);
2754 #if PY_MAJOR_VERSION < 3
2755 Py_XDECREF(py_srcfile);
2756 #endif
2757 return NULL;
2758 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)2759 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2760 int py_line, const char *filename) {
2761 PyCodeObject *py_code = 0;
2762 PyFrameObject *py_frame = 0;
2763 PyThreadState *tstate = __Pyx_PyThreadState_Current;
2764 if (c_line) {
2765 c_line = __Pyx_CLineForTraceback(tstate, c_line);
2766 }
2767 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
2768 if (!py_code) {
2769 py_code = __Pyx_CreateCodeObjectForTraceback(
2770 funcname, c_line, py_line, filename);
2771 if (!py_code) goto bad;
2772 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
2773 }
2774 py_frame = PyFrame_New(
2775 tstate, /*PyThreadState *tstate,*/
2776 py_code, /*PyCodeObject *code,*/
2777 __pyx_d, /*PyObject *globals,*/
2778 0 /*PyObject *locals*/
2779 );
2780 if (!py_frame) goto bad;
2781 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
2782 PyTraceBack_Here(py_frame);
2783 bad:
2784 Py_XDECREF(py_code);
2785 Py_XDECREF(py_frame);
2786 }
2787
2788 /* CIntFromPyVerify */
2789 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
2790 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
2791 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
2792 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
2793 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
2794 {\
2795 func_type value = func_value;\
2796 if (sizeof(target_type) < sizeof(func_type)) {\
2797 if (unlikely(value != (func_type) (target_type) value)) {\
2798 func_type zero = 0;\
2799 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
2800 return (target_type) -1;\
2801 if (is_unsigned && unlikely(value < zero))\
2802 goto raise_neg_overflow;\
2803 else\
2804 goto raise_overflow;\
2805 }\
2806 }\
2807 return (target_type) value;\
2808 }
2809
2810 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)2811 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
2812 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2813 #pragma GCC diagnostic push
2814 #pragma GCC diagnostic ignored "-Wconversion"
2815 #endif
2816 const int neg_one = (int) -1, const_zero = (int) 0;
2817 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2818 #pragma GCC diagnostic pop
2819 #endif
2820 const int is_unsigned = neg_one > const_zero;
2821 #if PY_MAJOR_VERSION < 3
2822 if (likely(PyInt_Check(x))) {
2823 if (sizeof(int) < sizeof(long)) {
2824 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
2825 } else {
2826 long val = PyInt_AS_LONG(x);
2827 if (is_unsigned && unlikely(val < 0)) {
2828 goto raise_neg_overflow;
2829 }
2830 return (int) val;
2831 }
2832 } else
2833 #endif
2834 if (likely(PyLong_Check(x))) {
2835 if (is_unsigned) {
2836 #if CYTHON_USE_PYLONG_INTERNALS
2837 const digit* digits = ((PyLongObject*)x)->ob_digit;
2838 switch (Py_SIZE(x)) {
2839 case 0: return (int) 0;
2840 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
2841 case 2:
2842 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
2843 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2844 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2845 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
2846 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
2847 }
2848 }
2849 break;
2850 case 3:
2851 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
2852 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2853 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2854 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
2855 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
2856 }
2857 }
2858 break;
2859 case 4:
2860 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
2861 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2862 __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])))
2863 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
2864 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
2865 }
2866 }
2867 break;
2868 }
2869 #endif
2870 #if CYTHON_COMPILING_IN_CPYTHON
2871 if (unlikely(Py_SIZE(x) < 0)) {
2872 goto raise_neg_overflow;
2873 }
2874 #else
2875 {
2876 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
2877 if (unlikely(result < 0))
2878 return (int) -1;
2879 if (unlikely(result == 1))
2880 goto raise_neg_overflow;
2881 }
2882 #endif
2883 if (sizeof(int) <= sizeof(unsigned long)) {
2884 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
2885 #ifdef HAVE_LONG_LONG
2886 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
2887 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
2888 #endif
2889 }
2890 } else {
2891 #if CYTHON_USE_PYLONG_INTERNALS
2892 const digit* digits = ((PyLongObject*)x)->ob_digit;
2893 switch (Py_SIZE(x)) {
2894 case 0: return (int) 0;
2895 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
2896 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
2897 case -2:
2898 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
2899 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2900 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2901 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
2902 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2903 }
2904 }
2905 break;
2906 case 2:
2907 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
2908 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2909 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2910 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
2911 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2912 }
2913 }
2914 break;
2915 case -3:
2916 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
2917 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2918 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2919 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
2920 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2921 }
2922 }
2923 break;
2924 case 3:
2925 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
2926 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2927 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2928 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
2929 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2930 }
2931 }
2932 break;
2933 case -4:
2934 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
2935 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2936 __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])))
2937 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
2938 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2939 }
2940 }
2941 break;
2942 case 4:
2943 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
2944 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2945 __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])))
2946 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
2947 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2948 }
2949 }
2950 break;
2951 }
2952 #endif
2953 if (sizeof(int) <= sizeof(long)) {
2954 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
2955 #ifdef HAVE_LONG_LONG
2956 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
2957 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
2958 #endif
2959 }
2960 }
2961 {
2962 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
2963 PyErr_SetString(PyExc_RuntimeError,
2964 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
2965 #else
2966 int val;
2967 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
2968 #if PY_MAJOR_VERSION < 3
2969 if (likely(v) && !PyLong_Check(v)) {
2970 PyObject *tmp = v;
2971 v = PyNumber_Long(tmp);
2972 Py_DECREF(tmp);
2973 }
2974 #endif
2975 if (likely(v)) {
2976 int one = 1; int is_little = (int)*(unsigned char *)&one;
2977 unsigned char *bytes = (unsigned char *)&val;
2978 int ret = _PyLong_AsByteArray((PyLongObject *)v,
2979 bytes, sizeof(val),
2980 is_little, !is_unsigned);
2981 Py_DECREF(v);
2982 if (likely(!ret))
2983 return val;
2984 }
2985 #endif
2986 return (int) -1;
2987 }
2988 } else {
2989 int val;
2990 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
2991 if (!tmp) return (int) -1;
2992 val = __Pyx_PyInt_As_int(tmp);
2993 Py_DECREF(tmp);
2994 return val;
2995 }
2996 raise_overflow:
2997 PyErr_SetString(PyExc_OverflowError,
2998 "value too large to convert to int");
2999 return (int) -1;
3000 raise_neg_overflow:
3001 PyErr_SetString(PyExc_OverflowError,
3002 "can't convert negative value to int");
3003 return (int) -1;
3004 }
3005
3006 /* CIntToPy */
__Pyx_PyInt_From_long(long value)3007 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
3008 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3009 #pragma GCC diagnostic push
3010 #pragma GCC diagnostic ignored "-Wconversion"
3011 #endif
3012 const long neg_one = (long) -1, const_zero = (long) 0;
3013 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3014 #pragma GCC diagnostic pop
3015 #endif
3016 const int is_unsigned = neg_one > const_zero;
3017 if (is_unsigned) {
3018 if (sizeof(long) < sizeof(long)) {
3019 return PyInt_FromLong((long) value);
3020 } else if (sizeof(long) <= sizeof(unsigned long)) {
3021 return PyLong_FromUnsignedLong((unsigned long) value);
3022 #ifdef HAVE_LONG_LONG
3023 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3024 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3025 #endif
3026 }
3027 } else {
3028 if (sizeof(long) <= sizeof(long)) {
3029 return PyInt_FromLong((long) value);
3030 #ifdef HAVE_LONG_LONG
3031 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3032 return PyLong_FromLongLong((PY_LONG_LONG) value);
3033 #endif
3034 }
3035 }
3036 {
3037 int one = 1; int little = (int)*(unsigned char *)&one;
3038 unsigned char *bytes = (unsigned char *)&value;
3039 return _PyLong_FromByteArray(bytes, sizeof(long),
3040 little, !is_unsigned);
3041 }
3042 }
3043
3044 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)3045 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
3046 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3047 #pragma GCC diagnostic push
3048 #pragma GCC diagnostic ignored "-Wconversion"
3049 #endif
3050 const long neg_one = (long) -1, const_zero = (long) 0;
3051 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3052 #pragma GCC diagnostic pop
3053 #endif
3054 const int is_unsigned = neg_one > const_zero;
3055 #if PY_MAJOR_VERSION < 3
3056 if (likely(PyInt_Check(x))) {
3057 if (sizeof(long) < sizeof(long)) {
3058 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
3059 } else {
3060 long val = PyInt_AS_LONG(x);
3061 if (is_unsigned && unlikely(val < 0)) {
3062 goto raise_neg_overflow;
3063 }
3064 return (long) val;
3065 }
3066 } else
3067 #endif
3068 if (likely(PyLong_Check(x))) {
3069 if (is_unsigned) {
3070 #if CYTHON_USE_PYLONG_INTERNALS
3071 const digit* digits = ((PyLongObject*)x)->ob_digit;
3072 switch (Py_SIZE(x)) {
3073 case 0: return (long) 0;
3074 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
3075 case 2:
3076 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3077 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3078 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3079 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
3080 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3081 }
3082 }
3083 break;
3084 case 3:
3085 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3086 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3087 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3088 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
3089 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3090 }
3091 }
3092 break;
3093 case 4:
3094 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3095 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3096 __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])))
3097 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
3098 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3099 }
3100 }
3101 break;
3102 }
3103 #endif
3104 #if CYTHON_COMPILING_IN_CPYTHON
3105 if (unlikely(Py_SIZE(x) < 0)) {
3106 goto raise_neg_overflow;
3107 }
3108 #else
3109 {
3110 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3111 if (unlikely(result < 0))
3112 return (long) -1;
3113 if (unlikely(result == 1))
3114 goto raise_neg_overflow;
3115 }
3116 #endif
3117 if (sizeof(long) <= sizeof(unsigned long)) {
3118 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
3119 #ifdef HAVE_LONG_LONG
3120 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3121 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3122 #endif
3123 }
3124 } else {
3125 #if CYTHON_USE_PYLONG_INTERNALS
3126 const digit* digits = ((PyLongObject*)x)->ob_digit;
3127 switch (Py_SIZE(x)) {
3128 case 0: return (long) 0;
3129 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
3130 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
3131 case -2:
3132 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
3133 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3134 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3135 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3136 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3137 }
3138 }
3139 break;
3140 case 2:
3141 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3142 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3143 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3144 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3145 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3146 }
3147 }
3148 break;
3149 case -3:
3150 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3151 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3152 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3153 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3154 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3155 }
3156 }
3157 break;
3158 case 3:
3159 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3160 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3161 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3162 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3163 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3164 }
3165 }
3166 break;
3167 case -4:
3168 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3169 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3170 __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])))
3171 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3172 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3173 }
3174 }
3175 break;
3176 case 4:
3177 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3178 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3179 __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])))
3180 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3181 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3182 }
3183 }
3184 break;
3185 }
3186 #endif
3187 if (sizeof(long) <= sizeof(long)) {
3188 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
3189 #ifdef HAVE_LONG_LONG
3190 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3191 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
3192 #endif
3193 }
3194 }
3195 {
3196 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3197 PyErr_SetString(PyExc_RuntimeError,
3198 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3199 #else
3200 long val;
3201 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3202 #if PY_MAJOR_VERSION < 3
3203 if (likely(v) && !PyLong_Check(v)) {
3204 PyObject *tmp = v;
3205 v = PyNumber_Long(tmp);
3206 Py_DECREF(tmp);
3207 }
3208 #endif
3209 if (likely(v)) {
3210 int one = 1; int is_little = (int)*(unsigned char *)&one;
3211 unsigned char *bytes = (unsigned char *)&val;
3212 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3213 bytes, sizeof(val),
3214 is_little, !is_unsigned);
3215 Py_DECREF(v);
3216 if (likely(!ret))
3217 return val;
3218 }
3219 #endif
3220 return (long) -1;
3221 }
3222 } else {
3223 long val;
3224 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3225 if (!tmp) return (long) -1;
3226 val = __Pyx_PyInt_As_long(tmp);
3227 Py_DECREF(tmp);
3228 return val;
3229 }
3230 raise_overflow:
3231 PyErr_SetString(PyExc_OverflowError,
3232 "value too large to convert to long");
3233 return (long) -1;
3234 raise_neg_overflow:
3235 PyErr_SetString(PyExc_OverflowError,
3236 "can't convert negative value to long");
3237 return (long) -1;
3238 }
3239
3240 /* FastTypeChecks */
3241 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)3242 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
3243 while (a) {
3244 a = a->tp_base;
3245 if (a == b)
3246 return 1;
3247 }
3248 return b == &PyBaseObject_Type;
3249 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)3250 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
3251 PyObject *mro;
3252 if (a == b) return 1;
3253 mro = a->tp_mro;
3254 if (likely(mro)) {
3255 Py_ssize_t i, n;
3256 n = PyTuple_GET_SIZE(mro);
3257 for (i = 0; i < n; i++) {
3258 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
3259 return 1;
3260 }
3261 return 0;
3262 }
3263 return __Pyx_InBases(a, b);
3264 }
3265 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)3266 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
3267 PyObject *exception, *value, *tb;
3268 int res;
3269 __Pyx_PyThreadState_declare
3270 __Pyx_PyThreadState_assign
3271 __Pyx_ErrFetch(&exception, &value, &tb);
3272 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
3273 if (unlikely(res == -1)) {
3274 PyErr_WriteUnraisable(err);
3275 res = 0;
3276 }
3277 if (!res) {
3278 res = PyObject_IsSubclass(err, exc_type2);
3279 if (unlikely(res == -1)) {
3280 PyErr_WriteUnraisable(err);
3281 res = 0;
3282 }
3283 }
3284 __Pyx_ErrRestore(exception, value, tb);
3285 return res;
3286 }
3287 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)3288 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
3289 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
3290 if (!res) {
3291 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
3292 }
3293 return res;
3294 }
3295 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)3296 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
3297 Py_ssize_t i, n;
3298 assert(PyExceptionClass_Check(exc_type));
3299 n = PyTuple_GET_SIZE(tuple);
3300 #if PY_MAJOR_VERSION >= 3
3301 for (i=0; i<n; i++) {
3302 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
3303 }
3304 #endif
3305 for (i=0; i<n; i++) {
3306 PyObject *t = PyTuple_GET_ITEM(tuple, i);
3307 #if PY_MAJOR_VERSION < 3
3308 if (likely(exc_type == t)) return 1;
3309 #endif
3310 if (likely(PyExceptionClass_Check(t))) {
3311 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
3312 } else {
3313 }
3314 }
3315 return 0;
3316 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)3317 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
3318 if (likely(err == exc_type)) return 1;
3319 if (likely(PyExceptionClass_Check(err))) {
3320 if (likely(PyExceptionClass_Check(exc_type))) {
3321 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
3322 } else if (likely(PyTuple_Check(exc_type))) {
3323 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
3324 } else {
3325 }
3326 }
3327 return PyErr_GivenExceptionMatches(err, exc_type);
3328 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)3329 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
3330 assert(PyExceptionClass_Check(exc_type1));
3331 assert(PyExceptionClass_Check(exc_type2));
3332 if (likely(err == exc_type1 || err == exc_type2)) return 1;
3333 if (likely(PyExceptionClass_Check(err))) {
3334 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
3335 }
3336 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
3337 }
3338 #endif
3339
3340 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)3341 static int __Pyx_check_binary_version(void) {
3342 char ctversion[4], rtversion[4];
3343 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
3344 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
3345 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
3346 char message[200];
3347 PyOS_snprintf(message, sizeof(message),
3348 "compiletime version %s of module '%.100s' "
3349 "does not match runtime version %s",
3350 ctversion, __Pyx_MODULE_NAME, rtversion);
3351 return PyErr_WarnEx(NULL, message, 1);
3352 }
3353 return 0;
3354 }
3355
3356 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)3357 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
3358 while (t->p) {
3359 #if PY_MAJOR_VERSION < 3
3360 if (t->is_unicode) {
3361 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
3362 } else if (t->intern) {
3363 *t->p = PyString_InternFromString(t->s);
3364 } else {
3365 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
3366 }
3367 #else
3368 if (t->is_unicode | t->is_str) {
3369 if (t->intern) {
3370 *t->p = PyUnicode_InternFromString(t->s);
3371 } else if (t->encoding) {
3372 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
3373 } else {
3374 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
3375 }
3376 } else {
3377 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
3378 }
3379 #endif
3380 if (!*t->p)
3381 return -1;
3382 if (PyObject_Hash(*t->p) == -1)
3383 return -1;
3384 ++t;
3385 }
3386 return 0;
3387 }
3388
__Pyx_PyUnicode_FromString(const char * c_str)3389 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
3390 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
3391 }
__Pyx_PyObject_AsString(PyObject * o)3392 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
3393 Py_ssize_t ignore;
3394 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
3395 }
3396 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
3397 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)3398 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3399 char* defenc_c;
3400 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
3401 if (!defenc) return NULL;
3402 defenc_c = PyBytes_AS_STRING(defenc);
3403 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3404 {
3405 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
3406 char* c;
3407 for (c = defenc_c; c < end; c++) {
3408 if ((unsigned char) (*c) >= 128) {
3409 PyUnicode_AsASCIIString(o);
3410 return NULL;
3411 }
3412 }
3413 }
3414 #endif
3415 *length = PyBytes_GET_SIZE(defenc);
3416 return defenc_c;
3417 }
3418 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)3419 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3420 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
3421 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3422 if (likely(PyUnicode_IS_ASCII(o))) {
3423 *length = PyUnicode_GET_LENGTH(o);
3424 return PyUnicode_AsUTF8(o);
3425 } else {
3426 PyUnicode_AsASCIIString(o);
3427 return NULL;
3428 }
3429 #else
3430 return PyUnicode_AsUTF8AndSize(o, length);
3431 #endif
3432 }
3433 #endif
3434 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)3435 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3436 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
3437 if (
3438 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3439 __Pyx_sys_getdefaultencoding_not_ascii &&
3440 #endif
3441 PyUnicode_Check(o)) {
3442 return __Pyx_PyUnicode_AsStringAndSize(o, length);
3443 } else
3444 #endif
3445 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
3446 if (PyByteArray_Check(o)) {
3447 *length = PyByteArray_GET_SIZE(o);
3448 return PyByteArray_AS_STRING(o);
3449 } else
3450 #endif
3451 {
3452 char* result;
3453 int r = PyBytes_AsStringAndSize(o, &result, length);
3454 if (unlikely(r < 0)) {
3455 return NULL;
3456 } else {
3457 return result;
3458 }
3459 }
3460 }
__Pyx_PyObject_IsTrue(PyObject * x)3461 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
3462 int is_true = x == Py_True;
3463 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
3464 else return PyObject_IsTrue(x);
3465 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)3466 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
3467 int retval;
3468 if (unlikely(!x)) return -1;
3469 retval = __Pyx_PyObject_IsTrue(x);
3470 Py_DECREF(x);
3471 return retval;
3472 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)3473 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
3474 #if PY_MAJOR_VERSION >= 3
3475 if (PyLong_Check(result)) {
3476 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
3477 "__int__ returned non-int (type %.200s). "
3478 "The ability to return an instance of a strict subclass of int "
3479 "is deprecated, and may be removed in a future version of Python.",
3480 Py_TYPE(result)->tp_name)) {
3481 Py_DECREF(result);
3482 return NULL;
3483 }
3484 return result;
3485 }
3486 #endif
3487 PyErr_Format(PyExc_TypeError,
3488 "__%.4s__ returned non-%.4s (type %.200s)",
3489 type_name, type_name, Py_TYPE(result)->tp_name);
3490 Py_DECREF(result);
3491 return NULL;
3492 }
__Pyx_PyNumber_IntOrLong(PyObject * x)3493 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
3494 #if CYTHON_USE_TYPE_SLOTS
3495 PyNumberMethods *m;
3496 #endif
3497 const char *name = NULL;
3498 PyObject *res = NULL;
3499 #if PY_MAJOR_VERSION < 3
3500 if (likely(PyInt_Check(x) || PyLong_Check(x)))
3501 #else
3502 if (likely(PyLong_Check(x)))
3503 #endif
3504 return __Pyx_NewRef(x);
3505 #if CYTHON_USE_TYPE_SLOTS
3506 m = Py_TYPE(x)->tp_as_number;
3507 #if PY_MAJOR_VERSION < 3
3508 if (m && m->nb_int) {
3509 name = "int";
3510 res = m->nb_int(x);
3511 }
3512 else if (m && m->nb_long) {
3513 name = "long";
3514 res = m->nb_long(x);
3515 }
3516 #else
3517 if (likely(m && m->nb_int)) {
3518 name = "int";
3519 res = m->nb_int(x);
3520 }
3521 #endif
3522 #else
3523 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
3524 res = PyNumber_Int(x);
3525 }
3526 #endif
3527 if (likely(res)) {
3528 #if PY_MAJOR_VERSION < 3
3529 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
3530 #else
3531 if (unlikely(!PyLong_CheckExact(res))) {
3532 #endif
3533 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
3534 }
3535 }
3536 else if (!PyErr_Occurred()) {
3537 PyErr_SetString(PyExc_TypeError,
3538 "an integer is required");
3539 }
3540 return res;
3541 }
3542 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
3543 Py_ssize_t ival;
3544 PyObject *x;
3545 #if PY_MAJOR_VERSION < 3
3546 if (likely(PyInt_CheckExact(b))) {
3547 if (sizeof(Py_ssize_t) >= sizeof(long))
3548 return PyInt_AS_LONG(b);
3549 else
3550 return PyInt_AsSsize_t(b);
3551 }
3552 #endif
3553 if (likely(PyLong_CheckExact(b))) {
3554 #if CYTHON_USE_PYLONG_INTERNALS
3555 const digit* digits = ((PyLongObject*)b)->ob_digit;
3556 const Py_ssize_t size = Py_SIZE(b);
3557 if (likely(__Pyx_sst_abs(size) <= 1)) {
3558 ival = likely(size) ? digits[0] : 0;
3559 if (size == -1) ival = -ival;
3560 return ival;
3561 } else {
3562 switch (size) {
3563 case 2:
3564 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
3565 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3566 }
3567 break;
3568 case -2:
3569 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
3570 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3571 }
3572 break;
3573 case 3:
3574 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
3575 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3576 }
3577 break;
3578 case -3:
3579 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
3580 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3581 }
3582 break;
3583 case 4:
3584 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
3585 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]));
3586 }
3587 break;
3588 case -4:
3589 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
3590 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]));
3591 }
3592 break;
3593 }
3594 }
3595 #endif
3596 return PyLong_AsSsize_t(b);
3597 }
3598 x = PyNumber_Index(b);
3599 if (!x) return -1;
3600 ival = PyInt_AsSsize_t(x);
3601 Py_DECREF(x);
3602 return ival;
3603 }
3604 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
3605 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
3606 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
3607 #if PY_MAJOR_VERSION < 3
3608 } else if (likely(PyInt_CheckExact(o))) {
3609 return PyInt_AS_LONG(o);
3610 #endif
3611 } else {
3612 Py_ssize_t ival;
3613 PyObject *x;
3614 x = PyNumber_Index(o);
3615 if (!x) return -1;
3616 ival = PyInt_AsLong(x);
3617 Py_DECREF(x);
3618 return ival;
3619 }
3620 }
3621 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
3622 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
3623 }
3624 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
3625 return PyInt_FromSize_t(ival);
3626 }
3627
3628
3629 #endif /* Py_PYTHON_H */
3630