1 /* Generated by Cython 0.29.13 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6     #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8     #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_13"
11 #define CYTHON_HEX_VERSION 0x001D0DF0
12 #define CYTHON_FUTURE_DIVISION 1
13 #include <stddef.h>
14 #ifndef offsetof
15   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18   #ifndef __stdcall
19     #define __stdcall
20   #endif
21   #ifndef __cdecl
22     #define __cdecl
23   #endif
24   #ifndef __fastcall
25     #define __fastcall
26   #endif
27 #endif
28 #ifndef DL_IMPORT
29   #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32   #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36   #if PY_VERSION_HEX >= 0x02070000
37     #define HAVE_LONG_LONG
38   #endif
39 #endif
40 #ifndef PY_LONG_LONG
41   #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44   #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47   #define CYTHON_COMPILING_IN_PYPY 1
48   #define CYTHON_COMPILING_IN_PYSTON 0
49   #define CYTHON_COMPILING_IN_CPYTHON 0
50   #undef CYTHON_USE_TYPE_SLOTS
51   #define CYTHON_USE_TYPE_SLOTS 0
52   #undef CYTHON_USE_PYTYPE_LOOKUP
53   #define CYTHON_USE_PYTYPE_LOOKUP 0
54   #if PY_VERSION_HEX < 0x03050000
55     #undef CYTHON_USE_ASYNC_SLOTS
56     #define CYTHON_USE_ASYNC_SLOTS 0
57   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58     #define CYTHON_USE_ASYNC_SLOTS 1
59   #endif
60   #undef CYTHON_USE_PYLIST_INTERNALS
61   #define CYTHON_USE_PYLIST_INTERNALS 0
62   #undef CYTHON_USE_UNICODE_INTERNALS
63   #define CYTHON_USE_UNICODE_INTERNALS 0
64   #undef CYTHON_USE_UNICODE_WRITER
65   #define CYTHON_USE_UNICODE_WRITER 0
66   #undef CYTHON_USE_PYLONG_INTERNALS
67   #define CYTHON_USE_PYLONG_INTERNALS 0
68   #undef CYTHON_AVOID_BORROWED_REFS
69   #define CYTHON_AVOID_BORROWED_REFS 1
70   #undef CYTHON_ASSUME_SAFE_MACROS
71   #define CYTHON_ASSUME_SAFE_MACROS 0
72   #undef CYTHON_UNPACK_METHODS
73   #define CYTHON_UNPACK_METHODS 0
74   #undef CYTHON_FAST_THREAD_STATE
75   #define CYTHON_FAST_THREAD_STATE 0
76   #undef CYTHON_FAST_PYCALL
77   #define CYTHON_FAST_PYCALL 0
78   #undef CYTHON_PEP489_MULTI_PHASE_INIT
79   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80   #undef CYTHON_USE_TP_FINALIZE
81   #define CYTHON_USE_TP_FINALIZE 0
82   #undef CYTHON_USE_DICT_VERSIONS
83   #define CYTHON_USE_DICT_VERSIONS 0
84   #undef CYTHON_USE_EXC_INFO_STACK
85   #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87   #define CYTHON_COMPILING_IN_PYPY 0
88   #define CYTHON_COMPILING_IN_PYSTON 1
89   #define CYTHON_COMPILING_IN_CPYTHON 0
90   #ifndef CYTHON_USE_TYPE_SLOTS
91     #define CYTHON_USE_TYPE_SLOTS 1
92   #endif
93   #undef CYTHON_USE_PYTYPE_LOOKUP
94   #define CYTHON_USE_PYTYPE_LOOKUP 0
95   #undef CYTHON_USE_ASYNC_SLOTS
96   #define CYTHON_USE_ASYNC_SLOTS 0
97   #undef CYTHON_USE_PYLIST_INTERNALS
98   #define CYTHON_USE_PYLIST_INTERNALS 0
99   #ifndef CYTHON_USE_UNICODE_INTERNALS
100     #define CYTHON_USE_UNICODE_INTERNALS 1
101   #endif
102   #undef CYTHON_USE_UNICODE_WRITER
103   #define CYTHON_USE_UNICODE_WRITER 0
104   #undef CYTHON_USE_PYLONG_INTERNALS
105   #define CYTHON_USE_PYLONG_INTERNALS 0
106   #ifndef CYTHON_AVOID_BORROWED_REFS
107     #define CYTHON_AVOID_BORROWED_REFS 0
108   #endif
109   #ifndef CYTHON_ASSUME_SAFE_MACROS
110     #define CYTHON_ASSUME_SAFE_MACROS 1
111   #endif
112   #ifndef CYTHON_UNPACK_METHODS
113     #define CYTHON_UNPACK_METHODS 1
114   #endif
115   #undef CYTHON_FAST_THREAD_STATE
116   #define CYTHON_FAST_THREAD_STATE 0
117   #undef CYTHON_FAST_PYCALL
118   #define CYTHON_FAST_PYCALL 0
119   #undef CYTHON_PEP489_MULTI_PHASE_INIT
120   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121   #undef CYTHON_USE_TP_FINALIZE
122   #define CYTHON_USE_TP_FINALIZE 0
123   #undef CYTHON_USE_DICT_VERSIONS
124   #define CYTHON_USE_DICT_VERSIONS 0
125   #undef CYTHON_USE_EXC_INFO_STACK
126   #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128   #define CYTHON_COMPILING_IN_PYPY 0
129   #define CYTHON_COMPILING_IN_PYSTON 0
130   #define CYTHON_COMPILING_IN_CPYTHON 1
131   #ifndef CYTHON_USE_TYPE_SLOTS
132     #define CYTHON_USE_TYPE_SLOTS 1
133   #endif
134   #if PY_VERSION_HEX < 0x02070000
135     #undef CYTHON_USE_PYTYPE_LOOKUP
136     #define CYTHON_USE_PYTYPE_LOOKUP 0
137   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138     #define CYTHON_USE_PYTYPE_LOOKUP 1
139   #endif
140   #if PY_MAJOR_VERSION < 3
141     #undef CYTHON_USE_ASYNC_SLOTS
142     #define CYTHON_USE_ASYNC_SLOTS 0
143   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144     #define CYTHON_USE_ASYNC_SLOTS 1
145   #endif
146   #if PY_VERSION_HEX < 0x02070000
147     #undef CYTHON_USE_PYLONG_INTERNALS
148     #define CYTHON_USE_PYLONG_INTERNALS 0
149   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150     #define CYTHON_USE_PYLONG_INTERNALS 1
151   #endif
152   #ifndef CYTHON_USE_PYLIST_INTERNALS
153     #define CYTHON_USE_PYLIST_INTERNALS 1
154   #endif
155   #ifndef CYTHON_USE_UNICODE_INTERNALS
156     #define CYTHON_USE_UNICODE_INTERNALS 1
157   #endif
158   #if PY_VERSION_HEX < 0x030300F0
159     #undef CYTHON_USE_UNICODE_WRITER
160     #define CYTHON_USE_UNICODE_WRITER 0
161   #elif !defined(CYTHON_USE_UNICODE_WRITER)
162     #define CYTHON_USE_UNICODE_WRITER 1
163   #endif
164   #ifndef CYTHON_AVOID_BORROWED_REFS
165     #define CYTHON_AVOID_BORROWED_REFS 0
166   #endif
167   #ifndef CYTHON_ASSUME_SAFE_MACROS
168     #define CYTHON_ASSUME_SAFE_MACROS 1
169   #endif
170   #ifndef CYTHON_UNPACK_METHODS
171     #define CYTHON_UNPACK_METHODS 1
172   #endif
173   #ifndef CYTHON_FAST_THREAD_STATE
174     #define CYTHON_FAST_THREAD_STATE 1
175   #endif
176   #ifndef CYTHON_FAST_PYCALL
177     #define CYTHON_FAST_PYCALL 1
178   #endif
179   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181   #endif
182   #ifndef CYTHON_USE_TP_FINALIZE
183     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184   #endif
185   #ifndef CYTHON_USE_DICT_VERSIONS
186     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187   #endif
188   #ifndef CYTHON_USE_EXC_INFO_STACK
189     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190   #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196   #include "longintrepr.h"
197   #undef SHIFT
198   #undef BASE
199   #undef MASK
200   #ifdef SIZEOF_VOID_P
201     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202   #endif
203 #endif
204 #ifndef __has_attribute
205   #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208   #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211   #if defined(__GNUC__)
212     #define CYTHON_RESTRICT __restrict__
213   #elif defined(_MSC_VER) && _MSC_VER >= 1400
214     #define CYTHON_RESTRICT __restrict
215   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216     #define CYTHON_RESTRICT restrict
217   #else
218     #define CYTHON_RESTRICT
219   #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 #     define CYTHON_UNUSED __attribute__ ((__unused__))
225 #   else
226 #     define CYTHON_UNUSED
227 #   endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 #   define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 #   define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)236      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 #  else
238 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 #  endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 #  define CYTHON_NCP_UNUSED
244 # else
245 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250     #ifndef _MSC_STDINT_H_
251         #if _MSC_VER < 1300
252            typedef unsigned char     uint8_t;
253            typedef unsigned int      uint32_t;
254         #else
255            typedef unsigned __int8   uint8_t;
256            typedef unsigned __int32  uint32_t;
257         #endif
258     #endif
259 #else
260    #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263   #if defined(__cplusplus) && __cplusplus >= 201103L
264     #if __has_cpp_attribute(fallthrough)
265       #define CYTHON_FALLTHROUGH [[fallthrough]]
266     #elif __has_cpp_attribute(clang::fallthrough)
267       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268     #elif __has_cpp_attribute(gnu::fallthrough)
269       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270     #endif
271   #endif
272   #ifndef CYTHON_FALLTHROUGH
273     #if __has_attribute(fallthrough)
274       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275     #else
276       #define CYTHON_FALLTHROUGH
277     #endif
278   #endif
279   #if defined(__clang__ ) && defined(__apple_build_version__)
280     #if __apple_build_version__ < 7000000
281       #undef  CYTHON_FALLTHROUGH
282       #define CYTHON_FALLTHROUGH
283     #endif
284   #endif
285 #endif
286 
287 #ifndef CYTHON_INLINE
288   #if defined(__clang__)
289     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290   #elif defined(__GNUC__)
291     #define CYTHON_INLINE __inline__
292   #elif defined(_MSC_VER)
293     #define CYTHON_INLINE __inline
294   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295     #define CYTHON_INLINE inline
296   #else
297     #define CYTHON_INLINE
298   #endif
299 #endif
300 
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302   #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310   #define __Pyx_DefaultClassType PyClass_Type
311 #else
312   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320   #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323   #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326   #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332   #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335   #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338   #ifndef METH_FASTCALL
339      #define METH_FASTCALL 0x80
340   #endif
341   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343                                                           Py_ssize_t nargs, PyObject *kwnames);
344 #else
345   #define __Pyx_PyCFunctionFast _PyCFunctionFast
346   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355   #define PyObject_Malloc(s)   PyMem_Malloc(s)
356   #define PyObject_Free(p)     PyMem_Free(p)
357   #define PyObject_Realloc(p)  PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
361   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
362   #define PyMem_RawFree(p)             PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
366   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
369   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372   #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376   #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378   #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385   *key = PyThread_create_key();
386   return 0;
387 }
PyThread_tss_alloc(void)388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390   *key = Py_tss_NEEDS_INIT;
391   return key;
392 }
PyThread_tss_free(Py_tss_t * key)393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394   PyObject_Free(key);
395 }
PyThread_tss_is_created(Py_tss_t * key)396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397   return *key != Py_tss_NEEDS_INIT;
398 }
PyThread_tss_delete(Py_tss_t * key)399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400   PyThread_delete_key(*key);
401   *key = Py_tss_NEEDS_INIT;
402 }
PyThread_tss_set(Py_tss_t * key,void * value)403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404   return PyThread_set_key_value(*key, value);
405 }
PyThread_tss_get(Py_tss_t * key)406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407   return PyThread_get_key_value(*key);
408 }
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
417   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
418 #else
419   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
420   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428   #define CYTHON_PEP393_ENABLED 1
429   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
430                                               0 : _PyUnicode_Ready((PyObject *)(op)))
431   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
432   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
434   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
435   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
436   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
437   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
438   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
439 #else
440   #define CYTHON_PEP393_ENABLED 0
441   #define PyUnicode_1BYTE_KIND  1
442   #define PyUnicode_2BYTE_KIND  2
443   #define PyUnicode_4BYTE_KIND  4
444   #define __Pyx_PyUnicode_READY(op)       (0)
445   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
446   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
447   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
448   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
449   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
450   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
451   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
452   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
453 #endif
454 #if CYTHON_COMPILING_IN_PYPY
455   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
456   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
457 #else
458   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
459   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
460       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
461 #endif
462 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
463   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
464 #endif
465 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
466   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
469   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
470 #endif
471 #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))
472 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
473 #if PY_MAJOR_VERSION >= 3
474   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
475 #else
476   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
477 #endif
478 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
479   #define PyObject_ASCII(o)            PyObject_Repr(o)
480 #endif
481 #if PY_MAJOR_VERSION >= 3
482   #define PyBaseString_Type            PyUnicode_Type
483   #define PyStringObject               PyUnicodeObject
484   #define PyString_Type                PyUnicode_Type
485   #define PyString_Check               PyUnicode_Check
486   #define PyString_CheckExact          PyUnicode_CheckExact
487   #define PyObject_Unicode             PyObject_Str
488 #endif
489 #if PY_MAJOR_VERSION >= 3
490   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
491   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
492 #else
493   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
494   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
495 #endif
496 #ifndef PySet_CheckExact
497   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
498 #endif
499 #if CYTHON_ASSUME_SAFE_MACROS
500   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
501 #else
502   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
503 #endif
504 #if PY_MAJOR_VERSION >= 3
505   #define PyIntObject                  PyLongObject
506   #define PyInt_Type                   PyLong_Type
507   #define PyInt_Check(op)              PyLong_Check(op)
508   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
509   #define PyInt_FromString             PyLong_FromString
510   #define PyInt_FromUnicode            PyLong_FromUnicode
511   #define PyInt_FromLong               PyLong_FromLong
512   #define PyInt_FromSize_t             PyLong_FromSize_t
513   #define PyInt_FromSsize_t            PyLong_FromSsize_t
514   #define PyInt_AsLong                 PyLong_AsLong
515   #define PyInt_AS_LONG                PyLong_AS_LONG
516   #define PyInt_AsSsize_t              PyLong_AsSsize_t
517   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
518   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
519   #define PyNumber_Int                 PyNumber_Long
520 #endif
521 #if PY_MAJOR_VERSION >= 3
522   #define PyBoolObject                 PyLongObject
523 #endif
524 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
525   #ifndef PyUnicode_InternFromString
526     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
527   #endif
528 #endif
529 #if PY_VERSION_HEX < 0x030200A4
530   typedef long Py_hash_t;
531   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
532   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
533 #else
534   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
535   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
536 #endif
537 #if PY_MAJOR_VERSION >= 3
538   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
539 #else
540   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
541 #endif
542 #if CYTHON_USE_ASYNC_SLOTS
543   #if PY_VERSION_HEX >= 0x030500B1
544     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
545     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
546   #else
547     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
548   #endif
549 #else
550   #define __Pyx_PyType_AsAsync(obj) NULL
551 #endif
552 #ifndef __Pyx_PyAsyncMethodsStruct
553     typedef struct {
554         unaryfunc am_await;
555         unaryfunc am_aiter;
556         unaryfunc am_anext;
557     } __Pyx_PyAsyncMethodsStruct;
558 #endif
559 
560 #if defined(WIN32) || defined(MS_WINDOWS)
561   #define _USE_MATH_DEFINES
562 #endif
563 #include <math.h>
564 #ifdef NAN
565 #define __PYX_NAN() ((float) NAN)
566 #else
__PYX_NAN()567 static CYTHON_INLINE float __PYX_NAN() {
568   float value;
569   memset(&value, 0xFF, sizeof(value));
570   return value;
571 }
572 #endif
573 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
574 #define __Pyx_truncl trunc
575 #else
576 #define __Pyx_truncl truncl
577 #endif
578 
579 
580 #define __PYX_ERR(f_index, lineno, Ln_error) \
581 { \
582   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
583 }
584 
585 #ifndef __PYX_EXTERN_C
586   #ifdef __cplusplus
587     #define __PYX_EXTERN_C extern "C"
588   #else
589     #define __PYX_EXTERN_C extern
590   #endif
591 #endif
592 
593 #define __PYX_HAVE__MACS2__IO__BedGraphIO
594 #define __PYX_HAVE_API__MACS2__IO__BedGraphIO
595 /* Early includes */
596 #include <string.h>
597 #include <stdio.h>
598 #include <stdlib.h>
599 #ifdef _OPENMP
600 #include <omp.h>
601 #endif /* _OPENMP */
602 
603 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
604 #define CYTHON_WITHOUT_ASSERTIONS
605 #endif
606 
607 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
608                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
609 
610 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
611 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
612 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
613 #define __PYX_DEFAULT_STRING_ENCODING ""
614 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
615 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
616 #define __Pyx_uchar_cast(c) ((unsigned char)c)
617 #define __Pyx_long_cast(x) ((long)x)
618 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
619     (sizeof(type) < sizeof(Py_ssize_t))  ||\
620     (sizeof(type) > sizeof(Py_ssize_t) &&\
621           likely(v < (type)PY_SSIZE_T_MAX ||\
622                  v == (type)PY_SSIZE_T_MAX)  &&\
623           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
624                                 v == (type)PY_SSIZE_T_MIN)))  ||\
625     (sizeof(type) == sizeof(Py_ssize_t) &&\
626           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
627                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)628 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
629     return (size_t) i < (size_t) limit;
630 }
631 #if defined (__cplusplus) && __cplusplus >= 201103L
632     #include <cstdlib>
633     #define __Pyx_sst_abs(value) std::abs(value)
634 #elif SIZEOF_INT >= SIZEOF_SIZE_T
635     #define __Pyx_sst_abs(value) abs(value)
636 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
637     #define __Pyx_sst_abs(value) labs(value)
638 #elif defined (_MSC_VER)
639     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
640 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
641     #define __Pyx_sst_abs(value) llabs(value)
642 #elif defined (__GNUC__)
643     #define __Pyx_sst_abs(value) __builtin_llabs(value)
644 #else
645     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
646 #endif
647 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
648 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
649 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
650 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
651 #define __Pyx_PyBytes_FromString        PyBytes_FromString
652 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
653 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
654 #if PY_MAJOR_VERSION < 3
655     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
656     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
657 #else
658     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
659     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
660 #endif
661 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
662 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
663 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
664 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
665 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
666 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
667 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
668 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
669 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
670 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
671 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
672 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
673 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
674 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
675 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
676 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)677 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
678     const Py_UNICODE *u_end = u;
679     while (*u_end++) ;
680     return (size_t)(u_end - u - 1);
681 }
682 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
683 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
684 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
685 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
686 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
687 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
688 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
689 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
690 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
691 #define __Pyx_PySequence_Tuple(obj)\
692     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
693 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
694 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
695 #if CYTHON_ASSUME_SAFE_MACROS
696 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
697 #else
698 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
699 #endif
700 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
701 #if PY_MAJOR_VERSION >= 3
702 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
703 #else
704 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
705 #endif
706 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
707 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
708 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)709 static int __Pyx_init_sys_getdefaultencoding_params(void) {
710     PyObject* sys;
711     PyObject* default_encoding = NULL;
712     PyObject* ascii_chars_u = NULL;
713     PyObject* ascii_chars_b = NULL;
714     const char* default_encoding_c;
715     sys = PyImport_ImportModule("sys");
716     if (!sys) goto bad;
717     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
718     Py_DECREF(sys);
719     if (!default_encoding) goto bad;
720     default_encoding_c = PyBytes_AsString(default_encoding);
721     if (!default_encoding_c) goto bad;
722     if (strcmp(default_encoding_c, "ascii") == 0) {
723         __Pyx_sys_getdefaultencoding_not_ascii = 0;
724     } else {
725         char ascii_chars[128];
726         int c;
727         for (c = 0; c < 128; c++) {
728             ascii_chars[c] = c;
729         }
730         __Pyx_sys_getdefaultencoding_not_ascii = 1;
731         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
732         if (!ascii_chars_u) goto bad;
733         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
734         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
735             PyErr_Format(
736                 PyExc_ValueError,
737                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
738                 default_encoding_c);
739             goto bad;
740         }
741         Py_DECREF(ascii_chars_u);
742         Py_DECREF(ascii_chars_b);
743     }
744     Py_DECREF(default_encoding);
745     return 0;
746 bad:
747     Py_XDECREF(default_encoding);
748     Py_XDECREF(ascii_chars_u);
749     Py_XDECREF(ascii_chars_b);
750     return -1;
751 }
752 #endif
753 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
754 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
755 #else
756 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
757 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
758 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)759 static int __Pyx_init_sys_getdefaultencoding_params(void) {
760     PyObject* sys;
761     PyObject* default_encoding = NULL;
762     char* default_encoding_c;
763     sys = PyImport_ImportModule("sys");
764     if (!sys) goto bad;
765     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
766     Py_DECREF(sys);
767     if (!default_encoding) goto bad;
768     default_encoding_c = PyBytes_AsString(default_encoding);
769     if (!default_encoding_c) goto bad;
770     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
771     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
772     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
773     Py_DECREF(default_encoding);
774     return 0;
775 bad:
776     Py_XDECREF(default_encoding);
777     return -1;
778 }
779 #endif
780 #endif
781 
782 
783 /* Test for GCC > 2.95 */
784 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
785   #define likely(x)   __builtin_expect(!!(x), 1)
786   #define unlikely(x) __builtin_expect(!!(x), 0)
787 #else /* !__GNUC__ or GCC < 2.95 */
788   #define likely(x)   (x)
789   #define unlikely(x) (x)
790 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)791 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
792 
793 static PyObject *__pyx_m = NULL;
794 static PyObject *__pyx_d;
795 static PyObject *__pyx_b;
796 static PyObject *__pyx_cython_runtime = NULL;
797 static PyObject *__pyx_empty_tuple;
798 static PyObject *__pyx_empty_bytes;
799 static PyObject *__pyx_empty_unicode;
800 static int __pyx_lineno;
801 static int __pyx_clineno = 0;
802 static const char * __pyx_cfilenm= __FILE__;
803 static const char *__pyx_filename;
804 
805 
806 static const char *__pyx_f[] = {
807   "MACS2/IO/BedGraphIO.pyx",
808   "stringsource",
809 };
810 
811 /*--- Type declarations ---*/
812 struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO;
813 struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO;
814 
815 /* "MACS2/IO/BedGraphIO.pyx":53
816  * # ------------------------------------
817  *
818  * cdef class bedGraphIO:             # <<<<<<<<<<<<<<
819  *     """File Parser Class for bedGraph File.
820  *
821  */
822 struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO {
823   PyObject_HEAD
824   PyObject *bedGraph_filename;
825 };
826 
827 
828 /* "MACS2/IO/BedGraphIO.pyx":108
829  *         return data
830  *
831  * cdef class genericBedIO:             # <<<<<<<<<<<<<<
832  *     """File Parser Class for generic bed File with at least column #1,#2,#3,and #5.
833  *
834  */
835 struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO {
836   PyObject_HEAD
837 };
838 
839 
840 /* --- Runtime support code (head) --- */
841 /* Refnanny.proto */
842 #ifndef CYTHON_REFNANNY
843   #define CYTHON_REFNANNY 0
844 #endif
845 #if CYTHON_REFNANNY
846   typedef struct {
847     void (*INCREF)(void*, PyObject*, int);
848     void (*DECREF)(void*, PyObject*, int);
849     void (*GOTREF)(void*, PyObject*, int);
850     void (*GIVEREF)(void*, PyObject*, int);
851     void* (*SetupContext)(const char*, int, const char*);
852     void (*FinishContext)(void**);
853   } __Pyx_RefNannyAPIStruct;
854   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
855   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
856   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
857 #ifdef WITH_THREAD
858   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
859           if (acquire_gil) {\
860               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
861               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
862               PyGILState_Release(__pyx_gilstate_save);\
863           } else {\
864               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
865           }
866 #else
867   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
868           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
869 #endif
870   #define __Pyx_RefNannyFinishContext()\
871           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
872   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
873   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
874   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
875   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
876   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
877   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
878   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
879   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
880 #else
881   #define __Pyx_RefNannyDeclarations
882   #define __Pyx_RefNannySetupContext(name, acquire_gil)
883   #define __Pyx_RefNannyFinishContext()
884   #define __Pyx_INCREF(r) Py_INCREF(r)
885   #define __Pyx_DECREF(r) Py_DECREF(r)
886   #define __Pyx_GOTREF(r)
887   #define __Pyx_GIVEREF(r)
888   #define __Pyx_XINCREF(r) Py_XINCREF(r)
889   #define __Pyx_XDECREF(r) Py_XDECREF(r)
890   #define __Pyx_XGOTREF(r)
891   #define __Pyx_XGIVEREF(r)
892 #endif
893 #define __Pyx_XDECREF_SET(r, v) do {\
894         PyObject *tmp = (PyObject *) r;\
895         r = v; __Pyx_XDECREF(tmp);\
896     } while (0)
897 #define __Pyx_DECREF_SET(r, v) do {\
898         PyObject *tmp = (PyObject *) r;\
899         r = v; __Pyx_DECREF(tmp);\
900     } while (0)
901 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
902 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
903 
904 /* PyObjectGetAttrStr.proto */
905 #if CYTHON_USE_TYPE_SLOTS
906 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
907 #else
908 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
909 #endif
910 
911 /* GetBuiltinName.proto */
912 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
913 
914 /* RaiseDoubleKeywords.proto */
915 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
916 
917 /* ParseKeywords.proto */
918 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
919     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
920     const char* function_name);
921 
922 /* RaiseArgTupleInvalid.proto */
923 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
924     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
925 
926 /* ArgTypeTest.proto */
927 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
928     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
929         __Pyx__ArgTypeTest(obj, type, name, exact))
930 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
931 
932 /* PyThreadStateGet.proto */
933 #if CYTHON_FAST_THREAD_STATE
934 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
935 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
936 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
937 #else
938 #define __Pyx_PyThreadState_declare
939 #define __Pyx_PyThreadState_assign
940 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
941 #endif
942 
943 /* PyErrFetchRestore.proto */
944 #if CYTHON_FAST_THREAD_STATE
945 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
946 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
947 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
948 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
949 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
950 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
951 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
952 #if CYTHON_COMPILING_IN_CPYTHON
953 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
954 #else
955 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
956 #endif
957 #else
958 #define __Pyx_PyErr_Clear() PyErr_Clear()
959 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
960 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
961 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
962 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
963 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
964 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
965 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
966 #endif
967 
968 /* Profile.proto */
969 #ifndef CYTHON_PROFILE
970 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
971   #define CYTHON_PROFILE 0
972 #else
973   #define CYTHON_PROFILE 1
974 #endif
975 #endif
976 #ifndef CYTHON_TRACE_NOGIL
977   #define CYTHON_TRACE_NOGIL 0
978 #else
979   #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
980     #define CYTHON_TRACE 1
981   #endif
982 #endif
983 #ifndef CYTHON_TRACE
984   #define CYTHON_TRACE 0
985 #endif
986 #if CYTHON_TRACE
987   #undef CYTHON_PROFILE_REUSE_FRAME
988 #endif
989 #ifndef CYTHON_PROFILE_REUSE_FRAME
990   #define CYTHON_PROFILE_REUSE_FRAME 0
991 #endif
992 #if CYTHON_PROFILE || CYTHON_TRACE
993   #include "compile.h"
994   #include "frameobject.h"
995   #include "traceback.h"
996   #if CYTHON_PROFILE_REUSE_FRAME
997     #define CYTHON_FRAME_MODIFIER static
998     #define CYTHON_FRAME_DEL(frame)
999   #else
1000     #define CYTHON_FRAME_MODIFIER
1001     #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1002   #endif
1003   #define __Pyx_TraceDeclarations\
1004   static PyCodeObject *__pyx_frame_code = NULL;\
1005   CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1006   int __Pyx_use_tracing = 0;
1007   #define __Pyx_TraceFrameInit(codeobj)\
1008   if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1009   #ifdef WITH_THREAD
1010   #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1011   if (nogil) {\
1012       if (CYTHON_TRACE_NOGIL) {\
1013           PyThreadState *tstate;\
1014           PyGILState_STATE state = PyGILState_Ensure();\
1015           tstate = __Pyx_PyThreadState_Current;\
1016           if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
1017                   (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
1018               __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1019           }\
1020           PyGILState_Release(state);\
1021           if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1022       }\
1023   } else {\
1024       PyThreadState* tstate = PyThreadState_GET();\
1025       if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
1026               (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
1027           __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1028           if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1029       }\
1030   }
1031   #else
1032   #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1033   {   PyThreadState* tstate = PyThreadState_GET();\
1034       if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
1035               (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
1036           __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1037           if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1038       }\
1039   }
1040   #endif
1041   #define __Pyx_TraceException()\
1042   if (likely(!__Pyx_use_tracing)); else {\
1043       PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1044       if (tstate->use_tracing &&\
1045               (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
1046           tstate->tracing++;\
1047           tstate->use_tracing = 0;\
1048           PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1049           if (exc_info) {\
1050               if (CYTHON_TRACE && tstate->c_tracefunc)\
1051                   tstate->c_tracefunc(\
1052                       tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1053               tstate->c_profilefunc(\
1054                   tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1055               Py_DECREF(exc_info);\
1056           }\
1057           tstate->use_tracing = 1;\
1058           tstate->tracing--;\
1059       }\
1060   }
__Pyx_call_return_trace_func(PyThreadState * tstate,PyFrameObject * frame,PyObject * result)1061   static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1062       PyObject *type, *value, *traceback;
1063       __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1064       tstate->tracing++;
1065       tstate->use_tracing = 0;
1066       if (CYTHON_TRACE && tstate->c_tracefunc)
1067           tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1068       if (tstate->c_profilefunc)
1069           tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1070       CYTHON_FRAME_DEL(frame);
1071       tstate->use_tracing = 1;
1072       tstate->tracing--;
1073       __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1074   }
1075   #ifdef WITH_THREAD
1076   #define __Pyx_TraceReturn(result, nogil)\
1077   if (likely(!__Pyx_use_tracing)); else {\
1078       if (nogil) {\
1079           if (CYTHON_TRACE_NOGIL) {\
1080               PyThreadState *tstate;\
1081               PyGILState_STATE state = PyGILState_Ensure();\
1082               tstate = __Pyx_PyThreadState_Current;\
1083               if (tstate->use_tracing) {\
1084                   __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1085               }\
1086               PyGILState_Release(state);\
1087           }\
1088       } else {\
1089           PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1090           if (tstate->use_tracing) {\
1091               __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1092           }\
1093       }\
1094   }
1095   #else
1096   #define __Pyx_TraceReturn(result, nogil)\
1097   if (likely(!__Pyx_use_tracing)); else {\
1098       PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1099       if (tstate->use_tracing) {\
1100           __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1101       }\
1102   }
1103   #endif
1104   static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
1105   static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
1106 #else
1107   #define __Pyx_TraceDeclarations
1108   #define __Pyx_TraceFrameInit(codeobj)
1109   #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)   if ((1)); else goto_error;
1110   #define __Pyx_TraceException()
1111   #define __Pyx_TraceReturn(result, nogil)
1112 #endif
1113 #if CYTHON_TRACE
__Pyx_call_line_trace_func(PyThreadState * tstate,PyFrameObject * frame,int lineno)1114   static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
1115       int ret;
1116       PyObject *type, *value, *traceback;
1117       __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1118       __Pyx_PyFrame_SetLineNumber(frame, lineno);
1119       tstate->tracing++;
1120       tstate->use_tracing = 0;
1121       ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
1122       tstate->use_tracing = 1;
1123       tstate->tracing--;
1124       if (likely(!ret)) {
1125           __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1126       } else {
1127           Py_XDECREF(type);
1128           Py_XDECREF(value);
1129           Py_XDECREF(traceback);
1130       }
1131       return ret;
1132   }
1133   #ifdef WITH_THREAD
1134   #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1135   if (likely(!__Pyx_use_tracing)); else {\
1136       if (nogil) {\
1137           if (CYTHON_TRACE_NOGIL) {\
1138               int ret = 0;\
1139               PyThreadState *tstate;\
1140               PyGILState_STATE state = PyGILState_Ensure();\
1141               tstate = __Pyx_PyThreadState_Current;\
1142               if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
1143                   ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1144               }\
1145               PyGILState_Release(state);\
1146               if (unlikely(ret)) goto_error;\
1147           }\
1148       } else {\
1149           PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1150           if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
1151               int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1152               if (unlikely(ret)) goto_error;\
1153           }\
1154       }\
1155   }
1156   #else
1157   #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1158   if (likely(!__Pyx_use_tracing)); else {\
1159       PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1160       if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
1161           int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1162           if (unlikely(ret)) goto_error;\
1163       }\
1164   }
1165   #endif
1166 #else
1167   #define __Pyx_TraceLine(lineno, nogil, goto_error)   if ((1)); else goto_error;
1168 #endif
1169 
1170 /* PyDictVersioning.proto */
1171 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1172 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1173 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1174 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1175     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1176     (cache_var) = (value);
1177 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1178     static PY_UINT64_T __pyx_dict_version = 0;\
1179     static PyObject *__pyx_dict_cached_value = NULL;\
1180     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1181         (VAR) = __pyx_dict_cached_value;\
1182     } else {\
1183         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1184         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1185     }\
1186 }
1187 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1188 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1189 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1190 #else
1191 #define __PYX_GET_DICT_VERSION(dict)  (0)
1192 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1193 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1194 #endif
1195 
1196 /* GetModuleGlobalName.proto */
1197 #if CYTHON_USE_DICT_VERSIONS
1198 #define __Pyx_GetModuleGlobalName(var, name)  {\
1199     static PY_UINT64_T __pyx_dict_version = 0;\
1200     static PyObject *__pyx_dict_cached_value = NULL;\
1201     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1202         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1203         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1204 }
1205 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1206     PY_UINT64_T __pyx_dict_version;\
1207     PyObject *__pyx_dict_cached_value;\
1208     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1209 }
1210 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1211 #else
1212 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1213 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1214 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1215 #endif
1216 
1217 /* PyObjectCall.proto */
1218 #if CYTHON_COMPILING_IN_CPYTHON
1219 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1220 #else
1221 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1222 #endif
1223 
1224 /* bytes_tailmatch.proto */
1225 static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
1226                                          Py_ssize_t start, Py_ssize_t end, int direction);
1227 static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
1228                                    Py_ssize_t start, Py_ssize_t end, int direction);
1229 
1230 /* UnpackUnboundCMethod.proto */
1231 typedef struct {
1232     PyObject *type;
1233     PyObject **method_name;
1234     PyCFunction func;
1235     PyObject *method;
1236     int flag;
1237 } __Pyx_CachedCFunction;
1238 
1239 /* CallUnboundCMethod0.proto */
1240 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1241 #if CYTHON_COMPILING_IN_CPYTHON
1242 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1243     (likely((cfunc)->func) ?\
1244         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1245          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1246             (PY_VERSION_HEX >= 0x030700A0 ?\
1247                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1248                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1249           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1250             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1251             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1252                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1253                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1254         __Pyx__CallUnboundCMethod0(cfunc, self))
1255 #else
1256 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1257 #endif
1258 
1259 /* GetItemInt.proto */
1260 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1261     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1262     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1263     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1264                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1265 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1266     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1267     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1268     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1269 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1270                                                               int wraparound, int boundscheck);
1271 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1272     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1273     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1274     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1275 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1276                                                               int wraparound, int boundscheck);
1277 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1278 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1279                                                      int is_list, int wraparound, int boundscheck);
1280 
1281 /* PyFunctionFastCall.proto */
1282 #if CYTHON_FAST_PYCALL
1283 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1284     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1285 #if 1 || PY_VERSION_HEX < 0x030600B1
1286 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1287 #else
1288 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1289 #endif
1290 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1291     (sizeof(char [1 - 2*!(cond)]) - 1)
1292 #ifndef Py_MEMBER_SIZE
1293 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1294 #endif
1295   static size_t __pyx_pyframe_localsplus_offset = 0;
1296   #include "frameobject.h"
1297   #define __Pxy_PyFrame_Initialize_Offsets()\
1298     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1299      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1300   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1301     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1302 #endif
1303 
1304 /* PyCFunctionFastCall.proto */
1305 #if CYTHON_FAST_PYCCALL
1306 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1307 #else
1308 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1309 #endif
1310 
1311 /* PyObjectCallMethO.proto */
1312 #if CYTHON_COMPILING_IN_CPYTHON
1313 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1314 #endif
1315 
1316 /* PyObjectCallNoArg.proto */
1317 #if CYTHON_COMPILING_IN_CPYTHON
1318 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1319 #else
1320 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1321 #endif
1322 
1323 /* PyObjectCallOneArg.proto */
1324 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1325 
1326 /* PyErrExceptionMatches.proto */
1327 #if CYTHON_FAST_THREAD_STATE
1328 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1329 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1330 #else
1331 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1332 #endif
1333 
1334 /* GetAttr.proto */
1335 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1336 
1337 /* GetAttr3.proto */
1338 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1339 
1340 /* PyObjectSetAttrStr.proto */
1341 #if CYTHON_USE_TYPE_SLOTS
1342 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1343 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1344 #else
1345 #define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
1346 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1347 #endif
1348 
1349 /* RaiseException.proto */
1350 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1351 
1352 /* PyObjectCall2Args.proto */
1353 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1354 
1355 /* Import.proto */
1356 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1357 
1358 /* ImportFrom.proto */
1359 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1360 
1361 /* HasAttr.proto */
1362 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1363 
1364 /* PyObject_GenericGetAttrNoDict.proto */
1365 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1366 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1367 #else
1368 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1369 #endif
1370 
1371 /* PyObject_GenericGetAttr.proto */
1372 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1373 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1374 #else
1375 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1376 #endif
1377 
1378 /* SetupReduce.proto */
1379 static int __Pyx_setup_reduce(PyObject* type_obj);
1380 
1381 /* CLineInTraceback.proto */
1382 #ifdef CYTHON_CLINE_IN_TRACEBACK
1383 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1384 #else
1385 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1386 #endif
1387 
1388 /* CodeObjectCache.proto */
1389 typedef struct {
1390     PyCodeObject* code_object;
1391     int code_line;
1392 } __Pyx_CodeObjectCacheEntry;
1393 struct __Pyx_CodeObjectCache {
1394     int count;
1395     int max_count;
1396     __Pyx_CodeObjectCacheEntry* entries;
1397 };
1398 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1399 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1400 static PyCodeObject *__pyx_find_code_object(int code_line);
1401 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1402 
1403 /* AddTraceback.proto */
1404 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1405                                int py_line, const char *filename);
1406 
1407 /* CIntToPy.proto */
1408 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1409 
1410 /* CIntToPy.proto */
1411 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1412 
1413 /* CIntFromPy.proto */
1414 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1415 
1416 /* CIntFromPy.proto */
1417 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1418 
1419 /* FastTypeChecks.proto */
1420 #if CYTHON_COMPILING_IN_CPYTHON
1421 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1422 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1423 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1424 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1425 #else
1426 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1427 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1428 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1429 #endif
1430 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1431 
1432 /* CheckBinaryVersion.proto */
1433 static int __Pyx_check_binary_version(void);
1434 
1435 /* InitStrings.proto */
1436 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1437 
1438 
1439 /* Module declarations from 'libc.string' */
1440 
1441 /* Module declarations from 'libc.stdio' */
1442 
1443 /* Module declarations from 'libc.stdlib' */
1444 
1445 /* Module declarations from 'MACS2.IO.BedGraphIO' */
1446 static PyTypeObject *__pyx_ptype_5MACS2_2IO_10BedGraphIO_bedGraphIO = 0;
1447 static PyTypeObject *__pyx_ptype_5MACS2_2IO_10BedGraphIO_genericBedIO = 0;
1448 static PyObject *__pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO__set_state(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *, PyObject *); /*proto*/
1449 static PyObject *__pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_genericBedIO__set_state(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *, PyObject *); /*proto*/
1450 #define __Pyx_MODULE_NAME "MACS2.IO.BedGraphIO"
1451 extern int __pyx_module_is_main_MACS2__IO__BedGraphIO;
1452 int __pyx_module_is_main_MACS2__IO__BedGraphIO = 0;
1453 
1454 /* Implementation of 'MACS2.IO.BedGraphIO' */
1455 static PyObject *__pyx_builtin_open;
1456 static const char __pyx_k_[] = "#";
1457 static const char __pyx_k_f[] = "f";
1458 static const char __pyx_k_io[] = "io";
1459 static const char __pyx_k_rb[] = "rb";
1460 static const char __pyx_k_fhd[] = "fhd";
1461 static const char __pyx_k_new[] = "__new__";
1462 static const char __pyx_k_dict[] = "__dict__";
1463 static const char __pyx_k_main[] = "__main__";
1464 static const char __pyx_k_name[] = "__name__";
1465 static const char __pyx_k_open[] = "open";
1466 static const char __pyx_k_seek[] = "seek";
1467 static const char __pyx_k_test[] = "__test__";
1468 static const char __pyx_k_close[] = "close";
1469 static const char __pyx_k_split[] = "split";
1470 static const char __pyx_k_track[] = "track";
1471 static const char __pyx_k_IOBase[] = "IOBase";
1472 static const char __pyx_k_browse[] = "browse";
1473 static const char __pyx_k_import[] = "__import__";
1474 static const char __pyx_k_pickle[] = "pickle";
1475 static const char __pyx_k_reduce[] = "__reduce__";
1476 static const char __pyx_k_update[] = "update";
1477 static const char __pyx_k_add_loc[] = "add_loc";
1478 static const char __pyx_k_getstate[] = "__getstate__";
1479 static const char __pyx_k_pyx_type[] = "__pyx_type";
1480 static const char __pyx_k_setstate[] = "__setstate__";
1481 static const char __pyx_k_pyx_state[] = "__pyx_state";
1482 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1483 static const char __pyx_k_bedGraphIO[] = "bedGraphIO";
1484 static const char __pyx_k_pyx_result[] = "__pyx_result";
1485 static const char __pyx_k_PickleError[] = "PickleError";
1486 static const char __pyx_k_genericBedIO[] = "genericBedIO";
1487 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1488 static const char __pyx_k_safe_add_loc[] = "safe_add_loc";
1489 static const char __pyx_k_stringsource[] = "stringsource";
1490 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1491 static const char __pyx_k_baseline_value[] = "baseline_value";
1492 static const char __pyx_k_bedGraphTrackI[] = "bedGraphTrackI";
1493 static const char __pyx_k_bedRegionTrackI[] = "bedRegionTrackI";
1494 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1495 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1496 static const char __pyx_k_MACS2_IO_BedGraph[] = "MACS2.IO.BedGraph";
1497 static const char __pyx_k_bedGraph_filename[] = "bedGraph_filename";
1498 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1499 static const char __pyx_k_MACS2_IO_BedGraphIO[] = "MACS2.IO.BedGraphIO";
1500 static const char __pyx_k_pyx_unpickle_bedGraphIO[] = "__pyx_unpickle_bedGraphIO";
1501 static const char __pyx_k_pyx_unpickle_genericBedIO[] = "__pyx_unpickle_genericBedIO";
1502 static const char __pyx_k_Incompatible_checksums_s_vs_0x31[] = "Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))";
1503 static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())";
1504 static const char __pyx_k_Module_Description_IO_Module_for[] = "Module Description:  IO Module for bedGraph file\n\nThis code is free software; you can redistribute it and/or modify it\nunder the terms of the BSD License (see the file LICENSE included with\nthe distribution).\n";
1505 static const char __pyx_k_f_must_be_a_filename_or_a_file_h[] = "f must be a filename or a file handler.";
1506 static PyObject *__pyx_kp_b_;
1507 static PyObject *__pyx_n_s_IOBase;
1508 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x31;
1509 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4;
1510 static PyObject *__pyx_n_s_MACS2_IO_BedGraph;
1511 static PyObject *__pyx_n_s_MACS2_IO_BedGraphIO;
1512 static PyObject *__pyx_n_s_PickleError;
1513 static PyObject *__pyx_n_s_add_loc;
1514 static PyObject *__pyx_n_s_baseline_value;
1515 static PyObject *__pyx_n_s_bedGraphIO;
1516 static PyObject *__pyx_n_s_bedGraphTrackI;
1517 static PyObject *__pyx_n_s_bedGraph_filename;
1518 static PyObject *__pyx_n_s_bedRegionTrackI;
1519 static PyObject *__pyx_n_b_browse;
1520 static PyObject *__pyx_n_s_cline_in_traceback;
1521 static PyObject *__pyx_n_s_close;
1522 static PyObject *__pyx_n_s_dict;
1523 static PyObject *__pyx_n_s_f;
1524 static PyObject *__pyx_kp_u_f_must_be_a_filename_or_a_file_h;
1525 static PyObject *__pyx_n_s_fhd;
1526 static PyObject *__pyx_n_s_genericBedIO;
1527 static PyObject *__pyx_n_s_getstate;
1528 static PyObject *__pyx_n_s_import;
1529 static PyObject *__pyx_n_s_io;
1530 static PyObject *__pyx_n_s_main;
1531 static PyObject *__pyx_n_s_name;
1532 static PyObject *__pyx_n_s_new;
1533 static PyObject *__pyx_n_s_open;
1534 static PyObject *__pyx_n_s_pickle;
1535 static PyObject *__pyx_n_s_pyx_PickleError;
1536 static PyObject *__pyx_n_s_pyx_checksum;
1537 static PyObject *__pyx_n_s_pyx_result;
1538 static PyObject *__pyx_n_s_pyx_state;
1539 static PyObject *__pyx_n_s_pyx_type;
1540 static PyObject *__pyx_n_s_pyx_unpickle_bedGraphIO;
1541 static PyObject *__pyx_n_s_pyx_unpickle_genericBedIO;
1542 static PyObject *__pyx_n_u_rb;
1543 static PyObject *__pyx_n_s_reduce;
1544 static PyObject *__pyx_n_s_reduce_cython;
1545 static PyObject *__pyx_n_s_reduce_ex;
1546 static PyObject *__pyx_n_s_safe_add_loc;
1547 static PyObject *__pyx_n_s_seek;
1548 static PyObject *__pyx_n_s_setstate;
1549 static PyObject *__pyx_n_s_setstate_cython;
1550 static PyObject *__pyx_n_s_split;
1551 static PyObject *__pyx_kp_s_stringsource;
1552 static PyObject *__pyx_n_s_test;
1553 static PyObject *__pyx_n_b_track;
1554 static PyObject *__pyx_n_s_update;
1555 static int __pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self, PyObject *__pyx_v_bedGraph_filename); /* proto */
1556 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_2build_bdgtrack(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self, double __pyx_v_baseline_value); /* proto */
1557 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_4__reduce_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self); /* proto */
1558 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_6__setstate_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1559 static int __pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
1560 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_2build_bedtrack(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self); /* proto */
1561 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_4__reduce_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self); /* proto */
1562 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_6__setstate_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1563 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1564 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_2__pyx_unpickle_genericBedIO(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1565 static PyObject *__pyx_tp_new_5MACS2_2IO_10BedGraphIO_bedGraphIO(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1566 static PyObject *__pyx_tp_new_5MACS2_2IO_10BedGraphIO_genericBedIO(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1567 static __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type_split = {0, &__pyx_n_s_split, 0, 0, 0};
1568 static PyObject *__pyx_int_0;
1569 static PyObject *__pyx_int_51759939;
1570 static PyObject *__pyx_int_222419149;
1571 static PyObject *__pyx_tuple__2;
1572 static PyObject *__pyx_tuple__5;
1573 static PyObject *__pyx_tuple__6;
1574 static PyObject *__pyx_codeobj__3;
1575 static PyObject *__pyx_codeobj__4;
1576 /* Late includes */
1577 
1578 /* "MACS2/IO/BedGraphIO.pyx":69
1579  *         str bedGraph_filename
1580  *
1581  *     def __init__ ( self, str bedGraph_filename ):             # <<<<<<<<<<<<<<
1582  *         """f must be a filename or a file handler.
1583  *
1584  */
1585 
1586 /* Python wrapper */
1587 static int __pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1588 static char __pyx_doc_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__[] = "f must be a filename or a file handler.\n        \n        ";
1589 #if CYTHON_COMPILING_IN_CPYTHON
1590 struct wrapperbase __pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__;
1591 #endif
__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1592 static int __pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1593   PyObject *__pyx_v_bedGraph_filename = 0;
1594   int __pyx_r;
1595   __Pyx_RefNannyDeclarations
1596   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1597   {
1598     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bedGraph_filename,0};
1599     PyObject* values[1] = {0};
1600     if (unlikely(__pyx_kwds)) {
1601       Py_ssize_t kw_args;
1602       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1603       switch (pos_args) {
1604         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1605         CYTHON_FALLTHROUGH;
1606         case  0: break;
1607         default: goto __pyx_L5_argtuple_error;
1608       }
1609       kw_args = PyDict_Size(__pyx_kwds);
1610       switch (pos_args) {
1611         case  0:
1612         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bedGraph_filename)) != 0)) kw_args--;
1613         else goto __pyx_L5_argtuple_error;
1614       }
1615       if (unlikely(kw_args > 0)) {
1616         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
1617       }
1618     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
1619       goto __pyx_L5_argtuple_error;
1620     } else {
1621       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1622     }
1623     __pyx_v_bedGraph_filename = ((PyObject*)values[0]);
1624   }
1625   goto __pyx_L4_argument_unpacking_done;
1626   __pyx_L5_argtuple_error:;
1627   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
1628   __pyx_L3_error:;
1629   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.bedGraphIO.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1630   __Pyx_RefNannyFinishContext();
1631   return -1;
1632   __pyx_L4_argument_unpacking_done:;
1633   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bedGraph_filename), (&PyUnicode_Type), 1, "bedGraph_filename", 1))) __PYX_ERR(0, 69, __pyx_L1_error)
1634   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)__pyx_v_self), __pyx_v_bedGraph_filename);
1635 
1636   /* function exit code */
1637   goto __pyx_L0;
1638   __pyx_L1_error:;
1639   __pyx_r = -1;
1640   __pyx_L0:;
1641   __Pyx_RefNannyFinishContext();
1642   return __pyx_r;
1643 }
1644 
__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO * __pyx_v_self,PyObject * __pyx_v_bedGraph_filename)1645 static int __pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self, PyObject *__pyx_v_bedGraph_filename) {
1646   int __pyx_r;
1647   __Pyx_TraceDeclarations
1648   __Pyx_RefNannyDeclarations
1649   __Pyx_RefNannySetupContext("__init__", 0);
1650   __Pyx_TraceCall("__init__", __pyx_f[0], 69, 0, __PYX_ERR(0, 69, __pyx_L1_error));
1651 
1652   /* "MACS2/IO/BedGraphIO.pyx":73
1653  *
1654  *         """
1655  *         self.bedGraph_filename = bedGraph_filename             # <<<<<<<<<<<<<<
1656  *
1657  *     def build_bdgtrack (self, double baseline_value=0):
1658  */
1659   __Pyx_INCREF(__pyx_v_bedGraph_filename);
1660   __Pyx_GIVEREF(__pyx_v_bedGraph_filename);
1661   __Pyx_GOTREF(__pyx_v_self->bedGraph_filename);
1662   __Pyx_DECREF(__pyx_v_self->bedGraph_filename);
1663   __pyx_v_self->bedGraph_filename = __pyx_v_bedGraph_filename;
1664 
1665   /* "MACS2/IO/BedGraphIO.pyx":69
1666  *         str bedGraph_filename
1667  *
1668  *     def __init__ ( self, str bedGraph_filename ):             # <<<<<<<<<<<<<<
1669  *         """f must be a filename or a file handler.
1670  *
1671  */
1672 
1673   /* function exit code */
1674   __pyx_r = 0;
1675   goto __pyx_L0;
1676   __pyx_L1_error:;
1677   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.bedGraphIO.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1678   __pyx_r = -1;
1679   __pyx_L0:;
1680   __Pyx_TraceReturn(Py_None, 0);
1681   __Pyx_RefNannyFinishContext();
1682   return __pyx_r;
1683 }
1684 
1685 /* "MACS2/IO/BedGraphIO.pyx":75
1686  *         self.bedGraph_filename = bedGraph_filename
1687  *
1688  *     def build_bdgtrack (self, double baseline_value=0):             # <<<<<<<<<<<<<<
1689  *         """Use this function to return a bedGraphTrackI object.
1690  *
1691  */
1692 
1693 /* Python wrapper */
1694 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_3build_bdgtrack(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1695 static char __pyx_doc_5MACS2_2IO_10BedGraphIO_10bedGraphIO_2build_bdgtrack[] = "Use this function to return a bedGraphTrackI object.\n\n        baseline_value is the value to fill in the regions not defined\n        in bedGraph. For example, if the bedGraph is like:\n\n        chr1  100 200  1\n        chr1  250 350  2\n\n        Then the region chr1:200..250 should be filled with\n        baseline_value. Default of baseline_value is 0.\n        ";
__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_3build_bdgtrack(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1696 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_3build_bdgtrack(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1697   double __pyx_v_baseline_value;
1698   PyObject *__pyx_r = 0;
1699   __Pyx_RefNannyDeclarations
1700   __Pyx_RefNannySetupContext("build_bdgtrack (wrapper)", 0);
1701   {
1702     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_baseline_value,0};
1703     PyObject* values[1] = {0};
1704     if (unlikely(__pyx_kwds)) {
1705       Py_ssize_t kw_args;
1706       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1707       switch (pos_args) {
1708         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1709         CYTHON_FALLTHROUGH;
1710         case  0: break;
1711         default: goto __pyx_L5_argtuple_error;
1712       }
1713       kw_args = PyDict_Size(__pyx_kwds);
1714       switch (pos_args) {
1715         case  0:
1716         if (kw_args > 0) {
1717           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_baseline_value);
1718           if (value) { values[0] = value; kw_args--; }
1719         }
1720       }
1721       if (unlikely(kw_args > 0)) {
1722         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build_bdgtrack") < 0)) __PYX_ERR(0, 75, __pyx_L3_error)
1723       }
1724     } else {
1725       switch (PyTuple_GET_SIZE(__pyx_args)) {
1726         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1727         CYTHON_FALLTHROUGH;
1728         case  0: break;
1729         default: goto __pyx_L5_argtuple_error;
1730       }
1731     }
1732     if (values[0]) {
1733       __pyx_v_baseline_value = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_baseline_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error)
1734     } else {
1735       __pyx_v_baseline_value = ((double)0.0);
1736     }
1737   }
1738   goto __pyx_L4_argument_unpacking_done;
1739   __pyx_L5_argtuple_error:;
1740   __Pyx_RaiseArgtupleInvalid("build_bdgtrack", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 75, __pyx_L3_error)
1741   __pyx_L3_error:;
1742   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.bedGraphIO.build_bdgtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
1743   __Pyx_RefNannyFinishContext();
1744   return NULL;
1745   __pyx_L4_argument_unpacking_done:;
1746   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_2build_bdgtrack(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)__pyx_v_self), __pyx_v_baseline_value);
1747 
1748   /* function exit code */
1749   __Pyx_RefNannyFinishContext();
1750   return __pyx_r;
1751 }
1752 
__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_2build_bdgtrack(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO * __pyx_v_self,double __pyx_v_baseline_value)1753 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_2build_bdgtrack(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self, double __pyx_v_baseline_value) {
1754   PyObject *__pyx_v_i = 0;
1755   PyObject *__pyx_v_data = NULL;
1756   PyObject *__pyx_v_add_func = NULL;
1757   PyObject *__pyx_v_bedGraph_file = NULL;
1758   PyObject *__pyx_v_fs = NULL;
1759   PyObject *__pyx_r = NULL;
1760   __Pyx_TraceDeclarations
1761   __Pyx_RefNannyDeclarations
1762   PyObject *__pyx_t_1 = NULL;
1763   PyObject *__pyx_t_2 = NULL;
1764   PyObject *__pyx_t_3 = NULL;
1765   Py_ssize_t __pyx_t_4;
1766   PyObject *(*__pyx_t_5)(PyObject *);
1767   int __pyx_t_6;
1768   PyObject *__pyx_t_7 = NULL;
1769   char const *__pyx_t_8;
1770   PyObject *__pyx_t_9 = NULL;
1771   PyObject *__pyx_t_10 = NULL;
1772   char const *__pyx_t_11;
1773   PyObject *__pyx_t_12 = NULL;
1774   PyObject *__pyx_t_13 = NULL;
1775   int __pyx_t_14;
1776   PyObject *__pyx_t_15 = NULL;
1777   __Pyx_RefNannySetupContext("build_bdgtrack", 0);
1778   __Pyx_TraceCall("build_bdgtrack", __pyx_f[0], 75, 0, __PYX_ERR(0, 75, __pyx_L1_error));
1779 
1780   /* "MACS2/IO/BedGraphIO.pyx":89
1781  *         cdef bytes i
1782  *
1783  *         data = bedGraphTrackI(baseline_value=baseline_value)             # <<<<<<<<<<<<<<
1784  *         add_func = data.add_loc
1785  *         # python open file
1786  */
1787   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_bedGraphTrackI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
1788   __Pyx_GOTREF(__pyx_t_1);
1789   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
1790   __Pyx_GOTREF(__pyx_t_2);
1791   __pyx_t_3 = PyFloat_FromDouble(__pyx_v_baseline_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
1792   __Pyx_GOTREF(__pyx_t_3);
1793   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_baseline_value, __pyx_t_3) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
1794   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1795   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
1796   __Pyx_GOTREF(__pyx_t_3);
1797   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1798   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1799   __pyx_v_data = __pyx_t_3;
1800   __pyx_t_3 = 0;
1801 
1802   /* "MACS2/IO/BedGraphIO.pyx":90
1803  *
1804  *         data = bedGraphTrackI(baseline_value=baseline_value)
1805  *         add_func = data.add_loc             # <<<<<<<<<<<<<<
1806  *         # python open file
1807  *         bedGraph_file = open( self.bedGraph_filename, "rb" )
1808  */
1809   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_add_loc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
1810   __Pyx_GOTREF(__pyx_t_3);
1811   __pyx_v_add_func = __pyx_t_3;
1812   __pyx_t_3 = 0;
1813 
1814   /* "MACS2/IO/BedGraphIO.pyx":92
1815  *         add_func = data.add_loc
1816  *         # python open file
1817  *         bedGraph_file = open( self.bedGraph_filename, "rb" )             # <<<<<<<<<<<<<<
1818  *
1819  *         for i in bedGraph_file:
1820  */
1821   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
1822   __Pyx_GOTREF(__pyx_t_3);
1823   __Pyx_INCREF(__pyx_v_self->bedGraph_filename);
1824   __Pyx_GIVEREF(__pyx_v_self->bedGraph_filename);
1825   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->bedGraph_filename);
1826   __Pyx_INCREF(__pyx_n_u_rb);
1827   __Pyx_GIVEREF(__pyx_n_u_rb);
1828   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_rb);
1829   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
1830   __Pyx_GOTREF(__pyx_t_2);
1831   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1832   __pyx_v_bedGraph_file = __pyx_t_2;
1833   __pyx_t_2 = 0;
1834 
1835   /* "MACS2/IO/BedGraphIO.pyx":94
1836  *         bedGraph_file = open( self.bedGraph_filename, "rb" )
1837  *
1838  *         for i in bedGraph_file:             # <<<<<<<<<<<<<<
1839  *             if i.startswith(b"track"):
1840  *                 continue
1841  */
1842   if (likely(PyList_CheckExact(__pyx_v_bedGraph_file)) || PyTuple_CheckExact(__pyx_v_bedGraph_file)) {
1843     __pyx_t_2 = __pyx_v_bedGraph_file; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
1844     __pyx_t_5 = NULL;
1845   } else {
1846     __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_bedGraph_file); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
1847     __Pyx_GOTREF(__pyx_t_2);
1848     __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error)
1849   }
1850   for (;;) {
1851     if (likely(!__pyx_t_5)) {
1852       if (likely(PyList_CheckExact(__pyx_t_2))) {
1853         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
1854         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
1855         __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 94, __pyx_L1_error)
1856         #else
1857         __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
1858         __Pyx_GOTREF(__pyx_t_3);
1859         #endif
1860       } else {
1861         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
1862         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
1863         __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 94, __pyx_L1_error)
1864         #else
1865         __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
1866         __Pyx_GOTREF(__pyx_t_3);
1867         #endif
1868       }
1869     } else {
1870       __pyx_t_3 = __pyx_t_5(__pyx_t_2);
1871       if (unlikely(!__pyx_t_3)) {
1872         PyObject* exc_type = PyErr_Occurred();
1873         if (exc_type) {
1874           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
1875           else __PYX_ERR(0, 94, __pyx_L1_error)
1876         }
1877         break;
1878       }
1879       __Pyx_GOTREF(__pyx_t_3);
1880     }
1881     if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 94, __pyx_L1_error)
1882     __Pyx_XDECREF_SET(__pyx_v_i, ((PyObject*)__pyx_t_3));
1883     __pyx_t_3 = 0;
1884 
1885     /* "MACS2/IO/BedGraphIO.pyx":95
1886  *
1887  *         for i in bedGraph_file:
1888  *             if i.startswith(b"track"):             # <<<<<<<<<<<<<<
1889  *                 continue
1890  *             elif i.startswith(b"#"):
1891  */
1892     if (unlikely(__pyx_v_i == Py_None)) {
1893       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
1894       __PYX_ERR(0, 95, __pyx_L1_error)
1895     }
1896     __pyx_t_6 = __Pyx_PyBytes_Tailmatch(__pyx_v_i, __pyx_n_b_track, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 95, __pyx_L1_error)
1897     if ((__pyx_t_6 != 0)) {
1898 
1899       /* "MACS2/IO/BedGraphIO.pyx":96
1900  *         for i in bedGraph_file:
1901  *             if i.startswith(b"track"):
1902  *                 continue             # <<<<<<<<<<<<<<
1903  *             elif i.startswith(b"#"):
1904  *                 continue
1905  */
1906       goto __pyx_L3_continue;
1907 
1908       /* "MACS2/IO/BedGraphIO.pyx":95
1909  *
1910  *         for i in bedGraph_file:
1911  *             if i.startswith(b"track"):             # <<<<<<<<<<<<<<
1912  *                 continue
1913  *             elif i.startswith(b"#"):
1914  */
1915     }
1916 
1917     /* "MACS2/IO/BedGraphIO.pyx":97
1918  *             if i.startswith(b"track"):
1919  *                 continue
1920  *             elif i.startswith(b"#"):             # <<<<<<<<<<<<<<
1921  *                 continue
1922  *             elif i.startswith(b"browse"):
1923  */
1924     if (unlikely(__pyx_v_i == Py_None)) {
1925       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
1926       __PYX_ERR(0, 97, __pyx_L1_error)
1927     }
1928     __pyx_t_6 = __Pyx_PyBytes_Tailmatch(__pyx_v_i, __pyx_kp_b_, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
1929     if ((__pyx_t_6 != 0)) {
1930 
1931       /* "MACS2/IO/BedGraphIO.pyx":98
1932  *                 continue
1933  *             elif i.startswith(b"#"):
1934  *                 continue             # <<<<<<<<<<<<<<
1935  *             elif i.startswith(b"browse"):
1936  *                 continue
1937  */
1938       goto __pyx_L3_continue;
1939 
1940       /* "MACS2/IO/BedGraphIO.pyx":97
1941  *             if i.startswith(b"track"):
1942  *                 continue
1943  *             elif i.startswith(b"#"):             # <<<<<<<<<<<<<<
1944  *                 continue
1945  *             elif i.startswith(b"browse"):
1946  */
1947     }
1948 
1949     /* "MACS2/IO/BedGraphIO.pyx":99
1950  *             elif i.startswith(b"#"):
1951  *                 continue
1952  *             elif i.startswith(b"browse"):             # <<<<<<<<<<<<<<
1953  *                 continue
1954  *             else:
1955  */
1956     if (unlikely(__pyx_v_i == Py_None)) {
1957       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
1958       __PYX_ERR(0, 99, __pyx_L1_error)
1959     }
1960     __pyx_t_6 = __Pyx_PyBytes_Tailmatch(__pyx_v_i, __pyx_n_b_browse, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 99, __pyx_L1_error)
1961     if ((__pyx_t_6 != 0)) {
1962 
1963       /* "MACS2/IO/BedGraphIO.pyx":100
1964  *                 continue
1965  *             elif i.startswith(b"browse"):
1966  *                 continue             # <<<<<<<<<<<<<<
1967  *             else:
1968  *                 fs = i.split()
1969  */
1970       goto __pyx_L3_continue;
1971 
1972       /* "MACS2/IO/BedGraphIO.pyx":99
1973  *             elif i.startswith(b"#"):
1974  *                 continue
1975  *             elif i.startswith(b"browse"):             # <<<<<<<<<<<<<<
1976  *                 continue
1977  *             else:
1978  */
1979     }
1980 
1981     /* "MACS2/IO/BedGraphIO.pyx":102
1982  *                 continue
1983  *             else:
1984  *                 fs = i.split()             # <<<<<<<<<<<<<<
1985  *                 add_func(fs[0],atoi(fs[1]),atoi(fs[2]),atof(fs[3]))
1986  *
1987  */
1988     /*else*/ {
1989       __pyx_t_3 = __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyBytes_Type_split, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
1990       __Pyx_GOTREF(__pyx_t_3);
1991       __Pyx_XDECREF_SET(__pyx_v_fs, __pyx_t_3);
1992       __pyx_t_3 = 0;
1993 
1994       /* "MACS2/IO/BedGraphIO.pyx":103
1995  *             else:
1996  *                 fs = i.split()
1997  *                 add_func(fs[0],atoi(fs[1]),atoi(fs[2]),atof(fs[3]))             # <<<<<<<<<<<<<<
1998  *
1999  *         bedGraph_file.close()
2000  */
2001       __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
2002       __Pyx_GOTREF(__pyx_t_1);
2003       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fs, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error)
2004       __Pyx_GOTREF(__pyx_t_7);
2005       __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
2006       __pyx_t_9 = __Pyx_PyInt_From_int(atoi(__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error)
2007       __Pyx_GOTREF(__pyx_t_9);
2008       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2009       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fs, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error)
2010       __Pyx_GOTREF(__pyx_t_7);
2011       __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
2012       __pyx_t_10 = __Pyx_PyInt_From_int(atoi(__pyx_t_8)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 103, __pyx_L1_error)
2013       __Pyx_GOTREF(__pyx_t_10);
2014       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2015       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fs, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error)
2016       __Pyx_GOTREF(__pyx_t_7);
2017       __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
2018       __pyx_t_12 = PyFloat_FromDouble(atof(__pyx_t_11)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 103, __pyx_L1_error)
2019       __Pyx_GOTREF(__pyx_t_12);
2020       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2021       __Pyx_INCREF(__pyx_v_add_func);
2022       __pyx_t_7 = __pyx_v_add_func; __pyx_t_13 = NULL;
2023       __pyx_t_14 = 0;
2024       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
2025         __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7);
2026         if (likely(__pyx_t_13)) {
2027           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2028           __Pyx_INCREF(__pyx_t_13);
2029           __Pyx_INCREF(function);
2030           __Pyx_DECREF_SET(__pyx_t_7, function);
2031           __pyx_t_14 = 1;
2032         }
2033       }
2034       #if CYTHON_FAST_PYCALL
2035       if (PyFunction_Check(__pyx_t_7)) {
2036         PyObject *__pyx_temp[5] = {__pyx_t_13, __pyx_t_1, __pyx_t_9, __pyx_t_10, __pyx_t_12};
2037         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error)
2038         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2039         __Pyx_GOTREF(__pyx_t_3);
2040         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2041         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2042         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2043         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2044       } else
2045       #endif
2046       #if CYTHON_FAST_PYCCALL
2047       if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
2048         PyObject *__pyx_temp[5] = {__pyx_t_13, __pyx_t_1, __pyx_t_9, __pyx_t_10, __pyx_t_12};
2049         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error)
2050         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2051         __Pyx_GOTREF(__pyx_t_3);
2052         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2053         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2054         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2055         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2056       } else
2057       #endif
2058       {
2059         __pyx_t_15 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 103, __pyx_L1_error)
2060         __Pyx_GOTREF(__pyx_t_15);
2061         if (__pyx_t_13) {
2062           __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
2063         }
2064         __Pyx_GIVEREF(__pyx_t_1);
2065         PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_1);
2066         __Pyx_GIVEREF(__pyx_t_9);
2067         PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_9);
2068         __Pyx_GIVEREF(__pyx_t_10);
2069         PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_10);
2070         __Pyx_GIVEREF(__pyx_t_12);
2071         PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_12);
2072         __pyx_t_1 = 0;
2073         __pyx_t_9 = 0;
2074         __pyx_t_10 = 0;
2075         __pyx_t_12 = 0;
2076         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error)
2077         __Pyx_GOTREF(__pyx_t_3);
2078         __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
2079       }
2080       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2081       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2082     }
2083 
2084     /* "MACS2/IO/BedGraphIO.pyx":94
2085  *         bedGraph_file = open( self.bedGraph_filename, "rb" )
2086  *
2087  *         for i in bedGraph_file:             # <<<<<<<<<<<<<<
2088  *             if i.startswith(b"track"):
2089  *                 continue
2090  */
2091     __pyx_L3_continue:;
2092   }
2093   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2094 
2095   /* "MACS2/IO/BedGraphIO.pyx":105
2096  *                 add_func(fs[0],atoi(fs[1]),atoi(fs[2]),atof(fs[3]))
2097  *
2098  *         bedGraph_file.close()             # <<<<<<<<<<<<<<
2099  *         return data
2100  *
2101  */
2102   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_bedGraph_file, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error)
2103   __Pyx_GOTREF(__pyx_t_3);
2104   __pyx_t_7 = NULL;
2105   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2106     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
2107     if (likely(__pyx_t_7)) {
2108       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2109       __Pyx_INCREF(__pyx_t_7);
2110       __Pyx_INCREF(function);
2111       __Pyx_DECREF_SET(__pyx_t_3, function);
2112     }
2113   }
2114   __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
2115   __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2116   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
2117   __Pyx_GOTREF(__pyx_t_2);
2118   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2119   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2120 
2121   /* "MACS2/IO/BedGraphIO.pyx":106
2122  *
2123  *         bedGraph_file.close()
2124  *         return data             # <<<<<<<<<<<<<<
2125  *
2126  * cdef class genericBedIO:
2127  */
2128   __Pyx_XDECREF(__pyx_r);
2129   __Pyx_INCREF(__pyx_v_data);
2130   __pyx_r = __pyx_v_data;
2131   goto __pyx_L0;
2132 
2133   /* "MACS2/IO/BedGraphIO.pyx":75
2134  *         self.bedGraph_filename = bedGraph_filename
2135  *
2136  *     def build_bdgtrack (self, double baseline_value=0):             # <<<<<<<<<<<<<<
2137  *         """Use this function to return a bedGraphTrackI object.
2138  *
2139  */
2140 
2141   /* function exit code */
2142   __pyx_L1_error:;
2143   __Pyx_XDECREF(__pyx_t_1);
2144   __Pyx_XDECREF(__pyx_t_2);
2145   __Pyx_XDECREF(__pyx_t_3);
2146   __Pyx_XDECREF(__pyx_t_7);
2147   __Pyx_XDECREF(__pyx_t_9);
2148   __Pyx_XDECREF(__pyx_t_10);
2149   __Pyx_XDECREF(__pyx_t_12);
2150   __Pyx_XDECREF(__pyx_t_13);
2151   __Pyx_XDECREF(__pyx_t_15);
2152   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.bedGraphIO.build_bdgtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
2153   __pyx_r = NULL;
2154   __pyx_L0:;
2155   __Pyx_XDECREF(__pyx_v_i);
2156   __Pyx_XDECREF(__pyx_v_data);
2157   __Pyx_XDECREF(__pyx_v_add_func);
2158   __Pyx_XDECREF(__pyx_v_bedGraph_file);
2159   __Pyx_XDECREF(__pyx_v_fs);
2160   __Pyx_XGIVEREF(__pyx_r);
2161   __Pyx_TraceReturn(__pyx_r, 0);
2162   __Pyx_RefNannyFinishContext();
2163   return __pyx_r;
2164 }
2165 
2166 /* "(tree fragment)":1
2167  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
2168  *     cdef tuple state
2169  *     cdef object _dict
2170  */
2171 
2172 /* Python wrapper */
2173 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2174 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2175   PyObject *__pyx_r = 0;
2176   __Pyx_RefNannyDeclarations
2177   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
2178   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_4__reduce_cython__(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)__pyx_v_self));
2179 
2180   /* function exit code */
2181   __Pyx_RefNannyFinishContext();
2182   return __pyx_r;
2183 }
2184 
__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_4__reduce_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO * __pyx_v_self)2185 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_4__reduce_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self) {
2186   PyObject *__pyx_v_state = 0;
2187   PyObject *__pyx_v__dict = 0;
2188   int __pyx_v_use_setstate;
2189   PyObject *__pyx_r = NULL;
2190   __Pyx_TraceDeclarations
2191   __Pyx_RefNannyDeclarations
2192   PyObject *__pyx_t_1 = NULL;
2193   int __pyx_t_2;
2194   int __pyx_t_3;
2195   PyObject *__pyx_t_4 = NULL;
2196   PyObject *__pyx_t_5 = NULL;
2197   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
2198   __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
2199 
2200   /* "(tree fragment)":5
2201  *     cdef object _dict
2202  *     cdef bint use_setstate
2203  *     state = (self.bedGraph_filename,)             # <<<<<<<<<<<<<<
2204  *     _dict = getattr(self, '__dict__', None)
2205  *     if _dict is not None:
2206  */
2207   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
2208   __Pyx_GOTREF(__pyx_t_1);
2209   __Pyx_INCREF(__pyx_v_self->bedGraph_filename);
2210   __Pyx_GIVEREF(__pyx_v_self->bedGraph_filename);
2211   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->bedGraph_filename);
2212   __pyx_v_state = ((PyObject*)__pyx_t_1);
2213   __pyx_t_1 = 0;
2214 
2215   /* "(tree fragment)":6
2216  *     cdef bint use_setstate
2217  *     state = (self.bedGraph_filename,)
2218  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
2219  *     if _dict is not None:
2220  *         state += (_dict,)
2221  */
2222   __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)
2223   __Pyx_GOTREF(__pyx_t_1);
2224   __pyx_v__dict = __pyx_t_1;
2225   __pyx_t_1 = 0;
2226 
2227   /* "(tree fragment)":7
2228  *     state = (self.bedGraph_filename,)
2229  *     _dict = getattr(self, '__dict__', None)
2230  *     if _dict is not None:             # <<<<<<<<<<<<<<
2231  *         state += (_dict,)
2232  *         use_setstate = True
2233  */
2234   __pyx_t_2 = (__pyx_v__dict != Py_None);
2235   __pyx_t_3 = (__pyx_t_2 != 0);
2236   if (__pyx_t_3) {
2237 
2238     /* "(tree fragment)":8
2239  *     _dict = getattr(self, '__dict__', None)
2240  *     if _dict is not None:
2241  *         state += (_dict,)             # <<<<<<<<<<<<<<
2242  *         use_setstate = True
2243  *     else:
2244  */
2245     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
2246     __Pyx_GOTREF(__pyx_t_1);
2247     __Pyx_INCREF(__pyx_v__dict);
2248     __Pyx_GIVEREF(__pyx_v__dict);
2249     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
2250     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
2251     __Pyx_GOTREF(__pyx_t_4);
2252     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2253     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
2254     __pyx_t_4 = 0;
2255 
2256     /* "(tree fragment)":9
2257  *     if _dict is not None:
2258  *         state += (_dict,)
2259  *         use_setstate = True             # <<<<<<<<<<<<<<
2260  *     else:
2261  *         use_setstate = self.bedGraph_filename is not None
2262  */
2263     __pyx_v_use_setstate = 1;
2264 
2265     /* "(tree fragment)":7
2266  *     state = (self.bedGraph_filename,)
2267  *     _dict = getattr(self, '__dict__', None)
2268  *     if _dict is not None:             # <<<<<<<<<<<<<<
2269  *         state += (_dict,)
2270  *         use_setstate = True
2271  */
2272     goto __pyx_L3;
2273   }
2274 
2275   /* "(tree fragment)":11
2276  *         use_setstate = True
2277  *     else:
2278  *         use_setstate = self.bedGraph_filename is not None             # <<<<<<<<<<<<<<
2279  *     if use_setstate:
2280  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, None), state
2281  */
2282   /*else*/ {
2283     __pyx_t_3 = (__pyx_v_self->bedGraph_filename != ((PyObject*)Py_None));
2284     __pyx_v_use_setstate = __pyx_t_3;
2285   }
2286   __pyx_L3:;
2287 
2288   /* "(tree fragment)":12
2289  *     else:
2290  *         use_setstate = self.bedGraph_filename is not None
2291  *     if use_setstate:             # <<<<<<<<<<<<<<
2292  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, None), state
2293  *     else:
2294  */
2295   __pyx_t_3 = (__pyx_v_use_setstate != 0);
2296   if (__pyx_t_3) {
2297 
2298     /* "(tree fragment)":13
2299  *         use_setstate = self.bedGraph_filename is not None
2300  *     if use_setstate:
2301  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, None), state             # <<<<<<<<<<<<<<
2302  *     else:
2303  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, state)
2304  */
2305     __Pyx_XDECREF(__pyx_r);
2306     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_bedGraphIO); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
2307     __Pyx_GOTREF(__pyx_t_4);
2308     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
2309     __Pyx_GOTREF(__pyx_t_1);
2310     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2311     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2312     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2313     __Pyx_INCREF(__pyx_int_51759939);
2314     __Pyx_GIVEREF(__pyx_int_51759939);
2315     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_51759939);
2316     __Pyx_INCREF(Py_None);
2317     __Pyx_GIVEREF(Py_None);
2318     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
2319     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
2320     __Pyx_GOTREF(__pyx_t_5);
2321     __Pyx_GIVEREF(__pyx_t_4);
2322     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
2323     __Pyx_GIVEREF(__pyx_t_1);
2324     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
2325     __Pyx_INCREF(__pyx_v_state);
2326     __Pyx_GIVEREF(__pyx_v_state);
2327     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
2328     __pyx_t_4 = 0;
2329     __pyx_t_1 = 0;
2330     __pyx_r = __pyx_t_5;
2331     __pyx_t_5 = 0;
2332     goto __pyx_L0;
2333 
2334     /* "(tree fragment)":12
2335  *     else:
2336  *         use_setstate = self.bedGraph_filename is not None
2337  *     if use_setstate:             # <<<<<<<<<<<<<<
2338  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, None), state
2339  *     else:
2340  */
2341   }
2342 
2343   /* "(tree fragment)":15
2344  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, None), state
2345  *     else:
2346  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, state)             # <<<<<<<<<<<<<<
2347  * def __setstate_cython__(self, __pyx_state):
2348  *     __pyx_unpickle_bedGraphIO__set_state(self, __pyx_state)
2349  */
2350   /*else*/ {
2351     __Pyx_XDECREF(__pyx_r);
2352     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_bedGraphIO); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
2353     __Pyx_GOTREF(__pyx_t_5);
2354     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
2355     __Pyx_GOTREF(__pyx_t_1);
2356     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2357     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2358     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
2359     __Pyx_INCREF(__pyx_int_51759939);
2360     __Pyx_GIVEREF(__pyx_int_51759939);
2361     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_51759939);
2362     __Pyx_INCREF(__pyx_v_state);
2363     __Pyx_GIVEREF(__pyx_v_state);
2364     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
2365     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
2366     __Pyx_GOTREF(__pyx_t_4);
2367     __Pyx_GIVEREF(__pyx_t_5);
2368     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
2369     __Pyx_GIVEREF(__pyx_t_1);
2370     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
2371     __pyx_t_5 = 0;
2372     __pyx_t_1 = 0;
2373     __pyx_r = __pyx_t_4;
2374     __pyx_t_4 = 0;
2375     goto __pyx_L0;
2376   }
2377 
2378   /* "(tree fragment)":1
2379  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
2380  *     cdef tuple state
2381  *     cdef object _dict
2382  */
2383 
2384   /* function exit code */
2385   __pyx_L1_error:;
2386   __Pyx_XDECREF(__pyx_t_1);
2387   __Pyx_XDECREF(__pyx_t_4);
2388   __Pyx_XDECREF(__pyx_t_5);
2389   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.bedGraphIO.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2390   __pyx_r = NULL;
2391   __pyx_L0:;
2392   __Pyx_XDECREF(__pyx_v_state);
2393   __Pyx_XDECREF(__pyx_v__dict);
2394   __Pyx_XGIVEREF(__pyx_r);
2395   __Pyx_TraceReturn(__pyx_r, 0);
2396   __Pyx_RefNannyFinishContext();
2397   return __pyx_r;
2398 }
2399 
2400 /* "(tree fragment)":16
2401  *     else:
2402  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, state)
2403  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
2404  *     __pyx_unpickle_bedGraphIO__set_state(self, __pyx_state)
2405  */
2406 
2407 /* Python wrapper */
2408 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)2409 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
2410   PyObject *__pyx_r = 0;
2411   __Pyx_RefNannyDeclarations
2412   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
2413   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_6__setstate_cython__(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
2414 
2415   /* function exit code */
2416   __Pyx_RefNannyFinishContext();
2417   return __pyx_r;
2418 }
2419 
__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_6__setstate_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO * __pyx_v_self,PyObject * __pyx_v___pyx_state)2420 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_10bedGraphIO_6__setstate_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
2421   PyObject *__pyx_r = NULL;
2422   __Pyx_TraceDeclarations
2423   __Pyx_RefNannyDeclarations
2424   PyObject *__pyx_t_1 = NULL;
2425   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
2426   __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 16, 0, __PYX_ERR(1, 16, __pyx_L1_error));
2427 
2428   /* "(tree fragment)":17
2429  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, state)
2430  * def __setstate_cython__(self, __pyx_state):
2431  *     __pyx_unpickle_bedGraphIO__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
2432  */
2433   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)
2434   __pyx_t_1 = __pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
2435   __Pyx_GOTREF(__pyx_t_1);
2436   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2437 
2438   /* "(tree fragment)":16
2439  *     else:
2440  *         return __pyx_unpickle_bedGraphIO, (type(self), 0x315cb43, state)
2441  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
2442  *     __pyx_unpickle_bedGraphIO__set_state(self, __pyx_state)
2443  */
2444 
2445   /* function exit code */
2446   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2447   goto __pyx_L0;
2448   __pyx_L1_error:;
2449   __Pyx_XDECREF(__pyx_t_1);
2450   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.bedGraphIO.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2451   __pyx_r = NULL;
2452   __pyx_L0:;
2453   __Pyx_XGIVEREF(__pyx_r);
2454   __Pyx_TraceReturn(__pyx_r, 0);
2455   __Pyx_RefNannyFinishContext();
2456   return __pyx_r;
2457 }
2458 
2459 /* "MACS2/IO/BedGraphIO.pyx":123
2460  *     by chromosome and start position.
2461  *     """
2462  *     def __init__ (self,f):             # <<<<<<<<<<<<<<
2463  *         """f must be a filename or a file handler.
2464  *
2465  */
2466 
2467 /* Python wrapper */
2468 static int __pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2469 static char __pyx_doc_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__[] = "f must be a filename or a file handler.\n        \n        ";
2470 #if CYTHON_COMPILING_IN_CPYTHON
2471 struct wrapperbase __pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__;
2472 #endif
__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2473 static int __pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2474   PyObject *__pyx_v_f = 0;
2475   int __pyx_r;
2476   __Pyx_RefNannyDeclarations
2477   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2478   {
2479     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,0};
2480     PyObject* values[1] = {0};
2481     if (unlikely(__pyx_kwds)) {
2482       Py_ssize_t kw_args;
2483       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2484       switch (pos_args) {
2485         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2486         CYTHON_FALLTHROUGH;
2487         case  0: break;
2488         default: goto __pyx_L5_argtuple_error;
2489       }
2490       kw_args = PyDict_Size(__pyx_kwds);
2491       switch (pos_args) {
2492         case  0:
2493         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
2494         else goto __pyx_L5_argtuple_error;
2495       }
2496       if (unlikely(kw_args > 0)) {
2497         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 123, __pyx_L3_error)
2498       }
2499     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
2500       goto __pyx_L5_argtuple_error;
2501     } else {
2502       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2503     }
2504     __pyx_v_f = values[0];
2505   }
2506   goto __pyx_L4_argument_unpacking_done;
2507   __pyx_L5_argtuple_error:;
2508   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 123, __pyx_L3_error)
2509   __pyx_L3_error:;
2510   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.genericBedIO.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2511   __Pyx_RefNannyFinishContext();
2512   return -1;
2513   __pyx_L4_argument_unpacking_done:;
2514   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *)__pyx_v_self), __pyx_v_f);
2515 
2516   /* function exit code */
2517   __Pyx_RefNannyFinishContext();
2518   return __pyx_r;
2519 }
2520 
__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO * __pyx_v_self,PyObject * __pyx_v_f)2521 static int __pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self, PyObject *__pyx_v_f) {
2522   int __pyx_r;
2523   __Pyx_TraceDeclarations
2524   __Pyx_RefNannyDeclarations
2525   PyObject *__pyx_t_1 = NULL;
2526   int __pyx_t_2;
2527   PyObject *__pyx_t_3 = NULL;
2528   __Pyx_RefNannySetupContext("__init__", 0);
2529   __Pyx_TraceCall("__init__", __pyx_f[0], 123, 0, __PYX_ERR(0, 123, __pyx_L1_error));
2530 
2531   /* "MACS2/IO/BedGraphIO.pyx":127
2532  *
2533  *         """
2534  *         if type(f) == str:             # <<<<<<<<<<<<<<
2535  *             self.fhd = open(f,"rb")
2536  *         elif type(f) == io.IOBase:
2537  */
2538   __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_f)), ((PyObject *)(&PyUnicode_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
2539   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 127, __pyx_L1_error)
2540   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2541   if (__pyx_t_2) {
2542 
2543     /* "MACS2/IO/BedGraphIO.pyx":128
2544  *         """
2545  *         if type(f) == str:
2546  *             self.fhd = open(f,"rb")             # <<<<<<<<<<<<<<
2547  *         elif type(f) == io.IOBase:
2548  *             self.fhd = f
2549  */
2550     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
2551     __Pyx_GOTREF(__pyx_t_1);
2552     __Pyx_INCREF(__pyx_v_f);
2553     __Pyx_GIVEREF(__pyx_v_f);
2554     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f);
2555     __Pyx_INCREF(__pyx_n_u_rb);
2556     __Pyx_GIVEREF(__pyx_n_u_rb);
2557     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_rb);
2558     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error)
2559     __Pyx_GOTREF(__pyx_t_3);
2560     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2561     if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fhd, __pyx_t_3) < 0) __PYX_ERR(0, 128, __pyx_L1_error)
2562     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2563 
2564     /* "MACS2/IO/BedGraphIO.pyx":127
2565  *
2566  *         """
2567  *         if type(f) == str:             # <<<<<<<<<<<<<<
2568  *             self.fhd = open(f,"rb")
2569  *         elif type(f) == io.IOBase:
2570  */
2571     goto __pyx_L3;
2572   }
2573 
2574   /* "MACS2/IO/BedGraphIO.pyx":129
2575  *         if type(f) == str:
2576  *             self.fhd = open(f,"rb")
2577  *         elif type(f) == io.IOBase:             # <<<<<<<<<<<<<<
2578  *             self.fhd = f
2579  *         else:
2580  */
2581   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
2582   __Pyx_GOTREF(__pyx_t_3);
2583   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IOBase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
2584   __Pyx_GOTREF(__pyx_t_1);
2585   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2586   __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_f)), __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
2587   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2588   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 129, __pyx_L1_error)
2589   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2590   if (likely(__pyx_t_2)) {
2591 
2592     /* "MACS2/IO/BedGraphIO.pyx":130
2593  *             self.fhd = open(f,"rb")
2594  *         elif type(f) == io.IOBase:
2595  *             self.fhd = f             # <<<<<<<<<<<<<<
2596  *         else:
2597  *             raise Exception("f must be a filename or a file handler.")
2598  */
2599     if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fhd, __pyx_v_f) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
2600 
2601     /* "MACS2/IO/BedGraphIO.pyx":129
2602  *         if type(f) == str:
2603  *             self.fhd = open(f,"rb")
2604  *         elif type(f) == io.IOBase:             # <<<<<<<<<<<<<<
2605  *             self.fhd = f
2606  *         else:
2607  */
2608     goto __pyx_L3;
2609   }
2610 
2611   /* "MACS2/IO/BedGraphIO.pyx":132
2612  *             self.fhd = f
2613  *         else:
2614  *             raise Exception("f must be a filename or a file handler.")             # <<<<<<<<<<<<<<
2615  *
2616  *     def build_bedtrack (self):
2617  */
2618   /*else*/ {
2619     __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error)
2620     __Pyx_GOTREF(__pyx_t_3);
2621     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2622     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2623     __PYX_ERR(0, 132, __pyx_L1_error)
2624   }
2625   __pyx_L3:;
2626 
2627   /* "MACS2/IO/BedGraphIO.pyx":123
2628  *     by chromosome and start position.
2629  *     """
2630  *     def __init__ (self,f):             # <<<<<<<<<<<<<<
2631  *         """f must be a filename or a file handler.
2632  *
2633  */
2634 
2635   /* function exit code */
2636   __pyx_r = 0;
2637   goto __pyx_L0;
2638   __pyx_L1_error:;
2639   __Pyx_XDECREF(__pyx_t_1);
2640   __Pyx_XDECREF(__pyx_t_3);
2641   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.genericBedIO.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2642   __pyx_r = -1;
2643   __pyx_L0:;
2644   __Pyx_TraceReturn(Py_None, 0);
2645   __Pyx_RefNannyFinishContext();
2646   return __pyx_r;
2647 }
2648 
2649 /* "MACS2/IO/BedGraphIO.pyx":134
2650  *             raise Exception("f must be a filename or a file handler.")
2651  *
2652  *     def build_bedtrack (self):             # <<<<<<<<<<<<<<
2653  *         """Use this function to return a bedGraphTrackI object.
2654  *
2655  */
2656 
2657 /* Python wrapper */
2658 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_3build_bedtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2659 static char __pyx_doc_5MACS2_2IO_10BedGraphIO_12genericBedIO_2build_bedtrack[] = "Use this function to return a bedGraphTrackI object.\n\n        baseline_value is the value to fill in the regions not defined\n        in bedGraph. For example, if the bedGraph is like:\n\n        chr1  100 200  1\n        chr1  250 350  2\n\n        Then the region chr1:200..250 should be filled with\n        baseline_value. Default of baseline_value is 0.\n        ";
__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_3build_bedtrack(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2660 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_3build_bedtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2661   PyObject *__pyx_r = 0;
2662   __Pyx_RefNannyDeclarations
2663   __Pyx_RefNannySetupContext("build_bedtrack (wrapper)", 0);
2664   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_2build_bedtrack(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *)__pyx_v_self));
2665 
2666   /* function exit code */
2667   __Pyx_RefNannyFinishContext();
2668   return __pyx_r;
2669 }
2670 
__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_2build_bedtrack(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO * __pyx_v_self)2671 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_2build_bedtrack(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self) {
2672   PyObject *__pyx_v_i = 0;
2673   PyObject *__pyx_v_data = NULL;
2674   PyObject *__pyx_v_add_func = NULL;
2675   CYTHON_UNUSED PyObject *__pyx_v_chrom_itemcount = NULL;
2676   PyObject *__pyx_v_fs = NULL;
2677   PyObject *__pyx_r = NULL;
2678   __Pyx_TraceDeclarations
2679   __Pyx_RefNannyDeclarations
2680   PyObject *__pyx_t_1 = NULL;
2681   PyObject *__pyx_t_2 = NULL;
2682   PyObject *__pyx_t_3 = NULL;
2683   Py_ssize_t __pyx_t_4;
2684   PyObject *(*__pyx_t_5)(PyObject *);
2685   PyObject *__pyx_t_6 = NULL;
2686   char const *__pyx_t_7;
2687   PyObject *__pyx_t_8 = NULL;
2688   PyObject *__pyx_t_9 = NULL;
2689   PyObject *__pyx_t_10 = NULL;
2690   int __pyx_t_11;
2691   PyObject *__pyx_t_12 = NULL;
2692   __Pyx_RefNannySetupContext("build_bedtrack", 0);
2693   __Pyx_TraceCall("build_bedtrack", __pyx_f[0], 134, 0, __PYX_ERR(0, 134, __pyx_L1_error));
2694 
2695   /* "MACS2/IO/BedGraphIO.pyx":148
2696  *         cdef str i
2697  *
2698  *         data = bedRegionTrackI() #(baseline_value=baseline_value)             # <<<<<<<<<<<<<<
2699  *         add_func = data.safe_add_loc
2700  *         chrom_itemcount = {}
2701  */
2702   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_bedRegionTrackI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
2703   __Pyx_GOTREF(__pyx_t_2);
2704   __pyx_t_3 = NULL;
2705   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2706     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2707     if (likely(__pyx_t_3)) {
2708       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2709       __Pyx_INCREF(__pyx_t_3);
2710       __Pyx_INCREF(function);
2711       __Pyx_DECREF_SET(__pyx_t_2, function);
2712     }
2713   }
2714   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
2715   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2716   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
2717   __Pyx_GOTREF(__pyx_t_1);
2718   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2719   __pyx_v_data = __pyx_t_1;
2720   __pyx_t_1 = 0;
2721 
2722   /* "MACS2/IO/BedGraphIO.pyx":149
2723  *
2724  *         data = bedRegionTrackI() #(baseline_value=baseline_value)
2725  *         add_func = data.safe_add_loc             # <<<<<<<<<<<<<<
2726  *         chrom_itemcount = {}
2727  *
2728  */
2729   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_safe_add_loc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
2730   __Pyx_GOTREF(__pyx_t_1);
2731   __pyx_v_add_func = __pyx_t_1;
2732   __pyx_t_1 = 0;
2733 
2734   /* "MACS2/IO/BedGraphIO.pyx":150
2735  *         data = bedRegionTrackI() #(baseline_value=baseline_value)
2736  *         add_func = data.safe_add_loc
2737  *         chrom_itemcount = {}             # <<<<<<<<<<<<<<
2738  *
2739  *         self.fhd.seek(0)
2740  */
2741   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
2742   __Pyx_GOTREF(__pyx_t_1);
2743   __pyx_v_chrom_itemcount = ((PyObject*)__pyx_t_1);
2744   __pyx_t_1 = 0;
2745 
2746   /* "MACS2/IO/BedGraphIO.pyx":152
2747  *         chrom_itemcount = {}
2748  *
2749  *         self.fhd.seek(0)             # <<<<<<<<<<<<<<
2750  *
2751  *         for i in self.fhd:
2752  */
2753   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fhd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
2754   __Pyx_GOTREF(__pyx_t_2);
2755   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_seek); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
2756   __Pyx_GOTREF(__pyx_t_3);
2757   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2758   __pyx_t_2 = NULL;
2759   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2760     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2761     if (likely(__pyx_t_2)) {
2762       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2763       __Pyx_INCREF(__pyx_t_2);
2764       __Pyx_INCREF(function);
2765       __Pyx_DECREF_SET(__pyx_t_3, function);
2766     }
2767   }
2768   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_0);
2769   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2770   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
2771   __Pyx_GOTREF(__pyx_t_1);
2772   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2773   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2774 
2775   /* "MACS2/IO/BedGraphIO.pyx":154
2776  *         self.fhd.seek(0)
2777  *
2778  *         for i in self.fhd:             # <<<<<<<<<<<<<<
2779  *             fs = i.split()
2780  *             add_func(fs[0],atoi(fs[1]),atoi(fs[2])) #,float(value))
2781  */
2782   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fhd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
2783   __Pyx_GOTREF(__pyx_t_1);
2784   if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
2785     __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
2786     __pyx_t_5 = NULL;
2787   } else {
2788     __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
2789     __Pyx_GOTREF(__pyx_t_3);
2790     __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error)
2791   }
2792   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2793   for (;;) {
2794     if (likely(!__pyx_t_5)) {
2795       if (likely(PyList_CheckExact(__pyx_t_3))) {
2796         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
2797         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2798         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
2799         #else
2800         __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
2801         __Pyx_GOTREF(__pyx_t_1);
2802         #endif
2803       } else {
2804         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
2805         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2806         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
2807         #else
2808         __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
2809         __Pyx_GOTREF(__pyx_t_1);
2810         #endif
2811       }
2812     } else {
2813       __pyx_t_1 = __pyx_t_5(__pyx_t_3);
2814       if (unlikely(!__pyx_t_1)) {
2815         PyObject* exc_type = PyErr_Occurred();
2816         if (exc_type) {
2817           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2818           else __PYX_ERR(0, 154, __pyx_L1_error)
2819         }
2820         break;
2821       }
2822       __Pyx_GOTREF(__pyx_t_1);
2823     }
2824     if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 154, __pyx_L1_error)
2825     __Pyx_XDECREF_SET(__pyx_v_i, ((PyObject*)__pyx_t_1));
2826     __pyx_t_1 = 0;
2827 
2828     /* "MACS2/IO/BedGraphIO.pyx":155
2829  *
2830  *         for i in self.fhd:
2831  *             fs = i.split()             # <<<<<<<<<<<<<<
2832  *             add_func(fs[0],atoi(fs[1]),atoi(fs[2])) #,float(value))
2833  *         self.fhd.seek(0)
2834  */
2835     if (unlikely(__pyx_v_i == Py_None)) {
2836       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "split");
2837       __PYX_ERR(0, 155, __pyx_L1_error)
2838     }
2839     __pyx_t_1 = PyUnicode_Split(__pyx_v_i, ((PyObject *)NULL), -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
2840     __Pyx_GOTREF(__pyx_t_1);
2841     __Pyx_XDECREF_SET(__pyx_v_fs, __pyx_t_1);
2842     __pyx_t_1 = 0;
2843 
2844     /* "MACS2/IO/BedGraphIO.pyx":156
2845  *         for i in self.fhd:
2846  *             fs = i.split()
2847  *             add_func(fs[0],atoi(fs[1]),atoi(fs[2])) #,float(value))             # <<<<<<<<<<<<<<
2848  *         self.fhd.seek(0)
2849  *         return data
2850  */
2851     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
2852     __Pyx_GOTREF(__pyx_t_2);
2853     __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_fs, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error)
2854     __Pyx_GOTREF(__pyx_t_6);
2855     __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_6); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error)
2856     __pyx_t_8 = __Pyx_PyInt_From_int(atoi(__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 156, __pyx_L1_error)
2857     __Pyx_GOTREF(__pyx_t_8);
2858     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2859     __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_fs, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error)
2860     __Pyx_GOTREF(__pyx_t_6);
2861     __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_6); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error)
2862     __pyx_t_9 = __Pyx_PyInt_From_int(atoi(__pyx_t_7)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 156, __pyx_L1_error)
2863     __Pyx_GOTREF(__pyx_t_9);
2864     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2865     __Pyx_INCREF(__pyx_v_add_func);
2866     __pyx_t_6 = __pyx_v_add_func; __pyx_t_10 = NULL;
2867     __pyx_t_11 = 0;
2868     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
2869       __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
2870       if (likely(__pyx_t_10)) {
2871         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
2872         __Pyx_INCREF(__pyx_t_10);
2873         __Pyx_INCREF(function);
2874         __Pyx_DECREF_SET(__pyx_t_6, function);
2875         __pyx_t_11 = 1;
2876       }
2877     }
2878     #if CYTHON_FAST_PYCALL
2879     if (PyFunction_Check(__pyx_t_6)) {
2880       PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_2, __pyx_t_8, __pyx_t_9};
2881       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
2882       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2883       __Pyx_GOTREF(__pyx_t_1);
2884       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2885       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2886       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2887     } else
2888     #endif
2889     #if CYTHON_FAST_PYCCALL
2890     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
2891       PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_2, __pyx_t_8, __pyx_t_9};
2892       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
2893       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2894       __Pyx_GOTREF(__pyx_t_1);
2895       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2896       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2897       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2898     } else
2899     #endif
2900     {
2901       __pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 156, __pyx_L1_error)
2902       __Pyx_GOTREF(__pyx_t_12);
2903       if (__pyx_t_10) {
2904         __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
2905       }
2906       __Pyx_GIVEREF(__pyx_t_2);
2907       PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_2);
2908       __Pyx_GIVEREF(__pyx_t_8);
2909       PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_8);
2910       __Pyx_GIVEREF(__pyx_t_9);
2911       PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_9);
2912       __pyx_t_2 = 0;
2913       __pyx_t_8 = 0;
2914       __pyx_t_9 = 0;
2915       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
2916       __Pyx_GOTREF(__pyx_t_1);
2917       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2918     }
2919     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2920     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2921 
2922     /* "MACS2/IO/BedGraphIO.pyx":154
2923  *         self.fhd.seek(0)
2924  *
2925  *         for i in self.fhd:             # <<<<<<<<<<<<<<
2926  *             fs = i.split()
2927  *             add_func(fs[0],atoi(fs[1]),atoi(fs[2])) #,float(value))
2928  */
2929   }
2930   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2931 
2932   /* "MACS2/IO/BedGraphIO.pyx":157
2933  *             fs = i.split()
2934  *             add_func(fs[0],atoi(fs[1]),atoi(fs[2])) #,float(value))
2935  *         self.fhd.seek(0)             # <<<<<<<<<<<<<<
2936  *         return data
2937  *
2938  */
2939   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fhd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
2940   __Pyx_GOTREF(__pyx_t_1);
2941   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_seek); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
2942   __Pyx_GOTREF(__pyx_t_6);
2943   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2944   __pyx_t_1 = NULL;
2945   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
2946     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
2947     if (likely(__pyx_t_1)) {
2948       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
2949       __Pyx_INCREF(__pyx_t_1);
2950       __Pyx_INCREF(function);
2951       __Pyx_DECREF_SET(__pyx_t_6, function);
2952     }
2953   }
2954   __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_0);
2955   __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2956   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error)
2957   __Pyx_GOTREF(__pyx_t_3);
2958   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2959   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2960 
2961   /* "MACS2/IO/BedGraphIO.pyx":158
2962  *             add_func(fs[0],atoi(fs[1]),atoi(fs[2])) #,float(value))
2963  *         self.fhd.seek(0)
2964  *         return data             # <<<<<<<<<<<<<<
2965  *
2966  *
2967  */
2968   __Pyx_XDECREF(__pyx_r);
2969   __Pyx_INCREF(__pyx_v_data);
2970   __pyx_r = __pyx_v_data;
2971   goto __pyx_L0;
2972 
2973   /* "MACS2/IO/BedGraphIO.pyx":134
2974  *             raise Exception("f must be a filename or a file handler.")
2975  *
2976  *     def build_bedtrack (self):             # <<<<<<<<<<<<<<
2977  *         """Use this function to return a bedGraphTrackI object.
2978  *
2979  */
2980 
2981   /* function exit code */
2982   __pyx_L1_error:;
2983   __Pyx_XDECREF(__pyx_t_1);
2984   __Pyx_XDECREF(__pyx_t_2);
2985   __Pyx_XDECREF(__pyx_t_3);
2986   __Pyx_XDECREF(__pyx_t_6);
2987   __Pyx_XDECREF(__pyx_t_8);
2988   __Pyx_XDECREF(__pyx_t_9);
2989   __Pyx_XDECREF(__pyx_t_10);
2990   __Pyx_XDECREF(__pyx_t_12);
2991   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.genericBedIO.build_bedtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
2992   __pyx_r = NULL;
2993   __pyx_L0:;
2994   __Pyx_XDECREF(__pyx_v_i);
2995   __Pyx_XDECREF(__pyx_v_data);
2996   __Pyx_XDECREF(__pyx_v_add_func);
2997   __Pyx_XDECREF(__pyx_v_chrom_itemcount);
2998   __Pyx_XDECREF(__pyx_v_fs);
2999   __Pyx_XGIVEREF(__pyx_r);
3000   __Pyx_TraceReturn(__pyx_r, 0);
3001   __Pyx_RefNannyFinishContext();
3002   return __pyx_r;
3003 }
3004 
3005 /* "(tree fragment)":1
3006  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3007  *     cdef tuple state
3008  *     cdef object _dict
3009  */
3010 
3011 /* Python wrapper */
3012 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3013 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3014   PyObject *__pyx_r = 0;
3015   __Pyx_RefNannyDeclarations
3016   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3017   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_4__reduce_cython__(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *)__pyx_v_self));
3018 
3019   /* function exit code */
3020   __Pyx_RefNannyFinishContext();
3021   return __pyx_r;
3022 }
3023 
__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_4__reduce_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO * __pyx_v_self)3024 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_4__reduce_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self) {
3025   PyObject *__pyx_v_state = 0;
3026   PyObject *__pyx_v__dict = 0;
3027   int __pyx_v_use_setstate;
3028   PyObject *__pyx_r = NULL;
3029   __Pyx_TraceDeclarations
3030   __Pyx_RefNannyDeclarations
3031   PyObject *__pyx_t_1 = NULL;
3032   int __pyx_t_2;
3033   int __pyx_t_3;
3034   PyObject *__pyx_t_4 = NULL;
3035   PyObject *__pyx_t_5 = NULL;
3036   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3037   __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
3038 
3039   /* "(tree fragment)":5
3040  *     cdef object _dict
3041  *     cdef bint use_setstate
3042  *     state = ()             # <<<<<<<<<<<<<<
3043  *     _dict = getattr(self, '__dict__', None)
3044  *     if _dict is not None:
3045  */
3046   __Pyx_INCREF(__pyx_empty_tuple);
3047   __pyx_v_state = __pyx_empty_tuple;
3048 
3049   /* "(tree fragment)":6
3050  *     cdef bint use_setstate
3051  *     state = ()
3052  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
3053  *     if _dict is not None:
3054  *         state += (_dict,)
3055  */
3056   __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)
3057   __Pyx_GOTREF(__pyx_t_1);
3058   __pyx_v__dict = __pyx_t_1;
3059   __pyx_t_1 = 0;
3060 
3061   /* "(tree fragment)":7
3062  *     state = ()
3063  *     _dict = getattr(self, '__dict__', None)
3064  *     if _dict is not None:             # <<<<<<<<<<<<<<
3065  *         state += (_dict,)
3066  *         use_setstate = True
3067  */
3068   __pyx_t_2 = (__pyx_v__dict != Py_None);
3069   __pyx_t_3 = (__pyx_t_2 != 0);
3070   if (__pyx_t_3) {
3071 
3072     /* "(tree fragment)":8
3073  *     _dict = getattr(self, '__dict__', None)
3074  *     if _dict is not None:
3075  *         state += (_dict,)             # <<<<<<<<<<<<<<
3076  *         use_setstate = True
3077  *     else:
3078  */
3079     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
3080     __Pyx_GOTREF(__pyx_t_1);
3081     __Pyx_INCREF(__pyx_v__dict);
3082     __Pyx_GIVEREF(__pyx_v__dict);
3083     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
3084     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
3085     __Pyx_GOTREF(__pyx_t_4);
3086     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3087     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
3088     __pyx_t_4 = 0;
3089 
3090     /* "(tree fragment)":9
3091  *     if _dict is not None:
3092  *         state += (_dict,)
3093  *         use_setstate = True             # <<<<<<<<<<<<<<
3094  *     else:
3095  *         use_setstate = False
3096  */
3097     __pyx_v_use_setstate = 1;
3098 
3099     /* "(tree fragment)":7
3100  *     state = ()
3101  *     _dict = getattr(self, '__dict__', None)
3102  *     if _dict is not None:             # <<<<<<<<<<<<<<
3103  *         state += (_dict,)
3104  *         use_setstate = True
3105  */
3106     goto __pyx_L3;
3107   }
3108 
3109   /* "(tree fragment)":11
3110  *         use_setstate = True
3111  *     else:
3112  *         use_setstate = False             # <<<<<<<<<<<<<<
3113  *     if use_setstate:
3114  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, None), state
3115  */
3116   /*else*/ {
3117     __pyx_v_use_setstate = 0;
3118   }
3119   __pyx_L3:;
3120 
3121   /* "(tree fragment)":12
3122  *     else:
3123  *         use_setstate = False
3124  *     if use_setstate:             # <<<<<<<<<<<<<<
3125  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, None), state
3126  *     else:
3127  */
3128   __pyx_t_3 = (__pyx_v_use_setstate != 0);
3129   if (__pyx_t_3) {
3130 
3131     /* "(tree fragment)":13
3132  *         use_setstate = False
3133  *     if use_setstate:
3134  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
3135  *     else:
3136  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, state)
3137  */
3138     __Pyx_XDECREF(__pyx_r);
3139     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_genericBedIO); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
3140     __Pyx_GOTREF(__pyx_t_4);
3141     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
3142     __Pyx_GOTREF(__pyx_t_1);
3143     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3144     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3145     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3146     __Pyx_INCREF(__pyx_int_222419149);
3147     __Pyx_GIVEREF(__pyx_int_222419149);
3148     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
3149     __Pyx_INCREF(Py_None);
3150     __Pyx_GIVEREF(Py_None);
3151     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
3152     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
3153     __Pyx_GOTREF(__pyx_t_5);
3154     __Pyx_GIVEREF(__pyx_t_4);
3155     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
3156     __Pyx_GIVEREF(__pyx_t_1);
3157     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
3158     __Pyx_INCREF(__pyx_v_state);
3159     __Pyx_GIVEREF(__pyx_v_state);
3160     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
3161     __pyx_t_4 = 0;
3162     __pyx_t_1 = 0;
3163     __pyx_r = __pyx_t_5;
3164     __pyx_t_5 = 0;
3165     goto __pyx_L0;
3166 
3167     /* "(tree fragment)":12
3168  *     else:
3169  *         use_setstate = False
3170  *     if use_setstate:             # <<<<<<<<<<<<<<
3171  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, None), state
3172  *     else:
3173  */
3174   }
3175 
3176   /* "(tree fragment)":15
3177  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, None), state
3178  *     else:
3179  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
3180  * def __setstate_cython__(self, __pyx_state):
3181  *     __pyx_unpickle_genericBedIO__set_state(self, __pyx_state)
3182  */
3183   /*else*/ {
3184     __Pyx_XDECREF(__pyx_r);
3185     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_genericBedIO); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
3186     __Pyx_GOTREF(__pyx_t_5);
3187     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
3188     __Pyx_GOTREF(__pyx_t_1);
3189     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3190     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3191     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3192     __Pyx_INCREF(__pyx_int_222419149);
3193     __Pyx_GIVEREF(__pyx_int_222419149);
3194     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
3195     __Pyx_INCREF(__pyx_v_state);
3196     __Pyx_GIVEREF(__pyx_v_state);
3197     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
3198     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
3199     __Pyx_GOTREF(__pyx_t_4);
3200     __Pyx_GIVEREF(__pyx_t_5);
3201     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
3202     __Pyx_GIVEREF(__pyx_t_1);
3203     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
3204     __pyx_t_5 = 0;
3205     __pyx_t_1 = 0;
3206     __pyx_r = __pyx_t_4;
3207     __pyx_t_4 = 0;
3208     goto __pyx_L0;
3209   }
3210 
3211   /* "(tree fragment)":1
3212  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3213  *     cdef tuple state
3214  *     cdef object _dict
3215  */
3216 
3217   /* function exit code */
3218   __pyx_L1_error:;
3219   __Pyx_XDECREF(__pyx_t_1);
3220   __Pyx_XDECREF(__pyx_t_4);
3221   __Pyx_XDECREF(__pyx_t_5);
3222   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.genericBedIO.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3223   __pyx_r = NULL;
3224   __pyx_L0:;
3225   __Pyx_XDECREF(__pyx_v_state);
3226   __Pyx_XDECREF(__pyx_v__dict);
3227   __Pyx_XGIVEREF(__pyx_r);
3228   __Pyx_TraceReturn(__pyx_r, 0);
3229   __Pyx_RefNannyFinishContext();
3230   return __pyx_r;
3231 }
3232 
3233 /* "(tree fragment)":16
3234  *     else:
3235  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, state)
3236  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3237  *     __pyx_unpickle_genericBedIO__set_state(self, __pyx_state)
3238  */
3239 
3240 /* Python wrapper */
3241 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3242 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3243   PyObject *__pyx_r = 0;
3244   __Pyx_RefNannyDeclarations
3245   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3246   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_6__setstate_cython__(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3247 
3248   /* function exit code */
3249   __Pyx_RefNannyFinishContext();
3250   return __pyx_r;
3251 }
3252 
__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_6__setstate_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO * __pyx_v_self,PyObject * __pyx_v___pyx_state)3253 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_12genericBedIO_6__setstate_cython__(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3254   PyObject *__pyx_r = NULL;
3255   __Pyx_TraceDeclarations
3256   __Pyx_RefNannyDeclarations
3257   PyObject *__pyx_t_1 = NULL;
3258   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3259   __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 16, 0, __PYX_ERR(1, 16, __pyx_L1_error));
3260 
3261   /* "(tree fragment)":17
3262  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, state)
3263  * def __setstate_cython__(self, __pyx_state):
3264  *     __pyx_unpickle_genericBedIO__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
3265  */
3266   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)
3267   __pyx_t_1 = __pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_genericBedIO__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
3268   __Pyx_GOTREF(__pyx_t_1);
3269   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3270 
3271   /* "(tree fragment)":16
3272  *     else:
3273  *         return __pyx_unpickle_genericBedIO, (type(self), 0xd41d8cd, state)
3274  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3275  *     __pyx_unpickle_genericBedIO__set_state(self, __pyx_state)
3276  */
3277 
3278   /* function exit code */
3279   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3280   goto __pyx_L0;
3281   __pyx_L1_error:;
3282   __Pyx_XDECREF(__pyx_t_1);
3283   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.genericBedIO.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3284   __pyx_r = NULL;
3285   __pyx_L0:;
3286   __Pyx_XGIVEREF(__pyx_r);
3287   __Pyx_TraceReturn(__pyx_r, 0);
3288   __Pyx_RefNannyFinishContext();
3289   return __pyx_r;
3290 }
3291 
3292 /* "(tree fragment)":1
3293  * def __pyx_unpickle_bedGraphIO(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
3294  *     cdef object __pyx_PickleError
3295  *     cdef object __pyx_result
3296  */
3297 
3298 /* Python wrapper */
3299 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_1__pyx_unpickle_bedGraphIO(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3300 static PyMethodDef __pyx_mdef_5MACS2_2IO_10BedGraphIO_1__pyx_unpickle_bedGraphIO = {"__pyx_unpickle_bedGraphIO", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5MACS2_2IO_10BedGraphIO_1__pyx_unpickle_bedGraphIO, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_5MACS2_2IO_10BedGraphIO_1__pyx_unpickle_bedGraphIO(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3301 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_1__pyx_unpickle_bedGraphIO(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3302   PyObject *__pyx_v___pyx_type = 0;
3303   long __pyx_v___pyx_checksum;
3304   PyObject *__pyx_v___pyx_state = 0;
3305   PyObject *__pyx_r = 0;
3306   __Pyx_RefNannyDeclarations
3307   __Pyx_RefNannySetupContext("__pyx_unpickle_bedGraphIO (wrapper)", 0);
3308   {
3309     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
3310     PyObject* values[3] = {0,0,0};
3311     if (unlikely(__pyx_kwds)) {
3312       Py_ssize_t kw_args;
3313       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3314       switch (pos_args) {
3315         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3316         CYTHON_FALLTHROUGH;
3317         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3318         CYTHON_FALLTHROUGH;
3319         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3320         CYTHON_FALLTHROUGH;
3321         case  0: break;
3322         default: goto __pyx_L5_argtuple_error;
3323       }
3324       kw_args = PyDict_Size(__pyx_kwds);
3325       switch (pos_args) {
3326         case  0:
3327         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
3328         else goto __pyx_L5_argtuple_error;
3329         CYTHON_FALLTHROUGH;
3330         case  1:
3331         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
3332         else {
3333           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_bedGraphIO", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
3334         }
3335         CYTHON_FALLTHROUGH;
3336         case  2:
3337         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
3338         else {
3339           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_bedGraphIO", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
3340         }
3341       }
3342       if (unlikely(kw_args > 0)) {
3343         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_bedGraphIO") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
3344       }
3345     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3346       goto __pyx_L5_argtuple_error;
3347     } else {
3348       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3349       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3350       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3351     }
3352     __pyx_v___pyx_type = values[0];
3353     __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)
3354     __pyx_v___pyx_state = values[2];
3355   }
3356   goto __pyx_L4_argument_unpacking_done;
3357   __pyx_L5_argtuple_error:;
3358   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_bedGraphIO", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
3359   __pyx_L3_error:;
3360   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.__pyx_unpickle_bedGraphIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
3361   __Pyx_RefNannyFinishContext();
3362   return NULL;
3363   __pyx_L4_argument_unpacking_done:;
3364   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
3365 
3366   /* function exit code */
3367   __Pyx_RefNannyFinishContext();
3368   return __pyx_r;
3369 }
3370 
__pyx_pf_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)3371 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
3372   PyObject *__pyx_v___pyx_PickleError = 0;
3373   PyObject *__pyx_v___pyx_result = 0;
3374   PyObject *__pyx_r = NULL;
3375   __Pyx_TraceDeclarations
3376   __Pyx_RefNannyDeclarations
3377   int __pyx_t_1;
3378   PyObject *__pyx_t_2 = NULL;
3379   PyObject *__pyx_t_3 = NULL;
3380   PyObject *__pyx_t_4 = NULL;
3381   PyObject *__pyx_t_5 = NULL;
3382   int __pyx_t_6;
3383   __Pyx_TraceFrameInit(__pyx_codeobj__3)
3384   __Pyx_RefNannySetupContext("__pyx_unpickle_bedGraphIO", 0);
3385   __Pyx_TraceCall("__pyx_unpickle_bedGraphIO", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
3386 
3387   /* "(tree fragment)":4
3388  *     cdef object __pyx_PickleError
3389  *     cdef object __pyx_result
3390  *     if __pyx_checksum != 0x315cb43:             # <<<<<<<<<<<<<<
3391  *         from pickle import PickleError as __pyx_PickleError
3392  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)
3393  */
3394   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x315cb43) != 0);
3395   if (__pyx_t_1) {
3396 
3397     /* "(tree fragment)":5
3398  *     cdef object __pyx_result
3399  *     if __pyx_checksum != 0x315cb43:
3400  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
3401  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)
3402  *     __pyx_result = bedGraphIO.__new__(__pyx_type)
3403  */
3404     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
3405     __Pyx_GOTREF(__pyx_t_2);
3406     __Pyx_INCREF(__pyx_n_s_PickleError);
3407     __Pyx_GIVEREF(__pyx_n_s_PickleError);
3408     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
3409     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
3410     __Pyx_GOTREF(__pyx_t_3);
3411     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3412     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
3413     __Pyx_GOTREF(__pyx_t_2);
3414     __Pyx_INCREF(__pyx_t_2);
3415     __pyx_v___pyx_PickleError = __pyx_t_2;
3416     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3417     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3418 
3419     /* "(tree fragment)":6
3420  *     if __pyx_checksum != 0x315cb43:
3421  *         from pickle import PickleError as __pyx_PickleError
3422  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)             # <<<<<<<<<<<<<<
3423  *     __pyx_result = bedGraphIO.__new__(__pyx_type)
3424  *     if __pyx_state is not None:
3425  */
3426     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
3427     __Pyx_GOTREF(__pyx_t_2);
3428     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x31, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
3429     __Pyx_GOTREF(__pyx_t_4);
3430     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3431     __Pyx_INCREF(__pyx_v___pyx_PickleError);
3432     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
3433     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3434       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
3435       if (likely(__pyx_t_5)) {
3436         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3437         __Pyx_INCREF(__pyx_t_5);
3438         __Pyx_INCREF(function);
3439         __Pyx_DECREF_SET(__pyx_t_2, function);
3440       }
3441     }
3442     __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);
3443     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3444     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3445     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
3446     __Pyx_GOTREF(__pyx_t_3);
3447     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3448     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3449     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3450     __PYX_ERR(1, 6, __pyx_L1_error)
3451 
3452     /* "(tree fragment)":4
3453  *     cdef object __pyx_PickleError
3454  *     cdef object __pyx_result
3455  *     if __pyx_checksum != 0x315cb43:             # <<<<<<<<<<<<<<
3456  *         from pickle import PickleError as __pyx_PickleError
3457  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)
3458  */
3459   }
3460 
3461   /* "(tree fragment)":7
3462  *         from pickle import PickleError as __pyx_PickleError
3463  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)
3464  *     __pyx_result = bedGraphIO.__new__(__pyx_type)             # <<<<<<<<<<<<<<
3465  *     if __pyx_state is not None:
3466  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
3467  */
3468   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5MACS2_2IO_10BedGraphIO_bedGraphIO), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
3469   __Pyx_GOTREF(__pyx_t_2);
3470   __pyx_t_4 = NULL;
3471   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3472     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
3473     if (likely(__pyx_t_4)) {
3474       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3475       __Pyx_INCREF(__pyx_t_4);
3476       __Pyx_INCREF(function);
3477       __Pyx_DECREF_SET(__pyx_t_2, function);
3478     }
3479   }
3480   __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);
3481   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3482   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
3483   __Pyx_GOTREF(__pyx_t_3);
3484   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3485   __pyx_v___pyx_result = __pyx_t_3;
3486   __pyx_t_3 = 0;
3487 
3488   /* "(tree fragment)":8
3489  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)
3490  *     __pyx_result = bedGraphIO.__new__(__pyx_type)
3491  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
3492  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
3493  *     return __pyx_result
3494  */
3495   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
3496   __pyx_t_6 = (__pyx_t_1 != 0);
3497   if (__pyx_t_6) {
3498 
3499     /* "(tree fragment)":9
3500  *     __pyx_result = bedGraphIO.__new__(__pyx_type)
3501  *     if __pyx_state is not None:
3502  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
3503  *     return __pyx_result
3504  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):
3505  */
3506     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)
3507     __pyx_t_3 = __pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO__set_state(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
3508     __Pyx_GOTREF(__pyx_t_3);
3509     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3510 
3511     /* "(tree fragment)":8
3512  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x315cb43 = (bedGraph_filename))" % __pyx_checksum)
3513  *     __pyx_result = bedGraphIO.__new__(__pyx_type)
3514  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
3515  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
3516  *     return __pyx_result
3517  */
3518   }
3519 
3520   /* "(tree fragment)":10
3521  *     if __pyx_state is not None:
3522  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
3523  *     return __pyx_result             # <<<<<<<<<<<<<<
3524  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):
3525  *     __pyx_result.bedGraph_filename = __pyx_state[0]
3526  */
3527   __Pyx_XDECREF(__pyx_r);
3528   __Pyx_INCREF(__pyx_v___pyx_result);
3529   __pyx_r = __pyx_v___pyx_result;
3530   goto __pyx_L0;
3531 
3532   /* "(tree fragment)":1
3533  * def __pyx_unpickle_bedGraphIO(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
3534  *     cdef object __pyx_PickleError
3535  *     cdef object __pyx_result
3536  */
3537 
3538   /* function exit code */
3539   __pyx_L1_error:;
3540   __Pyx_XDECREF(__pyx_t_2);
3541   __Pyx_XDECREF(__pyx_t_3);
3542   __Pyx_XDECREF(__pyx_t_4);
3543   __Pyx_XDECREF(__pyx_t_5);
3544   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.__pyx_unpickle_bedGraphIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
3545   __pyx_r = NULL;
3546   __pyx_L0:;
3547   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
3548   __Pyx_XDECREF(__pyx_v___pyx_result);
3549   __Pyx_XGIVEREF(__pyx_r);
3550   __Pyx_TraceReturn(__pyx_r, 0);
3551   __Pyx_RefNannyFinishContext();
3552   return __pyx_r;
3553 }
3554 
3555 /* "(tree fragment)":11
3556  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
3557  *     return __pyx_result
3558  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
3559  *     __pyx_result.bedGraph_filename = __pyx_state[0]
3560  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
3561  */
3562 
__pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO__set_state(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)3563 static PyObject *__pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_bedGraphIO__set_state(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
3564   PyObject *__pyx_r = NULL;
3565   __Pyx_TraceDeclarations
3566   __Pyx_RefNannyDeclarations
3567   PyObject *__pyx_t_1 = NULL;
3568   int __pyx_t_2;
3569   Py_ssize_t __pyx_t_3;
3570   int __pyx_t_4;
3571   int __pyx_t_5;
3572   PyObject *__pyx_t_6 = NULL;
3573   PyObject *__pyx_t_7 = NULL;
3574   PyObject *__pyx_t_8 = NULL;
3575   __Pyx_RefNannySetupContext("__pyx_unpickle_bedGraphIO__set_state", 0);
3576   __Pyx_TraceCall("__pyx_unpickle_bedGraphIO__set_state", __pyx_f[1], 11, 0, __PYX_ERR(1, 11, __pyx_L1_error));
3577 
3578   /* "(tree fragment)":12
3579  *     return __pyx_result
3580  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):
3581  *     __pyx_result.bedGraph_filename = __pyx_state[0]             # <<<<<<<<<<<<<<
3582  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
3583  *         __pyx_result.__dict__.update(__pyx_state[1])
3584  */
3585   if (unlikely(__pyx_v___pyx_state == Py_None)) {
3586     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3587     __PYX_ERR(1, 12, __pyx_L1_error)
3588   }
3589   __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)
3590   __Pyx_GOTREF(__pyx_t_1);
3591   if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
3592   __Pyx_GIVEREF(__pyx_t_1);
3593   __Pyx_GOTREF(__pyx_v___pyx_result->bedGraph_filename);
3594   __Pyx_DECREF(__pyx_v___pyx_result->bedGraph_filename);
3595   __pyx_v___pyx_result->bedGraph_filename = ((PyObject*)__pyx_t_1);
3596   __pyx_t_1 = 0;
3597 
3598   /* "(tree fragment)":13
3599  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):
3600  *     __pyx_result.bedGraph_filename = __pyx_state[0]
3601  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
3602  *         __pyx_result.__dict__.update(__pyx_state[1])
3603  */
3604   if (unlikely(__pyx_v___pyx_state == Py_None)) {
3605     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3606     __PYX_ERR(1, 13, __pyx_L1_error)
3607   }
3608   __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)
3609   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
3610   if (__pyx_t_4) {
3611   } else {
3612     __pyx_t_2 = __pyx_t_4;
3613     goto __pyx_L4_bool_binop_done;
3614   }
3615   __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)
3616   __pyx_t_5 = (__pyx_t_4 != 0);
3617   __pyx_t_2 = __pyx_t_5;
3618   __pyx_L4_bool_binop_done:;
3619   if (__pyx_t_2) {
3620 
3621     /* "(tree fragment)":14
3622  *     __pyx_result.bedGraph_filename = __pyx_state[0]
3623  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
3624  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
3625  */
3626     __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)
3627     __Pyx_GOTREF(__pyx_t_6);
3628     __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)
3629     __Pyx_GOTREF(__pyx_t_7);
3630     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3631     if (unlikely(__pyx_v___pyx_state == Py_None)) {
3632       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3633       __PYX_ERR(1, 14, __pyx_L1_error)
3634     }
3635     __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)
3636     __Pyx_GOTREF(__pyx_t_6);
3637     __pyx_t_8 = NULL;
3638     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
3639       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
3640       if (likely(__pyx_t_8)) {
3641         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
3642         __Pyx_INCREF(__pyx_t_8);
3643         __Pyx_INCREF(function);
3644         __Pyx_DECREF_SET(__pyx_t_7, function);
3645       }
3646     }
3647     __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);
3648     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3649     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3650     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
3651     __Pyx_GOTREF(__pyx_t_1);
3652     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3653     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3654 
3655     /* "(tree fragment)":13
3656  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):
3657  *     __pyx_result.bedGraph_filename = __pyx_state[0]
3658  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
3659  *         __pyx_result.__dict__.update(__pyx_state[1])
3660  */
3661   }
3662 
3663   /* "(tree fragment)":11
3664  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
3665  *     return __pyx_result
3666  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
3667  *     __pyx_result.bedGraph_filename = __pyx_state[0]
3668  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
3669  */
3670 
3671   /* function exit code */
3672   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3673   goto __pyx_L0;
3674   __pyx_L1_error:;
3675   __Pyx_XDECREF(__pyx_t_1);
3676   __Pyx_XDECREF(__pyx_t_6);
3677   __Pyx_XDECREF(__pyx_t_7);
3678   __Pyx_XDECREF(__pyx_t_8);
3679   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.__pyx_unpickle_bedGraphIO__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
3680   __pyx_r = 0;
3681   __pyx_L0:;
3682   __Pyx_XGIVEREF(__pyx_r);
3683   __Pyx_TraceReturn(__pyx_r, 0);
3684   __Pyx_RefNannyFinishContext();
3685   return __pyx_r;
3686 }
3687 
3688 /* "(tree fragment)":1
3689  * def __pyx_unpickle_genericBedIO(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
3690  *     cdef object __pyx_PickleError
3691  *     cdef object __pyx_result
3692  */
3693 
3694 /* Python wrapper */
3695 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_3__pyx_unpickle_genericBedIO(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3696 static PyMethodDef __pyx_mdef_5MACS2_2IO_10BedGraphIO_3__pyx_unpickle_genericBedIO = {"__pyx_unpickle_genericBedIO", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5MACS2_2IO_10BedGraphIO_3__pyx_unpickle_genericBedIO, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_5MACS2_2IO_10BedGraphIO_3__pyx_unpickle_genericBedIO(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3697 static PyObject *__pyx_pw_5MACS2_2IO_10BedGraphIO_3__pyx_unpickle_genericBedIO(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3698   PyObject *__pyx_v___pyx_type = 0;
3699   long __pyx_v___pyx_checksum;
3700   PyObject *__pyx_v___pyx_state = 0;
3701   PyObject *__pyx_r = 0;
3702   __Pyx_RefNannyDeclarations
3703   __Pyx_RefNannySetupContext("__pyx_unpickle_genericBedIO (wrapper)", 0);
3704   {
3705     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
3706     PyObject* values[3] = {0,0,0};
3707     if (unlikely(__pyx_kwds)) {
3708       Py_ssize_t kw_args;
3709       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3710       switch (pos_args) {
3711         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3712         CYTHON_FALLTHROUGH;
3713         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3714         CYTHON_FALLTHROUGH;
3715         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3716         CYTHON_FALLTHROUGH;
3717         case  0: break;
3718         default: goto __pyx_L5_argtuple_error;
3719       }
3720       kw_args = PyDict_Size(__pyx_kwds);
3721       switch (pos_args) {
3722         case  0:
3723         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
3724         else goto __pyx_L5_argtuple_error;
3725         CYTHON_FALLTHROUGH;
3726         case  1:
3727         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
3728         else {
3729           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_genericBedIO", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
3730         }
3731         CYTHON_FALLTHROUGH;
3732         case  2:
3733         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
3734         else {
3735           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_genericBedIO", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
3736         }
3737       }
3738       if (unlikely(kw_args > 0)) {
3739         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_genericBedIO") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
3740       }
3741     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3742       goto __pyx_L5_argtuple_error;
3743     } else {
3744       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3745       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3746       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3747     }
3748     __pyx_v___pyx_type = values[0];
3749     __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)
3750     __pyx_v___pyx_state = values[2];
3751   }
3752   goto __pyx_L4_argument_unpacking_done;
3753   __pyx_L5_argtuple_error:;
3754   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_genericBedIO", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
3755   __pyx_L3_error:;
3756   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.__pyx_unpickle_genericBedIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
3757   __Pyx_RefNannyFinishContext();
3758   return NULL;
3759   __pyx_L4_argument_unpacking_done:;
3760   __pyx_r = __pyx_pf_5MACS2_2IO_10BedGraphIO_2__pyx_unpickle_genericBedIO(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
3761 
3762   /* function exit code */
3763   __Pyx_RefNannyFinishContext();
3764   return __pyx_r;
3765 }
3766 
__pyx_pf_5MACS2_2IO_10BedGraphIO_2__pyx_unpickle_genericBedIO(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)3767 static PyObject *__pyx_pf_5MACS2_2IO_10BedGraphIO_2__pyx_unpickle_genericBedIO(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
3768   PyObject *__pyx_v___pyx_PickleError = 0;
3769   PyObject *__pyx_v___pyx_result = 0;
3770   PyObject *__pyx_r = NULL;
3771   __Pyx_TraceDeclarations
3772   __Pyx_RefNannyDeclarations
3773   int __pyx_t_1;
3774   PyObject *__pyx_t_2 = NULL;
3775   PyObject *__pyx_t_3 = NULL;
3776   PyObject *__pyx_t_4 = NULL;
3777   PyObject *__pyx_t_5 = NULL;
3778   int __pyx_t_6;
3779   __Pyx_TraceFrameInit(__pyx_codeobj__4)
3780   __Pyx_RefNannySetupContext("__pyx_unpickle_genericBedIO", 0);
3781   __Pyx_TraceCall("__pyx_unpickle_genericBedIO", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
3782 
3783   /* "(tree fragment)":4
3784  *     cdef object __pyx_PickleError
3785  *     cdef object __pyx_result
3786  *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
3787  *         from pickle import PickleError as __pyx_PickleError
3788  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
3789  */
3790   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
3791   if (__pyx_t_1) {
3792 
3793     /* "(tree fragment)":5
3794  *     cdef object __pyx_result
3795  *     if __pyx_checksum != 0xd41d8cd:
3796  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
3797  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
3798  *     __pyx_result = genericBedIO.__new__(__pyx_type)
3799  */
3800     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
3801     __Pyx_GOTREF(__pyx_t_2);
3802     __Pyx_INCREF(__pyx_n_s_PickleError);
3803     __Pyx_GIVEREF(__pyx_n_s_PickleError);
3804     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
3805     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
3806     __Pyx_GOTREF(__pyx_t_3);
3807     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3808     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
3809     __Pyx_GOTREF(__pyx_t_2);
3810     __Pyx_INCREF(__pyx_t_2);
3811     __pyx_v___pyx_PickleError = __pyx_t_2;
3812     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3813     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3814 
3815     /* "(tree fragment)":6
3816  *     if __pyx_checksum != 0xd41d8cd:
3817  *         from pickle import PickleError as __pyx_PickleError
3818  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
3819  *     __pyx_result = genericBedIO.__new__(__pyx_type)
3820  *     if __pyx_state is not None:
3821  */
3822     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
3823     __Pyx_GOTREF(__pyx_t_2);
3824     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
3825     __Pyx_GOTREF(__pyx_t_4);
3826     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3827     __Pyx_INCREF(__pyx_v___pyx_PickleError);
3828     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
3829     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3830       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
3831       if (likely(__pyx_t_5)) {
3832         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3833         __Pyx_INCREF(__pyx_t_5);
3834         __Pyx_INCREF(function);
3835         __Pyx_DECREF_SET(__pyx_t_2, function);
3836       }
3837     }
3838     __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);
3839     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3840     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3841     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
3842     __Pyx_GOTREF(__pyx_t_3);
3843     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3844     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3845     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3846     __PYX_ERR(1, 6, __pyx_L1_error)
3847 
3848     /* "(tree fragment)":4
3849  *     cdef object __pyx_PickleError
3850  *     cdef object __pyx_result
3851  *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
3852  *         from pickle import PickleError as __pyx_PickleError
3853  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
3854  */
3855   }
3856 
3857   /* "(tree fragment)":7
3858  *         from pickle import PickleError as __pyx_PickleError
3859  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
3860  *     __pyx_result = genericBedIO.__new__(__pyx_type)             # <<<<<<<<<<<<<<
3861  *     if __pyx_state is not None:
3862  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)
3863  */
3864   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5MACS2_2IO_10BedGraphIO_genericBedIO), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
3865   __Pyx_GOTREF(__pyx_t_2);
3866   __pyx_t_4 = NULL;
3867   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3868     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
3869     if (likely(__pyx_t_4)) {
3870       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3871       __Pyx_INCREF(__pyx_t_4);
3872       __Pyx_INCREF(function);
3873       __Pyx_DECREF_SET(__pyx_t_2, function);
3874     }
3875   }
3876   __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);
3877   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3878   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
3879   __Pyx_GOTREF(__pyx_t_3);
3880   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3881   __pyx_v___pyx_result = __pyx_t_3;
3882   __pyx_t_3 = 0;
3883 
3884   /* "(tree fragment)":8
3885  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
3886  *     __pyx_result = genericBedIO.__new__(__pyx_type)
3887  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
3888  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)
3889  *     return __pyx_result
3890  */
3891   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
3892   __pyx_t_6 = (__pyx_t_1 != 0);
3893   if (__pyx_t_6) {
3894 
3895     /* "(tree fragment)":9
3896  *     __pyx_result = genericBedIO.__new__(__pyx_type)
3897  *     if __pyx_state is not None:
3898  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
3899  *     return __pyx_result
3900  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):
3901  */
3902     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)
3903     __pyx_t_3 = __pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_genericBedIO__set_state(((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
3904     __Pyx_GOTREF(__pyx_t_3);
3905     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3906 
3907     /* "(tree fragment)":8
3908  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
3909  *     __pyx_result = genericBedIO.__new__(__pyx_type)
3910  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
3911  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)
3912  *     return __pyx_result
3913  */
3914   }
3915 
3916   /* "(tree fragment)":10
3917  *     if __pyx_state is not None:
3918  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)
3919  *     return __pyx_result             # <<<<<<<<<<<<<<
3920  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):
3921  *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
3922  */
3923   __Pyx_XDECREF(__pyx_r);
3924   __Pyx_INCREF(__pyx_v___pyx_result);
3925   __pyx_r = __pyx_v___pyx_result;
3926   goto __pyx_L0;
3927 
3928   /* "(tree fragment)":1
3929  * def __pyx_unpickle_genericBedIO(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
3930  *     cdef object __pyx_PickleError
3931  *     cdef object __pyx_result
3932  */
3933 
3934   /* function exit code */
3935   __pyx_L1_error:;
3936   __Pyx_XDECREF(__pyx_t_2);
3937   __Pyx_XDECREF(__pyx_t_3);
3938   __Pyx_XDECREF(__pyx_t_4);
3939   __Pyx_XDECREF(__pyx_t_5);
3940   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.__pyx_unpickle_genericBedIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
3941   __pyx_r = NULL;
3942   __pyx_L0:;
3943   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
3944   __Pyx_XDECREF(__pyx_v___pyx_result);
3945   __Pyx_XGIVEREF(__pyx_r);
3946   __Pyx_TraceReturn(__pyx_r, 0);
3947   __Pyx_RefNannyFinishContext();
3948   return __pyx_r;
3949 }
3950 
3951 /* "(tree fragment)":11
3952  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)
3953  *     return __pyx_result
3954  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
3955  *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
3956  *         __pyx_result.__dict__.update(__pyx_state[0])
3957  */
3958 
__pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_genericBedIO__set_state(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)3959 static PyObject *__pyx_f_5MACS2_2IO_10BedGraphIO___pyx_unpickle_genericBedIO__set_state(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
3960   PyObject *__pyx_r = NULL;
3961   __Pyx_TraceDeclarations
3962   __Pyx_RefNannyDeclarations
3963   int __pyx_t_1;
3964   Py_ssize_t __pyx_t_2;
3965   int __pyx_t_3;
3966   int __pyx_t_4;
3967   PyObject *__pyx_t_5 = NULL;
3968   PyObject *__pyx_t_6 = NULL;
3969   PyObject *__pyx_t_7 = NULL;
3970   PyObject *__pyx_t_8 = NULL;
3971   __Pyx_RefNannySetupContext("__pyx_unpickle_genericBedIO__set_state", 0);
3972   __Pyx_TraceCall("__pyx_unpickle_genericBedIO__set_state", __pyx_f[1], 11, 0, __PYX_ERR(1, 11, __pyx_L1_error));
3973 
3974   /* "(tree fragment)":12
3975  *     return __pyx_result
3976  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):
3977  *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
3978  *         __pyx_result.__dict__.update(__pyx_state[0])
3979  */
3980   if (unlikely(__pyx_v___pyx_state == Py_None)) {
3981     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3982     __PYX_ERR(1, 12, __pyx_L1_error)
3983   }
3984   __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
3985   __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
3986   if (__pyx_t_3) {
3987   } else {
3988     __pyx_t_1 = __pyx_t_3;
3989     goto __pyx_L4_bool_binop_done;
3990   }
3991   __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
3992   __pyx_t_4 = (__pyx_t_3 != 0);
3993   __pyx_t_1 = __pyx_t_4;
3994   __pyx_L4_bool_binop_done:;
3995   if (__pyx_t_1) {
3996 
3997     /* "(tree fragment)":13
3998  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):
3999  *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
4000  *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
4001  */
4002     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
4003     __Pyx_GOTREF(__pyx_t_6);
4004     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
4005     __Pyx_GOTREF(__pyx_t_7);
4006     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4007     if (unlikely(__pyx_v___pyx_state == Py_None)) {
4008       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4009       __PYX_ERR(1, 13, __pyx_L1_error)
4010     }
4011     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
4012     __Pyx_GOTREF(__pyx_t_6);
4013     __pyx_t_8 = NULL;
4014     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
4015       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
4016       if (likely(__pyx_t_8)) {
4017         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
4018         __Pyx_INCREF(__pyx_t_8);
4019         __Pyx_INCREF(function);
4020         __Pyx_DECREF_SET(__pyx_t_7, function);
4021       }
4022     }
4023     __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
4024     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
4025     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4026     if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
4027     __Pyx_GOTREF(__pyx_t_5);
4028     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4029     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4030 
4031     /* "(tree fragment)":12
4032  *     return __pyx_result
4033  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):
4034  *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
4035  *         __pyx_result.__dict__.update(__pyx_state[0])
4036  */
4037   }
4038 
4039   /* "(tree fragment)":11
4040  *         __pyx_unpickle_genericBedIO__set_state(<genericBedIO> __pyx_result, __pyx_state)
4041  *     return __pyx_result
4042  * cdef __pyx_unpickle_genericBedIO__set_state(genericBedIO __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
4043  *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
4044  *         __pyx_result.__dict__.update(__pyx_state[0])
4045  */
4046 
4047   /* function exit code */
4048   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4049   goto __pyx_L0;
4050   __pyx_L1_error:;
4051   __Pyx_XDECREF(__pyx_t_5);
4052   __Pyx_XDECREF(__pyx_t_6);
4053   __Pyx_XDECREF(__pyx_t_7);
4054   __Pyx_XDECREF(__pyx_t_8);
4055   __Pyx_AddTraceback("MACS2.IO.BedGraphIO.__pyx_unpickle_genericBedIO__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
4056   __pyx_r = 0;
4057   __pyx_L0:;
4058   __Pyx_XGIVEREF(__pyx_r);
4059   __Pyx_TraceReturn(__pyx_r, 0);
4060   __Pyx_RefNannyFinishContext();
4061   return __pyx_r;
4062 }
4063 
__pyx_tp_new_5MACS2_2IO_10BedGraphIO_bedGraphIO(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)4064 static PyObject *__pyx_tp_new_5MACS2_2IO_10BedGraphIO_bedGraphIO(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4065   struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *p;
4066   PyObject *o;
4067   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4068     o = (*t->tp_alloc)(t, 0);
4069   } else {
4070     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4071   }
4072   if (unlikely(!o)) return 0;
4073   p = ((struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)o);
4074   p->bedGraph_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
4075   return o;
4076 }
4077 
__pyx_tp_dealloc_5MACS2_2IO_10BedGraphIO_bedGraphIO(PyObject * o)4078 static void __pyx_tp_dealloc_5MACS2_2IO_10BedGraphIO_bedGraphIO(PyObject *o) {
4079   struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *p = (struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO *)o;
4080   #if CYTHON_USE_TP_FINALIZE
4081   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
4082     if (PyObject_CallFinalizerFromDealloc(o)) return;
4083   }
4084   #endif
4085   Py_CLEAR(p->bedGraph_filename);
4086   (*Py_TYPE(o)->tp_free)(o);
4087 }
4088 
4089 static PyMethodDef __pyx_methods_5MACS2_2IO_10BedGraphIO_bedGraphIO[] = {
4090   {"build_bdgtrack", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_3build_bdgtrack, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5MACS2_2IO_10BedGraphIO_10bedGraphIO_2build_bdgtrack},
4091   {"__reduce_cython__", (PyCFunction)__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_5__reduce_cython__, METH_NOARGS, 0},
4092   {"__setstate_cython__", (PyCFunction)__pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_7__setstate_cython__, METH_O, 0},
4093   {0, 0, 0, 0}
4094 };
4095 
4096 static PyTypeObject __pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO = {
4097   PyVarObject_HEAD_INIT(0, 0)
4098   "MACS2.IO.BedGraphIO.bedGraphIO", /*tp_name*/
4099   sizeof(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_bedGraphIO), /*tp_basicsize*/
4100   0, /*tp_itemsize*/
4101   __pyx_tp_dealloc_5MACS2_2IO_10BedGraphIO_bedGraphIO, /*tp_dealloc*/
4102   0, /*tp_print*/
4103   0, /*tp_getattr*/
4104   0, /*tp_setattr*/
4105   #if PY_MAJOR_VERSION < 3
4106   0, /*tp_compare*/
4107   #endif
4108   #if PY_MAJOR_VERSION >= 3
4109   0, /*tp_as_async*/
4110   #endif
4111   0, /*tp_repr*/
4112   0, /*tp_as_number*/
4113   0, /*tp_as_sequence*/
4114   0, /*tp_as_mapping*/
4115   0, /*tp_hash*/
4116   0, /*tp_call*/
4117   0, /*tp_str*/
4118   0, /*tp_getattro*/
4119   0, /*tp_setattro*/
4120   0, /*tp_as_buffer*/
4121   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
4122   "File Parser Class for bedGraph File.\n\n    There are two assumptions in my bedGraphTrackI object:\n\n    1. Continuous: the next region should be after the previous one\n    unless they are on different chromosomes;\n    \n    2. Non-overlapping: the next region should never have overlaps\n    with preceding region.\n\n    If any of the above two criteria is violated, parsering will fail.\n    ", /*tp_doc*/
4123   0, /*tp_traverse*/
4124   0, /*tp_clear*/
4125   0, /*tp_richcompare*/
4126   0, /*tp_weaklistoffset*/
4127   0, /*tp_iter*/
4128   0, /*tp_iternext*/
4129   __pyx_methods_5MACS2_2IO_10BedGraphIO_bedGraphIO, /*tp_methods*/
4130   0, /*tp_members*/
4131   0, /*tp_getset*/
4132   0, /*tp_base*/
4133   0, /*tp_dict*/
4134   0, /*tp_descr_get*/
4135   0, /*tp_descr_set*/
4136   0, /*tp_dictoffset*/
4137   __pyx_pw_5MACS2_2IO_10BedGraphIO_10bedGraphIO_1__init__, /*tp_init*/
4138   0, /*tp_alloc*/
4139   __pyx_tp_new_5MACS2_2IO_10BedGraphIO_bedGraphIO, /*tp_new*/
4140   0, /*tp_free*/
4141   0, /*tp_is_gc*/
4142   0, /*tp_bases*/
4143   0, /*tp_mro*/
4144   0, /*tp_cache*/
4145   0, /*tp_subclasses*/
4146   0, /*tp_weaklist*/
4147   0, /*tp_del*/
4148   0, /*tp_version_tag*/
4149   #if PY_VERSION_HEX >= 0x030400a1
4150   0, /*tp_finalize*/
4151   #endif
4152   #if PY_VERSION_HEX >= 0x030800b1
4153   0, /*tp_vectorcall*/
4154   #endif
4155 };
4156 
__pyx_tp_new_5MACS2_2IO_10BedGraphIO_genericBedIO(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)4157 static PyObject *__pyx_tp_new_5MACS2_2IO_10BedGraphIO_genericBedIO(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4158   PyObject *o;
4159   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4160     o = (*t->tp_alloc)(t, 0);
4161   } else {
4162     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4163   }
4164   if (unlikely(!o)) return 0;
4165   return o;
4166 }
4167 
__pyx_tp_dealloc_5MACS2_2IO_10BedGraphIO_genericBedIO(PyObject * o)4168 static void __pyx_tp_dealloc_5MACS2_2IO_10BedGraphIO_genericBedIO(PyObject *o) {
4169   #if CYTHON_USE_TP_FINALIZE
4170   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
4171     if (PyObject_CallFinalizerFromDealloc(o)) return;
4172   }
4173   #endif
4174   (*Py_TYPE(o)->tp_free)(o);
4175 }
4176 
4177 static PyMethodDef __pyx_methods_5MACS2_2IO_10BedGraphIO_genericBedIO[] = {
4178   {"build_bedtrack", (PyCFunction)__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_3build_bedtrack, METH_NOARGS, __pyx_doc_5MACS2_2IO_10BedGraphIO_12genericBedIO_2build_bedtrack},
4179   {"__reduce_cython__", (PyCFunction)__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_5__reduce_cython__, METH_NOARGS, 0},
4180   {"__setstate_cython__", (PyCFunction)__pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_7__setstate_cython__, METH_O, 0},
4181   {0, 0, 0, 0}
4182 };
4183 
4184 static PyTypeObject __pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO = {
4185   PyVarObject_HEAD_INIT(0, 0)
4186   "MACS2.IO.BedGraphIO.genericBedIO", /*tp_name*/
4187   sizeof(struct __pyx_obj_5MACS2_2IO_10BedGraphIO_genericBedIO), /*tp_basicsize*/
4188   0, /*tp_itemsize*/
4189   __pyx_tp_dealloc_5MACS2_2IO_10BedGraphIO_genericBedIO, /*tp_dealloc*/
4190   0, /*tp_print*/
4191   0, /*tp_getattr*/
4192   0, /*tp_setattr*/
4193   #if PY_MAJOR_VERSION < 3
4194   0, /*tp_compare*/
4195   #endif
4196   #if PY_MAJOR_VERSION >= 3
4197   0, /*tp_as_async*/
4198   #endif
4199   0, /*tp_repr*/
4200   0, /*tp_as_number*/
4201   0, /*tp_as_sequence*/
4202   0, /*tp_as_mapping*/
4203   0, /*tp_hash*/
4204   0, /*tp_call*/
4205   0, /*tp_str*/
4206   0, /*tp_getattro*/
4207   0, /*tp_setattro*/
4208   0, /*tp_as_buffer*/
4209   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
4210   "File Parser Class for generic bed File with at least column #1,#2,#3,and #5.\n\n    There are two assumptions in my bedGraphTrackI object:\n\n    1. Continuous: the next region should be after the previous one\n    unless they are on different chromosomes;\n    \n    2. Non-overlapping: the next region should never have overlaps\n    with preceding region.\n\n    If any of the above two criteria is violated, parsering will\n    fail. You'd better use it to read peak file from MACS. Or sort BED\n    by chromosome and start position.\n    ", /*tp_doc*/
4211   0, /*tp_traverse*/
4212   0, /*tp_clear*/
4213   0, /*tp_richcompare*/
4214   0, /*tp_weaklistoffset*/
4215   0, /*tp_iter*/
4216   0, /*tp_iternext*/
4217   __pyx_methods_5MACS2_2IO_10BedGraphIO_genericBedIO, /*tp_methods*/
4218   0, /*tp_members*/
4219   0, /*tp_getset*/
4220   0, /*tp_base*/
4221   0, /*tp_dict*/
4222   0, /*tp_descr_get*/
4223   0, /*tp_descr_set*/
4224   0, /*tp_dictoffset*/
4225   __pyx_pw_5MACS2_2IO_10BedGraphIO_12genericBedIO_1__init__, /*tp_init*/
4226   0, /*tp_alloc*/
4227   __pyx_tp_new_5MACS2_2IO_10BedGraphIO_genericBedIO, /*tp_new*/
4228   0, /*tp_free*/
4229   0, /*tp_is_gc*/
4230   0, /*tp_bases*/
4231   0, /*tp_mro*/
4232   0, /*tp_cache*/
4233   0, /*tp_subclasses*/
4234   0, /*tp_weaklist*/
4235   0, /*tp_del*/
4236   0, /*tp_version_tag*/
4237   #if PY_VERSION_HEX >= 0x030400a1
4238   0, /*tp_finalize*/
4239   #endif
4240   #if PY_VERSION_HEX >= 0x030800b1
4241   0, /*tp_vectorcall*/
4242   #endif
4243 };
4244 
4245 static PyMethodDef __pyx_methods[] = {
4246   {0, 0, 0, 0}
4247 };
4248 
4249 #if PY_MAJOR_VERSION >= 3
4250 #if CYTHON_PEP489_MULTI_PHASE_INIT
4251 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
4252 static int __pyx_pymod_exec_BedGraphIO(PyObject* module); /*proto*/
4253 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
4254   {Py_mod_create, (void*)__pyx_pymod_create},
4255   {Py_mod_exec, (void*)__pyx_pymod_exec_BedGraphIO},
4256   {0, NULL}
4257 };
4258 #endif
4259 
4260 static struct PyModuleDef __pyx_moduledef = {
4261     PyModuleDef_HEAD_INIT,
4262     "BedGraphIO",
4263     __pyx_k_Module_Description_IO_Module_for, /* m_doc */
4264   #if CYTHON_PEP489_MULTI_PHASE_INIT
4265     0, /* m_size */
4266   #else
4267     -1, /* m_size */
4268   #endif
4269     __pyx_methods /* m_methods */,
4270   #if CYTHON_PEP489_MULTI_PHASE_INIT
4271     __pyx_moduledef_slots, /* m_slots */
4272   #else
4273     NULL, /* m_reload */
4274   #endif
4275     NULL, /* m_traverse */
4276     NULL, /* m_clear */
4277     NULL /* m_free */
4278 };
4279 #endif
4280 #ifndef CYTHON_SMALL_CODE
4281 #if defined(__clang__)
4282     #define CYTHON_SMALL_CODE
4283 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
4284     #define CYTHON_SMALL_CODE __attribute__((cold))
4285 #else
4286     #define CYTHON_SMALL_CODE
4287 #endif
4288 #endif
4289 
4290 static __Pyx_StringTabEntry __pyx_string_tab[] = {
4291   {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0},
4292   {&__pyx_n_s_IOBase, __pyx_k_IOBase, sizeof(__pyx_k_IOBase), 0, 0, 1, 1},
4293   {&__pyx_kp_s_Incompatible_checksums_s_vs_0x31, __pyx_k_Incompatible_checksums_s_vs_0x31, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x31), 0, 0, 1, 0},
4294   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0},
4295   {&__pyx_n_s_MACS2_IO_BedGraph, __pyx_k_MACS2_IO_BedGraph, sizeof(__pyx_k_MACS2_IO_BedGraph), 0, 0, 1, 1},
4296   {&__pyx_n_s_MACS2_IO_BedGraphIO, __pyx_k_MACS2_IO_BedGraphIO, sizeof(__pyx_k_MACS2_IO_BedGraphIO), 0, 0, 1, 1},
4297   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
4298   {&__pyx_n_s_add_loc, __pyx_k_add_loc, sizeof(__pyx_k_add_loc), 0, 0, 1, 1},
4299   {&__pyx_n_s_baseline_value, __pyx_k_baseline_value, sizeof(__pyx_k_baseline_value), 0, 0, 1, 1},
4300   {&__pyx_n_s_bedGraphIO, __pyx_k_bedGraphIO, sizeof(__pyx_k_bedGraphIO), 0, 0, 1, 1},
4301   {&__pyx_n_s_bedGraphTrackI, __pyx_k_bedGraphTrackI, sizeof(__pyx_k_bedGraphTrackI), 0, 0, 1, 1},
4302   {&__pyx_n_s_bedGraph_filename, __pyx_k_bedGraph_filename, sizeof(__pyx_k_bedGraph_filename), 0, 0, 1, 1},
4303   {&__pyx_n_s_bedRegionTrackI, __pyx_k_bedRegionTrackI, sizeof(__pyx_k_bedRegionTrackI), 0, 0, 1, 1},
4304   {&__pyx_n_b_browse, __pyx_k_browse, sizeof(__pyx_k_browse), 0, 0, 0, 1},
4305   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
4306   {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
4307   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
4308   {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
4309   {&__pyx_kp_u_f_must_be_a_filename_or_a_file_h, __pyx_k_f_must_be_a_filename_or_a_file_h, sizeof(__pyx_k_f_must_be_a_filename_or_a_file_h), 0, 1, 0, 0},
4310   {&__pyx_n_s_fhd, __pyx_k_fhd, sizeof(__pyx_k_fhd), 0, 0, 1, 1},
4311   {&__pyx_n_s_genericBedIO, __pyx_k_genericBedIO, sizeof(__pyx_k_genericBedIO), 0, 0, 1, 1},
4312   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
4313   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4314   {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
4315   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4316   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
4317   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
4318   {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
4319   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
4320   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
4321   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
4322   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
4323   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
4324   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
4325   {&__pyx_n_s_pyx_unpickle_bedGraphIO, __pyx_k_pyx_unpickle_bedGraphIO, sizeof(__pyx_k_pyx_unpickle_bedGraphIO), 0, 0, 1, 1},
4326   {&__pyx_n_s_pyx_unpickle_genericBedIO, __pyx_k_pyx_unpickle_genericBedIO, sizeof(__pyx_k_pyx_unpickle_genericBedIO), 0, 0, 1, 1},
4327   {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
4328   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
4329   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
4330   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
4331   {&__pyx_n_s_safe_add_loc, __pyx_k_safe_add_loc, sizeof(__pyx_k_safe_add_loc), 0, 0, 1, 1},
4332   {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1},
4333   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
4334   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
4335   {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
4336   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
4337   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4338   {&__pyx_n_b_track, __pyx_k_track, sizeof(__pyx_k_track), 0, 0, 0, 1},
4339   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
4340   {0, 0, 0, 0, 0, 0, 0}
4341 };
__Pyx_InitCachedBuiltins(void)4342 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
4343   __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 92, __pyx_L1_error)
4344   return 0;
4345   __pyx_L1_error:;
4346   return -1;
4347 }
4348 
__Pyx_InitCachedConstants(void)4349 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
4350   __Pyx_RefNannyDeclarations
4351   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4352 
4353   /* "MACS2/IO/BedGraphIO.pyx":132
4354  *             self.fhd = f
4355  *         else:
4356  *             raise Exception("f must be a filename or a file handler.")             # <<<<<<<<<<<<<<
4357  *
4358  *     def build_bedtrack (self):
4359  */
4360   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_f_must_be_a_filename_or_a_file_h); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 132, __pyx_L1_error)
4361   __Pyx_GOTREF(__pyx_tuple__2);
4362   __Pyx_GIVEREF(__pyx_tuple__2);
4363 
4364   /* "(tree fragment)":1
4365  * def __pyx_unpickle_bedGraphIO(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
4366  *     cdef object __pyx_PickleError
4367  *     cdef object __pyx_result
4368  */
4369   __pyx_tuple__5 = 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__5)) __PYX_ERR(1, 1, __pyx_L1_error)
4370   __Pyx_GOTREF(__pyx_tuple__5);
4371   __Pyx_GIVEREF(__pyx_tuple__5);
4372   __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__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_bedGraphIO, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 1, __pyx_L1_error)
4373   __pyx_tuple__6 = 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__6)) __PYX_ERR(1, 1, __pyx_L1_error)
4374   __Pyx_GOTREF(__pyx_tuple__6);
4375   __Pyx_GIVEREF(__pyx_tuple__6);
4376   __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_genericBedIO, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(1, 1, __pyx_L1_error)
4377   __Pyx_RefNannyFinishContext();
4378   return 0;
4379   __pyx_L1_error:;
4380   __Pyx_RefNannyFinishContext();
4381   return -1;
4382 }
4383 
__Pyx_InitGlobals(void)4384 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
4385   __pyx_umethod_PyBytes_Type_split.type = (PyObject*)&PyBytes_Type;
4386   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4387   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
4388   __pyx_int_51759939 = PyInt_FromLong(51759939L); if (unlikely(!__pyx_int_51759939)) __PYX_ERR(0, 1, __pyx_L1_error)
4389   __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error)
4390   return 0;
4391   __pyx_L1_error:;
4392   return -1;
4393 }
4394 
4395 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
4396 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
4397 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
4398 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
4399 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
4400 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
4401 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
4402 
__Pyx_modinit_global_init_code(void)4403 static int __Pyx_modinit_global_init_code(void) {
4404   __Pyx_RefNannyDeclarations
4405   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
4406   /*--- Global init code ---*/
4407   __Pyx_RefNannyFinishContext();
4408   return 0;
4409 }
4410 
__Pyx_modinit_variable_export_code(void)4411 static int __Pyx_modinit_variable_export_code(void) {
4412   __Pyx_RefNannyDeclarations
4413   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
4414   /*--- Variable export code ---*/
4415   __Pyx_RefNannyFinishContext();
4416   return 0;
4417 }
4418 
__Pyx_modinit_function_export_code(void)4419 static int __Pyx_modinit_function_export_code(void) {
4420   __Pyx_RefNannyDeclarations
4421   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
4422   /*--- Function export code ---*/
4423   __Pyx_RefNannyFinishContext();
4424   return 0;
4425 }
4426 
__Pyx_modinit_type_init_code(void)4427 static int __Pyx_modinit_type_init_code(void) {
4428   __Pyx_RefNannyDeclarations
4429   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
4430   /*--- Type init code ---*/
4431   if (PyType_Ready(&__pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
4432   #if PY_VERSION_HEX < 0x030800B1
4433   __pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO.tp_print = 0;
4434   #endif
4435   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO.tp_dictoffset && __pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO.tp_getattro == PyObject_GenericGetAttr)) {
4436     __pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO.tp_getattro = __Pyx_PyObject_GenericGetAttr;
4437   }
4438   #if CYTHON_COMPILING_IN_CPYTHON
4439   {
4440     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 53, __pyx_L1_error)
4441     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
4442       __pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
4443       __pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__.doc = __pyx_doc_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__;
4444       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_10bedGraphIO___init__;
4445     }
4446   }
4447   #endif
4448   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_bedGraphIO, (PyObject *)&__pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
4449   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
4450   __pyx_ptype_5MACS2_2IO_10BedGraphIO_bedGraphIO = &__pyx_type_5MACS2_2IO_10BedGraphIO_bedGraphIO;
4451   if (PyType_Ready(&__pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
4452   #if PY_VERSION_HEX < 0x030800B1
4453   __pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO.tp_print = 0;
4454   #endif
4455   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO.tp_dictoffset && __pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO.tp_getattro == PyObject_GenericGetAttr)) {
4456     __pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO.tp_getattro = __Pyx_PyObject_GenericGetAttr;
4457   }
4458   #if CYTHON_COMPILING_IN_CPYTHON
4459   {
4460     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 108, __pyx_L1_error)
4461     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
4462       __pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
4463       __pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__.doc = __pyx_doc_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__;
4464       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5MACS2_2IO_10BedGraphIO_12genericBedIO___init__;
4465     }
4466   }
4467   #endif
4468   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_genericBedIO, (PyObject *)&__pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
4469   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
4470   __pyx_ptype_5MACS2_2IO_10BedGraphIO_genericBedIO = &__pyx_type_5MACS2_2IO_10BedGraphIO_genericBedIO;
4471   __Pyx_RefNannyFinishContext();
4472   return 0;
4473   __pyx_L1_error:;
4474   __Pyx_RefNannyFinishContext();
4475   return -1;
4476 }
4477 
__Pyx_modinit_type_import_code(void)4478 static int __Pyx_modinit_type_import_code(void) {
4479   __Pyx_RefNannyDeclarations
4480   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
4481   /*--- Type import code ---*/
4482   __Pyx_RefNannyFinishContext();
4483   return 0;
4484 }
4485 
__Pyx_modinit_variable_import_code(void)4486 static int __Pyx_modinit_variable_import_code(void) {
4487   __Pyx_RefNannyDeclarations
4488   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
4489   /*--- Variable import code ---*/
4490   __Pyx_RefNannyFinishContext();
4491   return 0;
4492 }
4493 
__Pyx_modinit_function_import_code(void)4494 static int __Pyx_modinit_function_import_code(void) {
4495   __Pyx_RefNannyDeclarations
4496   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
4497   /*--- Function import code ---*/
4498   __Pyx_RefNannyFinishContext();
4499   return 0;
4500 }
4501 
4502 
4503 #if PY_MAJOR_VERSION < 3
4504 #ifdef CYTHON_NO_PYINIT_EXPORT
4505 #define __Pyx_PyMODINIT_FUNC void
4506 #else
4507 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4508 #endif
4509 #else
4510 #ifdef CYTHON_NO_PYINIT_EXPORT
4511 #define __Pyx_PyMODINIT_FUNC PyObject *
4512 #else
4513 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4514 #endif
4515 #endif
4516 
4517 
4518 #if PY_MAJOR_VERSION < 3
4519 __Pyx_PyMODINIT_FUNC initBedGraphIO(void) CYTHON_SMALL_CODE; /*proto*/
initBedGraphIO(void)4520 __Pyx_PyMODINIT_FUNC initBedGraphIO(void)
4521 #else
4522 __Pyx_PyMODINIT_FUNC PyInit_BedGraphIO(void) CYTHON_SMALL_CODE; /*proto*/
4523 __Pyx_PyMODINIT_FUNC PyInit_BedGraphIO(void)
4524 #if CYTHON_PEP489_MULTI_PHASE_INIT
4525 {
4526   return PyModuleDef_Init(&__pyx_moduledef);
4527 }
4528 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
4529     #if PY_VERSION_HEX >= 0x030700A1
4530     static PY_INT64_T main_interpreter_id = -1;
4531     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
4532     if (main_interpreter_id == -1) {
4533         main_interpreter_id = current_id;
4534         return (unlikely(current_id == -1)) ? -1 : 0;
4535     } else if (unlikely(main_interpreter_id != current_id))
4536     #else
4537     static PyInterpreterState *main_interpreter = NULL;
4538     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
4539     if (!main_interpreter) {
4540         main_interpreter = current_interpreter;
4541     } else if (unlikely(main_interpreter != current_interpreter))
4542     #endif
4543     {
4544         PyErr_SetString(
4545             PyExc_ImportError,
4546             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
4547         return -1;
4548     }
4549     return 0;
4550 }
4551 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) {
4552     PyObject *value = PyObject_GetAttrString(spec, from_name);
4553     int result = 0;
4554     if (likely(value)) {
4555         if (allow_none || value != Py_None) {
4556             result = PyDict_SetItemString(moddict, to_name, value);
4557         }
4558         Py_DECREF(value);
4559     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
4560         PyErr_Clear();
4561     } else {
4562         result = -1;
4563     }
4564     return result;
4565 }
4566 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
4567     PyObject *module = NULL, *moddict, *modname;
4568     if (__Pyx_check_single_interpreter())
4569         return NULL;
4570     if (__pyx_m)
4571         return __Pyx_NewRef(__pyx_m);
4572     modname = PyObject_GetAttrString(spec, "name");
4573     if (unlikely(!modname)) goto bad;
4574     module = PyModule_NewObject(modname);
4575     Py_DECREF(modname);
4576     if (unlikely(!module)) goto bad;
4577     moddict = PyModule_GetDict(module);
4578     if (unlikely(!moddict)) goto bad;
4579     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
4580     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
4581     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
4582     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
4583     return module;
4584 bad:
4585     Py_XDECREF(module);
4586     return NULL;
4587 }
4588 
4589 
4590 static CYTHON_SMALL_CODE int __pyx_pymod_exec_BedGraphIO(PyObject *__pyx_pyinit_module)
4591 #endif
4592 #endif
4593 {
4594   __Pyx_TraceDeclarations
4595   PyObject *__pyx_t_1 = NULL;
4596   PyObject *__pyx_t_2 = NULL;
4597   __Pyx_RefNannyDeclarations
4598   #if CYTHON_PEP489_MULTI_PHASE_INIT
4599   if (__pyx_m) {
4600     if (__pyx_m == __pyx_pyinit_module) return 0;
4601     PyErr_SetString(PyExc_RuntimeError, "Module 'BedGraphIO' has already been imported. Re-initialisation is not supported.");
4602     return -1;
4603   }
4604   #elif PY_MAJOR_VERSION >= 3
4605   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
4606   #endif
4607   #if CYTHON_REFNANNY
4608 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4609 if (!__Pyx_RefNanny) {
4610   PyErr_Clear();
4611   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4612   if (!__Pyx_RefNanny)
4613       Py_FatalError("failed to import 'refnanny' module");
4614 }
4615 #endif
4616   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_BedGraphIO(void)", 0);
4617   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4618   #ifdef __Pxy_PyFrame_Initialize_Offsets
4619   __Pxy_PyFrame_Initialize_Offsets();
4620   #endif
4621   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
4622   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
4623   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
4624   #ifdef __Pyx_CyFunction_USED
4625   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4626   #endif
4627   #ifdef __Pyx_FusedFunction_USED
4628   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4629   #endif
4630   #ifdef __Pyx_Coroutine_USED
4631   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4632   #endif
4633   #ifdef __Pyx_Generator_USED
4634   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4635   #endif
4636   #ifdef __Pyx_AsyncGen_USED
4637   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4638   #endif
4639   #ifdef __Pyx_StopAsyncIteration_USED
4640   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4641   #endif
4642   /*--- Library function declarations ---*/
4643   /*--- Threads initialization code ---*/
4644   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4645   #ifdef WITH_THREAD /* Python build with threading support? */
4646   PyEval_InitThreads();
4647   #endif
4648   #endif
4649   /*--- Module creation code ---*/
4650   #if CYTHON_PEP489_MULTI_PHASE_INIT
4651   __pyx_m = __pyx_pyinit_module;
4652   Py_INCREF(__pyx_m);
4653   #else
4654   #if PY_MAJOR_VERSION < 3
4655   __pyx_m = Py_InitModule4("BedGraphIO", __pyx_methods, __pyx_k_Module_Description_IO_Module_for, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4656   #else
4657   __pyx_m = PyModule_Create(&__pyx_moduledef);
4658   #endif
4659   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4660   #endif
4661   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4662   Py_INCREF(__pyx_d);
4663   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
4664   Py_INCREF(__pyx_b);
4665   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
4666   Py_INCREF(__pyx_cython_runtime);
4667   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4668   /*--- Initialize various global constants etc. ---*/
4669   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4670   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4671   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4672   #endif
4673   if (__pyx_module_is_main_MACS2__IO__BedGraphIO) {
4674     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4675   }
4676   #if PY_MAJOR_VERSION >= 3
4677   {
4678     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
4679     if (!PyDict_GetItemString(modules, "MACS2.IO.BedGraphIO")) {
4680       if (unlikely(PyDict_SetItemString(modules, "MACS2.IO.BedGraphIO", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4681     }
4682   }
4683   #endif
4684   /*--- Builtin init code ---*/
4685   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
4686   /*--- Constants init code ---*/
4687   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
4688   /*--- Global type/function init code ---*/
4689   (void)__Pyx_modinit_global_init_code();
4690   (void)__Pyx_modinit_variable_export_code();
4691   (void)__Pyx_modinit_function_export_code();
4692   if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
4693   (void)__Pyx_modinit_type_import_code();
4694   (void)__Pyx_modinit_variable_import_code();
4695   (void)__Pyx_modinit_function_import_code();
4696   /*--- Execution code ---*/
4697   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4698   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4699   #endif
4700   __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_BedGraphIO(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
4701 
4702   /* "MACS2/IO/BedGraphIO.pyx":15
4703  * # python modules
4704  * # ------------------------------------
4705  * import io             # <<<<<<<<<<<<<<
4706  *
4707  * from MACS2.IO.BedGraph import bedGraphTrackI,bedRegionTrackI
4708  */
4709   __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
4710   __Pyx_GOTREF(__pyx_t_1);
4711   if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
4712   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4713 
4714   /* "MACS2/IO/BedGraphIO.pyx":17
4715  * import io
4716  *
4717  * from MACS2.IO.BedGraph import bedGraphTrackI,bedRegionTrackI             # <<<<<<<<<<<<<<
4718  *
4719  * # ------------------------------------
4720  */
4721   __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
4722   __Pyx_GOTREF(__pyx_t_1);
4723   __Pyx_INCREF(__pyx_n_s_bedGraphTrackI);
4724   __Pyx_GIVEREF(__pyx_n_s_bedGraphTrackI);
4725   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bedGraphTrackI);
4726   __Pyx_INCREF(__pyx_n_s_bedRegionTrackI);
4727   __Pyx_GIVEREF(__pyx_n_s_bedRegionTrackI);
4728   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_bedRegionTrackI);
4729   __pyx_t_2 = __Pyx_Import(__pyx_n_s_MACS2_IO_BedGraph, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
4730   __Pyx_GOTREF(__pyx_t_2);
4731   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4732   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bedGraphTrackI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
4733   __Pyx_GOTREF(__pyx_t_1);
4734   if (PyDict_SetItem(__pyx_d, __pyx_n_s_bedGraphTrackI, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
4735   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4736   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bedRegionTrackI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
4737   __Pyx_GOTREF(__pyx_t_1);
4738   if (PyDict_SetItem(__pyx_d, __pyx_n_s_bedRegionTrackI, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
4739   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4740   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4741 
4742   /* "(tree fragment)":1
4743  * def __pyx_unpickle_bedGraphIO(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
4744  *     cdef object __pyx_PickleError
4745  *     cdef object __pyx_result
4746  */
4747   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5MACS2_2IO_10BedGraphIO_1__pyx_unpickle_bedGraphIO, NULL, __pyx_n_s_MACS2_IO_BedGraphIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
4748   __Pyx_GOTREF(__pyx_t_2);
4749   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_bedGraphIO, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4750   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4751 
4752   /* "(tree fragment)":11
4753  *         __pyx_unpickle_bedGraphIO__set_state(<bedGraphIO> __pyx_result, __pyx_state)
4754  *     return __pyx_result
4755  * cdef __pyx_unpickle_bedGraphIO__set_state(bedGraphIO __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
4756  *     __pyx_result.bedGraph_filename = __pyx_state[0]
4757  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
4758  */
4759   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5MACS2_2IO_10BedGraphIO_3__pyx_unpickle_genericBedIO, NULL, __pyx_n_s_MACS2_IO_BedGraphIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
4760   __Pyx_GOTREF(__pyx_t_2);
4761   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_genericBedIO, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4762   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4763 
4764   /* "MACS2/IO/BedGraphIO.pyx":1
4765  * # cython: language_level=3             # <<<<<<<<<<<<<<
4766  * # cython: profile=True
4767  * # Time-stamp: <2019-10-30 17:49:01 taoliu>
4768  */
4769   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
4770   __Pyx_GOTREF(__pyx_t_2);
4771   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4772   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4773   __Pyx_TraceReturn(Py_None, 0);
4774 
4775   /*--- Wrapped vars code ---*/
4776 
4777   goto __pyx_L0;
4778   __pyx_L1_error:;
4779   __Pyx_XDECREF(__pyx_t_1);
4780   __Pyx_XDECREF(__pyx_t_2);
4781   if (__pyx_m) {
4782     if (__pyx_d) {
4783       __Pyx_AddTraceback("init MACS2.IO.BedGraphIO", __pyx_clineno, __pyx_lineno, __pyx_filename);
4784     }
4785     Py_CLEAR(__pyx_m);
4786   } else if (!PyErr_Occurred()) {
4787     PyErr_SetString(PyExc_ImportError, "init MACS2.IO.BedGraphIO");
4788   }
4789   __pyx_L0:;
4790   __Pyx_RefNannyFinishContext();
4791   #if CYTHON_PEP489_MULTI_PHASE_INIT
4792   return (__pyx_m != NULL) ? 0 : -1;
4793   #elif PY_MAJOR_VERSION >= 3
4794   return __pyx_m;
4795   #else
4796   return;
4797   #endif
4798 }
4799 
4800 /* --- Runtime support code --- */
4801 /* Refnanny */
4802 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)4803 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
4804     PyObject *m = NULL, *p = NULL;
4805     void *r = NULL;
4806     m = PyImport_ImportModule(modname);
4807     if (!m) goto end;
4808     p = PyObject_GetAttrString(m, "RefNannyAPI");
4809     if (!p) goto end;
4810     r = PyLong_AsVoidPtr(p);
4811 end:
4812     Py_XDECREF(p);
4813     Py_XDECREF(m);
4814     return (__Pyx_RefNannyAPIStruct *)r;
4815 }
4816 #endif
4817 
4818 /* PyObjectGetAttrStr */
4819 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)4820 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
4821     PyTypeObject* tp = Py_TYPE(obj);
4822     if (likely(tp->tp_getattro))
4823         return tp->tp_getattro(obj, attr_name);
4824 #if PY_MAJOR_VERSION < 3
4825     if (likely(tp->tp_getattr))
4826         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
4827 #endif
4828     return PyObject_GetAttr(obj, attr_name);
4829 }
4830 #endif
4831 
4832 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)4833 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
4834     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
4835     if (unlikely(!result)) {
4836         PyErr_Format(PyExc_NameError,
4837 #if PY_MAJOR_VERSION >= 3
4838             "name '%U' is not defined", name);
4839 #else
4840             "name '%.200s' is not defined", PyString_AS_STRING(name));
4841 #endif
4842     }
4843     return result;
4844 }
4845 
4846 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)4847 static void __Pyx_RaiseDoubleKeywordsError(
4848     const char* func_name,
4849     PyObject* kw_name)
4850 {
4851     PyErr_Format(PyExc_TypeError,
4852         #if PY_MAJOR_VERSION >= 3
4853         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
4854         #else
4855         "%s() got multiple values for keyword argument '%s'", func_name,
4856         PyString_AsString(kw_name));
4857         #endif
4858 }
4859 
4860 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)4861 static int __Pyx_ParseOptionalKeywords(
4862     PyObject *kwds,
4863     PyObject **argnames[],
4864     PyObject *kwds2,
4865     PyObject *values[],
4866     Py_ssize_t num_pos_args,
4867     const char* function_name)
4868 {
4869     PyObject *key = 0, *value = 0;
4870     Py_ssize_t pos = 0;
4871     PyObject*** name;
4872     PyObject*** first_kw_arg = argnames + num_pos_args;
4873     while (PyDict_Next(kwds, &pos, &key, &value)) {
4874         name = first_kw_arg;
4875         while (*name && (**name != key)) name++;
4876         if (*name) {
4877             values[name-argnames] = value;
4878             continue;
4879         }
4880         name = first_kw_arg;
4881         #if PY_MAJOR_VERSION < 3
4882         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
4883             while (*name) {
4884                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
4885                         && _PyString_Eq(**name, key)) {
4886                     values[name-argnames] = value;
4887                     break;
4888                 }
4889                 name++;
4890             }
4891             if (*name) continue;
4892             else {
4893                 PyObject*** argname = argnames;
4894                 while (argname != first_kw_arg) {
4895                     if ((**argname == key) || (
4896                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
4897                              && _PyString_Eq(**argname, key))) {
4898                         goto arg_passed_twice;
4899                     }
4900                     argname++;
4901                 }
4902             }
4903         } else
4904         #endif
4905         if (likely(PyUnicode_Check(key))) {
4906             while (*name) {
4907                 int cmp = (**name == key) ? 0 :
4908                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
4909                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
4910                 #endif
4911                     PyUnicode_Compare(**name, key);
4912                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
4913                 if (cmp == 0) {
4914                     values[name-argnames] = value;
4915                     break;
4916                 }
4917                 name++;
4918             }
4919             if (*name) continue;
4920             else {
4921                 PyObject*** argname = argnames;
4922                 while (argname != first_kw_arg) {
4923                     int cmp = (**argname == key) ? 0 :
4924                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
4925                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
4926                     #endif
4927                         PyUnicode_Compare(**argname, key);
4928                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
4929                     if (cmp == 0) goto arg_passed_twice;
4930                     argname++;
4931                 }
4932             }
4933         } else
4934             goto invalid_keyword_type;
4935         if (kwds2) {
4936             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
4937         } else {
4938             goto invalid_keyword;
4939         }
4940     }
4941     return 0;
4942 arg_passed_twice:
4943     __Pyx_RaiseDoubleKeywordsError(function_name, key);
4944     goto bad;
4945 invalid_keyword_type:
4946     PyErr_Format(PyExc_TypeError,
4947         "%.200s() keywords must be strings", function_name);
4948     goto bad;
4949 invalid_keyword:
4950     PyErr_Format(PyExc_TypeError,
4951     #if PY_MAJOR_VERSION < 3
4952         "%.200s() got an unexpected keyword argument '%.200s'",
4953         function_name, PyString_AsString(key));
4954     #else
4955         "%s() got an unexpected keyword argument '%U'",
4956         function_name, key);
4957     #endif
4958 bad:
4959     return -1;
4960 }
4961 
4962 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)4963 static void __Pyx_RaiseArgtupleInvalid(
4964     const char* func_name,
4965     int exact,
4966     Py_ssize_t num_min,
4967     Py_ssize_t num_max,
4968     Py_ssize_t num_found)
4969 {
4970     Py_ssize_t num_expected;
4971     const char *more_or_less;
4972     if (num_found < num_min) {
4973         num_expected = num_min;
4974         more_or_less = "at least";
4975     } else {
4976         num_expected = num_max;
4977         more_or_less = "at most";
4978     }
4979     if (exact) {
4980         more_or_less = "exactly";
4981     }
4982     PyErr_Format(PyExc_TypeError,
4983                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
4984                  func_name, more_or_less, num_expected,
4985                  (num_expected == 1) ? "" : "s", num_found);
4986 }
4987 
4988 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)4989 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
4990 {
4991     if (unlikely(!type)) {
4992         PyErr_SetString(PyExc_SystemError, "Missing type object");
4993         return 0;
4994     }
4995     else if (exact) {
4996         #if PY_MAJOR_VERSION == 2
4997         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
4998         #endif
4999     }
5000     else {
5001         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
5002     }
5003     PyErr_Format(PyExc_TypeError,
5004         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
5005         name, type->tp_name, Py_TYPE(obj)->tp_name);
5006     return 0;
5007 }
5008 
5009 /* PyErrFetchRestore */
5010 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)5011 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5012     PyObject *tmp_type, *tmp_value, *tmp_tb;
5013     tmp_type = tstate->curexc_type;
5014     tmp_value = tstate->curexc_value;
5015     tmp_tb = tstate->curexc_traceback;
5016     tstate->curexc_type = type;
5017     tstate->curexc_value = value;
5018     tstate->curexc_traceback = tb;
5019     Py_XDECREF(tmp_type);
5020     Py_XDECREF(tmp_value);
5021     Py_XDECREF(tmp_tb);
5022 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)5023 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5024     *type = tstate->curexc_type;
5025     *value = tstate->curexc_value;
5026     *tb = tstate->curexc_traceback;
5027     tstate->curexc_type = 0;
5028     tstate->curexc_value = 0;
5029     tstate->curexc_traceback = 0;
5030 }
5031 #endif
5032 
5033 /* Profile */
5034 #if CYTHON_PROFILE
__Pyx_TraceSetupAndCall(PyCodeObject ** code,PyFrameObject ** frame,PyThreadState * tstate,const char * funcname,const char * srcfile,int firstlineno)5035 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
5036                                    PyFrameObject** frame,
5037                                    PyThreadState* tstate,
5038                                    const char *funcname,
5039                                    const char *srcfile,
5040                                    int firstlineno) {
5041     PyObject *type, *value, *traceback;
5042     int retval;
5043     if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
5044         if (*code == NULL) {
5045             *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
5046             if (*code == NULL) return 0;
5047         }
5048         *frame = PyFrame_New(
5049             tstate,                          /*PyThreadState *tstate*/
5050             *code,                           /*PyCodeObject *code*/
5051             __pyx_d,                  /*PyObject *globals*/
5052             0                                /*PyObject *locals*/
5053         );
5054         if (*frame == NULL) return 0;
5055         if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
5056             Py_INCREF(Py_None);
5057             (*frame)->f_trace = Py_None;
5058         }
5059 #if PY_VERSION_HEX < 0x030400B1
5060     } else {
5061         (*frame)->f_tstate = tstate;
5062 #endif
5063     }
5064       __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
5065     retval = 1;
5066     tstate->tracing++;
5067     tstate->use_tracing = 0;
5068     __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
5069     #if CYTHON_TRACE
5070     if (tstate->c_tracefunc)
5071         retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
5072     if (retval && tstate->c_profilefunc)
5073     #endif
5074         retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
5075     tstate->use_tracing = (tstate->c_profilefunc ||
5076                            (CYTHON_TRACE && tstate->c_tracefunc));
5077     tstate->tracing--;
5078     if (retval) {
5079         __Pyx_ErrRestoreInState(tstate, type, value, traceback);
5080         return tstate->use_tracing && retval;
5081     } else {
5082         Py_XDECREF(type);
5083         Py_XDECREF(value);
5084         Py_XDECREF(traceback);
5085         return -1;
5086     }
5087 }
__Pyx_createFrameCodeObject(const char * funcname,const char * srcfile,int firstlineno)5088 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
5089     PyCodeObject *py_code = 0;
5090 #if PY_MAJOR_VERSION >= 3
5091     py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
5092     if (likely(py_code)) {
5093         py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
5094     }
5095 #else
5096     PyObject *py_srcfile = 0;
5097     PyObject *py_funcname = 0;
5098     py_funcname = PyString_FromString(funcname);
5099     if (unlikely(!py_funcname)) goto bad;
5100     py_srcfile = PyString_FromString(srcfile);
5101     if (unlikely(!py_srcfile)) goto bad;
5102     py_code = PyCode_New(
5103         0,
5104         0,
5105         0,
5106         CO_OPTIMIZED | CO_NEWLOCALS,
5107         __pyx_empty_bytes,     /*PyObject *code,*/
5108         __pyx_empty_tuple,     /*PyObject *consts,*/
5109         __pyx_empty_tuple,     /*PyObject *names,*/
5110         __pyx_empty_tuple,     /*PyObject *varnames,*/
5111         __pyx_empty_tuple,     /*PyObject *freevars,*/
5112         __pyx_empty_tuple,     /*PyObject *cellvars,*/
5113         py_srcfile,       /*PyObject *filename,*/
5114         py_funcname,      /*PyObject *name,*/
5115         firstlineno,
5116         __pyx_empty_bytes      /*PyObject *lnotab*/
5117     );
5118 bad:
5119     Py_XDECREF(py_srcfile);
5120     Py_XDECREF(py_funcname);
5121 #endif
5122     return py_code;
5123 }
5124 #endif
5125 
5126 /* PyDictVersioning */
5127 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)5128 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5129     PyObject *dict = Py_TYPE(obj)->tp_dict;
5130     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5131 }
__Pyx_get_object_dict_version(PyObject * obj)5132 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5133     PyObject **dictptr = NULL;
5134     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5135     if (offset) {
5136 #if CYTHON_COMPILING_IN_CPYTHON
5137         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
5138 #else
5139         dictptr = _PyObject_GetDictPtr(obj);
5140 #endif
5141     }
5142     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5143 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)5144 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5145     PyObject *dict = Py_TYPE(obj)->tp_dict;
5146     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5147         return 0;
5148     return obj_dict_version == __Pyx_get_object_dict_version(obj);
5149 }
5150 #endif
5151 
5152 /* GetModuleGlobalName */
5153 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)5154 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
5155 #else
5156 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
5157 #endif
5158 {
5159     PyObject *result;
5160 #if !CYTHON_AVOID_BORROWED_REFS
5161 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
5162     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
5163     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5164     if (likely(result)) {
5165         return __Pyx_NewRef(result);
5166     } else if (unlikely(PyErr_Occurred())) {
5167         return NULL;
5168     }
5169 #else
5170     result = PyDict_GetItem(__pyx_d, name);
5171     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5172     if (likely(result)) {
5173         return __Pyx_NewRef(result);
5174     }
5175 #endif
5176 #else
5177     result = PyObject_GetItem(__pyx_d, name);
5178     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5179     if (likely(result)) {
5180         return __Pyx_NewRef(result);
5181     }
5182     PyErr_Clear();
5183 #endif
5184     return __Pyx_GetBuiltinName(name);
5185 }
5186 
5187 /* PyObjectCall */
5188 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)5189 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
5190     PyObject *result;
5191     ternaryfunc call = func->ob_type->tp_call;
5192     if (unlikely(!call))
5193         return PyObject_Call(func, arg, kw);
5194     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5195         return NULL;
5196     result = (*call)(func, arg, kw);
5197     Py_LeaveRecursiveCall();
5198     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5199         PyErr_SetString(
5200             PyExc_SystemError,
5201             "NULL result without error in PyObject_Call");
5202     }
5203     return result;
5204 }
5205 #endif
5206 
5207 /* bytes_tailmatch */
__Pyx_PyBytes_SingleTailmatch(PyObject * self,PyObject * arg,Py_ssize_t start,Py_ssize_t end,int direction)5208 static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
5209                                          Py_ssize_t start, Py_ssize_t end, int direction) {
5210     const char* self_ptr = PyBytes_AS_STRING(self);
5211     Py_ssize_t self_len = PyBytes_GET_SIZE(self);
5212     const char* sub_ptr;
5213     Py_ssize_t sub_len;
5214     int retval;
5215     Py_buffer view;
5216     view.obj = NULL;
5217     if ( PyBytes_Check(arg) ) {
5218         sub_ptr = PyBytes_AS_STRING(arg);
5219         sub_len = PyBytes_GET_SIZE(arg);
5220     }
5221 #if PY_MAJOR_VERSION < 3
5222     else if ( PyUnicode_Check(arg) ) {
5223         return (int) PyUnicode_Tailmatch(self, arg, start, end, direction);
5224     }
5225 #endif
5226     else {
5227         if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
5228             return -1;
5229         sub_ptr = (const char*) view.buf;
5230         sub_len = view.len;
5231     }
5232     if (end > self_len)
5233         end = self_len;
5234     else if (end < 0)
5235         end += self_len;
5236     if (end < 0)
5237         end = 0;
5238     if (start < 0)
5239         start += self_len;
5240     if (start < 0)
5241         start = 0;
5242     if (direction > 0) {
5243         if (end-sub_len > start)
5244             start = end - sub_len;
5245     }
5246     if (start + sub_len <= end)
5247         retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len);
5248     else
5249         retval = 0;
5250     if (view.obj)
5251         PyBuffer_Release(&view);
5252     return retval;
5253 }
__Pyx_PyBytes_TailmatchTuple(PyObject * self,PyObject * substrings,Py_ssize_t start,Py_ssize_t end,int direction)5254 static int __Pyx_PyBytes_TailmatchTuple(PyObject* self, PyObject* substrings,
5255                                         Py_ssize_t start, Py_ssize_t end, int direction) {
5256     Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
5257     for (i = 0; i < count; i++) {
5258         int result;
5259 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5260         result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substrings, i),
5261                                                start, end, direction);
5262 #else
5263         PyObject* sub = PySequence_ITEM(substrings, i);
5264         if (unlikely(!sub)) return -1;
5265         result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction);
5266         Py_DECREF(sub);
5267 #endif
5268         if (result) {
5269             return result;
5270         }
5271     }
5272     return 0;
5273 }
__Pyx_PyBytes_Tailmatch(PyObject * self,PyObject * substr,Py_ssize_t start,Py_ssize_t end,int direction)5274 static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
5275                                    Py_ssize_t start, Py_ssize_t end, int direction) {
5276     if (unlikely(PyTuple_Check(substr))) {
5277         return __Pyx_PyBytes_TailmatchTuple(self, substr, start, end, direction);
5278     }
5279     return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
5280 }
5281 
5282 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)5283 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
5284     PyObject *method;
5285     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
5286     if (unlikely(!method))
5287         return -1;
5288     target->method = method;
5289 #if CYTHON_COMPILING_IN_CPYTHON
5290     #if PY_MAJOR_VERSION >= 3
5291     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
5292     #endif
5293     {
5294         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
5295         target->func = descr->d_method->ml_meth;
5296         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
5297     }
5298 #endif
5299     return 0;
5300 }
5301 
5302 /* CallUnboundCMethod0 */
__Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction * cfunc,PyObject * self)5303 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
5304     PyObject *args, *result = NULL;
5305     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
5306 #if CYTHON_ASSUME_SAFE_MACROS
5307     args = PyTuple_New(1);
5308     if (unlikely(!args)) goto bad;
5309     Py_INCREF(self);
5310     PyTuple_SET_ITEM(args, 0, self);
5311 #else
5312     args = PyTuple_Pack(1, self);
5313     if (unlikely(!args)) goto bad;
5314 #endif
5315     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
5316     Py_DECREF(args);
5317 bad:
5318     return result;
5319 }
5320 
5321 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)5322 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
5323     PyObject *r;
5324     if (!j) return NULL;
5325     r = PyObject_GetItem(o, j);
5326     Py_DECREF(j);
5327     return r;
5328 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)5329 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
5330                                                               CYTHON_NCP_UNUSED int wraparound,
5331                                                               CYTHON_NCP_UNUSED int boundscheck) {
5332 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5333     Py_ssize_t wrapped_i = i;
5334     if (wraparound & unlikely(i < 0)) {
5335         wrapped_i += PyList_GET_SIZE(o);
5336     }
5337     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
5338         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
5339         Py_INCREF(r);
5340         return r;
5341     }
5342     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
5343 #else
5344     return PySequence_GetItem(o, i);
5345 #endif
5346 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)5347 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
5348                                                               CYTHON_NCP_UNUSED int wraparound,
5349                                                               CYTHON_NCP_UNUSED int boundscheck) {
5350 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5351     Py_ssize_t wrapped_i = i;
5352     if (wraparound & unlikely(i < 0)) {
5353         wrapped_i += PyTuple_GET_SIZE(o);
5354     }
5355     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
5356         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
5357         Py_INCREF(r);
5358         return r;
5359     }
5360     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
5361 #else
5362     return PySequence_GetItem(o, i);
5363 #endif
5364 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)5365 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
5366                                                      CYTHON_NCP_UNUSED int wraparound,
5367                                                      CYTHON_NCP_UNUSED int boundscheck) {
5368 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
5369     if (is_list || PyList_CheckExact(o)) {
5370         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
5371         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
5372             PyObject *r = PyList_GET_ITEM(o, n);
5373             Py_INCREF(r);
5374             return r;
5375         }
5376     }
5377     else if (PyTuple_CheckExact(o)) {
5378         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
5379         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
5380             PyObject *r = PyTuple_GET_ITEM(o, n);
5381             Py_INCREF(r);
5382             return r;
5383         }
5384     } else {
5385         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
5386         if (likely(m && m->sq_item)) {
5387             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
5388                 Py_ssize_t l = m->sq_length(o);
5389                 if (likely(l >= 0)) {
5390                     i += l;
5391                 } else {
5392                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
5393                         return NULL;
5394                     PyErr_Clear();
5395                 }
5396             }
5397             return m->sq_item(o, i);
5398         }
5399     }
5400 #else
5401     if (is_list || PySequence_Check(o)) {
5402         return PySequence_GetItem(o, i);
5403     }
5404 #endif
5405     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
5406 }
5407 
5408 /* PyFunctionFastCall */
5409 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)5410 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
5411                                                PyObject *globals) {
5412     PyFrameObject *f;
5413     PyThreadState *tstate = __Pyx_PyThreadState_Current;
5414     PyObject **fastlocals;
5415     Py_ssize_t i;
5416     PyObject *result;
5417     assert(globals != NULL);
5418     /* XXX Perhaps we should create a specialized
5419        PyFrame_New() that doesn't take locals, but does
5420        take builtins without sanity checking them.
5421        */
5422     assert(tstate != NULL);
5423     f = PyFrame_New(tstate, co, globals, NULL);
5424     if (f == NULL) {
5425         return NULL;
5426     }
5427     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
5428     for (i = 0; i < na; i++) {
5429         Py_INCREF(*args);
5430         fastlocals[i] = *args++;
5431     }
5432     result = PyEval_EvalFrameEx(f,0);
5433     ++tstate->recursion_depth;
5434     Py_DECREF(f);
5435     --tstate->recursion_depth;
5436     return result;
5437 }
5438 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)5439 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
5440     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
5441     PyObject *globals = PyFunction_GET_GLOBALS(func);
5442     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
5443     PyObject *closure;
5444 #if PY_MAJOR_VERSION >= 3
5445     PyObject *kwdefs;
5446 #endif
5447     PyObject *kwtuple, **k;
5448     PyObject **d;
5449     Py_ssize_t nd;
5450     Py_ssize_t nk;
5451     PyObject *result;
5452     assert(kwargs == NULL || PyDict_Check(kwargs));
5453     nk = kwargs ? PyDict_Size(kwargs) : 0;
5454     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
5455         return NULL;
5456     }
5457     if (
5458 #if PY_MAJOR_VERSION >= 3
5459             co->co_kwonlyargcount == 0 &&
5460 #endif
5461             likely(kwargs == NULL || nk == 0) &&
5462             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
5463         if (argdefs == NULL && co->co_argcount == nargs) {
5464             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
5465             goto done;
5466         }
5467         else if (nargs == 0 && argdefs != NULL
5468                  && co->co_argcount == Py_SIZE(argdefs)) {
5469             /* function called with no arguments, but all parameters have
5470                a default value: use default values as arguments .*/
5471             args = &PyTuple_GET_ITEM(argdefs, 0);
5472             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
5473             goto done;
5474         }
5475     }
5476     if (kwargs != NULL) {
5477         Py_ssize_t pos, i;
5478         kwtuple = PyTuple_New(2 * nk);
5479         if (kwtuple == NULL) {
5480             result = NULL;
5481             goto done;
5482         }
5483         k = &PyTuple_GET_ITEM(kwtuple, 0);
5484         pos = i = 0;
5485         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
5486             Py_INCREF(k[i]);
5487             Py_INCREF(k[i+1]);
5488             i += 2;
5489         }
5490         nk = i / 2;
5491     }
5492     else {
5493         kwtuple = NULL;
5494         k = NULL;
5495     }
5496     closure = PyFunction_GET_CLOSURE(func);
5497 #if PY_MAJOR_VERSION >= 3
5498     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
5499 #endif
5500     if (argdefs != NULL) {
5501         d = &PyTuple_GET_ITEM(argdefs, 0);
5502         nd = Py_SIZE(argdefs);
5503     }
5504     else {
5505         d = NULL;
5506         nd = 0;
5507     }
5508 #if PY_MAJOR_VERSION >= 3
5509     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
5510                                args, (int)nargs,
5511                                k, (int)nk,
5512                                d, (int)nd, kwdefs, closure);
5513 #else
5514     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
5515                                args, (int)nargs,
5516                                k, (int)nk,
5517                                d, (int)nd, closure);
5518 #endif
5519     Py_XDECREF(kwtuple);
5520 done:
5521     Py_LeaveRecursiveCall();
5522     return result;
5523 }
5524 #endif
5525 #endif
5526 
5527 /* PyCFunctionFastCall */
5528 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)5529 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
5530     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
5531     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
5532     PyObject *self = PyCFunction_GET_SELF(func);
5533     int flags = PyCFunction_GET_FLAGS(func);
5534     assert(PyCFunction_Check(func));
5535     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
5536     assert(nargs >= 0);
5537     assert(nargs == 0 || args != NULL);
5538     /* _PyCFunction_FastCallDict() must not be called with an exception set,
5539        because it may clear it (directly or indirectly) and so the
5540        caller loses its exception */
5541     assert(!PyErr_Occurred());
5542     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
5543         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
5544     } else {
5545         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
5546     }
5547 }
5548 #endif
5549 
5550 /* PyObjectCallMethO */
5551 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)5552 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
5553     PyObject *self, *result;
5554     PyCFunction cfunc;
5555     cfunc = PyCFunction_GET_FUNCTION(func);
5556     self = PyCFunction_GET_SELF(func);
5557     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5558         return NULL;
5559     result = cfunc(self, arg);
5560     Py_LeaveRecursiveCall();
5561     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5562         PyErr_SetString(
5563             PyExc_SystemError,
5564             "NULL result without error in PyObject_Call");
5565     }
5566     return result;
5567 }
5568 #endif
5569 
5570 /* PyObjectCallNoArg */
5571 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)5572 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
5573 #if CYTHON_FAST_PYCALL
5574     if (PyFunction_Check(func)) {
5575         return __Pyx_PyFunction_FastCall(func, NULL, 0);
5576     }
5577 #endif
5578 #ifdef __Pyx_CyFunction_USED
5579     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
5580 #else
5581     if (likely(PyCFunction_Check(func)))
5582 #endif
5583     {
5584         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
5585             return __Pyx_PyObject_CallMethO(func, NULL);
5586         }
5587     }
5588     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
5589 }
5590 #endif
5591 
5592 /* PyObjectCallOneArg */
5593 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)5594 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5595     PyObject *result;
5596     PyObject *args = PyTuple_New(1);
5597     if (unlikely(!args)) return NULL;
5598     Py_INCREF(arg);
5599     PyTuple_SET_ITEM(args, 0, arg);
5600     result = __Pyx_PyObject_Call(func, args, NULL);
5601     Py_DECREF(args);
5602     return result;
5603 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)5604 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5605 #if CYTHON_FAST_PYCALL
5606     if (PyFunction_Check(func)) {
5607         return __Pyx_PyFunction_FastCall(func, &arg, 1);
5608     }
5609 #endif
5610     if (likely(PyCFunction_Check(func))) {
5611         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
5612             return __Pyx_PyObject_CallMethO(func, arg);
5613 #if CYTHON_FAST_PYCCALL
5614         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
5615             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
5616 #endif
5617         }
5618     }
5619     return __Pyx__PyObject_CallOneArg(func, arg);
5620 }
5621 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)5622 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5623     PyObject *result;
5624     PyObject *args = PyTuple_Pack(1, arg);
5625     if (unlikely(!args)) return NULL;
5626     result = __Pyx_PyObject_Call(func, args, NULL);
5627     Py_DECREF(args);
5628     return result;
5629 }
5630 #endif
5631 
5632 /* PyErrExceptionMatches */
5633 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)5634 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
5635     Py_ssize_t i, n;
5636     n = PyTuple_GET_SIZE(tuple);
5637 #if PY_MAJOR_VERSION >= 3
5638     for (i=0; i<n; i++) {
5639         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
5640     }
5641 #endif
5642     for (i=0; i<n; i++) {
5643         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
5644     }
5645     return 0;
5646 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)5647 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
5648     PyObject *exc_type = tstate->curexc_type;
5649     if (exc_type == err) return 1;
5650     if (unlikely(!exc_type)) return 0;
5651     if (unlikely(PyTuple_Check(err)))
5652         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
5653     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
5654 }
5655 #endif
5656 
5657 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)5658 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
5659 #if CYTHON_USE_TYPE_SLOTS
5660 #if PY_MAJOR_VERSION >= 3
5661     if (likely(PyUnicode_Check(n)))
5662 #else
5663     if (likely(PyString_Check(n)))
5664 #endif
5665         return __Pyx_PyObject_GetAttrStr(o, n);
5666 #endif
5667     return PyObject_GetAttr(o, n);
5668 }
5669 
5670 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)5671 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
5672     __Pyx_PyThreadState_declare
5673     __Pyx_PyThreadState_assign
5674     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
5675         return NULL;
5676     __Pyx_PyErr_Clear();
5677     Py_INCREF(d);
5678     return d;
5679 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)5680 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
5681     PyObject *r = __Pyx_GetAttr(o, n);
5682     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
5683 }
5684 
5685 /* PyObjectSetAttrStr */
5686 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_SetAttrStr(PyObject * obj,PyObject * attr_name,PyObject * value)5687 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
5688     PyTypeObject* tp = Py_TYPE(obj);
5689     if (likely(tp->tp_setattro))
5690         return tp->tp_setattro(obj, attr_name, value);
5691 #if PY_MAJOR_VERSION < 3
5692     if (likely(tp->tp_setattr))
5693         return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
5694 #endif
5695     return PyObject_SetAttr(obj, attr_name, value);
5696 }
5697 #endif
5698 
5699 /* RaiseException */
5700 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)5701 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
5702                         CYTHON_UNUSED PyObject *cause) {
5703     __Pyx_PyThreadState_declare
5704     Py_XINCREF(type);
5705     if (!value || value == Py_None)
5706         value = NULL;
5707     else
5708         Py_INCREF(value);
5709     if (!tb || tb == Py_None)
5710         tb = NULL;
5711     else {
5712         Py_INCREF(tb);
5713         if (!PyTraceBack_Check(tb)) {
5714             PyErr_SetString(PyExc_TypeError,
5715                 "raise: arg 3 must be a traceback or None");
5716             goto raise_error;
5717         }
5718     }
5719     if (PyType_Check(type)) {
5720 #if CYTHON_COMPILING_IN_PYPY
5721         if (!value) {
5722             Py_INCREF(Py_None);
5723             value = Py_None;
5724         }
5725 #endif
5726         PyErr_NormalizeException(&type, &value, &tb);
5727     } else {
5728         if (value) {
5729             PyErr_SetString(PyExc_TypeError,
5730                 "instance exception may not have a separate value");
5731             goto raise_error;
5732         }
5733         value = type;
5734         type = (PyObject*) Py_TYPE(type);
5735         Py_INCREF(type);
5736         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
5737             PyErr_SetString(PyExc_TypeError,
5738                 "raise: exception class must be a subclass of BaseException");
5739             goto raise_error;
5740         }
5741     }
5742     __Pyx_PyThreadState_assign
5743     __Pyx_ErrRestore(type, value, tb);
5744     return;
5745 raise_error:
5746     Py_XDECREF(value);
5747     Py_XDECREF(type);
5748     Py_XDECREF(tb);
5749     return;
5750 }
5751 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)5752 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5753     PyObject* owned_instance = NULL;
5754     if (tb == Py_None) {
5755         tb = 0;
5756     } else if (tb && !PyTraceBack_Check(tb)) {
5757         PyErr_SetString(PyExc_TypeError,
5758             "raise: arg 3 must be a traceback or None");
5759         goto bad;
5760     }
5761     if (value == Py_None)
5762         value = 0;
5763     if (PyExceptionInstance_Check(type)) {
5764         if (value) {
5765             PyErr_SetString(PyExc_TypeError,
5766                 "instance exception may not have a separate value");
5767             goto bad;
5768         }
5769         value = type;
5770         type = (PyObject*) Py_TYPE(value);
5771     } else if (PyExceptionClass_Check(type)) {
5772         PyObject *instance_class = NULL;
5773         if (value && PyExceptionInstance_Check(value)) {
5774             instance_class = (PyObject*) Py_TYPE(value);
5775             if (instance_class != type) {
5776                 int is_subclass = PyObject_IsSubclass(instance_class, type);
5777                 if (!is_subclass) {
5778                     instance_class = NULL;
5779                 } else if (unlikely(is_subclass == -1)) {
5780                     goto bad;
5781                 } else {
5782                     type = instance_class;
5783                 }
5784             }
5785         }
5786         if (!instance_class) {
5787             PyObject *args;
5788             if (!value)
5789                 args = PyTuple_New(0);
5790             else if (PyTuple_Check(value)) {
5791                 Py_INCREF(value);
5792                 args = value;
5793             } else
5794                 args = PyTuple_Pack(1, value);
5795             if (!args)
5796                 goto bad;
5797             owned_instance = PyObject_Call(type, args, NULL);
5798             Py_DECREF(args);
5799             if (!owned_instance)
5800                 goto bad;
5801             value = owned_instance;
5802             if (!PyExceptionInstance_Check(value)) {
5803                 PyErr_Format(PyExc_TypeError,
5804                              "calling %R should have returned an instance of "
5805                              "BaseException, not %R",
5806                              type, Py_TYPE(value));
5807                 goto bad;
5808             }
5809         }
5810     } else {
5811         PyErr_SetString(PyExc_TypeError,
5812             "raise: exception class must be a subclass of BaseException");
5813         goto bad;
5814     }
5815     if (cause) {
5816         PyObject *fixed_cause;
5817         if (cause == Py_None) {
5818             fixed_cause = NULL;
5819         } else if (PyExceptionClass_Check(cause)) {
5820             fixed_cause = PyObject_CallObject(cause, NULL);
5821             if (fixed_cause == NULL)
5822                 goto bad;
5823         } else if (PyExceptionInstance_Check(cause)) {
5824             fixed_cause = cause;
5825             Py_INCREF(fixed_cause);
5826         } else {
5827             PyErr_SetString(PyExc_TypeError,
5828                             "exception causes must derive from "
5829                             "BaseException");
5830             goto bad;
5831         }
5832         PyException_SetCause(value, fixed_cause);
5833     }
5834     PyErr_SetObject(type, value);
5835     if (tb) {
5836 #if CYTHON_COMPILING_IN_PYPY
5837         PyObject *tmp_type, *tmp_value, *tmp_tb;
5838         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
5839         Py_INCREF(tb);
5840         PyErr_Restore(tmp_type, tmp_value, tb);
5841         Py_XDECREF(tmp_tb);
5842 #else
5843         PyThreadState *tstate = __Pyx_PyThreadState_Current;
5844         PyObject* tmp_tb = tstate->curexc_traceback;
5845         if (tb != tmp_tb) {
5846             Py_INCREF(tb);
5847             tstate->curexc_traceback = tb;
5848             Py_XDECREF(tmp_tb);
5849         }
5850 #endif
5851     }
5852 bad:
5853     Py_XDECREF(owned_instance);
5854     return;
5855 }
5856 #endif
5857 
5858 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)5859 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
5860     PyObject *args, *result = NULL;
5861     #if CYTHON_FAST_PYCALL
5862     if (PyFunction_Check(function)) {
5863         PyObject *args[2] = {arg1, arg2};
5864         return __Pyx_PyFunction_FastCall(function, args, 2);
5865     }
5866     #endif
5867     #if CYTHON_FAST_PYCCALL
5868     if (__Pyx_PyFastCFunction_Check(function)) {
5869         PyObject *args[2] = {arg1, arg2};
5870         return __Pyx_PyCFunction_FastCall(function, args, 2);
5871     }
5872     #endif
5873     args = PyTuple_New(2);
5874     if (unlikely(!args)) goto done;
5875     Py_INCREF(arg1);
5876     PyTuple_SET_ITEM(args, 0, arg1);
5877     Py_INCREF(arg2);
5878     PyTuple_SET_ITEM(args, 1, arg2);
5879     Py_INCREF(function);
5880     result = __Pyx_PyObject_Call(function, args, NULL);
5881     Py_DECREF(args);
5882     Py_DECREF(function);
5883 done:
5884     return result;
5885 }
5886 
5887 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)5888 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
5889     PyObject *empty_list = 0;
5890     PyObject *module = 0;
5891     PyObject *global_dict = 0;
5892     PyObject *empty_dict = 0;
5893     PyObject *list;
5894     #if PY_MAJOR_VERSION < 3
5895     PyObject *py_import;
5896     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5897     if (!py_import)
5898         goto bad;
5899     #endif
5900     if (from_list)
5901         list = from_list;
5902     else {
5903         empty_list = PyList_New(0);
5904         if (!empty_list)
5905             goto bad;
5906         list = empty_list;
5907     }
5908     global_dict = PyModule_GetDict(__pyx_m);
5909     if (!global_dict)
5910         goto bad;
5911     empty_dict = PyDict_New();
5912     if (!empty_dict)
5913         goto bad;
5914     {
5915         #if PY_MAJOR_VERSION >= 3
5916         if (level == -1) {
5917             if (strchr(__Pyx_MODULE_NAME, '.')) {
5918                 module = PyImport_ImportModuleLevelObject(
5919                     name, global_dict, empty_dict, list, 1);
5920                 if (!module) {
5921                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
5922                         goto bad;
5923                     PyErr_Clear();
5924                 }
5925             }
5926             level = 0;
5927         }
5928         #endif
5929         if (!module) {
5930             #if PY_MAJOR_VERSION < 3
5931             PyObject *py_level = PyInt_FromLong(level);
5932             if (!py_level)
5933                 goto bad;
5934             module = PyObject_CallFunctionObjArgs(py_import,
5935                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
5936             Py_DECREF(py_level);
5937             #else
5938             module = PyImport_ImportModuleLevelObject(
5939                 name, global_dict, empty_dict, list, level);
5940             #endif
5941         }
5942     }
5943 bad:
5944     #if PY_MAJOR_VERSION < 3
5945     Py_XDECREF(py_import);
5946     #endif
5947     Py_XDECREF(empty_list);
5948     Py_XDECREF(empty_dict);
5949     return module;
5950 }
5951 
5952 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)5953 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
5954     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
5955     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
5956         PyErr_Format(PyExc_ImportError,
5957         #if PY_MAJOR_VERSION < 3
5958             "cannot import name %.230s", PyString_AS_STRING(name));
5959         #else
5960             "cannot import name %S", name);
5961         #endif
5962     }
5963     return value;
5964 }
5965 
5966 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)5967 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
5968     PyObject *r;
5969     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
5970         PyErr_SetString(PyExc_TypeError,
5971                         "hasattr(): attribute name must be string");
5972         return -1;
5973     }
5974     r = __Pyx_GetAttr(o, n);
5975     if (unlikely(!r)) {
5976         PyErr_Clear();
5977         return 0;
5978     } else {
5979         Py_DECREF(r);
5980         return 1;
5981     }
5982 }
5983 
5984 /* PyObject_GenericGetAttrNoDict */
5985 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)5986 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
5987     PyErr_Format(PyExc_AttributeError,
5988 #if PY_MAJOR_VERSION >= 3
5989                  "'%.50s' object has no attribute '%U'",
5990                  tp->tp_name, attr_name);
5991 #else
5992                  "'%.50s' object has no attribute '%.400s'",
5993                  tp->tp_name, PyString_AS_STRING(attr_name));
5994 #endif
5995     return NULL;
5996 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)5997 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
5998     PyObject *descr;
5999     PyTypeObject *tp = Py_TYPE(obj);
6000     if (unlikely(!PyString_Check(attr_name))) {
6001         return PyObject_GenericGetAttr(obj, attr_name);
6002     }
6003     assert(!tp->tp_dictoffset);
6004     descr = _PyType_Lookup(tp, attr_name);
6005     if (unlikely(!descr)) {
6006         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
6007     }
6008     Py_INCREF(descr);
6009     #if PY_MAJOR_VERSION < 3
6010     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
6011     #endif
6012     {
6013         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
6014         if (unlikely(f)) {
6015             PyObject *res = f(descr, obj, (PyObject *)tp);
6016             Py_DECREF(descr);
6017             return res;
6018         }
6019     }
6020     return descr;
6021 }
6022 #endif
6023 
6024 /* PyObject_GenericGetAttr */
6025 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)6026 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
6027     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
6028         return PyObject_GenericGetAttr(obj, attr_name);
6029     }
6030     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
6031 }
6032 #endif
6033 
6034 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)6035 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
6036   int ret;
6037   PyObject *name_attr;
6038   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
6039   if (likely(name_attr)) {
6040       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
6041   } else {
6042       ret = -1;
6043   }
6044   if (unlikely(ret < 0)) {
6045       PyErr_Clear();
6046       ret = 0;
6047   }
6048   Py_XDECREF(name_attr);
6049   return ret;
6050 }
__Pyx_setup_reduce(PyObject * type_obj)6051 static int __Pyx_setup_reduce(PyObject* type_obj) {
6052     int ret = 0;
6053     PyObject *object_reduce = NULL;
6054     PyObject *object_reduce_ex = NULL;
6055     PyObject *reduce = NULL;
6056     PyObject *reduce_ex = NULL;
6057     PyObject *reduce_cython = NULL;
6058     PyObject *setstate = NULL;
6059     PyObject *setstate_cython = NULL;
6060 #if CYTHON_USE_PYTYPE_LOOKUP
6061     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
6062 #else
6063     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
6064 #endif
6065 #if CYTHON_USE_PYTYPE_LOOKUP
6066     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
6067 #else
6068     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
6069 #endif
6070     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
6071     if (reduce_ex == object_reduce_ex) {
6072 #if CYTHON_USE_PYTYPE_LOOKUP
6073         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
6074 #else
6075         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
6076 #endif
6077         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
6078         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
6079             reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
6080             ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
6081             ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
6082             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
6083             if (!setstate) PyErr_Clear();
6084             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
6085                 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
6086                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
6087                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
6088             }
6089             PyType_Modified((PyTypeObject*)type_obj);
6090         }
6091     }
6092     goto GOOD;
6093 BAD:
6094     if (!PyErr_Occurred())
6095         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
6096     ret = -1;
6097 GOOD:
6098 #if !CYTHON_USE_PYTYPE_LOOKUP
6099     Py_XDECREF(object_reduce);
6100     Py_XDECREF(object_reduce_ex);
6101 #endif
6102     Py_XDECREF(reduce);
6103     Py_XDECREF(reduce_ex);
6104     Py_XDECREF(reduce_cython);
6105     Py_XDECREF(setstate);
6106     Py_XDECREF(setstate_cython);
6107     return ret;
6108 }
6109 
6110 /* CLineInTraceback */
6111 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)6112 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
6113     PyObject *use_cline;
6114     PyObject *ptype, *pvalue, *ptraceback;
6115 #if CYTHON_COMPILING_IN_CPYTHON
6116     PyObject **cython_runtime_dict;
6117 #endif
6118     if (unlikely(!__pyx_cython_runtime)) {
6119         return c_line;
6120     }
6121     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
6122 #if CYTHON_COMPILING_IN_CPYTHON
6123     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
6124     if (likely(cython_runtime_dict)) {
6125         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
6126             use_cline, *cython_runtime_dict,
6127             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
6128     } else
6129 #endif
6130     {
6131       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
6132       if (use_cline_obj) {
6133         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
6134         Py_DECREF(use_cline_obj);
6135       } else {
6136         PyErr_Clear();
6137         use_cline = NULL;
6138       }
6139     }
6140     if (!use_cline) {
6141         c_line = 0;
6142         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
6143     }
6144     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
6145         c_line = 0;
6146     }
6147     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
6148     return c_line;
6149 }
6150 #endif
6151 
6152 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)6153 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
6154     int start = 0, mid = 0, end = count - 1;
6155     if (end >= 0 && code_line > entries[end].code_line) {
6156         return count;
6157     }
6158     while (start < end) {
6159         mid = start + (end - start) / 2;
6160         if (code_line < entries[mid].code_line) {
6161             end = mid;
6162         } else if (code_line > entries[mid].code_line) {
6163              start = mid + 1;
6164         } else {
6165             return mid;
6166         }
6167     }
6168     if (code_line <= entries[mid].code_line) {
6169         return mid;
6170     } else {
6171         return mid + 1;
6172     }
6173 }
__pyx_find_code_object(int code_line)6174 static PyCodeObject *__pyx_find_code_object(int code_line) {
6175     PyCodeObject* code_object;
6176     int pos;
6177     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
6178         return NULL;
6179     }
6180     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6181     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
6182         return NULL;
6183     }
6184     code_object = __pyx_code_cache.entries[pos].code_object;
6185     Py_INCREF(code_object);
6186     return code_object;
6187 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)6188 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
6189     int pos, i;
6190     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
6191     if (unlikely(!code_line)) {
6192         return;
6193     }
6194     if (unlikely(!entries)) {
6195         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
6196         if (likely(entries)) {
6197             __pyx_code_cache.entries = entries;
6198             __pyx_code_cache.max_count = 64;
6199             __pyx_code_cache.count = 1;
6200             entries[0].code_line = code_line;
6201             entries[0].code_object = code_object;
6202             Py_INCREF(code_object);
6203         }
6204         return;
6205     }
6206     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6207     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
6208         PyCodeObject* tmp = entries[pos].code_object;
6209         entries[pos].code_object = code_object;
6210         Py_DECREF(tmp);
6211         return;
6212     }
6213     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
6214         int new_max = __pyx_code_cache.max_count + 64;
6215         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
6216             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
6217         if (unlikely(!entries)) {
6218             return;
6219         }
6220         __pyx_code_cache.entries = entries;
6221         __pyx_code_cache.max_count = new_max;
6222     }
6223     for (i=__pyx_code_cache.count; i>pos; i--) {
6224         entries[i] = entries[i-1];
6225     }
6226     entries[pos].code_line = code_line;
6227     entries[pos].code_object = code_object;
6228     __pyx_code_cache.count++;
6229     Py_INCREF(code_object);
6230 }
6231 
6232 /* AddTraceback */
6233 #include "compile.h"
6234 #include "frameobject.h"
6235 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)6236 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
6237             const char *funcname, int c_line,
6238             int py_line, const char *filename) {
6239     PyCodeObject *py_code = 0;
6240     PyObject *py_srcfile = 0;
6241     PyObject *py_funcname = 0;
6242     #if PY_MAJOR_VERSION < 3
6243     py_srcfile = PyString_FromString(filename);
6244     #else
6245     py_srcfile = PyUnicode_FromString(filename);
6246     #endif
6247     if (!py_srcfile) goto bad;
6248     if (c_line) {
6249         #if PY_MAJOR_VERSION < 3
6250         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6251         #else
6252         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6253         #endif
6254     }
6255     else {
6256         #if PY_MAJOR_VERSION < 3
6257         py_funcname = PyString_FromString(funcname);
6258         #else
6259         py_funcname = PyUnicode_FromString(funcname);
6260         #endif
6261     }
6262     if (!py_funcname) goto bad;
6263     py_code = __Pyx_PyCode_New(
6264         0,
6265         0,
6266         0,
6267         0,
6268         0,
6269         __pyx_empty_bytes, /*PyObject *code,*/
6270         __pyx_empty_tuple, /*PyObject *consts,*/
6271         __pyx_empty_tuple, /*PyObject *names,*/
6272         __pyx_empty_tuple, /*PyObject *varnames,*/
6273         __pyx_empty_tuple, /*PyObject *freevars,*/
6274         __pyx_empty_tuple, /*PyObject *cellvars,*/
6275         py_srcfile,   /*PyObject *filename,*/
6276         py_funcname,  /*PyObject *name,*/
6277         py_line,
6278         __pyx_empty_bytes  /*PyObject *lnotab*/
6279     );
6280     Py_DECREF(py_srcfile);
6281     Py_DECREF(py_funcname);
6282     return py_code;
6283 bad:
6284     Py_XDECREF(py_srcfile);
6285     Py_XDECREF(py_funcname);
6286     return NULL;
6287 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)6288 static void __Pyx_AddTraceback(const char *funcname, int c_line,
6289                                int py_line, const char *filename) {
6290     PyCodeObject *py_code = 0;
6291     PyFrameObject *py_frame = 0;
6292     PyThreadState *tstate = __Pyx_PyThreadState_Current;
6293     if (c_line) {
6294         c_line = __Pyx_CLineForTraceback(tstate, c_line);
6295     }
6296     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
6297     if (!py_code) {
6298         py_code = __Pyx_CreateCodeObjectForTraceback(
6299             funcname, c_line, py_line, filename);
6300         if (!py_code) goto bad;
6301         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
6302     }
6303     py_frame = PyFrame_New(
6304         tstate,            /*PyThreadState *tstate,*/
6305         py_code,           /*PyCodeObject *code,*/
6306         __pyx_d,    /*PyObject *globals,*/
6307         0                  /*PyObject *locals*/
6308     );
6309     if (!py_frame) goto bad;
6310     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
6311     PyTraceBack_Here(py_frame);
6312 bad:
6313     Py_XDECREF(py_code);
6314     Py_XDECREF(py_frame);
6315 }
6316 
6317 /* CIntFromPyVerify */
6318 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
6319     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
6320 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
6321     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
6322 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
6323     {\
6324         func_type value = func_value;\
6325         if (sizeof(target_type) < sizeof(func_type)) {\
6326             if (unlikely(value != (func_type) (target_type) value)) {\
6327                 func_type zero = 0;\
6328                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
6329                     return (target_type) -1;\
6330                 if (is_unsigned && unlikely(value < zero))\
6331                     goto raise_neg_overflow;\
6332                 else\
6333                     goto raise_overflow;\
6334             }\
6335         }\
6336         return (target_type) value;\
6337     }
6338 
6339 /* CIntToPy */
__Pyx_PyInt_From_long(long value)6340 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
6341     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
6342     const int is_unsigned = neg_one > const_zero;
6343     if (is_unsigned) {
6344         if (sizeof(long) < sizeof(long)) {
6345             return PyInt_FromLong((long) value);
6346         } else if (sizeof(long) <= sizeof(unsigned long)) {
6347             return PyLong_FromUnsignedLong((unsigned long) value);
6348 #ifdef HAVE_LONG_LONG
6349         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6350             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6351 #endif
6352         }
6353     } else {
6354         if (sizeof(long) <= sizeof(long)) {
6355             return PyInt_FromLong((long) value);
6356 #ifdef HAVE_LONG_LONG
6357         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6358             return PyLong_FromLongLong((PY_LONG_LONG) value);
6359 #endif
6360         }
6361     }
6362     {
6363         int one = 1; int little = (int)*(unsigned char *)&one;
6364         unsigned char *bytes = (unsigned char *)&value;
6365         return _PyLong_FromByteArray(bytes, sizeof(long),
6366                                      little, !is_unsigned);
6367     }
6368 }
6369 
6370 /* CIntToPy */
__Pyx_PyInt_From_int(int value)6371 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
6372     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
6373     const int is_unsigned = neg_one > const_zero;
6374     if (is_unsigned) {
6375         if (sizeof(int) < sizeof(long)) {
6376             return PyInt_FromLong((long) value);
6377         } else if (sizeof(int) <= sizeof(unsigned long)) {
6378             return PyLong_FromUnsignedLong((unsigned long) value);
6379 #ifdef HAVE_LONG_LONG
6380         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6381             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6382 #endif
6383         }
6384     } else {
6385         if (sizeof(int) <= sizeof(long)) {
6386             return PyInt_FromLong((long) value);
6387 #ifdef HAVE_LONG_LONG
6388         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6389             return PyLong_FromLongLong((PY_LONG_LONG) value);
6390 #endif
6391         }
6392     }
6393     {
6394         int one = 1; int little = (int)*(unsigned char *)&one;
6395         unsigned char *bytes = (unsigned char *)&value;
6396         return _PyLong_FromByteArray(bytes, sizeof(int),
6397                                      little, !is_unsigned);
6398     }
6399 }
6400 
6401 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)6402 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
6403     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
6404     const int is_unsigned = neg_one > const_zero;
6405 #if PY_MAJOR_VERSION < 3
6406     if (likely(PyInt_Check(x))) {
6407         if (sizeof(long) < sizeof(long)) {
6408             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
6409         } else {
6410             long val = PyInt_AS_LONG(x);
6411             if (is_unsigned && unlikely(val < 0)) {
6412                 goto raise_neg_overflow;
6413             }
6414             return (long) val;
6415         }
6416     } else
6417 #endif
6418     if (likely(PyLong_Check(x))) {
6419         if (is_unsigned) {
6420 #if CYTHON_USE_PYLONG_INTERNALS
6421             const digit* digits = ((PyLongObject*)x)->ob_digit;
6422             switch (Py_SIZE(x)) {
6423                 case  0: return (long) 0;
6424                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
6425                 case 2:
6426                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6427                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6428                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6429                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
6430                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6431                         }
6432                     }
6433                     break;
6434                 case 3:
6435                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6436                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6437                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6438                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
6439                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6440                         }
6441                     }
6442                     break;
6443                 case 4:
6444                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6445                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6446                             __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])))
6447                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
6448                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6449                         }
6450                     }
6451                     break;
6452             }
6453 #endif
6454 #if CYTHON_COMPILING_IN_CPYTHON
6455             if (unlikely(Py_SIZE(x) < 0)) {
6456                 goto raise_neg_overflow;
6457             }
6458 #else
6459             {
6460                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6461                 if (unlikely(result < 0))
6462                     return (long) -1;
6463                 if (unlikely(result == 1))
6464                     goto raise_neg_overflow;
6465             }
6466 #endif
6467             if (sizeof(long) <= sizeof(unsigned long)) {
6468                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
6469 #ifdef HAVE_LONG_LONG
6470             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6471                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6472 #endif
6473             }
6474         } else {
6475 #if CYTHON_USE_PYLONG_INTERNALS
6476             const digit* digits = ((PyLongObject*)x)->ob_digit;
6477             switch (Py_SIZE(x)) {
6478                 case  0: return (long) 0;
6479                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
6480                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
6481                 case -2:
6482                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
6483                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6484                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6485                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6486                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6487                         }
6488                     }
6489                     break;
6490                 case 2:
6491                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6492                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6493                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6494                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6495                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6496                         }
6497                     }
6498                     break;
6499                 case -3:
6500                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6501                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6502                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6503                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6504                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6505                         }
6506                     }
6507                     break;
6508                 case 3:
6509                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6510                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6511                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6512                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6513                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6514                         }
6515                     }
6516                     break;
6517                 case -4:
6518                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6519                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6520                             __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])))
6521                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6522                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6523                         }
6524                     }
6525                     break;
6526                 case 4:
6527                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6528                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6529                             __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])))
6530                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6531                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6532                         }
6533                     }
6534                     break;
6535             }
6536 #endif
6537             if (sizeof(long) <= sizeof(long)) {
6538                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
6539 #ifdef HAVE_LONG_LONG
6540             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6541                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
6542 #endif
6543             }
6544         }
6545         {
6546 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6547             PyErr_SetString(PyExc_RuntimeError,
6548                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6549 #else
6550             long val;
6551             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6552  #if PY_MAJOR_VERSION < 3
6553             if (likely(v) && !PyLong_Check(v)) {
6554                 PyObject *tmp = v;
6555                 v = PyNumber_Long(tmp);
6556                 Py_DECREF(tmp);
6557             }
6558  #endif
6559             if (likely(v)) {
6560                 int one = 1; int is_little = (int)*(unsigned char *)&one;
6561                 unsigned char *bytes = (unsigned char *)&val;
6562                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
6563                                               bytes, sizeof(val),
6564                                               is_little, !is_unsigned);
6565                 Py_DECREF(v);
6566                 if (likely(!ret))
6567                     return val;
6568             }
6569 #endif
6570             return (long) -1;
6571         }
6572     } else {
6573         long val;
6574         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6575         if (!tmp) return (long) -1;
6576         val = __Pyx_PyInt_As_long(tmp);
6577         Py_DECREF(tmp);
6578         return val;
6579     }
6580 raise_overflow:
6581     PyErr_SetString(PyExc_OverflowError,
6582         "value too large to convert to long");
6583     return (long) -1;
6584 raise_neg_overflow:
6585     PyErr_SetString(PyExc_OverflowError,
6586         "can't convert negative value to long");
6587     return (long) -1;
6588 }
6589 
6590 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)6591 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
6592     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
6593     const int is_unsigned = neg_one > const_zero;
6594 #if PY_MAJOR_VERSION < 3
6595     if (likely(PyInt_Check(x))) {
6596         if (sizeof(int) < sizeof(long)) {
6597             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
6598         } else {
6599             long val = PyInt_AS_LONG(x);
6600             if (is_unsigned && unlikely(val < 0)) {
6601                 goto raise_neg_overflow;
6602             }
6603             return (int) val;
6604         }
6605     } else
6606 #endif
6607     if (likely(PyLong_Check(x))) {
6608         if (is_unsigned) {
6609 #if CYTHON_USE_PYLONG_INTERNALS
6610             const digit* digits = ((PyLongObject*)x)->ob_digit;
6611             switch (Py_SIZE(x)) {
6612                 case  0: return (int) 0;
6613                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
6614                 case 2:
6615                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6616                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6617                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6618                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
6619                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6620                         }
6621                     }
6622                     break;
6623                 case 3:
6624                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6625                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6626                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6627                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
6628                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6629                         }
6630                     }
6631                     break;
6632                 case 4:
6633                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6634                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6635                             __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])))
6636                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
6637                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6638                         }
6639                     }
6640                     break;
6641             }
6642 #endif
6643 #if CYTHON_COMPILING_IN_CPYTHON
6644             if (unlikely(Py_SIZE(x) < 0)) {
6645                 goto raise_neg_overflow;
6646             }
6647 #else
6648             {
6649                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6650                 if (unlikely(result < 0))
6651                     return (int) -1;
6652                 if (unlikely(result == 1))
6653                     goto raise_neg_overflow;
6654             }
6655 #endif
6656             if (sizeof(int) <= sizeof(unsigned long)) {
6657                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
6658 #ifdef HAVE_LONG_LONG
6659             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6660                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6661 #endif
6662             }
6663         } else {
6664 #if CYTHON_USE_PYLONG_INTERNALS
6665             const digit* digits = ((PyLongObject*)x)->ob_digit;
6666             switch (Py_SIZE(x)) {
6667                 case  0: return (int) 0;
6668                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
6669                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
6670                 case -2:
6671                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
6672                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6673                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6674                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6675                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6676                         }
6677                     }
6678                     break;
6679                 case 2:
6680                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6681                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6682                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6683                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6684                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6685                         }
6686                     }
6687                     break;
6688                 case -3:
6689                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6690                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6691                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6692                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6693                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6694                         }
6695                     }
6696                     break;
6697                 case 3:
6698                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6699                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6700                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6701                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6702                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6703                         }
6704                     }
6705                     break;
6706                 case -4:
6707                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6708                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6709                             __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])))
6710                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6711                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6712                         }
6713                     }
6714                     break;
6715                 case 4:
6716                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6717                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6718                             __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])))
6719                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6720                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6721                         }
6722                     }
6723                     break;
6724             }
6725 #endif
6726             if (sizeof(int) <= sizeof(long)) {
6727                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
6728 #ifdef HAVE_LONG_LONG
6729             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6730                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
6731 #endif
6732             }
6733         }
6734         {
6735 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6736             PyErr_SetString(PyExc_RuntimeError,
6737                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6738 #else
6739             int val;
6740             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6741  #if PY_MAJOR_VERSION < 3
6742             if (likely(v) && !PyLong_Check(v)) {
6743                 PyObject *tmp = v;
6744                 v = PyNumber_Long(tmp);
6745                 Py_DECREF(tmp);
6746             }
6747  #endif
6748             if (likely(v)) {
6749                 int one = 1; int is_little = (int)*(unsigned char *)&one;
6750                 unsigned char *bytes = (unsigned char *)&val;
6751                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
6752                                               bytes, sizeof(val),
6753                                               is_little, !is_unsigned);
6754                 Py_DECREF(v);
6755                 if (likely(!ret))
6756                     return val;
6757             }
6758 #endif
6759             return (int) -1;
6760         }
6761     } else {
6762         int val;
6763         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6764         if (!tmp) return (int) -1;
6765         val = __Pyx_PyInt_As_int(tmp);
6766         Py_DECREF(tmp);
6767         return val;
6768     }
6769 raise_overflow:
6770     PyErr_SetString(PyExc_OverflowError,
6771         "value too large to convert to int");
6772     return (int) -1;
6773 raise_neg_overflow:
6774     PyErr_SetString(PyExc_OverflowError,
6775         "can't convert negative value to int");
6776     return (int) -1;
6777 }
6778 
6779 /* FastTypeChecks */
6780 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)6781 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
6782     while (a) {
6783         a = a->tp_base;
6784         if (a == b)
6785             return 1;
6786     }
6787     return b == &PyBaseObject_Type;
6788 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)6789 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
6790     PyObject *mro;
6791     if (a == b) return 1;
6792     mro = a->tp_mro;
6793     if (likely(mro)) {
6794         Py_ssize_t i, n;
6795         n = PyTuple_GET_SIZE(mro);
6796         for (i = 0; i < n; i++) {
6797             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
6798                 return 1;
6799         }
6800         return 0;
6801     }
6802     return __Pyx_InBases(a, b);
6803 }
6804 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)6805 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
6806     PyObject *exception, *value, *tb;
6807     int res;
6808     __Pyx_PyThreadState_declare
6809     __Pyx_PyThreadState_assign
6810     __Pyx_ErrFetch(&exception, &value, &tb);
6811     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
6812     if (unlikely(res == -1)) {
6813         PyErr_WriteUnraisable(err);
6814         res = 0;
6815     }
6816     if (!res) {
6817         res = PyObject_IsSubclass(err, exc_type2);
6818         if (unlikely(res == -1)) {
6819             PyErr_WriteUnraisable(err);
6820             res = 0;
6821         }
6822     }
6823     __Pyx_ErrRestore(exception, value, tb);
6824     return res;
6825 }
6826 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)6827 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
6828     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
6829     if (!res) {
6830         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
6831     }
6832     return res;
6833 }
6834 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)6835 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6836     Py_ssize_t i, n;
6837     assert(PyExceptionClass_Check(exc_type));
6838     n = PyTuple_GET_SIZE(tuple);
6839 #if PY_MAJOR_VERSION >= 3
6840     for (i=0; i<n; i++) {
6841         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6842     }
6843 #endif
6844     for (i=0; i<n; i++) {
6845         PyObject *t = PyTuple_GET_ITEM(tuple, i);
6846         #if PY_MAJOR_VERSION < 3
6847         if (likely(exc_type == t)) return 1;
6848         #endif
6849         if (likely(PyExceptionClass_Check(t))) {
6850             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
6851         } else {
6852         }
6853     }
6854     return 0;
6855 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)6856 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
6857     if (likely(err == exc_type)) return 1;
6858     if (likely(PyExceptionClass_Check(err))) {
6859         if (likely(PyExceptionClass_Check(exc_type))) {
6860             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
6861         } else if (likely(PyTuple_Check(exc_type))) {
6862             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
6863         } else {
6864         }
6865     }
6866     return PyErr_GivenExceptionMatches(err, exc_type);
6867 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)6868 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
6869     assert(PyExceptionClass_Check(exc_type1));
6870     assert(PyExceptionClass_Check(exc_type2));
6871     if (likely(err == exc_type1 || err == exc_type2)) return 1;
6872     if (likely(PyExceptionClass_Check(err))) {
6873         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
6874     }
6875     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
6876 }
6877 #endif
6878 
6879 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)6880 static int __Pyx_check_binary_version(void) {
6881     char ctversion[4], rtversion[4];
6882     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
6883     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
6884     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
6885         char message[200];
6886         PyOS_snprintf(message, sizeof(message),
6887                       "compiletime version %s of module '%.100s' "
6888                       "does not match runtime version %s",
6889                       ctversion, __Pyx_MODULE_NAME, rtversion);
6890         return PyErr_WarnEx(NULL, message, 1);
6891     }
6892     return 0;
6893 }
6894 
6895 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)6896 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
6897     while (t->p) {
6898         #if PY_MAJOR_VERSION < 3
6899         if (t->is_unicode) {
6900             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
6901         } else if (t->intern) {
6902             *t->p = PyString_InternFromString(t->s);
6903         } else {
6904             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
6905         }
6906         #else
6907         if (t->is_unicode | t->is_str) {
6908             if (t->intern) {
6909                 *t->p = PyUnicode_InternFromString(t->s);
6910             } else if (t->encoding) {
6911                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
6912             } else {
6913                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
6914             }
6915         } else {
6916             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
6917         }
6918         #endif
6919         if (!*t->p)
6920             return -1;
6921         if (PyObject_Hash(*t->p) == -1)
6922             return -1;
6923         ++t;
6924     }
6925     return 0;
6926 }
6927 
__Pyx_PyUnicode_FromString(const char * c_str)6928 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
6929     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
6930 }
__Pyx_PyObject_AsString(PyObject * o)6931 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
6932     Py_ssize_t ignore;
6933     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
6934 }
6935 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6936 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)6937 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6938     char* defenc_c;
6939     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
6940     if (!defenc) return NULL;
6941     defenc_c = PyBytes_AS_STRING(defenc);
6942 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6943     {
6944         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
6945         char* c;
6946         for (c = defenc_c; c < end; c++) {
6947             if ((unsigned char) (*c) >= 128) {
6948                 PyUnicode_AsASCIIString(o);
6949                 return NULL;
6950             }
6951         }
6952     }
6953 #endif
6954     *length = PyBytes_GET_SIZE(defenc);
6955     return defenc_c;
6956 }
6957 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)6958 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6959     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
6960 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6961     if (likely(PyUnicode_IS_ASCII(o))) {
6962         *length = PyUnicode_GET_LENGTH(o);
6963         return PyUnicode_AsUTF8(o);
6964     } else {
6965         PyUnicode_AsASCIIString(o);
6966         return NULL;
6967     }
6968 #else
6969     return PyUnicode_AsUTF8AndSize(o, length);
6970 #endif
6971 }
6972 #endif
6973 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)6974 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6975 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6976     if (
6977 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6978             __Pyx_sys_getdefaultencoding_not_ascii &&
6979 #endif
6980             PyUnicode_Check(o)) {
6981         return __Pyx_PyUnicode_AsStringAndSize(o, length);
6982     } else
6983 #endif
6984 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
6985     if (PyByteArray_Check(o)) {
6986         *length = PyByteArray_GET_SIZE(o);
6987         return PyByteArray_AS_STRING(o);
6988     } else
6989 #endif
6990     {
6991         char* result;
6992         int r = PyBytes_AsStringAndSize(o, &result, length);
6993         if (unlikely(r < 0)) {
6994             return NULL;
6995         } else {
6996             return result;
6997         }
6998     }
6999 }
__Pyx_PyObject_IsTrue(PyObject * x)7000 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
7001    int is_true = x == Py_True;
7002    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
7003    else return PyObject_IsTrue(x);
7004 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)7005 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
7006     int retval;
7007     if (unlikely(!x)) return -1;
7008     retval = __Pyx_PyObject_IsTrue(x);
7009     Py_DECREF(x);
7010     return retval;
7011 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)7012 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
7013 #if PY_MAJOR_VERSION >= 3
7014     if (PyLong_Check(result)) {
7015         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
7016                 "__int__ returned non-int (type %.200s).  "
7017                 "The ability to return an instance of a strict subclass of int "
7018                 "is deprecated, and may be removed in a future version of Python.",
7019                 Py_TYPE(result)->tp_name)) {
7020             Py_DECREF(result);
7021             return NULL;
7022         }
7023         return result;
7024     }
7025 #endif
7026     PyErr_Format(PyExc_TypeError,
7027                  "__%.4s__ returned non-%.4s (type %.200s)",
7028                  type_name, type_name, Py_TYPE(result)->tp_name);
7029     Py_DECREF(result);
7030     return NULL;
7031 }
__Pyx_PyNumber_IntOrLong(PyObject * x)7032 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
7033 #if CYTHON_USE_TYPE_SLOTS
7034   PyNumberMethods *m;
7035 #endif
7036   const char *name = NULL;
7037   PyObject *res = NULL;
7038 #if PY_MAJOR_VERSION < 3
7039   if (likely(PyInt_Check(x) || PyLong_Check(x)))
7040 #else
7041   if (likely(PyLong_Check(x)))
7042 #endif
7043     return __Pyx_NewRef(x);
7044 #if CYTHON_USE_TYPE_SLOTS
7045   m = Py_TYPE(x)->tp_as_number;
7046   #if PY_MAJOR_VERSION < 3
7047   if (m && m->nb_int) {
7048     name = "int";
7049     res = m->nb_int(x);
7050   }
7051   else if (m && m->nb_long) {
7052     name = "long";
7053     res = m->nb_long(x);
7054   }
7055   #else
7056   if (likely(m && m->nb_int)) {
7057     name = "int";
7058     res = m->nb_int(x);
7059   }
7060   #endif
7061 #else
7062   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
7063     res = PyNumber_Int(x);
7064   }
7065 #endif
7066   if (likely(res)) {
7067 #if PY_MAJOR_VERSION < 3
7068     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
7069 #else
7070     if (unlikely(!PyLong_CheckExact(res))) {
7071 #endif
7072         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
7073     }
7074   }
7075   else if (!PyErr_Occurred()) {
7076     PyErr_SetString(PyExc_TypeError,
7077                     "an integer is required");
7078   }
7079   return res;
7080 }
7081 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
7082   Py_ssize_t ival;
7083   PyObject *x;
7084 #if PY_MAJOR_VERSION < 3
7085   if (likely(PyInt_CheckExact(b))) {
7086     if (sizeof(Py_ssize_t) >= sizeof(long))
7087         return PyInt_AS_LONG(b);
7088     else
7089         return PyInt_AsSsize_t(b);
7090   }
7091 #endif
7092   if (likely(PyLong_CheckExact(b))) {
7093     #if CYTHON_USE_PYLONG_INTERNALS
7094     const digit* digits = ((PyLongObject*)b)->ob_digit;
7095     const Py_ssize_t size = Py_SIZE(b);
7096     if (likely(__Pyx_sst_abs(size) <= 1)) {
7097         ival = likely(size) ? digits[0] : 0;
7098         if (size == -1) ival = -ival;
7099         return ival;
7100     } else {
7101       switch (size) {
7102          case 2:
7103            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7104              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7105            }
7106            break;
7107          case -2:
7108            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7109              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7110            }
7111            break;
7112          case 3:
7113            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7114              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7115            }
7116            break;
7117          case -3:
7118            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7119              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7120            }
7121            break;
7122          case 4:
7123            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7124              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]));
7125            }
7126            break;
7127          case -4:
7128            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7129              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]));
7130            }
7131            break;
7132       }
7133     }
7134     #endif
7135     return PyLong_AsSsize_t(b);
7136   }
7137   x = PyNumber_Index(b);
7138   if (!x) return -1;
7139   ival = PyInt_AsSsize_t(x);
7140   Py_DECREF(x);
7141   return ival;
7142 }
7143 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
7144   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
7145 }
7146 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
7147     return PyInt_FromSize_t(ival);
7148 }
7149 
7150 
7151 #endif /* Py_PYTHON_H */
7152