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__arrays__bed
677 #define __PYX_HAVE_API__bx__arrays__bed
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/arrays/bed.pyx",
889 "stringsource",
890 };
891
892 /*--- Type declarations ---*/
893 struct __pyx_obj_2bx_6arrays_3bed_BedReader;
894
895 /* "bx/arrays/bed.pyx":6
896 * """
897 *
898 * cdef class BedReader: # <<<<<<<<<<<<<<
899 * cdef object f
900 * def __init__( self, f ):
901 */
902 struct __pyx_obj_2bx_6arrays_3bed_BedReader {
903 PyObject_HEAD
904 PyObject *f;
905 };
906
907
908 /* --- Runtime support code (head) --- */
909 /* Refnanny.proto */
910 #ifndef CYTHON_REFNANNY
911 #define CYTHON_REFNANNY 0
912 #endif
913 #if CYTHON_REFNANNY
914 typedef struct {
915 void (*INCREF)(void*, PyObject*, int);
916 void (*DECREF)(void*, PyObject*, int);
917 void (*GOTREF)(void*, PyObject*, int);
918 void (*GIVEREF)(void*, PyObject*, int);
919 void* (*SetupContext)(const char*, int, const char*);
920 void (*FinishContext)(void**);
921 } __Pyx_RefNannyAPIStruct;
922 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
923 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
924 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
925 #ifdef WITH_THREAD
926 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
927 if (acquire_gil) {\
928 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
929 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
930 PyGILState_Release(__pyx_gilstate_save);\
931 } else {\
932 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
933 }
934 #else
935 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
936 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
937 #endif
938 #define __Pyx_RefNannyFinishContext()\
939 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
940 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
941 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
942 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
943 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
944 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
945 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
946 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
947 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
948 #else
949 #define __Pyx_RefNannyDeclarations
950 #define __Pyx_RefNannySetupContext(name, acquire_gil)
951 #define __Pyx_RefNannyFinishContext()
952 #define __Pyx_INCREF(r) Py_INCREF(r)
953 #define __Pyx_DECREF(r) Py_DECREF(r)
954 #define __Pyx_GOTREF(r)
955 #define __Pyx_GIVEREF(r)
956 #define __Pyx_XINCREF(r) Py_XINCREF(r)
957 #define __Pyx_XDECREF(r) Py_XDECREF(r)
958 #define __Pyx_XGOTREF(r)
959 #define __Pyx_XGIVEREF(r)
960 #endif
961 #define __Pyx_XDECREF_SET(r, v) do {\
962 PyObject *tmp = (PyObject *) r;\
963 r = v; __Pyx_XDECREF(tmp);\
964 } while (0)
965 #define __Pyx_DECREF_SET(r, v) do {\
966 PyObject *tmp = (PyObject *) r;\
967 r = v; __Pyx_DECREF(tmp);\
968 } while (0)
969 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
970 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
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 /* GetBuiltinName.proto */
980 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
981
982 /* RaiseDoubleKeywords.proto */
983 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
984
985 /* ParseKeywords.proto */
986 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
987 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
988 const char* function_name);
989
990 /* RaiseArgTupleInvalid.proto */
991 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
992 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
993
994 /* PyFunctionFastCall.proto */
995 #if CYTHON_FAST_PYCALL
996 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
997 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
998 #if 1 || PY_VERSION_HEX < 0x030600B1
999 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1000 #else
1001 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1002 #endif
1003 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1004 (sizeof(char [1 - 2*!(cond)]) - 1)
1005 #ifndef Py_MEMBER_SIZE
1006 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1007 #endif
1008 #if CYTHON_FAST_PYCALL
1009 static size_t __pyx_pyframe_localsplus_offset = 0;
1010 #include "frameobject.h"
1011 #define __Pxy_PyFrame_Initialize_Offsets()\
1012 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1013 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1014 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1015 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1016 #endif // CYTHON_FAST_PYCALL
1017 #endif
1018
1019 /* PyObjectCall.proto */
1020 #if CYTHON_COMPILING_IN_CPYTHON
1021 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1022 #else
1023 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1024 #endif
1025
1026 /* PyObjectCallMethO.proto */
1027 #if CYTHON_COMPILING_IN_CPYTHON
1028 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1029 #endif
1030
1031 /* PyObjectCallNoArg.proto */
1032 #if CYTHON_COMPILING_IN_CPYTHON
1033 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1034 #else
1035 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1036 #endif
1037
1038 /* PyCFunctionFastCall.proto */
1039 #if CYTHON_FAST_PYCCALL
1040 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1041 #else
1042 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1043 #endif
1044
1045 /* PyObjectCallOneArg.proto */
1046 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1047
1048 /* PyThreadStateGet.proto */
1049 #if CYTHON_FAST_THREAD_STATE
1050 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1051 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1052 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1053 #else
1054 #define __Pyx_PyThreadState_declare
1055 #define __Pyx_PyThreadState_assign
1056 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1057 #endif
1058
1059 /* PyErrFetchRestore.proto */
1060 #if CYTHON_FAST_THREAD_STATE
1061 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1062 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1063 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1064 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1065 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1066 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1067 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1068 #if CYTHON_COMPILING_IN_CPYTHON
1069 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1070 #else
1071 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1072 #endif
1073 #else
1074 #define __Pyx_PyErr_Clear() PyErr_Clear()
1075 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1076 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1077 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1078 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1079 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1080 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1081 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1082 #endif
1083
1084 /* RaiseException.proto */
1085 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1086
1087 /* GetItemInt.proto */
1088 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1089 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1090 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1091 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1092 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1093 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1094 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1095 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1096 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1097 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1098 int wraparound, int boundscheck);
1099 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1100 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1101 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1102 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1103 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1104 int wraparound, int boundscheck);
1105 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1106 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1107 int is_list, int wraparound, int boundscheck);
1108
1109 /* IncludeStringH.proto */
1110 #include <string.h>
1111
1112 /* BytesEquals.proto */
1113 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1114
1115 /* UnicodeEquals.proto */
1116 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1117
1118 /* StrEquals.proto */
1119 #if PY_MAJOR_VERSION >= 3
1120 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1121 #else
1122 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1123 #endif
1124
1125 /* PyObjectCall2Args.proto */
1126 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1127
1128 /* PyErrExceptionMatches.proto */
1129 #if CYTHON_FAST_THREAD_STATE
1130 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1131 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1132 #else
1133 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1134 #endif
1135
1136 /* GetAttr.proto */
1137 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1138
1139 /* GetAttr3.proto */
1140 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1141
1142 /* PyDictVersioning.proto */
1143 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1144 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1145 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1146 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1147 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1148 (cache_var) = (value);
1149 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1150 static PY_UINT64_T __pyx_dict_version = 0;\
1151 static PyObject *__pyx_dict_cached_value = NULL;\
1152 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1153 (VAR) = __pyx_dict_cached_value;\
1154 } else {\
1155 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1156 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1157 }\
1158 }
1159 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1160 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1161 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1162 #else
1163 #define __PYX_GET_DICT_VERSION(dict) (0)
1164 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1165 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1166 #endif
1167
1168 /* GetModuleGlobalName.proto */
1169 #if CYTHON_USE_DICT_VERSIONS
1170 #define __Pyx_GetModuleGlobalName(var, name) {\
1171 static PY_UINT64_T __pyx_dict_version = 0;\
1172 static PyObject *__pyx_dict_cached_value = NULL;\
1173 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1174 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1175 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1176 }
1177 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1178 PY_UINT64_T __pyx_dict_version;\
1179 PyObject *__pyx_dict_cached_value;\
1180 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1181 }
1182 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1183 #else
1184 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1185 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1186 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1187 #endif
1188
1189 /* Import.proto */
1190 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1191
1192 /* ImportFrom.proto */
1193 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1194
1195 /* HasAttr.proto */
1196 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1197
1198 /* PyObject_GenericGetAttrNoDict.proto */
1199 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1200 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1201 #else
1202 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1203 #endif
1204
1205 /* PyObject_GenericGetAttr.proto */
1206 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1207 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1208 #else
1209 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1210 #endif
1211
1212 /* PyObjectGetAttrStrNoError.proto */
1213 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1214
1215 /* SetupReduce.proto */
1216 static int __Pyx_setup_reduce(PyObject* type_obj);
1217
1218 /* CLineInTraceback.proto */
1219 #ifdef CYTHON_CLINE_IN_TRACEBACK
1220 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1221 #else
1222 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1223 #endif
1224
1225 /* CodeObjectCache.proto */
1226 typedef struct {
1227 PyCodeObject* code_object;
1228 int code_line;
1229 } __Pyx_CodeObjectCacheEntry;
1230 struct __Pyx_CodeObjectCache {
1231 int count;
1232 int max_count;
1233 __Pyx_CodeObjectCacheEntry* entries;
1234 };
1235 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1236 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1237 static PyCodeObject *__pyx_find_code_object(int code_line);
1238 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1239
1240 /* AddTraceback.proto */
1241 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1242 int py_line, const char *filename);
1243
1244 /* GCCDiagnostics.proto */
1245 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1246 #define __Pyx_HAS_GCC_DIAGNOSTIC
1247 #endif
1248
1249 /* CIntFromPy.proto */
1250 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1251
1252 /* CIntToPy.proto */
1253 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1254
1255 /* CIntFromPy.proto */
1256 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1257
1258 /* FastTypeChecks.proto */
1259 #if CYTHON_COMPILING_IN_CPYTHON
1260 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1261 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1262 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1263 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1264 #else
1265 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1266 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1267 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1268 #endif
1269 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1270
1271 /* CheckBinaryVersion.proto */
1272 static int __Pyx_check_binary_version(void);
1273
1274 /* InitStrings.proto */
1275 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1276
1277
1278 /* Module declarations from 'bx.arrays.bed' */
1279 static PyTypeObject *__pyx_ptype_2bx_6arrays_3bed_BedReader = 0;
1280 static PyObject *__pyx_f_2bx_6arrays_3bed___pyx_unpickle_BedReader__set_state(struct __pyx_obj_2bx_6arrays_3bed_BedReader *, PyObject *); /*proto*/
1281 #define __Pyx_MODULE_NAME "bx.arrays.bed"
1282 extern int __pyx_module_is_main_bx__arrays__bed;
1283 int __pyx_module_is_main_bx__arrays__bed = 0;
1284
1285 /* Implementation of 'bx.arrays.bed' */
1286 static PyObject *__pyx_builtin_StopIteration;
1287 static const char __pyx_k_[] = "#";
1288 static const char __pyx_k_f[] = "f";
1289 static const char __pyx_k_new[] = "__new__";
1290 static const char __pyx_k_dict[] = "__dict__";
1291 static const char __pyx_k_main[] = "__main__";
1292 static const char __pyx_k_name[] = "__name__";
1293 static const char __pyx_k_test[] = "__test__";
1294 static const char __pyx_k_split[] = "split";
1295 static const char __pyx_k_strip[] = "strip";
1296 static const char __pyx_k_track[] = "track";
1297 static const char __pyx_k_import[] = "__import__";
1298 static const char __pyx_k_pickle[] = "pickle";
1299 static const char __pyx_k_reduce[] = "__reduce__";
1300 static const char __pyx_k_update[] = "update";
1301 static const char __pyx_k_browser[] = "browser";
1302 static const char __pyx_k_isalpha[] = "isalpha";
1303 static const char __pyx_k_isspace[] = "isspace";
1304 static const char __pyx_k_getstate[] = "__getstate__";
1305 static const char __pyx_k_pyx_type[] = "__pyx_type";
1306 static const char __pyx_k_readline[] = "readline";
1307 static const char __pyx_k_setstate[] = "__setstate__";
1308 static const char __pyx_k_BedReader[] = "BedReader";
1309 static const char __pyx_k_pyx_state[] = "__pyx_state";
1310 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1311 static const char __pyx_k_pyx_result[] = "__pyx_result";
1312 static const char __pyx_k_startswith[] = "startswith";
1313 static const char __pyx_k_PickleError[] = "PickleError";
1314 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1315 static const char __pyx_k_stringsource[] = "stringsource";
1316 static const char __pyx_k_StopIteration[] = "StopIteration";
1317 static const char __pyx_k_bx_arrays_bed[] = "bx.arrays.bed";
1318 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1319 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1320 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1321 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1322 static const char __pyx_k_pyx_unpickle_BedReader[] = "__pyx_unpickle_BedReader";
1323 static const char __pyx_k_Unexpected_input_line_s[] = "Unexpected input line: %s";
1324 static const char __pyx_k_Iterator_for_the_BED_format_htt[] = "\nIterator for the BED format ( http://genome.ucsc.edu/FAQ/FAQformat.html#format1 )\nReturns chrom, chromStart, chromEnd, name, score\n";
1325 static const char __pyx_k_Incompatible_checksums_s_vs_0x8f[] = "Incompatible checksums (%s vs 0x8fa14cd = (f))";
1326 static PyObject *__pyx_kp_s_;
1327 static PyObject *__pyx_n_s_BedReader;
1328 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x8f;
1329 static PyObject *__pyx_n_s_PickleError;
1330 static PyObject *__pyx_n_s_StopIteration;
1331 static PyObject *__pyx_kp_s_Unexpected_input_line_s;
1332 static PyObject *__pyx_n_s_browser;
1333 static PyObject *__pyx_n_s_bx_arrays_bed;
1334 static PyObject *__pyx_n_s_cline_in_traceback;
1335 static PyObject *__pyx_n_s_dict;
1336 static PyObject *__pyx_n_s_f;
1337 static PyObject *__pyx_n_s_getstate;
1338 static PyObject *__pyx_n_s_import;
1339 static PyObject *__pyx_n_s_isalpha;
1340 static PyObject *__pyx_n_s_isspace;
1341 static PyObject *__pyx_n_s_main;
1342 static PyObject *__pyx_n_s_name;
1343 static PyObject *__pyx_n_s_new;
1344 static PyObject *__pyx_n_s_pickle;
1345 static PyObject *__pyx_n_s_pyx_PickleError;
1346 static PyObject *__pyx_n_s_pyx_checksum;
1347 static PyObject *__pyx_n_s_pyx_result;
1348 static PyObject *__pyx_n_s_pyx_state;
1349 static PyObject *__pyx_n_s_pyx_type;
1350 static PyObject *__pyx_n_s_pyx_unpickle_BedReader;
1351 static PyObject *__pyx_n_s_readline;
1352 static PyObject *__pyx_n_s_reduce;
1353 static PyObject *__pyx_n_s_reduce_cython;
1354 static PyObject *__pyx_n_s_reduce_ex;
1355 static PyObject *__pyx_n_s_setstate;
1356 static PyObject *__pyx_n_s_setstate_cython;
1357 static PyObject *__pyx_n_s_split;
1358 static PyObject *__pyx_n_s_startswith;
1359 static PyObject *__pyx_kp_s_stringsource;
1360 static PyObject *__pyx_n_s_strip;
1361 static PyObject *__pyx_n_s_test;
1362 static PyObject *__pyx_n_s_track;
1363 static PyObject *__pyx_n_s_update;
1364 static int __pyx_pf_2bx_6arrays_3bed_9BedReader___init__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
1365 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_2__iter__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self); /* proto */
1366 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_4__next__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self); /* proto */
1367 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_6__reduce_cython__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self); /* proto */
1368 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_8__setstate_cython__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1369 static PyObject *__pyx_pf_2bx_6arrays_3bed___pyx_unpickle_BedReader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1370 static PyObject *__pyx_tp_new_2bx_6arrays_3bed_BedReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1371 static PyObject *__pyx_int_150607053;
1372 static PyObject *__pyx_tuple__2;
1373 static PyObject *__pyx_codeobj__3;
1374 /* Late includes */
1375
1376 /* "bx/arrays/bed.pyx":8
1377 * cdef class BedReader:
1378 * cdef object f
1379 * def __init__( self, f ): # <<<<<<<<<<<<<<
1380 * self.f = f
1381 *
1382 */
1383
1384 /* Python wrapper */
1385 static int __pyx_pw_2bx_6arrays_3bed_9BedReader_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2bx_6arrays_3bed_9BedReader_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1386 static int __pyx_pw_2bx_6arrays_3bed_9BedReader_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1387 PyObject *__pyx_v_f = 0;
1388 int __pyx_lineno = 0;
1389 const char *__pyx_filename = NULL;
1390 int __pyx_clineno = 0;
1391 int __pyx_r;
1392 __Pyx_RefNannyDeclarations
1393 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1394 {
1395 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,0};
1396 PyObject* values[1] = {0};
1397 if (unlikely(__pyx_kwds)) {
1398 Py_ssize_t kw_args;
1399 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1400 switch (pos_args) {
1401 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1402 CYTHON_FALLTHROUGH;
1403 case 0: break;
1404 default: goto __pyx_L5_argtuple_error;
1405 }
1406 kw_args = PyDict_Size(__pyx_kwds);
1407 switch (pos_args) {
1408 case 0:
1409 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
1410 else goto __pyx_L5_argtuple_error;
1411 }
1412 if (unlikely(kw_args > 0)) {
1413 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 8, __pyx_L3_error)
1414 }
1415 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
1416 goto __pyx_L5_argtuple_error;
1417 } else {
1418 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1419 }
1420 __pyx_v_f = values[0];
1421 }
1422 goto __pyx_L4_argument_unpacking_done;
1423 __pyx_L5_argtuple_error:;
1424 __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 8, __pyx_L3_error)
1425 __pyx_L3_error:;
1426 __Pyx_AddTraceback("bx.arrays.bed.BedReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1427 __Pyx_RefNannyFinishContext();
1428 return -1;
1429 __pyx_L4_argument_unpacking_done:;
1430 __pyx_r = __pyx_pf_2bx_6arrays_3bed_9BedReader___init__(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self), __pyx_v_f);
1431
1432 /* function exit code */
1433 __Pyx_RefNannyFinishContext();
1434 return __pyx_r;
1435 }
1436
__pyx_pf_2bx_6arrays_3bed_9BedReader___init__(struct __pyx_obj_2bx_6arrays_3bed_BedReader * __pyx_v_self,PyObject * __pyx_v_f)1437 static int __pyx_pf_2bx_6arrays_3bed_9BedReader___init__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self, PyObject *__pyx_v_f) {
1438 int __pyx_r;
1439 __Pyx_RefNannyDeclarations
1440 __Pyx_RefNannySetupContext("__init__", 0);
1441
1442 /* "bx/arrays/bed.pyx":9
1443 * cdef object f
1444 * def __init__( self, f ):
1445 * self.f = f # <<<<<<<<<<<<<<
1446 *
1447 * def __iter__( self ):
1448 */
1449 __Pyx_INCREF(__pyx_v_f);
1450 __Pyx_GIVEREF(__pyx_v_f);
1451 __Pyx_GOTREF(__pyx_v_self->f);
1452 __Pyx_DECREF(__pyx_v_self->f);
1453 __pyx_v_self->f = __pyx_v_f;
1454
1455 /* "bx/arrays/bed.pyx":8
1456 * cdef class BedReader:
1457 * cdef object f
1458 * def __init__( self, f ): # <<<<<<<<<<<<<<
1459 * self.f = f
1460 *
1461 */
1462
1463 /* function exit code */
1464 __pyx_r = 0;
1465 __Pyx_RefNannyFinishContext();
1466 return __pyx_r;
1467 }
1468
1469 /* "bx/arrays/bed.pyx":11
1470 * self.f = f
1471 *
1472 * def __iter__( self ): # <<<<<<<<<<<<<<
1473 * return self
1474 *
1475 */
1476
1477 /* Python wrapper */
1478 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_3__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2bx_6arrays_3bed_9BedReader_3__iter__(PyObject * __pyx_v_self)1479 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_3__iter__(PyObject *__pyx_v_self) {
1480 PyObject *__pyx_r = 0;
1481 __Pyx_RefNannyDeclarations
1482 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
1483 __pyx_r = __pyx_pf_2bx_6arrays_3bed_9BedReader_2__iter__(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self));
1484
1485 /* function exit code */
1486 __Pyx_RefNannyFinishContext();
1487 return __pyx_r;
1488 }
1489
__pyx_pf_2bx_6arrays_3bed_9BedReader_2__iter__(struct __pyx_obj_2bx_6arrays_3bed_BedReader * __pyx_v_self)1490 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_2__iter__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self) {
1491 PyObject *__pyx_r = NULL;
1492 __Pyx_RefNannyDeclarations
1493 __Pyx_RefNannySetupContext("__iter__", 0);
1494
1495 /* "bx/arrays/bed.pyx":12
1496 *
1497 * def __iter__( self ):
1498 * return self # <<<<<<<<<<<<<<
1499 *
1500 * def __next__( self ):
1501 */
1502 __Pyx_XDECREF(__pyx_r);
1503 __Pyx_INCREF(((PyObject *)__pyx_v_self));
1504 __pyx_r = ((PyObject *)__pyx_v_self);
1505 goto __pyx_L0;
1506
1507 /* "bx/arrays/bed.pyx":11
1508 * self.f = f
1509 *
1510 * def __iter__( self ): # <<<<<<<<<<<<<<
1511 * return self
1512 *
1513 */
1514
1515 /* function exit code */
1516 __pyx_L0:;
1517 __Pyx_XGIVEREF(__pyx_r);
1518 __Pyx_RefNannyFinishContext();
1519 return __pyx_r;
1520 }
1521
1522 /* "bx/arrays/bed.pyx":14
1523 * return self
1524 *
1525 * def __next__( self ): # <<<<<<<<<<<<<<
1526 * while True:
1527 * line = self.f.readline()
1528 */
1529
1530 /* Python wrapper */
1531 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__(PyObject * __pyx_v_self)1532 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__(PyObject *__pyx_v_self) {
1533 PyObject *__pyx_r = 0;
1534 __Pyx_RefNannyDeclarations
1535 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
1536 __pyx_r = __pyx_pf_2bx_6arrays_3bed_9BedReader_4__next__(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self));
1537
1538 /* function exit code */
1539 __Pyx_RefNannyFinishContext();
1540 return __pyx_r;
1541 }
1542
__pyx_pf_2bx_6arrays_3bed_9BedReader_4__next__(struct __pyx_obj_2bx_6arrays_3bed_BedReader * __pyx_v_self)1543 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_4__next__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self) {
1544 PyObject *__pyx_v_line = NULL;
1545 PyObject *__pyx_v_feature = NULL;
1546 PyObject *__pyx_v_chrom = NULL;
1547 PyObject *__pyx_v_chrom_start = NULL;
1548 PyObject *__pyx_v_chrom_end = NULL;
1549 PyObject *__pyx_v_name = NULL;
1550 PyObject *__pyx_v_score = NULL;
1551 PyObject *__pyx_r = NULL;
1552 __Pyx_RefNannyDeclarations
1553 PyObject *__pyx_t_1 = NULL;
1554 PyObject *__pyx_t_2 = NULL;
1555 PyObject *__pyx_t_3 = NULL;
1556 int __pyx_t_4;
1557 int __pyx_t_5;
1558 PyObject *__pyx_t_6 = NULL;
1559 Py_ssize_t __pyx_t_7;
1560 int __pyx_lineno = 0;
1561 const char *__pyx_filename = NULL;
1562 int __pyx_clineno = 0;
1563 __Pyx_RefNannySetupContext("__next__", 0);
1564
1565 /* "bx/arrays/bed.pyx":15
1566 *
1567 * def __next__( self ):
1568 * while True: # <<<<<<<<<<<<<<
1569 * line = self.f.readline()
1570 * if not line:
1571 */
1572 while (1) {
1573
1574 /* "bx/arrays/bed.pyx":16
1575 * def __next__( self ):
1576 * while True:
1577 * line = self.f.readline() # <<<<<<<<<<<<<<
1578 * if not line:
1579 * raise StopIteration()
1580 */
1581 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->f, __pyx_n_s_readline); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
1582 __Pyx_GOTREF(__pyx_t_2);
1583 __pyx_t_3 = NULL;
1584 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1585 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1586 if (likely(__pyx_t_3)) {
1587 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1588 __Pyx_INCREF(__pyx_t_3);
1589 __Pyx_INCREF(function);
1590 __Pyx_DECREF_SET(__pyx_t_2, function);
1591 }
1592 }
1593 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
1594 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1595 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
1596 __Pyx_GOTREF(__pyx_t_1);
1597 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1598 __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_1);
1599 __pyx_t_1 = 0;
1600
1601 /* "bx/arrays/bed.pyx":17
1602 * while True:
1603 * line = self.f.readline()
1604 * if not line: # <<<<<<<<<<<<<<
1605 * raise StopIteration()
1606 * if line.isspace():
1607 */
1608 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 17, __pyx_L1_error)
1609 __pyx_t_5 = ((!__pyx_t_4) != 0);
1610 if (unlikely(__pyx_t_5)) {
1611
1612 /* "bx/arrays/bed.pyx":18
1613 * line = self.f.readline()
1614 * if not line:
1615 * raise StopIteration() # <<<<<<<<<<<<<<
1616 * if line.isspace():
1617 * continue
1618 */
1619 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
1620 __Pyx_GOTREF(__pyx_t_1);
1621 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
1622 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1623 __PYX_ERR(0, 18, __pyx_L1_error)
1624
1625 /* "bx/arrays/bed.pyx":17
1626 * while True:
1627 * line = self.f.readline()
1628 * if not line: # <<<<<<<<<<<<<<
1629 * raise StopIteration()
1630 * if line.isspace():
1631 */
1632 }
1633
1634 /* "bx/arrays/bed.pyx":19
1635 * if not line:
1636 * raise StopIteration()
1637 * if line.isspace(): # <<<<<<<<<<<<<<
1638 * continue
1639 * if line[0] == "#":
1640 */
1641 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_isspace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
1642 __Pyx_GOTREF(__pyx_t_2);
1643 __pyx_t_3 = NULL;
1644 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1645 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1646 if (likely(__pyx_t_3)) {
1647 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1648 __Pyx_INCREF(__pyx_t_3);
1649 __Pyx_INCREF(function);
1650 __Pyx_DECREF_SET(__pyx_t_2, function);
1651 }
1652 }
1653 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
1654 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1655 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
1656 __Pyx_GOTREF(__pyx_t_1);
1657 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1658 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 19, __pyx_L1_error)
1659 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1660 if (__pyx_t_5) {
1661
1662 /* "bx/arrays/bed.pyx":20
1663 * raise StopIteration()
1664 * if line.isspace():
1665 * continue # <<<<<<<<<<<<<<
1666 * if line[0] == "#":
1667 * continue
1668 */
1669 goto __pyx_L3_continue;
1670
1671 /* "bx/arrays/bed.pyx":19
1672 * if not line:
1673 * raise StopIteration()
1674 * if line.isspace(): # <<<<<<<<<<<<<<
1675 * continue
1676 * if line[0] == "#":
1677 */
1678 }
1679
1680 /* "bx/arrays/bed.pyx":21
1681 * if line.isspace():
1682 * continue
1683 * if line[0] == "#": # <<<<<<<<<<<<<<
1684 * continue
1685 * if line[0].isalpha():
1686 */
1687 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
1688 __Pyx_GOTREF(__pyx_t_1);
1689 __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 21, __pyx_L1_error)
1690 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1691 if (__pyx_t_5) {
1692
1693 /* "bx/arrays/bed.pyx":22
1694 * continue
1695 * if line[0] == "#":
1696 * continue # <<<<<<<<<<<<<<
1697 * if line[0].isalpha():
1698 * if line.startswith( "track" ) or line.startswith( "browser" ):
1699 */
1700 goto __pyx_L3_continue;
1701
1702 /* "bx/arrays/bed.pyx":21
1703 * if line.isspace():
1704 * continue
1705 * if line[0] == "#": # <<<<<<<<<<<<<<
1706 * continue
1707 * if line[0].isalpha():
1708 */
1709 }
1710
1711 /* "bx/arrays/bed.pyx":23
1712 * if line[0] == "#":
1713 * continue
1714 * if line[0].isalpha(): # <<<<<<<<<<<<<<
1715 * if line.startswith( "track" ) or line.startswith( "browser" ):
1716 * continue
1717 */
1718 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
1719 __Pyx_GOTREF(__pyx_t_2);
1720 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isalpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
1721 __Pyx_GOTREF(__pyx_t_3);
1722 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1723 __pyx_t_2 = NULL;
1724 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
1725 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
1726 if (likely(__pyx_t_2)) {
1727 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1728 __Pyx_INCREF(__pyx_t_2);
1729 __Pyx_INCREF(function);
1730 __Pyx_DECREF_SET(__pyx_t_3, function);
1731 }
1732 }
1733 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
1734 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1735 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
1736 __Pyx_GOTREF(__pyx_t_1);
1737 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1738 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
1739 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1740 if (likely(__pyx_t_5)) {
1741
1742 /* "bx/arrays/bed.pyx":24
1743 * continue
1744 * if line[0].isalpha():
1745 * if line.startswith( "track" ) or line.startswith( "browser" ): # <<<<<<<<<<<<<<
1746 * continue
1747 *
1748 */
1749 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
1750 __Pyx_GOTREF(__pyx_t_3);
1751 __pyx_t_2 = NULL;
1752 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
1753 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
1754 if (likely(__pyx_t_2)) {
1755 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1756 __Pyx_INCREF(__pyx_t_2);
1757 __Pyx_INCREF(function);
1758 __Pyx_DECREF_SET(__pyx_t_3, function);
1759 }
1760 }
1761 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_track) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_track);
1762 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1763 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
1764 __Pyx_GOTREF(__pyx_t_1);
1765 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1766 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 24, __pyx_L1_error)
1767 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1768 if (!__pyx_t_4) {
1769 } else {
1770 __pyx_t_5 = __pyx_t_4;
1771 goto __pyx_L10_bool_binop_done;
1772 }
1773 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
1774 __Pyx_GOTREF(__pyx_t_3);
1775 __pyx_t_2 = NULL;
1776 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
1777 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
1778 if (likely(__pyx_t_2)) {
1779 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1780 __Pyx_INCREF(__pyx_t_2);
1781 __Pyx_INCREF(function);
1782 __Pyx_DECREF_SET(__pyx_t_3, function);
1783 }
1784 }
1785 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_browser) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_browser);
1786 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1787 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
1788 __Pyx_GOTREF(__pyx_t_1);
1789 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1790 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 24, __pyx_L1_error)
1791 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1792 __pyx_t_5 = __pyx_t_4;
1793 __pyx_L10_bool_binop_done:;
1794 if (__pyx_t_5) {
1795
1796 /* "bx/arrays/bed.pyx":25
1797 * if line[0].isalpha():
1798 * if line.startswith( "track" ) or line.startswith( "browser" ):
1799 * continue # <<<<<<<<<<<<<<
1800 *
1801 * feature = line.strip().split()
1802 */
1803 goto __pyx_L3_continue;
1804
1805 /* "bx/arrays/bed.pyx":24
1806 * continue
1807 * if line[0].isalpha():
1808 * if line.startswith( "track" ) or line.startswith( "browser" ): # <<<<<<<<<<<<<<
1809 * continue
1810 *
1811 */
1812 }
1813
1814 /* "bx/arrays/bed.pyx":27
1815 * continue
1816 *
1817 * feature = line.strip().split() # <<<<<<<<<<<<<<
1818 * chrom = feature[0]
1819 * chrom_start = int(feature[1])
1820 */
1821 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
1822 __Pyx_GOTREF(__pyx_t_2);
1823 __pyx_t_6 = NULL;
1824 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1825 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
1826 if (likely(__pyx_t_6)) {
1827 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1828 __Pyx_INCREF(__pyx_t_6);
1829 __Pyx_INCREF(function);
1830 __Pyx_DECREF_SET(__pyx_t_2, function);
1831 }
1832 }
1833 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
1834 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1835 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
1836 __Pyx_GOTREF(__pyx_t_3);
1837 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1838 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
1839 __Pyx_GOTREF(__pyx_t_2);
1840 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1841 __pyx_t_3 = NULL;
1842 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1843 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1844 if (likely(__pyx_t_3)) {
1845 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1846 __Pyx_INCREF(__pyx_t_3);
1847 __Pyx_INCREF(function);
1848 __Pyx_DECREF_SET(__pyx_t_2, function);
1849 }
1850 }
1851 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
1852 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1853 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
1854 __Pyx_GOTREF(__pyx_t_1);
1855 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1856 __pyx_v_feature = __pyx_t_1;
1857 __pyx_t_1 = 0;
1858
1859 /* "bx/arrays/bed.pyx":28
1860 *
1861 * feature = line.strip().split()
1862 * chrom = feature[0] # <<<<<<<<<<<<<<
1863 * chrom_start = int(feature[1])
1864 * chrom_end = int(feature[2])
1865 */
1866 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_feature, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
1867 __Pyx_GOTREF(__pyx_t_1);
1868 __pyx_v_chrom = __pyx_t_1;
1869 __pyx_t_1 = 0;
1870
1871 /* "bx/arrays/bed.pyx":29
1872 * feature = line.strip().split()
1873 * chrom = feature[0]
1874 * chrom_start = int(feature[1]) # <<<<<<<<<<<<<<
1875 * chrom_end = int(feature[2])
1876 * if len(feature) > 3:
1877 */
1878 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_feature, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1879 __Pyx_GOTREF(__pyx_t_1);
1880 __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
1881 __Pyx_GOTREF(__pyx_t_2);
1882 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1883 __pyx_v_chrom_start = __pyx_t_2;
1884 __pyx_t_2 = 0;
1885
1886 /* "bx/arrays/bed.pyx":30
1887 * chrom = feature[0]
1888 * chrom_start = int(feature[1])
1889 * chrom_end = int(feature[2]) # <<<<<<<<<<<<<<
1890 * if len(feature) > 3:
1891 * name = feature[3]
1892 */
1893 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_feature, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
1894 __Pyx_GOTREF(__pyx_t_2);
1895 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
1896 __Pyx_GOTREF(__pyx_t_1);
1897 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1898 __pyx_v_chrom_end = __pyx_t_1;
1899 __pyx_t_1 = 0;
1900
1901 /* "bx/arrays/bed.pyx":31
1902 * chrom_start = int(feature[1])
1903 * chrom_end = int(feature[2])
1904 * if len(feature) > 3: # <<<<<<<<<<<<<<
1905 * name = feature[3]
1906 * else:
1907 */
1908 __pyx_t_7 = PyObject_Length(__pyx_v_feature); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 31, __pyx_L1_error)
1909 __pyx_t_5 = ((__pyx_t_7 > 3) != 0);
1910 if (__pyx_t_5) {
1911
1912 /* "bx/arrays/bed.pyx":32
1913 * chrom_end = int(feature[2])
1914 * if len(feature) > 3:
1915 * name = feature[3] # <<<<<<<<<<<<<<
1916 * else:
1917 * name = None
1918 */
1919 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_feature, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
1920 __Pyx_GOTREF(__pyx_t_1);
1921 __pyx_v_name = __pyx_t_1;
1922 __pyx_t_1 = 0;
1923
1924 /* "bx/arrays/bed.pyx":31
1925 * chrom_start = int(feature[1])
1926 * chrom_end = int(feature[2])
1927 * if len(feature) > 3: # <<<<<<<<<<<<<<
1928 * name = feature[3]
1929 * else:
1930 */
1931 goto __pyx_L12;
1932 }
1933
1934 /* "bx/arrays/bed.pyx":34
1935 * name = feature[3]
1936 * else:
1937 * name = None # <<<<<<<<<<<<<<
1938 *
1939 * if len(feature) > 4:
1940 */
1941 /*else*/ {
1942 __Pyx_INCREF(Py_None);
1943 __pyx_v_name = Py_None;
1944 }
1945 __pyx_L12:;
1946
1947 /* "bx/arrays/bed.pyx":36
1948 * name = None
1949 *
1950 * if len(feature) > 4: # <<<<<<<<<<<<<<
1951 * score = int(feature[4])
1952 * else:
1953 */
1954 __pyx_t_7 = PyObject_Length(__pyx_v_feature); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 36, __pyx_L1_error)
1955 __pyx_t_5 = ((__pyx_t_7 > 4) != 0);
1956 if (__pyx_t_5) {
1957
1958 /* "bx/arrays/bed.pyx":37
1959 *
1960 * if len(feature) > 4:
1961 * score = int(feature[4]) # <<<<<<<<<<<<<<
1962 * else:
1963 * score = None
1964 */
1965 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_feature, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
1966 __Pyx_GOTREF(__pyx_t_1);
1967 __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
1968 __Pyx_GOTREF(__pyx_t_2);
1969 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1970 __pyx_v_score = __pyx_t_2;
1971 __pyx_t_2 = 0;
1972
1973 /* "bx/arrays/bed.pyx":36
1974 * name = None
1975 *
1976 * if len(feature) > 4: # <<<<<<<<<<<<<<
1977 * score = int(feature[4])
1978 * else:
1979 */
1980 goto __pyx_L13;
1981 }
1982
1983 /* "bx/arrays/bed.pyx":39
1984 * score = int(feature[4])
1985 * else:
1986 * score = None # <<<<<<<<<<<<<<
1987 *
1988 *
1989 */
1990 /*else*/ {
1991 __Pyx_INCREF(Py_None);
1992 __pyx_v_score = Py_None;
1993 }
1994 __pyx_L13:;
1995
1996 /* "bx/arrays/bed.pyx":42
1997 *
1998 *
1999 * return chrom, chrom_start, chrom_end, name, score # <<<<<<<<<<<<<<
2000 *
2001 * else:
2002 */
2003 __Pyx_XDECREF(__pyx_r);
2004 __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
2005 __Pyx_GOTREF(__pyx_t_2);
2006 __Pyx_INCREF(__pyx_v_chrom);
2007 __Pyx_GIVEREF(__pyx_v_chrom);
2008 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
2009 __Pyx_INCREF(__pyx_v_chrom_start);
2010 __Pyx_GIVEREF(__pyx_v_chrom_start);
2011 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_chrom_start);
2012 __Pyx_INCREF(__pyx_v_chrom_end);
2013 __Pyx_GIVEREF(__pyx_v_chrom_end);
2014 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_chrom_end);
2015 __Pyx_INCREF(__pyx_v_name);
2016 __Pyx_GIVEREF(__pyx_v_name);
2017 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_name);
2018 __Pyx_INCREF(__pyx_v_score);
2019 __Pyx_GIVEREF(__pyx_v_score);
2020 PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_score);
2021 __pyx_r = __pyx_t_2;
2022 __pyx_t_2 = 0;
2023 goto __pyx_L0;
2024
2025 /* "bx/arrays/bed.pyx":23
2026 * if line[0] == "#":
2027 * continue
2028 * if line[0].isalpha(): # <<<<<<<<<<<<<<
2029 * if line.startswith( "track" ) or line.startswith( "browser" ):
2030 * continue
2031 */
2032 }
2033
2034 /* "bx/arrays/bed.pyx":45
2035 *
2036 * else:
2037 * raise "Unexpected input line: %s" % line.strip() # <<<<<<<<<<<<<<
2038 *
2039 */
2040 /*else*/ {
2041 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
2042 __Pyx_GOTREF(__pyx_t_1);
2043 __pyx_t_3 = NULL;
2044 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2045 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2046 if (likely(__pyx_t_3)) {
2047 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2048 __Pyx_INCREF(__pyx_t_3);
2049 __Pyx_INCREF(function);
2050 __Pyx_DECREF_SET(__pyx_t_1, function);
2051 }
2052 }
2053 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
2054 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2055 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
2056 __Pyx_GOTREF(__pyx_t_2);
2057 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2058 __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unexpected_input_line_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
2059 __Pyx_GOTREF(__pyx_t_1);
2060 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2061 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2062 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2063 __PYX_ERR(0, 45, __pyx_L1_error)
2064 }
2065 __pyx_L3_continue:;
2066 }
2067
2068 /* "bx/arrays/bed.pyx":14
2069 * return self
2070 *
2071 * def __next__( self ): # <<<<<<<<<<<<<<
2072 * while True:
2073 * line = self.f.readline()
2074 */
2075
2076 /* function exit code */
2077 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2078 goto __pyx_L0;
2079 __pyx_L1_error:;
2080 __Pyx_XDECREF(__pyx_t_1);
2081 __Pyx_XDECREF(__pyx_t_2);
2082 __Pyx_XDECREF(__pyx_t_3);
2083 __Pyx_XDECREF(__pyx_t_6);
2084 __Pyx_AddTraceback("bx.arrays.bed.BedReader.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2085 __pyx_r = NULL;
2086 __pyx_L0:;
2087 __Pyx_XDECREF(__pyx_v_line);
2088 __Pyx_XDECREF(__pyx_v_feature);
2089 __Pyx_XDECREF(__pyx_v_chrom);
2090 __Pyx_XDECREF(__pyx_v_chrom_start);
2091 __Pyx_XDECREF(__pyx_v_chrom_end);
2092 __Pyx_XDECREF(__pyx_v_name);
2093 __Pyx_XDECREF(__pyx_v_score);
2094 __Pyx_XGIVEREF(__pyx_r);
2095 __Pyx_RefNannyFinishContext();
2096 return __pyx_r;
2097 }
2098
2099 /* "(tree fragment)":1
2100 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
2101 * cdef tuple state
2102 * cdef object _dict
2103 */
2104
2105 /* Python wrapper */
2106 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2bx_6arrays_3bed_9BedReader_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2107 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2108 PyObject *__pyx_r = 0;
2109 __Pyx_RefNannyDeclarations
2110 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
2111 __pyx_r = __pyx_pf_2bx_6arrays_3bed_9BedReader_6__reduce_cython__(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self));
2112
2113 /* function exit code */
2114 __Pyx_RefNannyFinishContext();
2115 return __pyx_r;
2116 }
2117
__pyx_pf_2bx_6arrays_3bed_9BedReader_6__reduce_cython__(struct __pyx_obj_2bx_6arrays_3bed_BedReader * __pyx_v_self)2118 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_6__reduce_cython__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self) {
2119 PyObject *__pyx_v_state = 0;
2120 PyObject *__pyx_v__dict = 0;
2121 int __pyx_v_use_setstate;
2122 PyObject *__pyx_r = NULL;
2123 __Pyx_RefNannyDeclarations
2124 PyObject *__pyx_t_1 = NULL;
2125 int __pyx_t_2;
2126 int __pyx_t_3;
2127 PyObject *__pyx_t_4 = NULL;
2128 PyObject *__pyx_t_5 = NULL;
2129 int __pyx_lineno = 0;
2130 const char *__pyx_filename = NULL;
2131 int __pyx_clineno = 0;
2132 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
2133
2134 /* "(tree fragment)":5
2135 * cdef object _dict
2136 * cdef bint use_setstate
2137 * state = (self.f,) # <<<<<<<<<<<<<<
2138 * _dict = getattr(self, '__dict__', None)
2139 * if _dict is not None:
2140 */
2141 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
2142 __Pyx_GOTREF(__pyx_t_1);
2143 __Pyx_INCREF(__pyx_v_self->f);
2144 __Pyx_GIVEREF(__pyx_v_self->f);
2145 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->f);
2146 __pyx_v_state = ((PyObject*)__pyx_t_1);
2147 __pyx_t_1 = 0;
2148
2149 /* "(tree fragment)":6
2150 * cdef bint use_setstate
2151 * state = (self.f,)
2152 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
2153 * if _dict is not None:
2154 * state += (_dict,)
2155 */
2156 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
2157 __Pyx_GOTREF(__pyx_t_1);
2158 __pyx_v__dict = __pyx_t_1;
2159 __pyx_t_1 = 0;
2160
2161 /* "(tree fragment)":7
2162 * state = (self.f,)
2163 * _dict = getattr(self, '__dict__', None)
2164 * if _dict is not None: # <<<<<<<<<<<<<<
2165 * state += (_dict,)
2166 * use_setstate = True
2167 */
2168 __pyx_t_2 = (__pyx_v__dict != Py_None);
2169 __pyx_t_3 = (__pyx_t_2 != 0);
2170 if (__pyx_t_3) {
2171
2172 /* "(tree fragment)":8
2173 * _dict = getattr(self, '__dict__', None)
2174 * if _dict is not None:
2175 * state += (_dict,) # <<<<<<<<<<<<<<
2176 * use_setstate = True
2177 * else:
2178 */
2179 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
2180 __Pyx_GOTREF(__pyx_t_1);
2181 __Pyx_INCREF(__pyx_v__dict);
2182 __Pyx_GIVEREF(__pyx_v__dict);
2183 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
2184 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
2185 __Pyx_GOTREF(__pyx_t_4);
2186 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2187 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
2188 __pyx_t_4 = 0;
2189
2190 /* "(tree fragment)":9
2191 * if _dict is not None:
2192 * state += (_dict,)
2193 * use_setstate = True # <<<<<<<<<<<<<<
2194 * else:
2195 * use_setstate = self.f is not None
2196 */
2197 __pyx_v_use_setstate = 1;
2198
2199 /* "(tree fragment)":7
2200 * state = (self.f,)
2201 * _dict = getattr(self, '__dict__', None)
2202 * if _dict is not None: # <<<<<<<<<<<<<<
2203 * state += (_dict,)
2204 * use_setstate = True
2205 */
2206 goto __pyx_L3;
2207 }
2208
2209 /* "(tree fragment)":11
2210 * use_setstate = True
2211 * else:
2212 * use_setstate = self.f is not None # <<<<<<<<<<<<<<
2213 * if use_setstate:
2214 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, None), state
2215 */
2216 /*else*/ {
2217 __pyx_t_3 = (__pyx_v_self->f != Py_None);
2218 __pyx_v_use_setstate = __pyx_t_3;
2219 }
2220 __pyx_L3:;
2221
2222 /* "(tree fragment)":12
2223 * else:
2224 * use_setstate = self.f is not None
2225 * if use_setstate: # <<<<<<<<<<<<<<
2226 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, None), state
2227 * else:
2228 */
2229 __pyx_t_3 = (__pyx_v_use_setstate != 0);
2230 if (__pyx_t_3) {
2231
2232 /* "(tree fragment)":13
2233 * use_setstate = self.f is not None
2234 * if use_setstate:
2235 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, None), state # <<<<<<<<<<<<<<
2236 * else:
2237 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, state)
2238 */
2239 __Pyx_XDECREF(__pyx_r);
2240 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BedReader); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
2241 __Pyx_GOTREF(__pyx_t_4);
2242 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
2243 __Pyx_GOTREF(__pyx_t_1);
2244 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2245 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2246 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2247 __Pyx_INCREF(__pyx_int_150607053);
2248 __Pyx_GIVEREF(__pyx_int_150607053);
2249 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_150607053);
2250 __Pyx_INCREF(Py_None);
2251 __Pyx_GIVEREF(Py_None);
2252 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
2253 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
2254 __Pyx_GOTREF(__pyx_t_5);
2255 __Pyx_GIVEREF(__pyx_t_4);
2256 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
2257 __Pyx_GIVEREF(__pyx_t_1);
2258 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
2259 __Pyx_INCREF(__pyx_v_state);
2260 __Pyx_GIVEREF(__pyx_v_state);
2261 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
2262 __pyx_t_4 = 0;
2263 __pyx_t_1 = 0;
2264 __pyx_r = __pyx_t_5;
2265 __pyx_t_5 = 0;
2266 goto __pyx_L0;
2267
2268 /* "(tree fragment)":12
2269 * else:
2270 * use_setstate = self.f is not None
2271 * if use_setstate: # <<<<<<<<<<<<<<
2272 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, None), state
2273 * else:
2274 */
2275 }
2276
2277 /* "(tree fragment)":15
2278 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, None), state
2279 * else:
2280 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, state) # <<<<<<<<<<<<<<
2281 * def __setstate_cython__(self, __pyx_state):
2282 * __pyx_unpickle_BedReader__set_state(self, __pyx_state)
2283 */
2284 /*else*/ {
2285 __Pyx_XDECREF(__pyx_r);
2286 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_BedReader); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
2287 __Pyx_GOTREF(__pyx_t_5);
2288 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
2289 __Pyx_GOTREF(__pyx_t_1);
2290 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2291 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2292 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2293 __Pyx_INCREF(__pyx_int_150607053);
2294 __Pyx_GIVEREF(__pyx_int_150607053);
2295 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_150607053);
2296 __Pyx_INCREF(__pyx_v_state);
2297 __Pyx_GIVEREF(__pyx_v_state);
2298 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
2299 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
2300 __Pyx_GOTREF(__pyx_t_4);
2301 __Pyx_GIVEREF(__pyx_t_5);
2302 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
2303 __Pyx_GIVEREF(__pyx_t_1);
2304 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
2305 __pyx_t_5 = 0;
2306 __pyx_t_1 = 0;
2307 __pyx_r = __pyx_t_4;
2308 __pyx_t_4 = 0;
2309 goto __pyx_L0;
2310 }
2311
2312 /* "(tree fragment)":1
2313 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
2314 * cdef tuple state
2315 * cdef object _dict
2316 */
2317
2318 /* function exit code */
2319 __pyx_L1_error:;
2320 __Pyx_XDECREF(__pyx_t_1);
2321 __Pyx_XDECREF(__pyx_t_4);
2322 __Pyx_XDECREF(__pyx_t_5);
2323 __Pyx_AddTraceback("bx.arrays.bed.BedReader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2324 __pyx_r = NULL;
2325 __pyx_L0:;
2326 __Pyx_XDECREF(__pyx_v_state);
2327 __Pyx_XDECREF(__pyx_v__dict);
2328 __Pyx_XGIVEREF(__pyx_r);
2329 __Pyx_RefNannyFinishContext();
2330 return __pyx_r;
2331 }
2332
2333 /* "(tree fragment)":16
2334 * else:
2335 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, state)
2336 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
2337 * __pyx_unpickle_BedReader__set_state(self, __pyx_state)
2338 */
2339
2340 /* Python wrapper */
2341 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_2bx_6arrays_3bed_9BedReader_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)2342 static PyObject *__pyx_pw_2bx_6arrays_3bed_9BedReader_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
2343 PyObject *__pyx_r = 0;
2344 __Pyx_RefNannyDeclarations
2345 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
2346 __pyx_r = __pyx_pf_2bx_6arrays_3bed_9BedReader_8__setstate_cython__(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
2347
2348 /* function exit code */
2349 __Pyx_RefNannyFinishContext();
2350 return __pyx_r;
2351 }
2352
__pyx_pf_2bx_6arrays_3bed_9BedReader_8__setstate_cython__(struct __pyx_obj_2bx_6arrays_3bed_BedReader * __pyx_v_self,PyObject * __pyx_v___pyx_state)2353 static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_8__setstate_cython__(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
2354 PyObject *__pyx_r = NULL;
2355 __Pyx_RefNannyDeclarations
2356 PyObject *__pyx_t_1 = NULL;
2357 int __pyx_lineno = 0;
2358 const char *__pyx_filename = NULL;
2359 int __pyx_clineno = 0;
2360 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
2361
2362 /* "(tree fragment)":17
2363 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, state)
2364 * def __setstate_cython__(self, __pyx_state):
2365 * __pyx_unpickle_BedReader__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
2366 */
2367 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
2368 __pyx_t_1 = __pyx_f_2bx_6arrays_3bed___pyx_unpickle_BedReader__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
2369 __Pyx_GOTREF(__pyx_t_1);
2370 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2371
2372 /* "(tree fragment)":16
2373 * else:
2374 * return __pyx_unpickle_BedReader, (type(self), 0x8fa14cd, state)
2375 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
2376 * __pyx_unpickle_BedReader__set_state(self, __pyx_state)
2377 */
2378
2379 /* function exit code */
2380 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2381 goto __pyx_L0;
2382 __pyx_L1_error:;
2383 __Pyx_XDECREF(__pyx_t_1);
2384 __Pyx_AddTraceback("bx.arrays.bed.BedReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2385 __pyx_r = NULL;
2386 __pyx_L0:;
2387 __Pyx_XGIVEREF(__pyx_r);
2388 __Pyx_RefNannyFinishContext();
2389 return __pyx_r;
2390 }
2391
2392 /* "(tree fragment)":1
2393 * def __pyx_unpickle_BedReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
2394 * cdef object __pyx_PickleError
2395 * cdef object __pyx_result
2396 */
2397
2398 /* Python wrapper */
2399 static PyObject *__pyx_pw_2bx_6arrays_3bed_1__pyx_unpickle_BedReader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2400 static PyMethodDef __pyx_mdef_2bx_6arrays_3bed_1__pyx_unpickle_BedReader = {"__pyx_unpickle_BedReader", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2bx_6arrays_3bed_1__pyx_unpickle_BedReader, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2bx_6arrays_3bed_1__pyx_unpickle_BedReader(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2401 static PyObject *__pyx_pw_2bx_6arrays_3bed_1__pyx_unpickle_BedReader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2402 PyObject *__pyx_v___pyx_type = 0;
2403 long __pyx_v___pyx_checksum;
2404 PyObject *__pyx_v___pyx_state = 0;
2405 int __pyx_lineno = 0;
2406 const char *__pyx_filename = NULL;
2407 int __pyx_clineno = 0;
2408 PyObject *__pyx_r = 0;
2409 __Pyx_RefNannyDeclarations
2410 __Pyx_RefNannySetupContext("__pyx_unpickle_BedReader (wrapper)", 0);
2411 {
2412 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
2413 PyObject* values[3] = {0,0,0};
2414 if (unlikely(__pyx_kwds)) {
2415 Py_ssize_t kw_args;
2416 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2417 switch (pos_args) {
2418 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2419 CYTHON_FALLTHROUGH;
2420 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2421 CYTHON_FALLTHROUGH;
2422 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2423 CYTHON_FALLTHROUGH;
2424 case 0: break;
2425 default: goto __pyx_L5_argtuple_error;
2426 }
2427 kw_args = PyDict_Size(__pyx_kwds);
2428 switch (pos_args) {
2429 case 0:
2430 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
2431 else goto __pyx_L5_argtuple_error;
2432 CYTHON_FALLTHROUGH;
2433 case 1:
2434 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
2435 else {
2436 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BedReader", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
2437 }
2438 CYTHON_FALLTHROUGH;
2439 case 2:
2440 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
2441 else {
2442 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BedReader", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
2443 }
2444 }
2445 if (unlikely(kw_args > 0)) {
2446 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BedReader") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
2447 }
2448 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2449 goto __pyx_L5_argtuple_error;
2450 } else {
2451 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2452 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2453 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2454 }
2455 __pyx_v___pyx_type = values[0];
2456 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
2457 __pyx_v___pyx_state = values[2];
2458 }
2459 goto __pyx_L4_argument_unpacking_done;
2460 __pyx_L5_argtuple_error:;
2461 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BedReader", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
2462 __pyx_L3_error:;
2463 __Pyx_AddTraceback("bx.arrays.bed.__pyx_unpickle_BedReader", __pyx_clineno, __pyx_lineno, __pyx_filename);
2464 __Pyx_RefNannyFinishContext();
2465 return NULL;
2466 __pyx_L4_argument_unpacking_done:;
2467 __pyx_r = __pyx_pf_2bx_6arrays_3bed___pyx_unpickle_BedReader(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
2468
2469 /* function exit code */
2470 __Pyx_RefNannyFinishContext();
2471 return __pyx_r;
2472 }
2473
__pyx_pf_2bx_6arrays_3bed___pyx_unpickle_BedReader(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)2474 static PyObject *__pyx_pf_2bx_6arrays_3bed___pyx_unpickle_BedReader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
2475 PyObject *__pyx_v___pyx_PickleError = 0;
2476 PyObject *__pyx_v___pyx_result = 0;
2477 PyObject *__pyx_r = NULL;
2478 __Pyx_RefNannyDeclarations
2479 int __pyx_t_1;
2480 PyObject *__pyx_t_2 = NULL;
2481 PyObject *__pyx_t_3 = NULL;
2482 PyObject *__pyx_t_4 = NULL;
2483 PyObject *__pyx_t_5 = NULL;
2484 int __pyx_t_6;
2485 int __pyx_lineno = 0;
2486 const char *__pyx_filename = NULL;
2487 int __pyx_clineno = 0;
2488 __Pyx_RefNannySetupContext("__pyx_unpickle_BedReader", 0);
2489
2490 /* "(tree fragment)":4
2491 * cdef object __pyx_PickleError
2492 * cdef object __pyx_result
2493 * if __pyx_checksum != 0x8fa14cd: # <<<<<<<<<<<<<<
2494 * from pickle import PickleError as __pyx_PickleError
2495 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum)
2496 */
2497 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x8fa14cd) != 0);
2498 if (__pyx_t_1) {
2499
2500 /* "(tree fragment)":5
2501 * cdef object __pyx_result
2502 * if __pyx_checksum != 0x8fa14cd:
2503 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
2504 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum)
2505 * __pyx_result = BedReader.__new__(__pyx_type)
2506 */
2507 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
2508 __Pyx_GOTREF(__pyx_t_2);
2509 __Pyx_INCREF(__pyx_n_s_PickleError);
2510 __Pyx_GIVEREF(__pyx_n_s_PickleError);
2511 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
2512 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
2513 __Pyx_GOTREF(__pyx_t_3);
2514 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2515 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
2516 __Pyx_GOTREF(__pyx_t_2);
2517 __Pyx_INCREF(__pyx_t_2);
2518 __pyx_v___pyx_PickleError = __pyx_t_2;
2519 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2520 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2521
2522 /* "(tree fragment)":6
2523 * if __pyx_checksum != 0x8fa14cd:
2524 * from pickle import PickleError as __pyx_PickleError
2525 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum) # <<<<<<<<<<<<<<
2526 * __pyx_result = BedReader.__new__(__pyx_type)
2527 * if __pyx_state is not None:
2528 */
2529 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
2530 __Pyx_GOTREF(__pyx_t_2);
2531 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x8f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
2532 __Pyx_GOTREF(__pyx_t_4);
2533 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2534 __Pyx_INCREF(__pyx_v___pyx_PickleError);
2535 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
2536 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2537 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
2538 if (likely(__pyx_t_5)) {
2539 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2540 __Pyx_INCREF(__pyx_t_5);
2541 __Pyx_INCREF(function);
2542 __Pyx_DECREF_SET(__pyx_t_2, function);
2543 }
2544 }
2545 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
2546 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2547 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2548 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
2549 __Pyx_GOTREF(__pyx_t_3);
2550 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2551 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2552 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2553 __PYX_ERR(1, 6, __pyx_L1_error)
2554
2555 /* "(tree fragment)":4
2556 * cdef object __pyx_PickleError
2557 * cdef object __pyx_result
2558 * if __pyx_checksum != 0x8fa14cd: # <<<<<<<<<<<<<<
2559 * from pickle import PickleError as __pyx_PickleError
2560 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum)
2561 */
2562 }
2563
2564 /* "(tree fragment)":7
2565 * from pickle import PickleError as __pyx_PickleError
2566 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum)
2567 * __pyx_result = BedReader.__new__(__pyx_type) # <<<<<<<<<<<<<<
2568 * if __pyx_state is not None:
2569 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state)
2570 */
2571 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_2bx_6arrays_3bed_BedReader), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
2572 __Pyx_GOTREF(__pyx_t_2);
2573 __pyx_t_4 = NULL;
2574 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2575 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
2576 if (likely(__pyx_t_4)) {
2577 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2578 __Pyx_INCREF(__pyx_t_4);
2579 __Pyx_INCREF(function);
2580 __Pyx_DECREF_SET(__pyx_t_2, function);
2581 }
2582 }
2583 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
2584 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2585 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
2586 __Pyx_GOTREF(__pyx_t_3);
2587 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2588 __pyx_v___pyx_result = __pyx_t_3;
2589 __pyx_t_3 = 0;
2590
2591 /* "(tree fragment)":8
2592 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum)
2593 * __pyx_result = BedReader.__new__(__pyx_type)
2594 * if __pyx_state is not None: # <<<<<<<<<<<<<<
2595 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state)
2596 * return __pyx_result
2597 */
2598 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
2599 __pyx_t_6 = (__pyx_t_1 != 0);
2600 if (__pyx_t_6) {
2601
2602 /* "(tree fragment)":9
2603 * __pyx_result = BedReader.__new__(__pyx_type)
2604 * if __pyx_state is not None:
2605 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
2606 * return __pyx_result
2607 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state):
2608 */
2609 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
2610 __pyx_t_3 = __pyx_f_2bx_6arrays_3bed___pyx_unpickle_BedReader__set_state(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
2611 __Pyx_GOTREF(__pyx_t_3);
2612 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2613
2614 /* "(tree fragment)":8
2615 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8fa14cd = (f))" % __pyx_checksum)
2616 * __pyx_result = BedReader.__new__(__pyx_type)
2617 * if __pyx_state is not None: # <<<<<<<<<<<<<<
2618 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state)
2619 * return __pyx_result
2620 */
2621 }
2622
2623 /* "(tree fragment)":10
2624 * if __pyx_state is not None:
2625 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state)
2626 * return __pyx_result # <<<<<<<<<<<<<<
2627 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state):
2628 * __pyx_result.f = __pyx_state[0]
2629 */
2630 __Pyx_XDECREF(__pyx_r);
2631 __Pyx_INCREF(__pyx_v___pyx_result);
2632 __pyx_r = __pyx_v___pyx_result;
2633 goto __pyx_L0;
2634
2635 /* "(tree fragment)":1
2636 * def __pyx_unpickle_BedReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
2637 * cdef object __pyx_PickleError
2638 * cdef object __pyx_result
2639 */
2640
2641 /* function exit code */
2642 __pyx_L1_error:;
2643 __Pyx_XDECREF(__pyx_t_2);
2644 __Pyx_XDECREF(__pyx_t_3);
2645 __Pyx_XDECREF(__pyx_t_4);
2646 __Pyx_XDECREF(__pyx_t_5);
2647 __Pyx_AddTraceback("bx.arrays.bed.__pyx_unpickle_BedReader", __pyx_clineno, __pyx_lineno, __pyx_filename);
2648 __pyx_r = NULL;
2649 __pyx_L0:;
2650 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
2651 __Pyx_XDECREF(__pyx_v___pyx_result);
2652 __Pyx_XGIVEREF(__pyx_r);
2653 __Pyx_RefNannyFinishContext();
2654 return __pyx_r;
2655 }
2656
2657 /* "(tree fragment)":11
2658 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state)
2659 * return __pyx_result
2660 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
2661 * __pyx_result.f = __pyx_state[0]
2662 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
2663 */
2664
__pyx_f_2bx_6arrays_3bed___pyx_unpickle_BedReader__set_state(struct __pyx_obj_2bx_6arrays_3bed_BedReader * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)2665 static PyObject *__pyx_f_2bx_6arrays_3bed___pyx_unpickle_BedReader__set_state(struct __pyx_obj_2bx_6arrays_3bed_BedReader *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
2666 PyObject *__pyx_r = NULL;
2667 __Pyx_RefNannyDeclarations
2668 PyObject *__pyx_t_1 = NULL;
2669 int __pyx_t_2;
2670 Py_ssize_t __pyx_t_3;
2671 int __pyx_t_4;
2672 int __pyx_t_5;
2673 PyObject *__pyx_t_6 = NULL;
2674 PyObject *__pyx_t_7 = NULL;
2675 PyObject *__pyx_t_8 = NULL;
2676 int __pyx_lineno = 0;
2677 const char *__pyx_filename = NULL;
2678 int __pyx_clineno = 0;
2679 __Pyx_RefNannySetupContext("__pyx_unpickle_BedReader__set_state", 0);
2680
2681 /* "(tree fragment)":12
2682 * return __pyx_result
2683 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state):
2684 * __pyx_result.f = __pyx_state[0] # <<<<<<<<<<<<<<
2685 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
2686 * __pyx_result.__dict__.update(__pyx_state[1])
2687 */
2688 if (unlikely(__pyx_v___pyx_state == Py_None)) {
2689 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
2690 __PYX_ERR(1, 12, __pyx_L1_error)
2691 }
2692 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
2693 __Pyx_GOTREF(__pyx_t_1);
2694 __Pyx_GIVEREF(__pyx_t_1);
2695 __Pyx_GOTREF(__pyx_v___pyx_result->f);
2696 __Pyx_DECREF(__pyx_v___pyx_result->f);
2697 __pyx_v___pyx_result->f = __pyx_t_1;
2698 __pyx_t_1 = 0;
2699
2700 /* "(tree fragment)":13
2701 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state):
2702 * __pyx_result.f = __pyx_state[0]
2703 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
2704 * __pyx_result.__dict__.update(__pyx_state[1])
2705 */
2706 if (unlikely(__pyx_v___pyx_state == Py_None)) {
2707 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
2708 __PYX_ERR(1, 13, __pyx_L1_error)
2709 }
2710 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
2711 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
2712 if (__pyx_t_4) {
2713 } else {
2714 __pyx_t_2 = __pyx_t_4;
2715 goto __pyx_L4_bool_binop_done;
2716 }
2717 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
2718 __pyx_t_5 = (__pyx_t_4 != 0);
2719 __pyx_t_2 = __pyx_t_5;
2720 __pyx_L4_bool_binop_done:;
2721 if (__pyx_t_2) {
2722
2723 /* "(tree fragment)":14
2724 * __pyx_result.f = __pyx_state[0]
2725 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
2726 * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
2727 */
2728 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
2729 __Pyx_GOTREF(__pyx_t_6);
2730 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
2731 __Pyx_GOTREF(__pyx_t_7);
2732 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2733 if (unlikely(__pyx_v___pyx_state == Py_None)) {
2734 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
2735 __PYX_ERR(1, 14, __pyx_L1_error)
2736 }
2737 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
2738 __Pyx_GOTREF(__pyx_t_6);
2739 __pyx_t_8 = NULL;
2740 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
2741 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
2742 if (likely(__pyx_t_8)) {
2743 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2744 __Pyx_INCREF(__pyx_t_8);
2745 __Pyx_INCREF(function);
2746 __Pyx_DECREF_SET(__pyx_t_7, function);
2747 }
2748 }
2749 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
2750 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2751 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2752 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
2753 __Pyx_GOTREF(__pyx_t_1);
2754 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2755 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2756
2757 /* "(tree fragment)":13
2758 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state):
2759 * __pyx_result.f = __pyx_state[0]
2760 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
2761 * __pyx_result.__dict__.update(__pyx_state[1])
2762 */
2763 }
2764
2765 /* "(tree fragment)":11
2766 * __pyx_unpickle_BedReader__set_state(<BedReader> __pyx_result, __pyx_state)
2767 * return __pyx_result
2768 * cdef __pyx_unpickle_BedReader__set_state(BedReader __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
2769 * __pyx_result.f = __pyx_state[0]
2770 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
2771 */
2772
2773 /* function exit code */
2774 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2775 goto __pyx_L0;
2776 __pyx_L1_error:;
2777 __Pyx_XDECREF(__pyx_t_1);
2778 __Pyx_XDECREF(__pyx_t_6);
2779 __Pyx_XDECREF(__pyx_t_7);
2780 __Pyx_XDECREF(__pyx_t_8);
2781 __Pyx_AddTraceback("bx.arrays.bed.__pyx_unpickle_BedReader__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
2782 __pyx_r = 0;
2783 __pyx_L0:;
2784 __Pyx_XGIVEREF(__pyx_r);
2785 __Pyx_RefNannyFinishContext();
2786 return __pyx_r;
2787 }
2788
__pyx_tp_new_2bx_6arrays_3bed_BedReader(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)2789 static PyObject *__pyx_tp_new_2bx_6arrays_3bed_BedReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
2790 struct __pyx_obj_2bx_6arrays_3bed_BedReader *p;
2791 PyObject *o;
2792 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
2793 o = (*t->tp_alloc)(t, 0);
2794 } else {
2795 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
2796 }
2797 if (unlikely(!o)) return 0;
2798 p = ((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o);
2799 p->f = Py_None; Py_INCREF(Py_None);
2800 return o;
2801 }
2802
__pyx_tp_dealloc_2bx_6arrays_3bed_BedReader(PyObject * o)2803 static void __pyx_tp_dealloc_2bx_6arrays_3bed_BedReader(PyObject *o) {
2804 struct __pyx_obj_2bx_6arrays_3bed_BedReader *p = (struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o;
2805 #if CYTHON_USE_TP_FINALIZE
2806 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
2807 if (PyObject_CallFinalizerFromDealloc(o)) return;
2808 }
2809 #endif
2810 PyObject_GC_UnTrack(o);
2811 Py_CLEAR(p->f);
2812 (*Py_TYPE(o)->tp_free)(o);
2813 }
2814
__pyx_tp_traverse_2bx_6arrays_3bed_BedReader(PyObject * o,visitproc v,void * a)2815 static int __pyx_tp_traverse_2bx_6arrays_3bed_BedReader(PyObject *o, visitproc v, void *a) {
2816 int e;
2817 struct __pyx_obj_2bx_6arrays_3bed_BedReader *p = (struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o;
2818 if (p->f) {
2819 e = (*v)(p->f, a); if (e) return e;
2820 }
2821 return 0;
2822 }
2823
__pyx_tp_clear_2bx_6arrays_3bed_BedReader(PyObject * o)2824 static int __pyx_tp_clear_2bx_6arrays_3bed_BedReader(PyObject *o) {
2825 PyObject* tmp;
2826 struct __pyx_obj_2bx_6arrays_3bed_BedReader *p = (struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o;
2827 tmp = ((PyObject*)p->f);
2828 p->f = Py_None; Py_INCREF(Py_None);
2829 Py_XDECREF(tmp);
2830 return 0;
2831 }
2832
__pyx_specialmethod___pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__(PyObject * self,CYTHON_UNUSED PyObject * arg)2833 static PyObject *__pyx_specialmethod___pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__(self);}
2834
2835 static PyMethodDef __pyx_methods_2bx_6arrays_3bed_BedReader[] = {
2836 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__, METH_NOARGS|METH_COEXIST, 0},
2837 {"__reduce_cython__", (PyCFunction)__pyx_pw_2bx_6arrays_3bed_9BedReader_7__reduce_cython__, METH_NOARGS, 0},
2838 {"__setstate_cython__", (PyCFunction)__pyx_pw_2bx_6arrays_3bed_9BedReader_9__setstate_cython__, METH_O, 0},
2839 {0, 0, 0, 0}
2840 };
2841
2842 static PyTypeObject __pyx_type_2bx_6arrays_3bed_BedReader = {
2843 PyVarObject_HEAD_INIT(0, 0)
2844 "bx.arrays.bed.BedReader", /*tp_name*/
2845 sizeof(struct __pyx_obj_2bx_6arrays_3bed_BedReader), /*tp_basicsize*/
2846 0, /*tp_itemsize*/
2847 __pyx_tp_dealloc_2bx_6arrays_3bed_BedReader, /*tp_dealloc*/
2848 #if PY_VERSION_HEX < 0x030800b4
2849 0, /*tp_print*/
2850 #endif
2851 #if PY_VERSION_HEX >= 0x030800b4
2852 0, /*tp_vectorcall_offset*/
2853 #endif
2854 0, /*tp_getattr*/
2855 0, /*tp_setattr*/
2856 #if PY_MAJOR_VERSION < 3
2857 0, /*tp_compare*/
2858 #endif
2859 #if PY_MAJOR_VERSION >= 3
2860 0, /*tp_as_async*/
2861 #endif
2862 0, /*tp_repr*/
2863 0, /*tp_as_number*/
2864 0, /*tp_as_sequence*/
2865 0, /*tp_as_mapping*/
2866 0, /*tp_hash*/
2867 0, /*tp_call*/
2868 0, /*tp_str*/
2869 0, /*tp_getattro*/
2870 0, /*tp_setattro*/
2871 0, /*tp_as_buffer*/
2872 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
2873 0, /*tp_doc*/
2874 __pyx_tp_traverse_2bx_6arrays_3bed_BedReader, /*tp_traverse*/
2875 __pyx_tp_clear_2bx_6arrays_3bed_BedReader, /*tp_clear*/
2876 0, /*tp_richcompare*/
2877 0, /*tp_weaklistoffset*/
2878 __pyx_pw_2bx_6arrays_3bed_9BedReader_3__iter__, /*tp_iter*/
2879 __pyx_pw_2bx_6arrays_3bed_9BedReader_5__next__, /*tp_iternext*/
2880 __pyx_methods_2bx_6arrays_3bed_BedReader, /*tp_methods*/
2881 0, /*tp_members*/
2882 0, /*tp_getset*/
2883 0, /*tp_base*/
2884 0, /*tp_dict*/
2885 0, /*tp_descr_get*/
2886 0, /*tp_descr_set*/
2887 0, /*tp_dictoffset*/
2888 __pyx_pw_2bx_6arrays_3bed_9BedReader_1__init__, /*tp_init*/
2889 0, /*tp_alloc*/
2890 __pyx_tp_new_2bx_6arrays_3bed_BedReader, /*tp_new*/
2891 0, /*tp_free*/
2892 0, /*tp_is_gc*/
2893 0, /*tp_bases*/
2894 0, /*tp_mro*/
2895 0, /*tp_cache*/
2896 0, /*tp_subclasses*/
2897 0, /*tp_weaklist*/
2898 0, /*tp_del*/
2899 0, /*tp_version_tag*/
2900 #if PY_VERSION_HEX >= 0x030400a1
2901 0, /*tp_finalize*/
2902 #endif
2903 #if PY_VERSION_HEX >= 0x030800b1
2904 0, /*tp_vectorcall*/
2905 #endif
2906 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
2907 0, /*tp_print*/
2908 #endif
2909 #if PY_VERSION_HEX >= 0x030B00A2
2910 0, /*tp_inline_values_offset*/
2911 #endif
2912 };
2913
2914 static PyMethodDef __pyx_methods[] = {
2915 {0, 0, 0, 0}
2916 };
2917
2918 #if PY_MAJOR_VERSION >= 3
2919 #if CYTHON_PEP489_MULTI_PHASE_INIT
2920 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
2921 static int __pyx_pymod_exec_bed(PyObject* module); /*proto*/
2922 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
2923 {Py_mod_create, (void*)__pyx_pymod_create},
2924 {Py_mod_exec, (void*)__pyx_pymod_exec_bed},
2925 {0, NULL}
2926 };
2927 #endif
2928
2929 static struct PyModuleDef __pyx_moduledef = {
2930 PyModuleDef_HEAD_INIT,
2931 "bed",
2932 __pyx_k_Iterator_for_the_BED_format_htt, /* m_doc */
2933 #if CYTHON_PEP489_MULTI_PHASE_INIT
2934 0, /* m_size */
2935 #else
2936 -1, /* m_size */
2937 #endif
2938 __pyx_methods /* m_methods */,
2939 #if CYTHON_PEP489_MULTI_PHASE_INIT
2940 __pyx_moduledef_slots, /* m_slots */
2941 #else
2942 NULL, /* m_reload */
2943 #endif
2944 NULL, /* m_traverse */
2945 NULL, /* m_clear */
2946 NULL /* m_free */
2947 };
2948 #endif
2949 #ifndef CYTHON_SMALL_CODE
2950 #if defined(__clang__)
2951 #define CYTHON_SMALL_CODE
2952 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
2953 #define CYTHON_SMALL_CODE __attribute__((cold))
2954 #else
2955 #define CYTHON_SMALL_CODE
2956 #endif
2957 #endif
2958
2959 static __Pyx_StringTabEntry __pyx_string_tab[] = {
2960 {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
2961 {&__pyx_n_s_BedReader, __pyx_k_BedReader, sizeof(__pyx_k_BedReader), 0, 0, 1, 1},
2962 {&__pyx_kp_s_Incompatible_checksums_s_vs_0x8f, __pyx_k_Incompatible_checksums_s_vs_0x8f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x8f), 0, 0, 1, 0},
2963 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
2964 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
2965 {&__pyx_kp_s_Unexpected_input_line_s, __pyx_k_Unexpected_input_line_s, sizeof(__pyx_k_Unexpected_input_line_s), 0, 0, 1, 0},
2966 {&__pyx_n_s_browser, __pyx_k_browser, sizeof(__pyx_k_browser), 0, 0, 1, 1},
2967 {&__pyx_n_s_bx_arrays_bed, __pyx_k_bx_arrays_bed, sizeof(__pyx_k_bx_arrays_bed), 0, 0, 1, 1},
2968 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
2969 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
2970 {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
2971 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
2972 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
2973 {&__pyx_n_s_isalpha, __pyx_k_isalpha, sizeof(__pyx_k_isalpha), 0, 0, 1, 1},
2974 {&__pyx_n_s_isspace, __pyx_k_isspace, sizeof(__pyx_k_isspace), 0, 0, 1, 1},
2975 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
2976 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
2977 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
2978 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
2979 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
2980 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
2981 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
2982 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
2983 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
2984 {&__pyx_n_s_pyx_unpickle_BedReader, __pyx_k_pyx_unpickle_BedReader, sizeof(__pyx_k_pyx_unpickle_BedReader), 0, 0, 1, 1},
2985 {&__pyx_n_s_readline, __pyx_k_readline, sizeof(__pyx_k_readline), 0, 0, 1, 1},
2986 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
2987 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
2988 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
2989 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
2990 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
2991 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
2992 {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
2993 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
2994 {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
2995 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
2996 {&__pyx_n_s_track, __pyx_k_track, sizeof(__pyx_k_track), 0, 0, 1, 1},
2997 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
2998 {0, 0, 0, 0, 0, 0, 0}
2999 };
__Pyx_InitCachedBuiltins(void)3000 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
3001 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 18, __pyx_L1_error)
3002 return 0;
3003 __pyx_L1_error:;
3004 return -1;
3005 }
3006
__Pyx_InitCachedConstants(void)3007 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
3008 __Pyx_RefNannyDeclarations
3009 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
3010
3011 /* "(tree fragment)":1
3012 * def __pyx_unpickle_BedReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
3013 * cdef object __pyx_PickleError
3014 * cdef object __pyx_result
3015 */
3016 __pyx_tuple__2 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 1, __pyx_L1_error)
3017 __Pyx_GOTREF(__pyx_tuple__2);
3018 __Pyx_GIVEREF(__pyx_tuple__2);
3019 __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_BedReader, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 1, __pyx_L1_error)
3020 __Pyx_RefNannyFinishContext();
3021 return 0;
3022 __pyx_L1_error:;
3023 __Pyx_RefNannyFinishContext();
3024 return -1;
3025 }
3026
__Pyx_InitGlobals(void)3027 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
3028 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3029 __pyx_int_150607053 = PyInt_FromLong(150607053L); if (unlikely(!__pyx_int_150607053)) __PYX_ERR(0, 1, __pyx_L1_error)
3030 return 0;
3031 __pyx_L1_error:;
3032 return -1;
3033 }
3034
3035 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
3036 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
3037 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
3038 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
3039 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
3040 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
3041 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
3042
__Pyx_modinit_global_init_code(void)3043 static int __Pyx_modinit_global_init_code(void) {
3044 __Pyx_RefNannyDeclarations
3045 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
3046 /*--- Global init code ---*/
3047 __Pyx_RefNannyFinishContext();
3048 return 0;
3049 }
3050
__Pyx_modinit_variable_export_code(void)3051 static int __Pyx_modinit_variable_export_code(void) {
3052 __Pyx_RefNannyDeclarations
3053 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
3054 /*--- Variable export code ---*/
3055 __Pyx_RefNannyFinishContext();
3056 return 0;
3057 }
3058
__Pyx_modinit_function_export_code(void)3059 static int __Pyx_modinit_function_export_code(void) {
3060 __Pyx_RefNannyDeclarations
3061 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
3062 /*--- Function export code ---*/
3063 __Pyx_RefNannyFinishContext();
3064 return 0;
3065 }
3066
__Pyx_modinit_type_init_code(void)3067 static int __Pyx_modinit_type_init_code(void) {
3068 __Pyx_RefNannyDeclarations
3069 int __pyx_lineno = 0;
3070 const char *__pyx_filename = NULL;
3071 int __pyx_clineno = 0;
3072 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
3073 /*--- Type init code ---*/
3074 if (PyType_Ready(&__pyx_type_2bx_6arrays_3bed_BedReader) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
3075 #if PY_VERSION_HEX < 0x030800B1
3076 __pyx_type_2bx_6arrays_3bed_BedReader.tp_print = 0;
3077 #endif
3078 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2bx_6arrays_3bed_BedReader.tp_dictoffset && __pyx_type_2bx_6arrays_3bed_BedReader.tp_getattro == PyObject_GenericGetAttr)) {
3079 __pyx_type_2bx_6arrays_3bed_BedReader.tp_getattro = __Pyx_PyObject_GenericGetAttr;
3080 }
3081 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BedReader, (PyObject *)&__pyx_type_2bx_6arrays_3bed_BedReader) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
3082 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2bx_6arrays_3bed_BedReader) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
3083 __pyx_ptype_2bx_6arrays_3bed_BedReader = &__pyx_type_2bx_6arrays_3bed_BedReader;
3084 __Pyx_RefNannyFinishContext();
3085 return 0;
3086 __pyx_L1_error:;
3087 __Pyx_RefNannyFinishContext();
3088 return -1;
3089 }
3090
__Pyx_modinit_type_import_code(void)3091 static int __Pyx_modinit_type_import_code(void) {
3092 __Pyx_RefNannyDeclarations
3093 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
3094 /*--- Type import code ---*/
3095 __Pyx_RefNannyFinishContext();
3096 return 0;
3097 }
3098
__Pyx_modinit_variable_import_code(void)3099 static int __Pyx_modinit_variable_import_code(void) {
3100 __Pyx_RefNannyDeclarations
3101 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
3102 /*--- Variable import code ---*/
3103 __Pyx_RefNannyFinishContext();
3104 return 0;
3105 }
3106
__Pyx_modinit_function_import_code(void)3107 static int __Pyx_modinit_function_import_code(void) {
3108 __Pyx_RefNannyDeclarations
3109 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
3110 /*--- Function import code ---*/
3111 __Pyx_RefNannyFinishContext();
3112 return 0;
3113 }
3114
3115
3116 #ifndef CYTHON_NO_PYINIT_EXPORT
3117 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
3118 #elif PY_MAJOR_VERSION < 3
3119 #ifdef __cplusplus
3120 #define __Pyx_PyMODINIT_FUNC extern "C" void
3121 #else
3122 #define __Pyx_PyMODINIT_FUNC void
3123 #endif
3124 #else
3125 #ifdef __cplusplus
3126 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
3127 #else
3128 #define __Pyx_PyMODINIT_FUNC PyObject *
3129 #endif
3130 #endif
3131
3132
3133 #if PY_MAJOR_VERSION < 3
3134 __Pyx_PyMODINIT_FUNC initbed(void) CYTHON_SMALL_CODE; /*proto*/
initbed(void)3135 __Pyx_PyMODINIT_FUNC initbed(void)
3136 #else
3137 __Pyx_PyMODINIT_FUNC PyInit_bed(void) CYTHON_SMALL_CODE; /*proto*/
3138 __Pyx_PyMODINIT_FUNC PyInit_bed(void)
3139 #if CYTHON_PEP489_MULTI_PHASE_INIT
3140 {
3141 return PyModuleDef_Init(&__pyx_moduledef);
3142 }
3143 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
3144 #if PY_VERSION_HEX >= 0x030700A1
3145 static PY_INT64_T main_interpreter_id = -1;
3146 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
3147 if (main_interpreter_id == -1) {
3148 main_interpreter_id = current_id;
3149 return (unlikely(current_id == -1)) ? -1 : 0;
3150 } else if (unlikely(main_interpreter_id != current_id))
3151 #else
3152 static PyInterpreterState *main_interpreter = NULL;
3153 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
3154 if (!main_interpreter) {
3155 main_interpreter = current_interpreter;
3156 } else if (unlikely(main_interpreter != current_interpreter))
3157 #endif
3158 {
3159 PyErr_SetString(
3160 PyExc_ImportError,
3161 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
3162 return -1;
3163 }
3164 return 0;
3165 }
3166 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) {
3167 PyObject *value = PyObject_GetAttrString(spec, from_name);
3168 int result = 0;
3169 if (likely(value)) {
3170 if (allow_none || value != Py_None) {
3171 result = PyDict_SetItemString(moddict, to_name, value);
3172 }
3173 Py_DECREF(value);
3174 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
3175 PyErr_Clear();
3176 } else {
3177 result = -1;
3178 }
3179 return result;
3180 }
3181 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
3182 PyObject *module = NULL, *moddict, *modname;
3183 if (__Pyx_check_single_interpreter())
3184 return NULL;
3185 if (__pyx_m)
3186 return __Pyx_NewRef(__pyx_m);
3187 modname = PyObject_GetAttrString(spec, "name");
3188 if (unlikely(!modname)) goto bad;
3189 module = PyModule_NewObject(modname);
3190 Py_DECREF(modname);
3191 if (unlikely(!module)) goto bad;
3192 moddict = PyModule_GetDict(module);
3193 if (unlikely(!moddict)) goto bad;
3194 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
3195 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
3196 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
3197 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
3198 return module;
3199 bad:
3200 Py_XDECREF(module);
3201 return NULL;
3202 }
3203
3204
3205 static CYTHON_SMALL_CODE int __pyx_pymod_exec_bed(PyObject *__pyx_pyinit_module)
3206 #endif
3207 #endif
3208 {
3209 PyObject *__pyx_t_1 = NULL;
3210 int __pyx_lineno = 0;
3211 const char *__pyx_filename = NULL;
3212 int __pyx_clineno = 0;
3213 __Pyx_RefNannyDeclarations
3214 #if CYTHON_PEP489_MULTI_PHASE_INIT
3215 if (__pyx_m) {
3216 if (__pyx_m == __pyx_pyinit_module) return 0;
3217 PyErr_SetString(PyExc_RuntimeError, "Module 'bed' has already been imported. Re-initialisation is not supported.");
3218 return -1;
3219 }
3220 #elif PY_MAJOR_VERSION >= 3
3221 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
3222 #endif
3223 #if CYTHON_REFNANNY
3224 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
3225 if (!__Pyx_RefNanny) {
3226 PyErr_Clear();
3227 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
3228 if (!__Pyx_RefNanny)
3229 Py_FatalError("failed to import 'refnanny' module");
3230 }
3231 #endif
3232 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_bed(void)", 0);
3233 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3234 #ifdef __Pxy_PyFrame_Initialize_Offsets
3235 __Pxy_PyFrame_Initialize_Offsets();
3236 #endif
3237 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
3238 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
3239 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
3240 #ifdef __Pyx_CyFunction_USED
3241 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3242 #endif
3243 #ifdef __Pyx_FusedFunction_USED
3244 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3245 #endif
3246 #ifdef __Pyx_Coroutine_USED
3247 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3248 #endif
3249 #ifdef __Pyx_Generator_USED
3250 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3251 #endif
3252 #ifdef __Pyx_AsyncGen_USED
3253 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3254 #endif
3255 #ifdef __Pyx_StopAsyncIteration_USED
3256 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3257 #endif
3258 /*--- Library function declarations ---*/
3259 /*--- Threads initialization code ---*/
3260 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
3261 PyEval_InitThreads();
3262 #endif
3263 /*--- Module creation code ---*/
3264 #if CYTHON_PEP489_MULTI_PHASE_INIT
3265 __pyx_m = __pyx_pyinit_module;
3266 Py_INCREF(__pyx_m);
3267 #else
3268 #if PY_MAJOR_VERSION < 3
3269 __pyx_m = Py_InitModule4("bed", __pyx_methods, __pyx_k_Iterator_for_the_BED_format_htt, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
3270 #else
3271 __pyx_m = PyModule_Create(&__pyx_moduledef);
3272 #endif
3273 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
3274 #endif
3275 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
3276 Py_INCREF(__pyx_d);
3277 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
3278 Py_INCREF(__pyx_b);
3279 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
3280 Py_INCREF(__pyx_cython_runtime);
3281 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3282 /*--- Initialize various global constants etc. ---*/
3283 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3284 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
3285 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3286 #endif
3287 if (__pyx_module_is_main_bx__arrays__bed) {
3288 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3289 }
3290 #if PY_MAJOR_VERSION >= 3
3291 {
3292 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
3293 if (!PyDict_GetItemString(modules, "bx.arrays.bed")) {
3294 if (unlikely(PyDict_SetItemString(modules, "bx.arrays.bed", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
3295 }
3296 }
3297 #endif
3298 /*--- Builtin init code ---*/
3299 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3300 /*--- Constants init code ---*/
3301 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3302 /*--- Global type/function init code ---*/
3303 (void)__Pyx_modinit_global_init_code();
3304 (void)__Pyx_modinit_variable_export_code();
3305 (void)__Pyx_modinit_function_export_code();
3306 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
3307 (void)__Pyx_modinit_type_import_code();
3308 (void)__Pyx_modinit_variable_import_code();
3309 (void)__Pyx_modinit_function_import_code();
3310 /*--- Execution code ---*/
3311 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
3312 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3313 #endif
3314
3315 /* "(tree fragment)":1
3316 * def __pyx_unpickle_BedReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
3317 * cdef object __pyx_PickleError
3318 * cdef object __pyx_result
3319 */
3320 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_6arrays_3bed_1__pyx_unpickle_BedReader, NULL, __pyx_n_s_bx_arrays_bed); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
3321 __Pyx_GOTREF(__pyx_t_1);
3322 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BedReader, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
3323 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3324
3325 /* "bx/arrays/bed.pyx":1
3326 * """ # <<<<<<<<<<<<<<
3327 * Iterator for the BED format ( http://genome.ucsc.edu/FAQ/FAQformat.html#format1 )
3328 * Returns chrom, chromStart, chromEnd, name, score
3329 */
3330 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
3331 __Pyx_GOTREF(__pyx_t_1);
3332 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3333 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3334
3335 /*--- Wrapped vars code ---*/
3336
3337 goto __pyx_L0;
3338 __pyx_L1_error:;
3339 __Pyx_XDECREF(__pyx_t_1);
3340 if (__pyx_m) {
3341 if (__pyx_d) {
3342 __Pyx_AddTraceback("init bx.arrays.bed", __pyx_clineno, __pyx_lineno, __pyx_filename);
3343 }
3344 Py_CLEAR(__pyx_m);
3345 } else if (!PyErr_Occurred()) {
3346 PyErr_SetString(PyExc_ImportError, "init bx.arrays.bed");
3347 }
3348 __pyx_L0:;
3349 __Pyx_RefNannyFinishContext();
3350 #if CYTHON_PEP489_MULTI_PHASE_INIT
3351 return (__pyx_m != NULL) ? 0 : -1;
3352 #elif PY_MAJOR_VERSION >= 3
3353 return __pyx_m;
3354 #else
3355 return;
3356 #endif
3357 }
3358
3359 /* --- Runtime support code --- */
3360 /* Refnanny */
3361 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)3362 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
3363 PyObject *m = NULL, *p = NULL;
3364 void *r = NULL;
3365 m = PyImport_ImportModule(modname);
3366 if (!m) goto end;
3367 p = PyObject_GetAttrString(m, "RefNannyAPI");
3368 if (!p) goto end;
3369 r = PyLong_AsVoidPtr(p);
3370 end:
3371 Py_XDECREF(p);
3372 Py_XDECREF(m);
3373 return (__Pyx_RefNannyAPIStruct *)r;
3374 }
3375 #endif
3376
3377 /* PyObjectGetAttrStr */
3378 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)3379 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
3380 PyTypeObject* tp = Py_TYPE(obj);
3381 if (likely(tp->tp_getattro))
3382 return tp->tp_getattro(obj, attr_name);
3383 #if PY_MAJOR_VERSION < 3
3384 if (likely(tp->tp_getattr))
3385 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
3386 #endif
3387 return PyObject_GetAttr(obj, attr_name);
3388 }
3389 #endif
3390
3391 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)3392 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
3393 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
3394 if (unlikely(!result)) {
3395 PyErr_Format(PyExc_NameError,
3396 #if PY_MAJOR_VERSION >= 3
3397 "name '%U' is not defined", name);
3398 #else
3399 "name '%.200s' is not defined", PyString_AS_STRING(name));
3400 #endif
3401 }
3402 return result;
3403 }
3404
3405 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)3406 static void __Pyx_RaiseDoubleKeywordsError(
3407 const char* func_name,
3408 PyObject* kw_name)
3409 {
3410 PyErr_Format(PyExc_TypeError,
3411 #if PY_MAJOR_VERSION >= 3
3412 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
3413 #else
3414 "%s() got multiple values for keyword argument '%s'", func_name,
3415 PyString_AsString(kw_name));
3416 #endif
3417 }
3418
3419 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)3420 static int __Pyx_ParseOptionalKeywords(
3421 PyObject *kwds,
3422 PyObject **argnames[],
3423 PyObject *kwds2,
3424 PyObject *values[],
3425 Py_ssize_t num_pos_args,
3426 const char* function_name)
3427 {
3428 PyObject *key = 0, *value = 0;
3429 Py_ssize_t pos = 0;
3430 PyObject*** name;
3431 PyObject*** first_kw_arg = argnames + num_pos_args;
3432 while (PyDict_Next(kwds, &pos, &key, &value)) {
3433 name = first_kw_arg;
3434 while (*name && (**name != key)) name++;
3435 if (*name) {
3436 values[name-argnames] = value;
3437 continue;
3438 }
3439 name = first_kw_arg;
3440 #if PY_MAJOR_VERSION < 3
3441 if (likely(PyString_Check(key))) {
3442 while (*name) {
3443 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
3444 && _PyString_Eq(**name, key)) {
3445 values[name-argnames] = value;
3446 break;
3447 }
3448 name++;
3449 }
3450 if (*name) continue;
3451 else {
3452 PyObject*** argname = argnames;
3453 while (argname != first_kw_arg) {
3454 if ((**argname == key) || (
3455 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
3456 && _PyString_Eq(**argname, key))) {
3457 goto arg_passed_twice;
3458 }
3459 argname++;
3460 }
3461 }
3462 } else
3463 #endif
3464 if (likely(PyUnicode_Check(key))) {
3465 while (*name) {
3466 int cmp = (**name == key) ? 0 :
3467 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
3468 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
3469 #endif
3470 PyUnicode_Compare(**name, key);
3471 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
3472 if (cmp == 0) {
3473 values[name-argnames] = value;
3474 break;
3475 }
3476 name++;
3477 }
3478 if (*name) continue;
3479 else {
3480 PyObject*** argname = argnames;
3481 while (argname != first_kw_arg) {
3482 int cmp = (**argname == key) ? 0 :
3483 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
3484 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
3485 #endif
3486 PyUnicode_Compare(**argname, key);
3487 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
3488 if (cmp == 0) goto arg_passed_twice;
3489 argname++;
3490 }
3491 }
3492 } else
3493 goto invalid_keyword_type;
3494 if (kwds2) {
3495 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
3496 } else {
3497 goto invalid_keyword;
3498 }
3499 }
3500 return 0;
3501 arg_passed_twice:
3502 __Pyx_RaiseDoubleKeywordsError(function_name, key);
3503 goto bad;
3504 invalid_keyword_type:
3505 PyErr_Format(PyExc_TypeError,
3506 "%.200s() keywords must be strings", function_name);
3507 goto bad;
3508 invalid_keyword:
3509 PyErr_Format(PyExc_TypeError,
3510 #if PY_MAJOR_VERSION < 3
3511 "%.200s() got an unexpected keyword argument '%.200s'",
3512 function_name, PyString_AsString(key));
3513 #else
3514 "%s() got an unexpected keyword argument '%U'",
3515 function_name, key);
3516 #endif
3517 bad:
3518 return -1;
3519 }
3520
3521 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)3522 static void __Pyx_RaiseArgtupleInvalid(
3523 const char* func_name,
3524 int exact,
3525 Py_ssize_t num_min,
3526 Py_ssize_t num_max,
3527 Py_ssize_t num_found)
3528 {
3529 Py_ssize_t num_expected;
3530 const char *more_or_less;
3531 if (num_found < num_min) {
3532 num_expected = num_min;
3533 more_or_less = "at least";
3534 } else {
3535 num_expected = num_max;
3536 more_or_less = "at most";
3537 }
3538 if (exact) {
3539 more_or_less = "exactly";
3540 }
3541 PyErr_Format(PyExc_TypeError,
3542 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
3543 func_name, more_or_less, num_expected,
3544 (num_expected == 1) ? "" : "s", num_found);
3545 }
3546
3547 /* PyFunctionFastCall */
3548 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)3549 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
3550 PyObject *globals) {
3551 PyFrameObject *f;
3552 PyThreadState *tstate = __Pyx_PyThreadState_Current;
3553 PyObject **fastlocals;
3554 Py_ssize_t i;
3555 PyObject *result;
3556 assert(globals != NULL);
3557 /* XXX Perhaps we should create a specialized
3558 PyFrame_New() that doesn't take locals, but does
3559 take builtins without sanity checking them.
3560 */
3561 assert(tstate != NULL);
3562 f = PyFrame_New(tstate, co, globals, NULL);
3563 if (f == NULL) {
3564 return NULL;
3565 }
3566 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
3567 for (i = 0; i < na; i++) {
3568 Py_INCREF(*args);
3569 fastlocals[i] = *args++;
3570 }
3571 result = PyEval_EvalFrameEx(f,0);
3572 ++tstate->recursion_depth;
3573 Py_DECREF(f);
3574 --tstate->recursion_depth;
3575 return result;
3576 }
3577 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)3578 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
3579 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
3580 PyObject *globals = PyFunction_GET_GLOBALS(func);
3581 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
3582 PyObject *closure;
3583 #if PY_MAJOR_VERSION >= 3
3584 PyObject *kwdefs;
3585 #endif
3586 PyObject *kwtuple, **k;
3587 PyObject **d;
3588 Py_ssize_t nd;
3589 Py_ssize_t nk;
3590 PyObject *result;
3591 assert(kwargs == NULL || PyDict_Check(kwargs));
3592 nk = kwargs ? PyDict_Size(kwargs) : 0;
3593 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
3594 return NULL;
3595 }
3596 if (
3597 #if PY_MAJOR_VERSION >= 3
3598 co->co_kwonlyargcount == 0 &&
3599 #endif
3600 likely(kwargs == NULL || nk == 0) &&
3601 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
3602 if (argdefs == NULL && co->co_argcount == nargs) {
3603 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
3604 goto done;
3605 }
3606 else if (nargs == 0 && argdefs != NULL
3607 && co->co_argcount == Py_SIZE(argdefs)) {
3608 /* function called with no arguments, but all parameters have
3609 a default value: use default values as arguments .*/
3610 args = &PyTuple_GET_ITEM(argdefs, 0);
3611 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
3612 goto done;
3613 }
3614 }
3615 if (kwargs != NULL) {
3616 Py_ssize_t pos, i;
3617 kwtuple = PyTuple_New(2 * nk);
3618 if (kwtuple == NULL) {
3619 result = NULL;
3620 goto done;
3621 }
3622 k = &PyTuple_GET_ITEM(kwtuple, 0);
3623 pos = i = 0;
3624 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
3625 Py_INCREF(k[i]);
3626 Py_INCREF(k[i+1]);
3627 i += 2;
3628 }
3629 nk = i / 2;
3630 }
3631 else {
3632 kwtuple = NULL;
3633 k = NULL;
3634 }
3635 closure = PyFunction_GET_CLOSURE(func);
3636 #if PY_MAJOR_VERSION >= 3
3637 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
3638 #endif
3639 if (argdefs != NULL) {
3640 d = &PyTuple_GET_ITEM(argdefs, 0);
3641 nd = Py_SIZE(argdefs);
3642 }
3643 else {
3644 d = NULL;
3645 nd = 0;
3646 }
3647 #if PY_MAJOR_VERSION >= 3
3648 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
3649 args, (int)nargs,
3650 k, (int)nk,
3651 d, (int)nd, kwdefs, closure);
3652 #else
3653 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
3654 args, (int)nargs,
3655 k, (int)nk,
3656 d, (int)nd, closure);
3657 #endif
3658 Py_XDECREF(kwtuple);
3659 done:
3660 Py_LeaveRecursiveCall();
3661 return result;
3662 }
3663 #endif
3664 #endif
3665
3666 /* PyObjectCall */
3667 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)3668 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
3669 PyObject *result;
3670 ternaryfunc call = Py_TYPE(func)->tp_call;
3671 if (unlikely(!call))
3672 return PyObject_Call(func, arg, kw);
3673 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
3674 return NULL;
3675 result = (*call)(func, arg, kw);
3676 Py_LeaveRecursiveCall();
3677 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3678 PyErr_SetString(
3679 PyExc_SystemError,
3680 "NULL result without error in PyObject_Call");
3681 }
3682 return result;
3683 }
3684 #endif
3685
3686 /* PyObjectCallMethO */
3687 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)3688 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
3689 PyObject *self, *result;
3690 PyCFunction cfunc;
3691 cfunc = PyCFunction_GET_FUNCTION(func);
3692 self = PyCFunction_GET_SELF(func);
3693 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
3694 return NULL;
3695 result = cfunc(self, arg);
3696 Py_LeaveRecursiveCall();
3697 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3698 PyErr_SetString(
3699 PyExc_SystemError,
3700 "NULL result without error in PyObject_Call");
3701 }
3702 return result;
3703 }
3704 #endif
3705
3706 /* PyObjectCallNoArg */
3707 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)3708 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
3709 #if CYTHON_FAST_PYCALL
3710 if (PyFunction_Check(func)) {
3711 return __Pyx_PyFunction_FastCall(func, NULL, 0);
3712 }
3713 #endif
3714 #ifdef __Pyx_CyFunction_USED
3715 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
3716 #else
3717 if (likely(PyCFunction_Check(func)))
3718 #endif
3719 {
3720 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
3721 return __Pyx_PyObject_CallMethO(func, NULL);
3722 }
3723 }
3724 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
3725 }
3726 #endif
3727
3728 /* PyCFunctionFastCall */
3729 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)3730 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
3731 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
3732 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
3733 PyObject *self = PyCFunction_GET_SELF(func);
3734 int flags = PyCFunction_GET_FLAGS(func);
3735 assert(PyCFunction_Check(func));
3736 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
3737 assert(nargs >= 0);
3738 assert(nargs == 0 || args != NULL);
3739 /* _PyCFunction_FastCallDict() must not be called with an exception set,
3740 because it may clear it (directly or indirectly) and so the
3741 caller loses its exception */
3742 assert(!PyErr_Occurred());
3743 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
3744 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
3745 } else {
3746 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
3747 }
3748 }
3749 #endif
3750
3751 /* PyObjectCallOneArg */
3752 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)3753 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
3754 PyObject *result;
3755 PyObject *args = PyTuple_New(1);
3756 if (unlikely(!args)) return NULL;
3757 Py_INCREF(arg);
3758 PyTuple_SET_ITEM(args, 0, arg);
3759 result = __Pyx_PyObject_Call(func, args, NULL);
3760 Py_DECREF(args);
3761 return result;
3762 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)3763 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
3764 #if CYTHON_FAST_PYCALL
3765 if (PyFunction_Check(func)) {
3766 return __Pyx_PyFunction_FastCall(func, &arg, 1);
3767 }
3768 #endif
3769 if (likely(PyCFunction_Check(func))) {
3770 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
3771 return __Pyx_PyObject_CallMethO(func, arg);
3772 #if CYTHON_FAST_PYCCALL
3773 } else if (__Pyx_PyFastCFunction_Check(func)) {
3774 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
3775 #endif
3776 }
3777 }
3778 return __Pyx__PyObject_CallOneArg(func, arg);
3779 }
3780 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)3781 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
3782 PyObject *result;
3783 PyObject *args = PyTuple_Pack(1, arg);
3784 if (unlikely(!args)) return NULL;
3785 result = __Pyx_PyObject_Call(func, args, NULL);
3786 Py_DECREF(args);
3787 return result;
3788 }
3789 #endif
3790
3791 /* PyErrFetchRestore */
3792 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)3793 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
3794 PyObject *tmp_type, *tmp_value, *tmp_tb;
3795 tmp_type = tstate->curexc_type;
3796 tmp_value = tstate->curexc_value;
3797 tmp_tb = tstate->curexc_traceback;
3798 tstate->curexc_type = type;
3799 tstate->curexc_value = value;
3800 tstate->curexc_traceback = tb;
3801 Py_XDECREF(tmp_type);
3802 Py_XDECREF(tmp_value);
3803 Py_XDECREF(tmp_tb);
3804 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)3805 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3806 *type = tstate->curexc_type;
3807 *value = tstate->curexc_value;
3808 *tb = tstate->curexc_traceback;
3809 tstate->curexc_type = 0;
3810 tstate->curexc_value = 0;
3811 tstate->curexc_traceback = 0;
3812 }
3813 #endif
3814
3815 /* RaiseException */
3816 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)3817 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
3818 CYTHON_UNUSED PyObject *cause) {
3819 __Pyx_PyThreadState_declare
3820 Py_XINCREF(type);
3821 if (!value || value == Py_None)
3822 value = NULL;
3823 else
3824 Py_INCREF(value);
3825 if (!tb || tb == Py_None)
3826 tb = NULL;
3827 else {
3828 Py_INCREF(tb);
3829 if (!PyTraceBack_Check(tb)) {
3830 PyErr_SetString(PyExc_TypeError,
3831 "raise: arg 3 must be a traceback or None");
3832 goto raise_error;
3833 }
3834 }
3835 if (PyType_Check(type)) {
3836 #if CYTHON_COMPILING_IN_PYPY
3837 if (!value) {
3838 Py_INCREF(Py_None);
3839 value = Py_None;
3840 }
3841 #endif
3842 PyErr_NormalizeException(&type, &value, &tb);
3843 } else {
3844 if (value) {
3845 PyErr_SetString(PyExc_TypeError,
3846 "instance exception may not have a separate value");
3847 goto raise_error;
3848 }
3849 value = type;
3850 type = (PyObject*) Py_TYPE(type);
3851 Py_INCREF(type);
3852 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
3853 PyErr_SetString(PyExc_TypeError,
3854 "raise: exception class must be a subclass of BaseException");
3855 goto raise_error;
3856 }
3857 }
3858 __Pyx_PyThreadState_assign
3859 __Pyx_ErrRestore(type, value, tb);
3860 return;
3861 raise_error:
3862 Py_XDECREF(value);
3863 Py_XDECREF(type);
3864 Py_XDECREF(tb);
3865 return;
3866 }
3867 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)3868 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
3869 PyObject* owned_instance = NULL;
3870 if (tb == Py_None) {
3871 tb = 0;
3872 } else if (tb && !PyTraceBack_Check(tb)) {
3873 PyErr_SetString(PyExc_TypeError,
3874 "raise: arg 3 must be a traceback or None");
3875 goto bad;
3876 }
3877 if (value == Py_None)
3878 value = 0;
3879 if (PyExceptionInstance_Check(type)) {
3880 if (value) {
3881 PyErr_SetString(PyExc_TypeError,
3882 "instance exception may not have a separate value");
3883 goto bad;
3884 }
3885 value = type;
3886 type = (PyObject*) Py_TYPE(value);
3887 } else if (PyExceptionClass_Check(type)) {
3888 PyObject *instance_class = NULL;
3889 if (value && PyExceptionInstance_Check(value)) {
3890 instance_class = (PyObject*) Py_TYPE(value);
3891 if (instance_class != type) {
3892 int is_subclass = PyObject_IsSubclass(instance_class, type);
3893 if (!is_subclass) {
3894 instance_class = NULL;
3895 } else if (unlikely(is_subclass == -1)) {
3896 goto bad;
3897 } else {
3898 type = instance_class;
3899 }
3900 }
3901 }
3902 if (!instance_class) {
3903 PyObject *args;
3904 if (!value)
3905 args = PyTuple_New(0);
3906 else if (PyTuple_Check(value)) {
3907 Py_INCREF(value);
3908 args = value;
3909 } else
3910 args = PyTuple_Pack(1, value);
3911 if (!args)
3912 goto bad;
3913 owned_instance = PyObject_Call(type, args, NULL);
3914 Py_DECREF(args);
3915 if (!owned_instance)
3916 goto bad;
3917 value = owned_instance;
3918 if (!PyExceptionInstance_Check(value)) {
3919 PyErr_Format(PyExc_TypeError,
3920 "calling %R should have returned an instance of "
3921 "BaseException, not %R",
3922 type, Py_TYPE(value));
3923 goto bad;
3924 }
3925 }
3926 } else {
3927 PyErr_SetString(PyExc_TypeError,
3928 "raise: exception class must be a subclass of BaseException");
3929 goto bad;
3930 }
3931 if (cause) {
3932 PyObject *fixed_cause;
3933 if (cause == Py_None) {
3934 fixed_cause = NULL;
3935 } else if (PyExceptionClass_Check(cause)) {
3936 fixed_cause = PyObject_CallObject(cause, NULL);
3937 if (fixed_cause == NULL)
3938 goto bad;
3939 } else if (PyExceptionInstance_Check(cause)) {
3940 fixed_cause = cause;
3941 Py_INCREF(fixed_cause);
3942 } else {
3943 PyErr_SetString(PyExc_TypeError,
3944 "exception causes must derive from "
3945 "BaseException");
3946 goto bad;
3947 }
3948 PyException_SetCause(value, fixed_cause);
3949 }
3950 PyErr_SetObject(type, value);
3951 if (tb) {
3952 #if CYTHON_COMPILING_IN_PYPY
3953 PyObject *tmp_type, *tmp_value, *tmp_tb;
3954 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
3955 Py_INCREF(tb);
3956 PyErr_Restore(tmp_type, tmp_value, tb);
3957 Py_XDECREF(tmp_tb);
3958 #else
3959 PyThreadState *tstate = __Pyx_PyThreadState_Current;
3960 PyObject* tmp_tb = tstate->curexc_traceback;
3961 if (tb != tmp_tb) {
3962 Py_INCREF(tb);
3963 tstate->curexc_traceback = tb;
3964 Py_XDECREF(tmp_tb);
3965 }
3966 #endif
3967 }
3968 bad:
3969 Py_XDECREF(owned_instance);
3970 return;
3971 }
3972 #endif
3973
3974 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)3975 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
3976 PyObject *r;
3977 if (!j) return NULL;
3978 r = PyObject_GetItem(o, j);
3979 Py_DECREF(j);
3980 return r;
3981 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)3982 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
3983 CYTHON_NCP_UNUSED int wraparound,
3984 CYTHON_NCP_UNUSED int boundscheck) {
3985 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3986 Py_ssize_t wrapped_i = i;
3987 if (wraparound & unlikely(i < 0)) {
3988 wrapped_i += PyList_GET_SIZE(o);
3989 }
3990 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
3991 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
3992 Py_INCREF(r);
3993 return r;
3994 }
3995 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
3996 #else
3997 return PySequence_GetItem(o, i);
3998 #endif
3999 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)4000 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
4001 CYTHON_NCP_UNUSED int wraparound,
4002 CYTHON_NCP_UNUSED int boundscheck) {
4003 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4004 Py_ssize_t wrapped_i = i;
4005 if (wraparound & unlikely(i < 0)) {
4006 wrapped_i += PyTuple_GET_SIZE(o);
4007 }
4008 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
4009 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
4010 Py_INCREF(r);
4011 return r;
4012 }
4013 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
4014 #else
4015 return PySequence_GetItem(o, i);
4016 #endif
4017 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)4018 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
4019 CYTHON_NCP_UNUSED int wraparound,
4020 CYTHON_NCP_UNUSED int boundscheck) {
4021 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
4022 if (is_list || PyList_CheckExact(o)) {
4023 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
4024 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
4025 PyObject *r = PyList_GET_ITEM(o, n);
4026 Py_INCREF(r);
4027 return r;
4028 }
4029 }
4030 else if (PyTuple_CheckExact(o)) {
4031 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
4032 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
4033 PyObject *r = PyTuple_GET_ITEM(o, n);
4034 Py_INCREF(r);
4035 return r;
4036 }
4037 } else {
4038 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
4039 if (likely(m && m->sq_item)) {
4040 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
4041 Py_ssize_t l = m->sq_length(o);
4042 if (likely(l >= 0)) {
4043 i += l;
4044 } else {
4045 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
4046 return NULL;
4047 PyErr_Clear();
4048 }
4049 }
4050 return m->sq_item(o, i);
4051 }
4052 }
4053 #else
4054 if (is_list || PySequence_Check(o)) {
4055 return PySequence_GetItem(o, i);
4056 }
4057 #endif
4058 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
4059 }
4060
4061 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)4062 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
4063 #if CYTHON_COMPILING_IN_PYPY
4064 return PyObject_RichCompareBool(s1, s2, equals);
4065 #else
4066 if (s1 == s2) {
4067 return (equals == Py_EQ);
4068 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
4069 const char *ps1, *ps2;
4070 Py_ssize_t length = PyBytes_GET_SIZE(s1);
4071 if (length != PyBytes_GET_SIZE(s2))
4072 return (equals == Py_NE);
4073 ps1 = PyBytes_AS_STRING(s1);
4074 ps2 = PyBytes_AS_STRING(s2);
4075 if (ps1[0] != ps2[0]) {
4076 return (equals == Py_NE);
4077 } else if (length == 1) {
4078 return (equals == Py_EQ);
4079 } else {
4080 int result;
4081 #if CYTHON_USE_UNICODE_INTERNALS
4082 Py_hash_t hash1, hash2;
4083 hash1 = ((PyBytesObject*)s1)->ob_shash;
4084 hash2 = ((PyBytesObject*)s2)->ob_shash;
4085 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
4086 return (equals == Py_NE);
4087 }
4088 #endif
4089 result = memcmp(ps1, ps2, (size_t)length);
4090 return (equals == Py_EQ) ? (result == 0) : (result != 0);
4091 }
4092 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
4093 return (equals == Py_NE);
4094 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
4095 return (equals == Py_NE);
4096 } else {
4097 int result;
4098 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
4099 if (!py_result)
4100 return -1;
4101 result = __Pyx_PyObject_IsTrue(py_result);
4102 Py_DECREF(py_result);
4103 return result;
4104 }
4105 #endif
4106 }
4107
4108 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)4109 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
4110 #if CYTHON_COMPILING_IN_PYPY
4111 return PyObject_RichCompareBool(s1, s2, equals);
4112 #else
4113 #if PY_MAJOR_VERSION < 3
4114 PyObject* owned_ref = NULL;
4115 #endif
4116 int s1_is_unicode, s2_is_unicode;
4117 if (s1 == s2) {
4118 goto return_eq;
4119 }
4120 s1_is_unicode = PyUnicode_CheckExact(s1);
4121 s2_is_unicode = PyUnicode_CheckExact(s2);
4122 #if PY_MAJOR_VERSION < 3
4123 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
4124 owned_ref = PyUnicode_FromObject(s2);
4125 if (unlikely(!owned_ref))
4126 return -1;
4127 s2 = owned_ref;
4128 s2_is_unicode = 1;
4129 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
4130 owned_ref = PyUnicode_FromObject(s1);
4131 if (unlikely(!owned_ref))
4132 return -1;
4133 s1 = owned_ref;
4134 s1_is_unicode = 1;
4135 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
4136 return __Pyx_PyBytes_Equals(s1, s2, equals);
4137 }
4138 #endif
4139 if (s1_is_unicode & s2_is_unicode) {
4140 Py_ssize_t length;
4141 int kind;
4142 void *data1, *data2;
4143 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
4144 return -1;
4145 length = __Pyx_PyUnicode_GET_LENGTH(s1);
4146 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
4147 goto return_ne;
4148 }
4149 #if CYTHON_USE_UNICODE_INTERNALS
4150 {
4151 Py_hash_t hash1, hash2;
4152 #if CYTHON_PEP393_ENABLED
4153 hash1 = ((PyASCIIObject*)s1)->hash;
4154 hash2 = ((PyASCIIObject*)s2)->hash;
4155 #else
4156 hash1 = ((PyUnicodeObject*)s1)->hash;
4157 hash2 = ((PyUnicodeObject*)s2)->hash;
4158 #endif
4159 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
4160 goto return_ne;
4161 }
4162 }
4163 #endif
4164 kind = __Pyx_PyUnicode_KIND(s1);
4165 if (kind != __Pyx_PyUnicode_KIND(s2)) {
4166 goto return_ne;
4167 }
4168 data1 = __Pyx_PyUnicode_DATA(s1);
4169 data2 = __Pyx_PyUnicode_DATA(s2);
4170 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
4171 goto return_ne;
4172 } else if (length == 1) {
4173 goto return_eq;
4174 } else {
4175 int result = memcmp(data1, data2, (size_t)(length * kind));
4176 #if PY_MAJOR_VERSION < 3
4177 Py_XDECREF(owned_ref);
4178 #endif
4179 return (equals == Py_EQ) ? (result == 0) : (result != 0);
4180 }
4181 } else if ((s1 == Py_None) & s2_is_unicode) {
4182 goto return_ne;
4183 } else if ((s2 == Py_None) & s1_is_unicode) {
4184 goto return_ne;
4185 } else {
4186 int result;
4187 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
4188 #if PY_MAJOR_VERSION < 3
4189 Py_XDECREF(owned_ref);
4190 #endif
4191 if (!py_result)
4192 return -1;
4193 result = __Pyx_PyObject_IsTrue(py_result);
4194 Py_DECREF(py_result);
4195 return result;
4196 }
4197 return_eq:
4198 #if PY_MAJOR_VERSION < 3
4199 Py_XDECREF(owned_ref);
4200 #endif
4201 return (equals == Py_EQ);
4202 return_ne:
4203 #if PY_MAJOR_VERSION < 3
4204 Py_XDECREF(owned_ref);
4205 #endif
4206 return (equals == Py_NE);
4207 #endif
4208 }
4209
4210 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)4211 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
4212 PyObject *args, *result = NULL;
4213 #if CYTHON_FAST_PYCALL
4214 if (PyFunction_Check(function)) {
4215 PyObject *args[2] = {arg1, arg2};
4216 return __Pyx_PyFunction_FastCall(function, args, 2);
4217 }
4218 #endif
4219 #if CYTHON_FAST_PYCCALL
4220 if (__Pyx_PyFastCFunction_Check(function)) {
4221 PyObject *args[2] = {arg1, arg2};
4222 return __Pyx_PyCFunction_FastCall(function, args, 2);
4223 }
4224 #endif
4225 args = PyTuple_New(2);
4226 if (unlikely(!args)) goto done;
4227 Py_INCREF(arg1);
4228 PyTuple_SET_ITEM(args, 0, arg1);
4229 Py_INCREF(arg2);
4230 PyTuple_SET_ITEM(args, 1, arg2);
4231 Py_INCREF(function);
4232 result = __Pyx_PyObject_Call(function, args, NULL);
4233 Py_DECREF(args);
4234 Py_DECREF(function);
4235 done:
4236 return result;
4237 }
4238
4239 /* PyErrExceptionMatches */
4240 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)4241 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4242 Py_ssize_t i, n;
4243 n = PyTuple_GET_SIZE(tuple);
4244 #if PY_MAJOR_VERSION >= 3
4245 for (i=0; i<n; i++) {
4246 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
4247 }
4248 #endif
4249 for (i=0; i<n; i++) {
4250 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
4251 }
4252 return 0;
4253 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)4254 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
4255 PyObject *exc_type = tstate->curexc_type;
4256 if (exc_type == err) return 1;
4257 if (unlikely(!exc_type)) return 0;
4258 if (unlikely(PyTuple_Check(err)))
4259 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
4260 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
4261 }
4262 #endif
4263
4264 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)4265 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
4266 #if CYTHON_USE_TYPE_SLOTS
4267 #if PY_MAJOR_VERSION >= 3
4268 if (likely(PyUnicode_Check(n)))
4269 #else
4270 if (likely(PyString_Check(n)))
4271 #endif
4272 return __Pyx_PyObject_GetAttrStr(o, n);
4273 #endif
4274 return PyObject_GetAttr(o, n);
4275 }
4276
4277 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)4278 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
4279 __Pyx_PyThreadState_declare
4280 __Pyx_PyThreadState_assign
4281 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
4282 return NULL;
4283 __Pyx_PyErr_Clear();
4284 Py_INCREF(d);
4285 return d;
4286 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)4287 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
4288 PyObject *r = __Pyx_GetAttr(o, n);
4289 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
4290 }
4291
4292 /* PyDictVersioning */
4293 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)4294 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
4295 PyObject *dict = Py_TYPE(obj)->tp_dict;
4296 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
4297 }
__Pyx_get_object_dict_version(PyObject * obj)4298 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
4299 PyObject **dictptr = NULL;
4300 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
4301 if (offset) {
4302 #if CYTHON_COMPILING_IN_CPYTHON
4303 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
4304 #else
4305 dictptr = _PyObject_GetDictPtr(obj);
4306 #endif
4307 }
4308 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
4309 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)4310 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
4311 PyObject *dict = Py_TYPE(obj)->tp_dict;
4312 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
4313 return 0;
4314 return obj_dict_version == __Pyx_get_object_dict_version(obj);
4315 }
4316 #endif
4317
4318 /* GetModuleGlobalName */
4319 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)4320 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
4321 #else
4322 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
4323 #endif
4324 {
4325 PyObject *result;
4326 #if !CYTHON_AVOID_BORROWED_REFS
4327 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
4328 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
4329 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
4330 if (likely(result)) {
4331 return __Pyx_NewRef(result);
4332 } else if (unlikely(PyErr_Occurred())) {
4333 return NULL;
4334 }
4335 #else
4336 result = PyDict_GetItem(__pyx_d, name);
4337 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
4338 if (likely(result)) {
4339 return __Pyx_NewRef(result);
4340 }
4341 #endif
4342 #else
4343 result = PyObject_GetItem(__pyx_d, name);
4344 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
4345 if (likely(result)) {
4346 return __Pyx_NewRef(result);
4347 }
4348 PyErr_Clear();
4349 #endif
4350 return __Pyx_GetBuiltinName(name);
4351 }
4352
4353 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)4354 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
4355 PyObject *empty_list = 0;
4356 PyObject *module = 0;
4357 PyObject *global_dict = 0;
4358 PyObject *empty_dict = 0;
4359 PyObject *list;
4360 #if PY_MAJOR_VERSION < 3
4361 PyObject *py_import;
4362 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
4363 if (!py_import)
4364 goto bad;
4365 #endif
4366 if (from_list)
4367 list = from_list;
4368 else {
4369 empty_list = PyList_New(0);
4370 if (!empty_list)
4371 goto bad;
4372 list = empty_list;
4373 }
4374 global_dict = PyModule_GetDict(__pyx_m);
4375 if (!global_dict)
4376 goto bad;
4377 empty_dict = PyDict_New();
4378 if (!empty_dict)
4379 goto bad;
4380 {
4381 #if PY_MAJOR_VERSION >= 3
4382 if (level == -1) {
4383 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
4384 module = PyImport_ImportModuleLevelObject(
4385 name, global_dict, empty_dict, list, 1);
4386 if (!module) {
4387 if (!PyErr_ExceptionMatches(PyExc_ImportError))
4388 goto bad;
4389 PyErr_Clear();
4390 }
4391 }
4392 level = 0;
4393 }
4394 #endif
4395 if (!module) {
4396 #if PY_MAJOR_VERSION < 3
4397 PyObject *py_level = PyInt_FromLong(level);
4398 if (!py_level)
4399 goto bad;
4400 module = PyObject_CallFunctionObjArgs(py_import,
4401 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
4402 Py_DECREF(py_level);
4403 #else
4404 module = PyImport_ImportModuleLevelObject(
4405 name, global_dict, empty_dict, list, level);
4406 #endif
4407 }
4408 }
4409 bad:
4410 #if PY_MAJOR_VERSION < 3
4411 Py_XDECREF(py_import);
4412 #endif
4413 Py_XDECREF(empty_list);
4414 Py_XDECREF(empty_dict);
4415 return module;
4416 }
4417
4418 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)4419 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
4420 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
4421 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
4422 PyErr_Format(PyExc_ImportError,
4423 #if PY_MAJOR_VERSION < 3
4424 "cannot import name %.230s", PyString_AS_STRING(name));
4425 #else
4426 "cannot import name %S", name);
4427 #endif
4428 }
4429 return value;
4430 }
4431
4432 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)4433 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
4434 PyObject *r;
4435 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
4436 PyErr_SetString(PyExc_TypeError,
4437 "hasattr(): attribute name must be string");
4438 return -1;
4439 }
4440 r = __Pyx_GetAttr(o, n);
4441 if (unlikely(!r)) {
4442 PyErr_Clear();
4443 return 0;
4444 } else {
4445 Py_DECREF(r);
4446 return 1;
4447 }
4448 }
4449
4450 /* PyObject_GenericGetAttrNoDict */
4451 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)4452 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
4453 PyErr_Format(PyExc_AttributeError,
4454 #if PY_MAJOR_VERSION >= 3
4455 "'%.50s' object has no attribute '%U'",
4456 tp->tp_name, attr_name);
4457 #else
4458 "'%.50s' object has no attribute '%.400s'",
4459 tp->tp_name, PyString_AS_STRING(attr_name));
4460 #endif
4461 return NULL;
4462 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)4463 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
4464 PyObject *descr;
4465 PyTypeObject *tp = Py_TYPE(obj);
4466 if (unlikely(!PyString_Check(attr_name))) {
4467 return PyObject_GenericGetAttr(obj, attr_name);
4468 }
4469 assert(!tp->tp_dictoffset);
4470 descr = _PyType_Lookup(tp, attr_name);
4471 if (unlikely(!descr)) {
4472 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
4473 }
4474 Py_INCREF(descr);
4475 #if PY_MAJOR_VERSION < 3
4476 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
4477 #endif
4478 {
4479 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
4480 if (unlikely(f)) {
4481 PyObject *res = f(descr, obj, (PyObject *)tp);
4482 Py_DECREF(descr);
4483 return res;
4484 }
4485 }
4486 return descr;
4487 }
4488 #endif
4489
4490 /* PyObject_GenericGetAttr */
4491 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)4492 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
4493 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
4494 return PyObject_GenericGetAttr(obj, attr_name);
4495 }
4496 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
4497 }
4498 #endif
4499
4500 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)4501 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
4502 __Pyx_PyThreadState_declare
4503 __Pyx_PyThreadState_assign
4504 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
4505 __Pyx_PyErr_Clear();
4506 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)4507 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
4508 PyObject *result;
4509 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
4510 PyTypeObject* tp = Py_TYPE(obj);
4511 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
4512 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
4513 }
4514 #endif
4515 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
4516 if (unlikely(!result)) {
4517 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
4518 }
4519 return result;
4520 }
4521
4522 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)4523 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
4524 int ret;
4525 PyObject *name_attr;
4526 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
4527 if (likely(name_attr)) {
4528 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
4529 } else {
4530 ret = -1;
4531 }
4532 if (unlikely(ret < 0)) {
4533 PyErr_Clear();
4534 ret = 0;
4535 }
4536 Py_XDECREF(name_attr);
4537 return ret;
4538 }
__Pyx_setup_reduce(PyObject * type_obj)4539 static int __Pyx_setup_reduce(PyObject* type_obj) {
4540 int ret = 0;
4541 PyObject *object_reduce = NULL;
4542 PyObject *object_reduce_ex = NULL;
4543 PyObject *reduce = NULL;
4544 PyObject *reduce_ex = NULL;
4545 PyObject *reduce_cython = NULL;
4546 PyObject *setstate = NULL;
4547 PyObject *setstate_cython = NULL;
4548 #if CYTHON_USE_PYTYPE_LOOKUP
4549 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
4550 #else
4551 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
4552 #endif
4553 #if CYTHON_USE_PYTYPE_LOOKUP
4554 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
4555 #else
4556 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
4557 #endif
4558 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
4559 if (reduce_ex == object_reduce_ex) {
4560 #if CYTHON_USE_PYTYPE_LOOKUP
4561 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
4562 #else
4563 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
4564 #endif
4565 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
4566 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
4567 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
4568 if (likely(reduce_cython)) {
4569 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
4570 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
4571 } else if (reduce == object_reduce || PyErr_Occurred()) {
4572 goto __PYX_BAD;
4573 }
4574 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
4575 if (!setstate) PyErr_Clear();
4576 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
4577 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
4578 if (likely(setstate_cython)) {
4579 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
4580 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
4581 } else if (!setstate || PyErr_Occurred()) {
4582 goto __PYX_BAD;
4583 }
4584 }
4585 PyType_Modified((PyTypeObject*)type_obj);
4586 }
4587 }
4588 goto __PYX_GOOD;
4589 __PYX_BAD:
4590 if (!PyErr_Occurred())
4591 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
4592 ret = -1;
4593 __PYX_GOOD:
4594 #if !CYTHON_USE_PYTYPE_LOOKUP
4595 Py_XDECREF(object_reduce);
4596 Py_XDECREF(object_reduce_ex);
4597 #endif
4598 Py_XDECREF(reduce);
4599 Py_XDECREF(reduce_ex);
4600 Py_XDECREF(reduce_cython);
4601 Py_XDECREF(setstate);
4602 Py_XDECREF(setstate_cython);
4603 return ret;
4604 }
4605
4606 /* CLineInTraceback */
4607 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)4608 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
4609 PyObject *use_cline;
4610 PyObject *ptype, *pvalue, *ptraceback;
4611 #if CYTHON_COMPILING_IN_CPYTHON
4612 PyObject **cython_runtime_dict;
4613 #endif
4614 if (unlikely(!__pyx_cython_runtime)) {
4615 return c_line;
4616 }
4617 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
4618 #if CYTHON_COMPILING_IN_CPYTHON
4619 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
4620 if (likely(cython_runtime_dict)) {
4621 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
4622 use_cline, *cython_runtime_dict,
4623 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
4624 } else
4625 #endif
4626 {
4627 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
4628 if (use_cline_obj) {
4629 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
4630 Py_DECREF(use_cline_obj);
4631 } else {
4632 PyErr_Clear();
4633 use_cline = NULL;
4634 }
4635 }
4636 if (!use_cline) {
4637 c_line = 0;
4638 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
4639 }
4640 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
4641 c_line = 0;
4642 }
4643 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
4644 return c_line;
4645 }
4646 #endif
4647
4648 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)4649 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
4650 int start = 0, mid = 0, end = count - 1;
4651 if (end >= 0 && code_line > entries[end].code_line) {
4652 return count;
4653 }
4654 while (start < end) {
4655 mid = start + (end - start) / 2;
4656 if (code_line < entries[mid].code_line) {
4657 end = mid;
4658 } else if (code_line > entries[mid].code_line) {
4659 start = mid + 1;
4660 } else {
4661 return mid;
4662 }
4663 }
4664 if (code_line <= entries[mid].code_line) {
4665 return mid;
4666 } else {
4667 return mid + 1;
4668 }
4669 }
__pyx_find_code_object(int code_line)4670 static PyCodeObject *__pyx_find_code_object(int code_line) {
4671 PyCodeObject* code_object;
4672 int pos;
4673 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
4674 return NULL;
4675 }
4676 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
4677 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
4678 return NULL;
4679 }
4680 code_object = __pyx_code_cache.entries[pos].code_object;
4681 Py_INCREF(code_object);
4682 return code_object;
4683 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)4684 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
4685 int pos, i;
4686 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
4687 if (unlikely(!code_line)) {
4688 return;
4689 }
4690 if (unlikely(!entries)) {
4691 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
4692 if (likely(entries)) {
4693 __pyx_code_cache.entries = entries;
4694 __pyx_code_cache.max_count = 64;
4695 __pyx_code_cache.count = 1;
4696 entries[0].code_line = code_line;
4697 entries[0].code_object = code_object;
4698 Py_INCREF(code_object);
4699 }
4700 return;
4701 }
4702 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
4703 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
4704 PyCodeObject* tmp = entries[pos].code_object;
4705 entries[pos].code_object = code_object;
4706 Py_DECREF(tmp);
4707 return;
4708 }
4709 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
4710 int new_max = __pyx_code_cache.max_count + 64;
4711 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
4712 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
4713 if (unlikely(!entries)) {
4714 return;
4715 }
4716 __pyx_code_cache.entries = entries;
4717 __pyx_code_cache.max_count = new_max;
4718 }
4719 for (i=__pyx_code_cache.count; i>pos; i--) {
4720 entries[i] = entries[i-1];
4721 }
4722 entries[pos].code_line = code_line;
4723 entries[pos].code_object = code_object;
4724 __pyx_code_cache.count++;
4725 Py_INCREF(code_object);
4726 }
4727
4728 /* AddTraceback */
4729 #include "compile.h"
4730 #include "frameobject.h"
4731 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)4732 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
4733 const char *funcname, int c_line,
4734 int py_line, const char *filename) {
4735 PyCodeObject *py_code = NULL;
4736 PyObject *py_funcname = NULL;
4737 #if PY_MAJOR_VERSION < 3
4738 PyObject *py_srcfile = NULL;
4739 py_srcfile = PyString_FromString(filename);
4740 if (!py_srcfile) goto bad;
4741 #endif
4742 if (c_line) {
4743 #if PY_MAJOR_VERSION < 3
4744 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
4745 if (!py_funcname) goto bad;
4746 #else
4747 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
4748 if (!py_funcname) goto bad;
4749 funcname = PyUnicode_AsUTF8(py_funcname);
4750 if (!funcname) goto bad;
4751 #endif
4752 }
4753 else {
4754 #if PY_MAJOR_VERSION < 3
4755 py_funcname = PyString_FromString(funcname);
4756 if (!py_funcname) goto bad;
4757 #endif
4758 }
4759 #if PY_MAJOR_VERSION < 3
4760 py_code = __Pyx_PyCode_New(
4761 0,
4762 0,
4763 0,
4764 0,
4765 0,
4766 __pyx_empty_bytes, /*PyObject *code,*/
4767 __pyx_empty_tuple, /*PyObject *consts,*/
4768 __pyx_empty_tuple, /*PyObject *names,*/
4769 __pyx_empty_tuple, /*PyObject *varnames,*/
4770 __pyx_empty_tuple, /*PyObject *freevars,*/
4771 __pyx_empty_tuple, /*PyObject *cellvars,*/
4772 py_srcfile, /*PyObject *filename,*/
4773 py_funcname, /*PyObject *name,*/
4774 py_line,
4775 __pyx_empty_bytes /*PyObject *lnotab*/
4776 );
4777 Py_DECREF(py_srcfile);
4778 #else
4779 py_code = PyCode_NewEmpty(filename, funcname, py_line);
4780 #endif
4781 Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
4782 return py_code;
4783 bad:
4784 Py_XDECREF(py_funcname);
4785 #if PY_MAJOR_VERSION < 3
4786 Py_XDECREF(py_srcfile);
4787 #endif
4788 return NULL;
4789 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)4790 static void __Pyx_AddTraceback(const char *funcname, int c_line,
4791 int py_line, const char *filename) {
4792 PyCodeObject *py_code = 0;
4793 PyFrameObject *py_frame = 0;
4794 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4795 if (c_line) {
4796 c_line = __Pyx_CLineForTraceback(tstate, c_line);
4797 }
4798 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
4799 if (!py_code) {
4800 py_code = __Pyx_CreateCodeObjectForTraceback(
4801 funcname, c_line, py_line, filename);
4802 if (!py_code) goto bad;
4803 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
4804 }
4805 py_frame = PyFrame_New(
4806 tstate, /*PyThreadState *tstate,*/
4807 py_code, /*PyCodeObject *code,*/
4808 __pyx_d, /*PyObject *globals,*/
4809 0 /*PyObject *locals*/
4810 );
4811 if (!py_frame) goto bad;
4812 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
4813 PyTraceBack_Here(py_frame);
4814 bad:
4815 Py_XDECREF(py_code);
4816 Py_XDECREF(py_frame);
4817 }
4818
4819 /* CIntFromPyVerify */
4820 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
4821 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
4822 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
4823 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
4824 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
4825 {\
4826 func_type value = func_value;\
4827 if (sizeof(target_type) < sizeof(func_type)) {\
4828 if (unlikely(value != (func_type) (target_type) value)) {\
4829 func_type zero = 0;\
4830 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
4831 return (target_type) -1;\
4832 if (is_unsigned && unlikely(value < zero))\
4833 goto raise_neg_overflow;\
4834 else\
4835 goto raise_overflow;\
4836 }\
4837 }\
4838 return (target_type) value;\
4839 }
4840
4841 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)4842 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
4843 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
4844 #pragma GCC diagnostic push
4845 #pragma GCC diagnostic ignored "-Wconversion"
4846 #endif
4847 const long neg_one = (long) -1, const_zero = (long) 0;
4848 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
4849 #pragma GCC diagnostic pop
4850 #endif
4851 const int is_unsigned = neg_one > const_zero;
4852 #if PY_MAJOR_VERSION < 3
4853 if (likely(PyInt_Check(x))) {
4854 if (sizeof(long) < sizeof(long)) {
4855 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
4856 } else {
4857 long val = PyInt_AS_LONG(x);
4858 if (is_unsigned && unlikely(val < 0)) {
4859 goto raise_neg_overflow;
4860 }
4861 return (long) val;
4862 }
4863 } else
4864 #endif
4865 if (likely(PyLong_Check(x))) {
4866 if (is_unsigned) {
4867 #if CYTHON_USE_PYLONG_INTERNALS
4868 const digit* digits = ((PyLongObject*)x)->ob_digit;
4869 switch (Py_SIZE(x)) {
4870 case 0: return (long) 0;
4871 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
4872 case 2:
4873 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
4874 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
4875 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4876 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
4877 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
4878 }
4879 }
4880 break;
4881 case 3:
4882 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
4883 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
4884 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4885 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
4886 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
4887 }
4888 }
4889 break;
4890 case 4:
4891 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
4892 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
4893 __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])))
4894 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
4895 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
4896 }
4897 }
4898 break;
4899 }
4900 #endif
4901 #if CYTHON_COMPILING_IN_CPYTHON
4902 if (unlikely(Py_SIZE(x) < 0)) {
4903 goto raise_neg_overflow;
4904 }
4905 #else
4906 {
4907 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
4908 if (unlikely(result < 0))
4909 return (long) -1;
4910 if (unlikely(result == 1))
4911 goto raise_neg_overflow;
4912 }
4913 #endif
4914 if (sizeof(long) <= sizeof(unsigned long)) {
4915 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
4916 #ifdef HAVE_LONG_LONG
4917 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
4918 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
4919 #endif
4920 }
4921 } else {
4922 #if CYTHON_USE_PYLONG_INTERNALS
4923 const digit* digits = ((PyLongObject*)x)->ob_digit;
4924 switch (Py_SIZE(x)) {
4925 case 0: return (long) 0;
4926 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
4927 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
4928 case -2:
4929 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
4930 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
4931 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4932 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
4933 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4934 }
4935 }
4936 break;
4937 case 2:
4938 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
4939 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
4940 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4941 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
4942 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4943 }
4944 }
4945 break;
4946 case -3:
4947 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
4948 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
4949 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4950 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
4951 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4952 }
4953 }
4954 break;
4955 case 3:
4956 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
4957 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
4958 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4959 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
4960 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4961 }
4962 }
4963 break;
4964 case -4:
4965 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
4966 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
4967 __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])))
4968 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
4969 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4970 }
4971 }
4972 break;
4973 case 4:
4974 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
4975 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
4976 __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])))
4977 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
4978 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4979 }
4980 }
4981 break;
4982 }
4983 #endif
4984 if (sizeof(long) <= sizeof(long)) {
4985 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
4986 #ifdef HAVE_LONG_LONG
4987 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
4988 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
4989 #endif
4990 }
4991 }
4992 {
4993 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
4994 PyErr_SetString(PyExc_RuntimeError,
4995 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
4996 #else
4997 long val;
4998 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
4999 #if PY_MAJOR_VERSION < 3
5000 if (likely(v) && !PyLong_Check(v)) {
5001 PyObject *tmp = v;
5002 v = PyNumber_Long(tmp);
5003 Py_DECREF(tmp);
5004 }
5005 #endif
5006 if (likely(v)) {
5007 int one = 1; int is_little = (int)*(unsigned char *)&one;
5008 unsigned char *bytes = (unsigned char *)&val;
5009 int ret = _PyLong_AsByteArray((PyLongObject *)v,
5010 bytes, sizeof(val),
5011 is_little, !is_unsigned);
5012 Py_DECREF(v);
5013 if (likely(!ret))
5014 return val;
5015 }
5016 #endif
5017 return (long) -1;
5018 }
5019 } else {
5020 long val;
5021 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
5022 if (!tmp) return (long) -1;
5023 val = __Pyx_PyInt_As_long(tmp);
5024 Py_DECREF(tmp);
5025 return val;
5026 }
5027 raise_overflow:
5028 PyErr_SetString(PyExc_OverflowError,
5029 "value too large to convert to long");
5030 return (long) -1;
5031 raise_neg_overflow:
5032 PyErr_SetString(PyExc_OverflowError,
5033 "can't convert negative value to long");
5034 return (long) -1;
5035 }
5036
5037 /* CIntToPy */
__Pyx_PyInt_From_long(long value)5038 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
5039 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5040 #pragma GCC diagnostic push
5041 #pragma GCC diagnostic ignored "-Wconversion"
5042 #endif
5043 const long neg_one = (long) -1, const_zero = (long) 0;
5044 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5045 #pragma GCC diagnostic pop
5046 #endif
5047 const int is_unsigned = neg_one > const_zero;
5048 if (is_unsigned) {
5049 if (sizeof(long) < sizeof(long)) {
5050 return PyInt_FromLong((long) value);
5051 } else if (sizeof(long) <= sizeof(unsigned long)) {
5052 return PyLong_FromUnsignedLong((unsigned long) value);
5053 #ifdef HAVE_LONG_LONG
5054 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
5055 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
5056 #endif
5057 }
5058 } else {
5059 if (sizeof(long) <= sizeof(long)) {
5060 return PyInt_FromLong((long) value);
5061 #ifdef HAVE_LONG_LONG
5062 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
5063 return PyLong_FromLongLong((PY_LONG_LONG) value);
5064 #endif
5065 }
5066 }
5067 {
5068 int one = 1; int little = (int)*(unsigned char *)&one;
5069 unsigned char *bytes = (unsigned char *)&value;
5070 return _PyLong_FromByteArray(bytes, sizeof(long),
5071 little, !is_unsigned);
5072 }
5073 }
5074
5075 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)5076 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
5077 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5078 #pragma GCC diagnostic push
5079 #pragma GCC diagnostic ignored "-Wconversion"
5080 #endif
5081 const int neg_one = (int) -1, const_zero = (int) 0;
5082 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5083 #pragma GCC diagnostic pop
5084 #endif
5085 const int is_unsigned = neg_one > const_zero;
5086 #if PY_MAJOR_VERSION < 3
5087 if (likely(PyInt_Check(x))) {
5088 if (sizeof(int) < sizeof(long)) {
5089 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
5090 } else {
5091 long val = PyInt_AS_LONG(x);
5092 if (is_unsigned && unlikely(val < 0)) {
5093 goto raise_neg_overflow;
5094 }
5095 return (int) val;
5096 }
5097 } else
5098 #endif
5099 if (likely(PyLong_Check(x))) {
5100 if (is_unsigned) {
5101 #if CYTHON_USE_PYLONG_INTERNALS
5102 const digit* digits = ((PyLongObject*)x)->ob_digit;
5103 switch (Py_SIZE(x)) {
5104 case 0: return (int) 0;
5105 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
5106 case 2:
5107 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
5108 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5109 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5110 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
5111 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5112 }
5113 }
5114 break;
5115 case 3:
5116 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
5117 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5118 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5119 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
5120 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5121 }
5122 }
5123 break;
5124 case 4:
5125 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
5126 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5127 __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])))
5128 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
5129 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5130 }
5131 }
5132 break;
5133 }
5134 #endif
5135 #if CYTHON_COMPILING_IN_CPYTHON
5136 if (unlikely(Py_SIZE(x) < 0)) {
5137 goto raise_neg_overflow;
5138 }
5139 #else
5140 {
5141 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5142 if (unlikely(result < 0))
5143 return (int) -1;
5144 if (unlikely(result == 1))
5145 goto raise_neg_overflow;
5146 }
5147 #endif
5148 if (sizeof(int) <= sizeof(unsigned long)) {
5149 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
5150 #ifdef HAVE_LONG_LONG
5151 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
5152 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
5153 #endif
5154 }
5155 } else {
5156 #if CYTHON_USE_PYLONG_INTERNALS
5157 const digit* digits = ((PyLongObject*)x)->ob_digit;
5158 switch (Py_SIZE(x)) {
5159 case 0: return (int) 0;
5160 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
5161 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
5162 case -2:
5163 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
5164 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5165 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5166 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
5167 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5168 }
5169 }
5170 break;
5171 case 2:
5172 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
5173 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5174 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5175 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
5176 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5177 }
5178 }
5179 break;
5180 case -3:
5181 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
5182 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5183 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5184 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
5185 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5186 }
5187 }
5188 break;
5189 case 3:
5190 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
5191 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5192 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5193 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
5194 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5195 }
5196 }
5197 break;
5198 case -4:
5199 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
5200 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5201 __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])))
5202 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
5203 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5204 }
5205 }
5206 break;
5207 case 4:
5208 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
5209 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5210 __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])))
5211 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
5212 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5213 }
5214 }
5215 break;
5216 }
5217 #endif
5218 if (sizeof(int) <= sizeof(long)) {
5219 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
5220 #ifdef HAVE_LONG_LONG
5221 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
5222 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
5223 #endif
5224 }
5225 }
5226 {
5227 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
5228 PyErr_SetString(PyExc_RuntimeError,
5229 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
5230 #else
5231 int val;
5232 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
5233 #if PY_MAJOR_VERSION < 3
5234 if (likely(v) && !PyLong_Check(v)) {
5235 PyObject *tmp = v;
5236 v = PyNumber_Long(tmp);
5237 Py_DECREF(tmp);
5238 }
5239 #endif
5240 if (likely(v)) {
5241 int one = 1; int is_little = (int)*(unsigned char *)&one;
5242 unsigned char *bytes = (unsigned char *)&val;
5243 int ret = _PyLong_AsByteArray((PyLongObject *)v,
5244 bytes, sizeof(val),
5245 is_little, !is_unsigned);
5246 Py_DECREF(v);
5247 if (likely(!ret))
5248 return val;
5249 }
5250 #endif
5251 return (int) -1;
5252 }
5253 } else {
5254 int val;
5255 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
5256 if (!tmp) return (int) -1;
5257 val = __Pyx_PyInt_As_int(tmp);
5258 Py_DECREF(tmp);
5259 return val;
5260 }
5261 raise_overflow:
5262 PyErr_SetString(PyExc_OverflowError,
5263 "value too large to convert to int");
5264 return (int) -1;
5265 raise_neg_overflow:
5266 PyErr_SetString(PyExc_OverflowError,
5267 "can't convert negative value to int");
5268 return (int) -1;
5269 }
5270
5271 /* FastTypeChecks */
5272 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)5273 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
5274 while (a) {
5275 a = a->tp_base;
5276 if (a == b)
5277 return 1;
5278 }
5279 return b == &PyBaseObject_Type;
5280 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)5281 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
5282 PyObject *mro;
5283 if (a == b) return 1;
5284 mro = a->tp_mro;
5285 if (likely(mro)) {
5286 Py_ssize_t i, n;
5287 n = PyTuple_GET_SIZE(mro);
5288 for (i = 0; i < n; i++) {
5289 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
5290 return 1;
5291 }
5292 return 0;
5293 }
5294 return __Pyx_InBases(a, b);
5295 }
5296 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)5297 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
5298 PyObject *exception, *value, *tb;
5299 int res;
5300 __Pyx_PyThreadState_declare
5301 __Pyx_PyThreadState_assign
5302 __Pyx_ErrFetch(&exception, &value, &tb);
5303 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
5304 if (unlikely(res == -1)) {
5305 PyErr_WriteUnraisable(err);
5306 res = 0;
5307 }
5308 if (!res) {
5309 res = PyObject_IsSubclass(err, exc_type2);
5310 if (unlikely(res == -1)) {
5311 PyErr_WriteUnraisable(err);
5312 res = 0;
5313 }
5314 }
5315 __Pyx_ErrRestore(exception, value, tb);
5316 return res;
5317 }
5318 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)5319 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
5320 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
5321 if (!res) {
5322 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
5323 }
5324 return res;
5325 }
5326 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)5327 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
5328 Py_ssize_t i, n;
5329 assert(PyExceptionClass_Check(exc_type));
5330 n = PyTuple_GET_SIZE(tuple);
5331 #if PY_MAJOR_VERSION >= 3
5332 for (i=0; i<n; i++) {
5333 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
5334 }
5335 #endif
5336 for (i=0; i<n; i++) {
5337 PyObject *t = PyTuple_GET_ITEM(tuple, i);
5338 #if PY_MAJOR_VERSION < 3
5339 if (likely(exc_type == t)) return 1;
5340 #endif
5341 if (likely(PyExceptionClass_Check(t))) {
5342 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
5343 } else {
5344 }
5345 }
5346 return 0;
5347 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)5348 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
5349 if (likely(err == exc_type)) return 1;
5350 if (likely(PyExceptionClass_Check(err))) {
5351 if (likely(PyExceptionClass_Check(exc_type))) {
5352 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
5353 } else if (likely(PyTuple_Check(exc_type))) {
5354 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
5355 } else {
5356 }
5357 }
5358 return PyErr_GivenExceptionMatches(err, exc_type);
5359 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)5360 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
5361 assert(PyExceptionClass_Check(exc_type1));
5362 assert(PyExceptionClass_Check(exc_type2));
5363 if (likely(err == exc_type1 || err == exc_type2)) return 1;
5364 if (likely(PyExceptionClass_Check(err))) {
5365 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
5366 }
5367 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
5368 }
5369 #endif
5370
5371 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)5372 static int __Pyx_check_binary_version(void) {
5373 char ctversion[4], rtversion[4];
5374 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
5375 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
5376 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
5377 char message[200];
5378 PyOS_snprintf(message, sizeof(message),
5379 "compiletime version %s of module '%.100s' "
5380 "does not match runtime version %s",
5381 ctversion, __Pyx_MODULE_NAME, rtversion);
5382 return PyErr_WarnEx(NULL, message, 1);
5383 }
5384 return 0;
5385 }
5386
5387 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)5388 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
5389 while (t->p) {
5390 #if PY_MAJOR_VERSION < 3
5391 if (t->is_unicode) {
5392 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
5393 } else if (t->intern) {
5394 *t->p = PyString_InternFromString(t->s);
5395 } else {
5396 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
5397 }
5398 #else
5399 if (t->is_unicode | t->is_str) {
5400 if (t->intern) {
5401 *t->p = PyUnicode_InternFromString(t->s);
5402 } else if (t->encoding) {
5403 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
5404 } else {
5405 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
5406 }
5407 } else {
5408 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
5409 }
5410 #endif
5411 if (!*t->p)
5412 return -1;
5413 if (PyObject_Hash(*t->p) == -1)
5414 return -1;
5415 ++t;
5416 }
5417 return 0;
5418 }
5419
__Pyx_PyUnicode_FromString(const char * c_str)5420 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
5421 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
5422 }
__Pyx_PyObject_AsString(PyObject * o)5423 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
5424 Py_ssize_t ignore;
5425 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
5426 }
5427 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
5428 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)5429 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
5430 char* defenc_c;
5431 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
5432 if (!defenc) return NULL;
5433 defenc_c = PyBytes_AS_STRING(defenc);
5434 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
5435 {
5436 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
5437 char* c;
5438 for (c = defenc_c; c < end; c++) {
5439 if ((unsigned char) (*c) >= 128) {
5440 PyUnicode_AsASCIIString(o);
5441 return NULL;
5442 }
5443 }
5444 }
5445 #endif
5446 *length = PyBytes_GET_SIZE(defenc);
5447 return defenc_c;
5448 }
5449 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)5450 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
5451 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
5452 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
5453 if (likely(PyUnicode_IS_ASCII(o))) {
5454 *length = PyUnicode_GET_LENGTH(o);
5455 return PyUnicode_AsUTF8(o);
5456 } else {
5457 PyUnicode_AsASCIIString(o);
5458 return NULL;
5459 }
5460 #else
5461 return PyUnicode_AsUTF8AndSize(o, length);
5462 #endif
5463 }
5464 #endif
5465 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)5466 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
5467 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
5468 if (
5469 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
5470 __Pyx_sys_getdefaultencoding_not_ascii &&
5471 #endif
5472 PyUnicode_Check(o)) {
5473 return __Pyx_PyUnicode_AsStringAndSize(o, length);
5474 } else
5475 #endif
5476 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
5477 if (PyByteArray_Check(o)) {
5478 *length = PyByteArray_GET_SIZE(o);
5479 return PyByteArray_AS_STRING(o);
5480 } else
5481 #endif
5482 {
5483 char* result;
5484 int r = PyBytes_AsStringAndSize(o, &result, length);
5485 if (unlikely(r < 0)) {
5486 return NULL;
5487 } else {
5488 return result;
5489 }
5490 }
5491 }
__Pyx_PyObject_IsTrue(PyObject * x)5492 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
5493 int is_true = x == Py_True;
5494 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
5495 else return PyObject_IsTrue(x);
5496 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)5497 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
5498 int retval;
5499 if (unlikely(!x)) return -1;
5500 retval = __Pyx_PyObject_IsTrue(x);
5501 Py_DECREF(x);
5502 return retval;
5503 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)5504 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
5505 #if PY_MAJOR_VERSION >= 3
5506 if (PyLong_Check(result)) {
5507 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
5508 "__int__ returned non-int (type %.200s). "
5509 "The ability to return an instance of a strict subclass of int "
5510 "is deprecated, and may be removed in a future version of Python.",
5511 Py_TYPE(result)->tp_name)) {
5512 Py_DECREF(result);
5513 return NULL;
5514 }
5515 return result;
5516 }
5517 #endif
5518 PyErr_Format(PyExc_TypeError,
5519 "__%.4s__ returned non-%.4s (type %.200s)",
5520 type_name, type_name, Py_TYPE(result)->tp_name);
5521 Py_DECREF(result);
5522 return NULL;
5523 }
__Pyx_PyNumber_IntOrLong(PyObject * x)5524 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
5525 #if CYTHON_USE_TYPE_SLOTS
5526 PyNumberMethods *m;
5527 #endif
5528 const char *name = NULL;
5529 PyObject *res = NULL;
5530 #if PY_MAJOR_VERSION < 3
5531 if (likely(PyInt_Check(x) || PyLong_Check(x)))
5532 #else
5533 if (likely(PyLong_Check(x)))
5534 #endif
5535 return __Pyx_NewRef(x);
5536 #if CYTHON_USE_TYPE_SLOTS
5537 m = Py_TYPE(x)->tp_as_number;
5538 #if PY_MAJOR_VERSION < 3
5539 if (m && m->nb_int) {
5540 name = "int";
5541 res = m->nb_int(x);
5542 }
5543 else if (m && m->nb_long) {
5544 name = "long";
5545 res = m->nb_long(x);
5546 }
5547 #else
5548 if (likely(m && m->nb_int)) {
5549 name = "int";
5550 res = m->nb_int(x);
5551 }
5552 #endif
5553 #else
5554 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
5555 res = PyNumber_Int(x);
5556 }
5557 #endif
5558 if (likely(res)) {
5559 #if PY_MAJOR_VERSION < 3
5560 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
5561 #else
5562 if (unlikely(!PyLong_CheckExact(res))) {
5563 #endif
5564 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
5565 }
5566 }
5567 else if (!PyErr_Occurred()) {
5568 PyErr_SetString(PyExc_TypeError,
5569 "an integer is required");
5570 }
5571 return res;
5572 }
5573 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
5574 Py_ssize_t ival;
5575 PyObject *x;
5576 #if PY_MAJOR_VERSION < 3
5577 if (likely(PyInt_CheckExact(b))) {
5578 if (sizeof(Py_ssize_t) >= sizeof(long))
5579 return PyInt_AS_LONG(b);
5580 else
5581 return PyInt_AsSsize_t(b);
5582 }
5583 #endif
5584 if (likely(PyLong_CheckExact(b))) {
5585 #if CYTHON_USE_PYLONG_INTERNALS
5586 const digit* digits = ((PyLongObject*)b)->ob_digit;
5587 const Py_ssize_t size = Py_SIZE(b);
5588 if (likely(__Pyx_sst_abs(size) <= 1)) {
5589 ival = likely(size) ? digits[0] : 0;
5590 if (size == -1) ival = -ival;
5591 return ival;
5592 } else {
5593 switch (size) {
5594 case 2:
5595 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
5596 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
5597 }
5598 break;
5599 case -2:
5600 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
5601 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
5602 }
5603 break;
5604 case 3:
5605 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
5606 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
5607 }
5608 break;
5609 case -3:
5610 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
5611 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
5612 }
5613 break;
5614 case 4:
5615 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
5616 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]));
5617 }
5618 break;
5619 case -4:
5620 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
5621 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]));
5622 }
5623 break;
5624 }
5625 }
5626 #endif
5627 return PyLong_AsSsize_t(b);
5628 }
5629 x = PyNumber_Index(b);
5630 if (!x) return -1;
5631 ival = PyInt_AsSsize_t(x);
5632 Py_DECREF(x);
5633 return ival;
5634 }
5635 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
5636 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
5637 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
5638 #if PY_MAJOR_VERSION < 3
5639 } else if (likely(PyInt_CheckExact(o))) {
5640 return PyInt_AS_LONG(o);
5641 #endif
5642 } else {
5643 Py_ssize_t ival;
5644 PyObject *x;
5645 x = PyNumber_Index(o);
5646 if (!x) return -1;
5647 ival = PyInt_AsLong(x);
5648 Py_DECREF(x);
5649 return ival;
5650 }
5651 }
5652 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
5653 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
5654 }
5655 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
5656 return PyInt_FromSize_t(ival);
5657 }
5658
5659
5660 #endif /* Py_PYTHON_H */
5661