Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pybedtools/cbedtools.cpp @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 /* Generated by Cython 0.29.37 */ | |
2 | |
3 /* BEGIN: Cython Metadata | |
4 { | |
5 "distutils": { | |
6 "depends": [ | |
7 "pybedtools/include/bedFile.h", | |
8 "pybedtools/include/fileType.h", | |
9 "pybedtools/include/gzstream.h", | |
10 "pybedtools/include/lineFileUtilities.h" | |
11 ], | |
12 "include_dirs": [ | |
13 "pybedtools/include/" | |
14 ], | |
15 "language": "c++", | |
16 "libraries": [ | |
17 "stdc++", | |
18 "z" | |
19 ], | |
20 "name": "pybedtools.cbedtools", | |
21 "sources": [ | |
22 "pybedtools/cbedtools.pyx", | |
23 "pybedtools/include/bedFile.cpp", | |
24 "pybedtools/include/fileType.cpp", | |
25 "pybedtools/include/gzstream.cpp" | |
26 ] | |
27 }, | |
28 "module_name": "pybedtools.cbedtools" | |
29 } | |
30 END: Cython Metadata */ | |
31 | |
32 #ifndef PY_SSIZE_T_CLEAN | |
33 #define PY_SSIZE_T_CLEAN | |
34 #endif /* PY_SSIZE_T_CLEAN */ | |
35 #include "Python.h" | |
36 #ifndef Py_PYTHON_H | |
37 #error Python headers needed to compile C extensions, please install development version of Python. | |
38 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) | |
39 #error Cython requires Python 2.6+ or Python 3.3+. | |
40 #else | |
41 #define CYTHON_ABI "0_29_37" | |
42 #define CYTHON_HEX_VERSION 0x001D25F0 | |
43 #define CYTHON_FUTURE_DIVISION 0 | |
44 #include <stddef.h> | |
45 #ifndef offsetof | |
46 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) | |
47 #endif | |
48 #if !defined(WIN32) && !defined(MS_WINDOWS) | |
49 #ifndef __stdcall | |
50 #define __stdcall | |
51 #endif | |
52 #ifndef __cdecl | |
53 #define __cdecl | |
54 #endif | |
55 #ifndef __fastcall | |
56 #define __fastcall | |
57 #endif | |
58 #endif | |
59 #ifndef DL_IMPORT | |
60 #define DL_IMPORT(t) t | |
61 #endif | |
62 #ifndef DL_EXPORT | |
63 #define DL_EXPORT(t) t | |
64 #endif | |
65 #define __PYX_COMMA , | |
66 #ifndef HAVE_LONG_LONG | |
67 #if PY_VERSION_HEX >= 0x02070000 | |
68 #define HAVE_LONG_LONG | |
69 #endif | |
70 #endif | |
71 #ifndef PY_LONG_LONG | |
72 #define PY_LONG_LONG LONG_LONG | |
73 #endif | |
74 #ifndef Py_HUGE_VAL | |
75 #define Py_HUGE_VAL HUGE_VAL | |
76 #endif | |
77 #ifdef PYPY_VERSION | |
78 #define CYTHON_COMPILING_IN_PYPY 1 | |
79 #define CYTHON_COMPILING_IN_PYSTON 0 | |
80 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
81 #define CYTHON_COMPILING_IN_NOGIL 0 | |
82 #undef CYTHON_USE_TYPE_SLOTS | |
83 #define CYTHON_USE_TYPE_SLOTS 0 | |
84 #undef CYTHON_USE_PYTYPE_LOOKUP | |
85 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
86 #if PY_VERSION_HEX < 0x03050000 | |
87 #undef CYTHON_USE_ASYNC_SLOTS | |
88 #define CYTHON_USE_ASYNC_SLOTS 0 | |
89 #elif !defined(CYTHON_USE_ASYNC_SLOTS) | |
90 #define CYTHON_USE_ASYNC_SLOTS 1 | |
91 #endif | |
92 #undef CYTHON_USE_PYLIST_INTERNALS | |
93 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
94 #undef CYTHON_USE_UNICODE_INTERNALS | |
95 #define CYTHON_USE_UNICODE_INTERNALS 0 | |
96 #undef CYTHON_USE_UNICODE_WRITER | |
97 #define CYTHON_USE_UNICODE_WRITER 0 | |
98 #undef CYTHON_USE_PYLONG_INTERNALS | |
99 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
100 #undef CYTHON_AVOID_BORROWED_REFS | |
101 #define CYTHON_AVOID_BORROWED_REFS 1 | |
102 #undef CYTHON_ASSUME_SAFE_MACROS | |
103 #define CYTHON_ASSUME_SAFE_MACROS 0 | |
104 #undef CYTHON_UNPACK_METHODS | |
105 #define CYTHON_UNPACK_METHODS 0 | |
106 #undef CYTHON_FAST_THREAD_STATE | |
107 #define CYTHON_FAST_THREAD_STATE 0 | |
108 #undef CYTHON_FAST_PYCALL | |
109 #define CYTHON_FAST_PYCALL 0 | |
110 #if PY_VERSION_HEX < 0x03090000 | |
111 #undef CYTHON_PEP489_MULTI_PHASE_INIT | |
112 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 | |
113 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) | |
114 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 | |
115 #endif | |
116 #undef CYTHON_USE_TP_FINALIZE | |
117 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) | |
118 #undef CYTHON_USE_DICT_VERSIONS | |
119 #define CYTHON_USE_DICT_VERSIONS 0 | |
120 #undef CYTHON_USE_EXC_INFO_STACK | |
121 #define CYTHON_USE_EXC_INFO_STACK 0 | |
122 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
123 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 | |
124 #endif | |
125 #elif defined(PYSTON_VERSION) | |
126 #define CYTHON_COMPILING_IN_PYPY 0 | |
127 #define CYTHON_COMPILING_IN_PYSTON 1 | |
128 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
129 #define CYTHON_COMPILING_IN_NOGIL 0 | |
130 #ifndef CYTHON_USE_TYPE_SLOTS | |
131 #define CYTHON_USE_TYPE_SLOTS 1 | |
132 #endif | |
133 #undef CYTHON_USE_PYTYPE_LOOKUP | |
134 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
135 #undef CYTHON_USE_ASYNC_SLOTS | |
136 #define CYTHON_USE_ASYNC_SLOTS 0 | |
137 #undef CYTHON_USE_PYLIST_INTERNALS | |
138 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
139 #ifndef CYTHON_USE_UNICODE_INTERNALS | |
140 #define CYTHON_USE_UNICODE_INTERNALS 1 | |
141 #endif | |
142 #undef CYTHON_USE_UNICODE_WRITER | |
143 #define CYTHON_USE_UNICODE_WRITER 0 | |
144 #undef CYTHON_USE_PYLONG_INTERNALS | |
145 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
146 #ifndef CYTHON_AVOID_BORROWED_REFS | |
147 #define CYTHON_AVOID_BORROWED_REFS 0 | |
148 #endif | |
149 #ifndef CYTHON_ASSUME_SAFE_MACROS | |
150 #define CYTHON_ASSUME_SAFE_MACROS 1 | |
151 #endif | |
152 #ifndef CYTHON_UNPACK_METHODS | |
153 #define CYTHON_UNPACK_METHODS 1 | |
154 #endif | |
155 #undef CYTHON_FAST_THREAD_STATE | |
156 #define CYTHON_FAST_THREAD_STATE 0 | |
157 #undef CYTHON_FAST_PYCALL | |
158 #define CYTHON_FAST_PYCALL 0 | |
159 #undef CYTHON_PEP489_MULTI_PHASE_INIT | |
160 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 | |
161 #undef CYTHON_USE_TP_FINALIZE | |
162 #define CYTHON_USE_TP_FINALIZE 0 | |
163 #undef CYTHON_USE_DICT_VERSIONS | |
164 #define CYTHON_USE_DICT_VERSIONS 0 | |
165 #undef CYTHON_USE_EXC_INFO_STACK | |
166 #define CYTHON_USE_EXC_INFO_STACK 0 | |
167 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
168 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 | |
169 #endif | |
170 #elif defined(PY_NOGIL) | |
171 #define CYTHON_COMPILING_IN_PYPY 0 | |
172 #define CYTHON_COMPILING_IN_PYSTON 0 | |
173 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
174 #define CYTHON_COMPILING_IN_NOGIL 1 | |
175 #ifndef CYTHON_USE_TYPE_SLOTS | |
176 #define CYTHON_USE_TYPE_SLOTS 1 | |
177 #endif | |
178 #undef CYTHON_USE_PYTYPE_LOOKUP | |
179 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
180 #ifndef CYTHON_USE_ASYNC_SLOTS | |
181 #define CYTHON_USE_ASYNC_SLOTS 1 | |
182 #endif | |
183 #undef CYTHON_USE_PYLIST_INTERNALS | |
184 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
185 #ifndef CYTHON_USE_UNICODE_INTERNALS | |
186 #define CYTHON_USE_UNICODE_INTERNALS 1 | |
187 #endif | |
188 #undef CYTHON_USE_UNICODE_WRITER | |
189 #define CYTHON_USE_UNICODE_WRITER 0 | |
190 #undef CYTHON_USE_PYLONG_INTERNALS | |
191 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
192 #ifndef CYTHON_AVOID_BORROWED_REFS | |
193 #define CYTHON_AVOID_BORROWED_REFS 0 | |
194 #endif | |
195 #ifndef CYTHON_ASSUME_SAFE_MACROS | |
196 #define CYTHON_ASSUME_SAFE_MACROS 1 | |
197 #endif | |
198 #ifndef CYTHON_UNPACK_METHODS | |
199 #define CYTHON_UNPACK_METHODS 1 | |
200 #endif | |
201 #undef CYTHON_FAST_THREAD_STATE | |
202 #define CYTHON_FAST_THREAD_STATE 0 | |
203 #undef CYTHON_FAST_PYCALL | |
204 #define CYTHON_FAST_PYCALL 0 | |
205 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT | |
206 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 | |
207 #endif | |
208 #ifndef CYTHON_USE_TP_FINALIZE | |
209 #define CYTHON_USE_TP_FINALIZE 1 | |
210 #endif | |
211 #undef CYTHON_USE_DICT_VERSIONS | |
212 #define CYTHON_USE_DICT_VERSIONS 0 | |
213 #undef CYTHON_USE_EXC_INFO_STACK | |
214 #define CYTHON_USE_EXC_INFO_STACK 0 | |
215 #else | |
216 #define CYTHON_COMPILING_IN_PYPY 0 | |
217 #define CYTHON_COMPILING_IN_PYSTON 0 | |
218 #define CYTHON_COMPILING_IN_CPYTHON 1 | |
219 #define CYTHON_COMPILING_IN_NOGIL 0 | |
220 #ifndef CYTHON_USE_TYPE_SLOTS | |
221 #define CYTHON_USE_TYPE_SLOTS 1 | |
222 #endif | |
223 #if PY_VERSION_HEX < 0x02070000 | |
224 #undef CYTHON_USE_PYTYPE_LOOKUP | |
225 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
226 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) | |
227 #define CYTHON_USE_PYTYPE_LOOKUP 1 | |
228 #endif | |
229 #if PY_MAJOR_VERSION < 3 | |
230 #undef CYTHON_USE_ASYNC_SLOTS | |
231 #define CYTHON_USE_ASYNC_SLOTS 0 | |
232 #elif !defined(CYTHON_USE_ASYNC_SLOTS) | |
233 #define CYTHON_USE_ASYNC_SLOTS 1 | |
234 #endif | |
235 #if PY_VERSION_HEX < 0x02070000 | |
236 #undef CYTHON_USE_PYLONG_INTERNALS | |
237 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
238 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) | |
239 #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) | |
240 #endif | |
241 #ifndef CYTHON_USE_PYLIST_INTERNALS | |
242 #define CYTHON_USE_PYLIST_INTERNALS 1 | |
243 #endif | |
244 #ifndef CYTHON_USE_UNICODE_INTERNALS | |
245 #define CYTHON_USE_UNICODE_INTERNALS 1 | |
246 #endif | |
247 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 | |
248 #undef CYTHON_USE_UNICODE_WRITER | |
249 #define CYTHON_USE_UNICODE_WRITER 0 | |
250 #elif !defined(CYTHON_USE_UNICODE_WRITER) | |
251 #define CYTHON_USE_UNICODE_WRITER 1 | |
252 #endif | |
253 #ifndef CYTHON_AVOID_BORROWED_REFS | |
254 #define CYTHON_AVOID_BORROWED_REFS 0 | |
255 #endif | |
256 #ifndef CYTHON_ASSUME_SAFE_MACROS | |
257 #define CYTHON_ASSUME_SAFE_MACROS 1 | |
258 #endif | |
259 #ifndef CYTHON_UNPACK_METHODS | |
260 #define CYTHON_UNPACK_METHODS 1 | |
261 #endif | |
262 #if PY_VERSION_HEX >= 0x030B00A4 | |
263 #undef CYTHON_FAST_THREAD_STATE | |
264 #define CYTHON_FAST_THREAD_STATE 0 | |
265 #elif !defined(CYTHON_FAST_THREAD_STATE) | |
266 #define CYTHON_FAST_THREAD_STATE 1 | |
267 #endif | |
268 #ifndef CYTHON_FAST_PYCALL | |
269 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) | |
270 #endif | |
271 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT | |
272 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) | |
273 #endif | |
274 #ifndef CYTHON_USE_TP_FINALIZE | |
275 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) | |
276 #endif | |
277 #ifndef CYTHON_USE_DICT_VERSIONS | |
278 #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) | |
279 #endif | |
280 #if PY_VERSION_HEX >= 0x030B00A4 | |
281 #undef CYTHON_USE_EXC_INFO_STACK | |
282 #define CYTHON_USE_EXC_INFO_STACK 0 | |
283 #elif !defined(CYTHON_USE_EXC_INFO_STACK) | |
284 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) | |
285 #endif | |
286 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
287 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 | |
288 #endif | |
289 #endif | |
290 #if !defined(CYTHON_FAST_PYCCALL) | |
291 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) | |
292 #endif | |
293 #if CYTHON_USE_PYLONG_INTERNALS | |
294 #if PY_MAJOR_VERSION < 3 | |
295 #include "longintrepr.h" | |
296 #endif | |
297 #undef SHIFT | |
298 #undef BASE | |
299 #undef MASK | |
300 #ifdef SIZEOF_VOID_P | |
301 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; | |
302 #endif | |
303 #endif | |
304 #ifndef __has_attribute | |
305 #define __has_attribute(x) 0 | |
306 #endif | |
307 #ifndef __has_cpp_attribute | |
308 #define __has_cpp_attribute(x) 0 | |
309 #endif | |
310 #ifndef CYTHON_RESTRICT | |
311 #if defined(__GNUC__) | |
312 #define CYTHON_RESTRICT __restrict__ | |
313 #elif defined(_MSC_VER) && _MSC_VER >= 1400 | |
314 #define CYTHON_RESTRICT __restrict | |
315 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
316 #define CYTHON_RESTRICT restrict | |
317 #else | |
318 #define CYTHON_RESTRICT | |
319 #endif | |
320 #endif | |
321 #ifndef CYTHON_UNUSED | |
322 # if defined(__GNUC__) | |
323 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
324 # define CYTHON_UNUSED __attribute__ ((__unused__)) | |
325 # else | |
326 # define CYTHON_UNUSED | |
327 # endif | |
328 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) | |
329 # define CYTHON_UNUSED __attribute__ ((__unused__)) | |
330 # else | |
331 # define CYTHON_UNUSED | |
332 # endif | |
333 #endif | |
334 #ifndef CYTHON_MAYBE_UNUSED_VAR | |
335 # if defined(__cplusplus) | |
336 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } | |
337 # else | |
338 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) | |
339 # endif | |
340 #endif | |
341 #ifndef CYTHON_NCP_UNUSED | |
342 # if CYTHON_COMPILING_IN_CPYTHON | |
343 # define CYTHON_NCP_UNUSED | |
344 # else | |
345 # define CYTHON_NCP_UNUSED CYTHON_UNUSED | |
346 # endif | |
347 #endif | |
348 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) | |
349 #ifdef _MSC_VER | |
350 #ifndef _MSC_STDINT_H_ | |
351 #if _MSC_VER < 1300 | |
352 typedef unsigned char uint8_t; | |
353 typedef unsigned int uint32_t; | |
354 #else | |
355 typedef unsigned __int8 uint8_t; | |
356 typedef unsigned __int32 uint32_t; | |
357 #endif | |
358 #endif | |
359 #else | |
360 #include <stdint.h> | |
361 #endif | |
362 #ifndef CYTHON_FALLTHROUGH | |
363 #if defined(__cplusplus) && __cplusplus >= 201103L | |
364 #if __has_cpp_attribute(fallthrough) | |
365 #define CYTHON_FALLTHROUGH [[fallthrough]] | |
366 #elif __has_cpp_attribute(clang::fallthrough) | |
367 #define CYTHON_FALLTHROUGH [[clang::fallthrough]] | |
368 #elif __has_cpp_attribute(gnu::fallthrough) | |
369 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] | |
370 #endif | |
371 #endif | |
372 #ifndef CYTHON_FALLTHROUGH | |
373 #if __has_attribute(fallthrough) | |
374 #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) | |
375 #else | |
376 #define CYTHON_FALLTHROUGH | |
377 #endif | |
378 #endif | |
379 #if defined(__clang__ ) && defined(__apple_build_version__) | |
380 #if __apple_build_version__ < 7000000 | |
381 #undef CYTHON_FALLTHROUGH | |
382 #define CYTHON_FALLTHROUGH | |
383 #endif | |
384 #endif | |
385 #endif | |
386 | |
387 #ifndef __cplusplus | |
388 #error "Cython files generated with the C++ option must be compiled with a C++ compiler." | |
389 #endif | |
390 #ifndef CYTHON_INLINE | |
391 #if defined(__clang__) | |
392 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) | |
393 #else | |
394 #define CYTHON_INLINE inline | |
395 #endif | |
396 #endif | |
397 template<typename T> | |
398 void __Pyx_call_destructor(T& x) { | |
399 x.~T(); | |
400 } | |
401 template<typename T> | |
402 class __Pyx_FakeReference { | |
403 public: | |
404 __Pyx_FakeReference() : ptr(NULL) { } | |
405 __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { } | |
406 T *operator->() { return ptr; } | |
407 T *operator&() { return ptr; } | |
408 operator T&() { return *ptr; } | |
409 template<typename U> bool operator ==(U other) { return *ptr == other; } | |
410 template<typename U> bool operator !=(U other) { return *ptr != other; } | |
411 private: | |
412 T *ptr; | |
413 }; | |
414 | |
415 #define __PYX_BUILD_PY_SSIZE_T "n" | |
416 #define CYTHON_FORMAT_SSIZE_T "z" | |
417 #if PY_MAJOR_VERSION < 3 | |
418 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" | |
419 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ | |
420 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) | |
421 #define __Pyx_DefaultClassType PyClass_Type | |
422 #else | |
423 #define __Pyx_BUILTIN_MODULE_NAME "builtins" | |
424 #define __Pyx_DefaultClassType PyType_Type | |
425 #if PY_VERSION_HEX >= 0x030B00A1 | |
426 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, | |
427 PyObject *code, PyObject *c, PyObject* n, PyObject *v, | |
428 PyObject *fv, PyObject *cell, PyObject* fn, | |
429 PyObject *name, int fline, PyObject *lnos) { | |
430 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; | |
431 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; | |
432 const char *fn_cstr=NULL; | |
433 const char *name_cstr=NULL; | |
434 PyCodeObject* co=NULL; | |
435 PyObject *type, *value, *traceback; | |
436 PyErr_Fetch(&type, &value, &traceback); | |
437 if (!(kwds=PyDict_New())) goto end; | |
438 if (!(argcount=PyLong_FromLong(a))) goto end; | |
439 if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; | |
440 if (!(posonlyargcount=PyLong_FromLong(0))) goto end; | |
441 if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; | |
442 if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; | |
443 if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; | |
444 if (!(nlocals=PyLong_FromLong(l))) goto end; | |
445 if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; | |
446 if (!(stacksize=PyLong_FromLong(s))) goto end; | |
447 if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; | |
448 if (!(flags=PyLong_FromLong(f))) goto end; | |
449 if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; | |
450 if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; | |
451 if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; | |
452 if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; | |
453 if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; | |
454 if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; | |
455 if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; | |
456 if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; | |
457 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; | |
458 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; | |
459 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; | |
460 if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; | |
461 if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here | |
462 if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; | |
463 Py_XDECREF((PyObject*)co); | |
464 co = (PyCodeObject*)call_result; | |
465 call_result = NULL; | |
466 if (0) { | |
467 cleanup_code_too: | |
468 Py_XDECREF((PyObject*)co); | |
469 co = NULL; | |
470 } | |
471 end: | |
472 Py_XDECREF(kwds); | |
473 Py_XDECREF(argcount); | |
474 Py_XDECREF(posonlyargcount); | |
475 Py_XDECREF(kwonlyargcount); | |
476 Py_XDECREF(nlocals); | |
477 Py_XDECREF(stacksize); | |
478 Py_XDECREF(replace); | |
479 Py_XDECREF(call_result); | |
480 Py_XDECREF(empty); | |
481 if (type) { | |
482 PyErr_Restore(type, value, traceback); | |
483 } | |
484 return co; | |
485 } | |
486 #else | |
487 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ | |
488 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) | |
489 #endif | |
490 #define __Pyx_DefaultClassType PyType_Type | |
491 #endif | |
492 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY | |
493 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) | |
494 #else | |
495 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) | |
496 #endif | |
497 #ifndef Py_TPFLAGS_CHECKTYPES | |
498 #define Py_TPFLAGS_CHECKTYPES 0 | |
499 #endif | |
500 #ifndef Py_TPFLAGS_HAVE_INDEX | |
501 #define Py_TPFLAGS_HAVE_INDEX 0 | |
502 #endif | |
503 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER | |
504 #define Py_TPFLAGS_HAVE_NEWBUFFER 0 | |
505 #endif | |
506 #ifndef Py_TPFLAGS_HAVE_FINALIZE | |
507 #define Py_TPFLAGS_HAVE_FINALIZE 0 | |
508 #endif | |
509 #ifndef METH_STACKLESS | |
510 #define METH_STACKLESS 0 | |
511 #endif | |
512 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) | |
513 #ifndef METH_FASTCALL | |
514 #define METH_FASTCALL 0x80 | |
515 #endif | |
516 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); | |
517 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, | |
518 Py_ssize_t nargs, PyObject *kwnames); | |
519 #else | |
520 #define __Pyx_PyCFunctionFast _PyCFunctionFast | |
521 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords | |
522 #endif | |
523 #if CYTHON_FAST_PYCCALL | |
524 #define __Pyx_PyFastCFunction_Check(func)\ | |
525 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) | |
526 #else | |
527 #define __Pyx_PyFastCFunction_Check(func) 0 | |
528 #endif | |
529 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) | |
530 #define PyObject_Malloc(s) PyMem_Malloc(s) | |
531 #define PyObject_Free(p) PyMem_Free(p) | |
532 #define PyObject_Realloc(p) PyMem_Realloc(p) | |
533 #endif | |
534 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 | |
535 #define PyMem_RawMalloc(n) PyMem_Malloc(n) | |
536 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) | |
537 #define PyMem_RawFree(p) PyMem_Free(p) | |
538 #endif | |
539 #if CYTHON_COMPILING_IN_PYSTON | |
540 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) | |
541 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) | |
542 #else | |
543 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) | |
544 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) | |
545 #endif | |
546 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 | |
547 #define __Pyx_PyThreadState_Current PyThreadState_GET() | |
548 #elif PY_VERSION_HEX >= 0x03060000 | |
549 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() | |
550 #elif PY_VERSION_HEX >= 0x03000000 | |
551 #define __Pyx_PyThreadState_Current PyThreadState_GET() | |
552 #else | |
553 #define __Pyx_PyThreadState_Current _PyThreadState_Current | |
554 #endif | |
555 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) | |
556 #include "pythread.h" | |
557 #define Py_tss_NEEDS_INIT 0 | |
558 typedef int Py_tss_t; | |
559 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { | |
560 *key = PyThread_create_key(); | |
561 return 0; | |
562 } | |
563 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { | |
564 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); | |
565 *key = Py_tss_NEEDS_INIT; | |
566 return key; | |
567 } | |
568 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { | |
569 PyObject_Free(key); | |
570 } | |
571 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { | |
572 return *key != Py_tss_NEEDS_INIT; | |
573 } | |
574 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { | |
575 PyThread_delete_key(*key); | |
576 *key = Py_tss_NEEDS_INIT; | |
577 } | |
578 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { | |
579 return PyThread_set_key_value(*key, value); | |
580 } | |
581 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { | |
582 return PyThread_get_key_value(*key); | |
583 } | |
584 #endif | |
585 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) | |
586 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) | |
587 #else | |
588 #define __Pyx_PyDict_NewPresized(n) PyDict_New() | |
589 #endif | |
590 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION | |
591 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) | |
592 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) | |
593 #else | |
594 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) | |
595 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) | |
596 #endif | |
597 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS | |
598 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) | |
599 #else | |
600 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) | |
601 #endif | |
602 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) | |
603 #define CYTHON_PEP393_ENABLED 1 | |
604 #if PY_VERSION_HEX >= 0x030C0000 | |
605 #define __Pyx_PyUnicode_READY(op) (0) | |
606 #else | |
607 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ | |
608 0 : _PyUnicode_Ready((PyObject *)(op))) | |
609 #endif | |
610 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) | |
611 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) | |
612 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) | |
613 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) | |
614 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) | |
615 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) | |
616 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) | |
617 #if PY_VERSION_HEX >= 0x030C0000 | |
618 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) | |
619 #else | |
620 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 | |
621 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) | |
622 #else | |
623 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) | |
624 #endif | |
625 #endif | |
626 #else | |
627 #define CYTHON_PEP393_ENABLED 0 | |
628 #define PyUnicode_1BYTE_KIND 1 | |
629 #define PyUnicode_2BYTE_KIND 2 | |
630 #define PyUnicode_4BYTE_KIND 4 | |
631 #define __Pyx_PyUnicode_READY(op) (0) | |
632 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) | |
633 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) | |
634 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) | |
635 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) | |
636 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) | |
637 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) | |
638 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) | |
639 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) | |
640 #endif | |
641 #if CYTHON_COMPILING_IN_PYPY | |
642 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) | |
643 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) | |
644 #else | |
645 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) | |
646 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ | |
647 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) | |
648 #endif | |
649 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) | |
650 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) | |
651 #endif | |
652 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) | |
653 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) | |
654 #endif | |
655 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) | |
656 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) | |
657 #endif | |
658 #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)) | |
659 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) | |
660 #if PY_MAJOR_VERSION >= 3 | |
661 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) | |
662 #else | |
663 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) | |
664 #endif | |
665 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) | |
666 #define PyObject_ASCII(o) PyObject_Repr(o) | |
667 #endif | |
668 #if PY_MAJOR_VERSION >= 3 | |
669 #define PyBaseString_Type PyUnicode_Type | |
670 #define PyStringObject PyUnicodeObject | |
671 #define PyString_Type PyUnicode_Type | |
672 #define PyString_Check PyUnicode_Check | |
673 #define PyString_CheckExact PyUnicode_CheckExact | |
674 #ifndef PyObject_Unicode | |
675 #define PyObject_Unicode PyObject_Str | |
676 #endif | |
677 #endif | |
678 #if PY_MAJOR_VERSION >= 3 | |
679 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) | |
680 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) | |
681 #else | |
682 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) | |
683 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) | |
684 #endif | |
685 #ifndef PySet_CheckExact | |
686 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) | |
687 #endif | |
688 #if PY_VERSION_HEX >= 0x030900A4 | |
689 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) | |
690 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) | |
691 #else | |
692 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) | |
693 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) | |
694 #endif | |
695 #if CYTHON_ASSUME_SAFE_MACROS | |
696 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) | |
697 #else | |
698 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) | |
699 #endif | |
700 #if PY_MAJOR_VERSION >= 3 | |
701 #define PyIntObject PyLongObject | |
702 #define PyInt_Type PyLong_Type | |
703 #define PyInt_Check(op) PyLong_Check(op) | |
704 #define PyInt_CheckExact(op) PyLong_CheckExact(op) | |
705 #define PyInt_FromString PyLong_FromString | |
706 #define PyInt_FromUnicode PyLong_FromUnicode | |
707 #define PyInt_FromLong PyLong_FromLong | |
708 #define PyInt_FromSize_t PyLong_FromSize_t | |
709 #define PyInt_FromSsize_t PyLong_FromSsize_t | |
710 #define PyInt_AsLong PyLong_AsLong | |
711 #define PyInt_AS_LONG PyLong_AS_LONG | |
712 #define PyInt_AsSsize_t PyLong_AsSsize_t | |
713 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask | |
714 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask | |
715 #define PyNumber_Int PyNumber_Long | |
716 #endif | |
717 #if PY_MAJOR_VERSION >= 3 | |
718 #define PyBoolObject PyLongObject | |
719 #endif | |
720 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY | |
721 #ifndef PyUnicode_InternFromString | |
722 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) | |
723 #endif | |
724 #endif | |
725 #if PY_VERSION_HEX < 0x030200A4 | |
726 typedef long Py_hash_t; | |
727 #define __Pyx_PyInt_FromHash_t PyInt_FromLong | |
728 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t | |
729 #else | |
730 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t | |
731 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t | |
732 #endif | |
733 #if PY_MAJOR_VERSION >= 3 | |
734 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) | |
735 #else | |
736 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) | |
737 #endif | |
738 #if CYTHON_USE_ASYNC_SLOTS | |
739 #if PY_VERSION_HEX >= 0x030500B1 | |
740 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods | |
741 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) | |
742 #else | |
743 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) | |
744 #endif | |
745 #else | |
746 #define __Pyx_PyType_AsAsync(obj) NULL | |
747 #endif | |
748 #ifndef __Pyx_PyAsyncMethodsStruct | |
749 typedef struct { | |
750 unaryfunc am_await; | |
751 unaryfunc am_aiter; | |
752 unaryfunc am_anext; | |
753 } __Pyx_PyAsyncMethodsStruct; | |
754 #endif | |
755 | |
756 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) | |
757 #if !defined(_USE_MATH_DEFINES) | |
758 #define _USE_MATH_DEFINES | |
759 #endif | |
760 #endif | |
761 #include <math.h> | |
762 #ifdef NAN | |
763 #define __PYX_NAN() ((float) NAN) | |
764 #else | |
765 static CYTHON_INLINE float __PYX_NAN() { | |
766 float value; | |
767 memset(&value, 0xFF, sizeof(value)); | |
768 return value; | |
769 } | |
770 #endif | |
771 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) | |
772 #define __Pyx_truncl trunc | |
773 #else | |
774 #define __Pyx_truncl truncl | |
775 #endif | |
776 | |
777 #define __PYX_MARK_ERR_POS(f_index, lineno) \ | |
778 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } | |
779 #define __PYX_ERR(f_index, lineno, Ln_error) \ | |
780 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } | |
781 | |
782 #ifndef __PYX_EXTERN_C | |
783 #ifdef __cplusplus | |
784 #define __PYX_EXTERN_C extern "C" | |
785 #else | |
786 #define __PYX_EXTERN_C extern | |
787 #endif | |
788 #endif | |
789 | |
790 #define __PYX_HAVE__pybedtools__cbedtools | |
791 #define __PYX_HAVE_API__pybedtools__cbedtools | |
792 /* Early includes */ | |
793 #include <string.h> | |
794 #include <stdio.h> | |
795 #include "pythread.h" | |
796 #include "ios" | |
797 #include "new" | |
798 #include "stdexcept" | |
799 #include "typeinfo" | |
800 #include <vector> | |
801 #include <string> | |
802 #include "bedFile.h" | |
803 #ifdef _OPENMP | |
804 #include <omp.h> | |
805 #endif /* _OPENMP */ | |
806 | |
807 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) | |
808 #define CYTHON_WITHOUT_ASSERTIONS | |
809 #endif | |
810 | |
811 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; | |
812 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; | |
813 | |
814 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 | |
815 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 | |
816 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) | |
817 #define __PYX_DEFAULT_STRING_ENCODING "" | |
818 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString | |
819 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize | |
820 #define __Pyx_uchar_cast(c) ((unsigned char)c) | |
821 #define __Pyx_long_cast(x) ((long)x) | |
822 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ | |
823 (sizeof(type) < sizeof(Py_ssize_t)) ||\ | |
824 (sizeof(type) > sizeof(Py_ssize_t) &&\ | |
825 likely(v < (type)PY_SSIZE_T_MAX ||\ | |
826 v == (type)PY_SSIZE_T_MAX) &&\ | |
827 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ | |
828 v == (type)PY_SSIZE_T_MIN))) ||\ | |
829 (sizeof(type) == sizeof(Py_ssize_t) &&\ | |
830 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ | |
831 v == (type)PY_SSIZE_T_MAX))) ) | |
832 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { | |
833 return (size_t) i < (size_t) limit; | |
834 } | |
835 #if defined (__cplusplus) && __cplusplus >= 201103L | |
836 #include <cstdlib> | |
837 #define __Pyx_sst_abs(value) std::abs(value) | |
838 #elif SIZEOF_INT >= SIZEOF_SIZE_T | |
839 #define __Pyx_sst_abs(value) abs(value) | |
840 #elif SIZEOF_LONG >= SIZEOF_SIZE_T | |
841 #define __Pyx_sst_abs(value) labs(value) | |
842 #elif defined (_MSC_VER) | |
843 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) | |
844 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
845 #define __Pyx_sst_abs(value) llabs(value) | |
846 #elif defined (__GNUC__) | |
847 #define __Pyx_sst_abs(value) __builtin_llabs(value) | |
848 #else | |
849 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) | |
850 #endif | |
851 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); | |
852 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); | |
853 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) | |
854 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) | |
855 #define __Pyx_PyBytes_FromString PyBytes_FromString | |
856 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize | |
857 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); | |
858 #if PY_MAJOR_VERSION < 3 | |
859 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString | |
860 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize | |
861 #else | |
862 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString | |
863 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize | |
864 #endif | |
865 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) | |
866 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) | |
867 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) | |
868 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) | |
869 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) | |
870 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) | |
871 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) | |
872 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) | |
873 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) | |
874 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) | |
875 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) | |
876 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) | |
877 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) | |
878 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) | |
879 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) | |
880 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) | |
881 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { | |
882 const Py_UNICODE *u_end = u; | |
883 while (*u_end++) ; | |
884 return (size_t)(u_end - u - 1); | |
885 } | |
886 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) | |
887 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode | |
888 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode | |
889 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) | |
890 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) | |
891 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); | |
892 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); | |
893 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); | |
894 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); | |
895 #define __Pyx_PySequence_Tuple(obj)\ | |
896 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) | |
897 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); | |
898 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); | |
899 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); | |
900 #if CYTHON_ASSUME_SAFE_MACROS | |
901 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) | |
902 #else | |
903 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) | |
904 #endif | |
905 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) | |
906 #if PY_MAJOR_VERSION >= 3 | |
907 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) | |
908 #else | |
909 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) | |
910 #endif | |
911 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) | |
912 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
913 static int __Pyx_sys_getdefaultencoding_not_ascii; | |
914 static int __Pyx_init_sys_getdefaultencoding_params(void) { | |
915 PyObject* sys; | |
916 PyObject* default_encoding = NULL; | |
917 PyObject* ascii_chars_u = NULL; | |
918 PyObject* ascii_chars_b = NULL; | |
919 const char* default_encoding_c; | |
920 sys = PyImport_ImportModule("sys"); | |
921 if (!sys) goto bad; | |
922 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); | |
923 Py_DECREF(sys); | |
924 if (!default_encoding) goto bad; | |
925 default_encoding_c = PyBytes_AsString(default_encoding); | |
926 if (!default_encoding_c) goto bad; | |
927 if (strcmp(default_encoding_c, "ascii") == 0) { | |
928 __Pyx_sys_getdefaultencoding_not_ascii = 0; | |
929 } else { | |
930 char ascii_chars[128]; | |
931 int c; | |
932 for (c = 0; c < 128; c++) { | |
933 ascii_chars[c] = c; | |
934 } | |
935 __Pyx_sys_getdefaultencoding_not_ascii = 1; | |
936 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); | |
937 if (!ascii_chars_u) goto bad; | |
938 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); | |
939 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { | |
940 PyErr_Format( | |
941 PyExc_ValueError, | |
942 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", | |
943 default_encoding_c); | |
944 goto bad; | |
945 } | |
946 Py_DECREF(ascii_chars_u); | |
947 Py_DECREF(ascii_chars_b); | |
948 } | |
949 Py_DECREF(default_encoding); | |
950 return 0; | |
951 bad: | |
952 Py_XDECREF(default_encoding); | |
953 Py_XDECREF(ascii_chars_u); | |
954 Py_XDECREF(ascii_chars_b); | |
955 return -1; | |
956 } | |
957 #endif | |
958 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 | |
959 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) | |
960 #else | |
961 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) | |
962 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT | |
963 static char* __PYX_DEFAULT_STRING_ENCODING; | |
964 static int __Pyx_init_sys_getdefaultencoding_params(void) { | |
965 PyObject* sys; | |
966 PyObject* default_encoding = NULL; | |
967 char* default_encoding_c; | |
968 sys = PyImport_ImportModule("sys"); | |
969 if (!sys) goto bad; | |
970 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); | |
971 Py_DECREF(sys); | |
972 if (!default_encoding) goto bad; | |
973 default_encoding_c = PyBytes_AsString(default_encoding); | |
974 if (!default_encoding_c) goto bad; | |
975 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); | |
976 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; | |
977 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); | |
978 Py_DECREF(default_encoding); | |
979 return 0; | |
980 bad: | |
981 Py_XDECREF(default_encoding); | |
982 return -1; | |
983 } | |
984 #endif | |
985 #endif | |
986 | |
987 | |
988 /* Test for GCC > 2.95 */ | |
989 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) | |
990 #define likely(x) __builtin_expect(!!(x), 1) | |
991 #define unlikely(x) __builtin_expect(!!(x), 0) | |
992 #else /* !__GNUC__ or GCC < 2.95 */ | |
993 #define likely(x) (x) | |
994 #define unlikely(x) (x) | |
995 #endif /* __GNUC__ */ | |
996 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } | |
997 | |
998 static PyObject *__pyx_m = NULL; | |
999 static PyObject *__pyx_d; | |
1000 static PyObject *__pyx_b; | |
1001 static PyObject *__pyx_cython_runtime = NULL; | |
1002 static PyObject *__pyx_empty_tuple; | |
1003 static PyObject *__pyx_empty_bytes; | |
1004 static PyObject *__pyx_empty_unicode; | |
1005 static int __pyx_lineno; | |
1006 static int __pyx_clineno = 0; | |
1007 static const char * __pyx_cfilenm= __FILE__; | |
1008 static const char *__pyx_filename; | |
1009 | |
1010 | |
1011 static const char *__pyx_f[] = { | |
1012 "pybedtools/cbedtools.pyx", | |
1013 "stringsource", | |
1014 "env39/lib/python3.9/site-packages/Cython/Includes/cpython/type.pxd", | |
1015 "env39/lib/python3.9/site-packages/Cython/Includes/cpython/bool.pxd", | |
1016 "env39/lib/python3.9/site-packages/Cython/Includes/cpython/complex.pxd", | |
1017 }; | |
1018 | |
1019 /*--- Type declarations ---*/ | |
1020 struct __pyx_obj_10pybedtools_9cbedtools_Interval; | |
1021 struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator; | |
1022 struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile; | |
1023 | |
1024 /* "pybedtools/cbedtools.pxd":84 | |
1025 * | |
1026 * | |
1027 * cdef class Interval: # <<<<<<<<<<<<<< | |
1028 * cdef BED *_bed | |
1029 * cdef object _attrs | |
1030 */ | |
1031 struct __pyx_obj_10pybedtools_9cbedtools_Interval { | |
1032 PyObject_HEAD | |
1033 struct __pyx_vtabstruct_10pybedtools_9cbedtools_Interval *__pyx_vtab; | |
1034 BED *_bed; | |
1035 PyObject *_attrs; | |
1036 }; | |
1037 | |
1038 | |
1039 /* "pybedtools/cbedtools.pyx":729 | |
1040 * | |
1041 * | |
1042 * cdef class IntervalIterator: # <<<<<<<<<<<<<< | |
1043 * cdef object stream | |
1044 * cdef int _itemtype | |
1045 */ | |
1046 struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator { | |
1047 PyObject_HEAD | |
1048 PyObject *stream; | |
1049 int _itemtype; | |
1050 }; | |
1051 | |
1052 | |
1053 /* "pybedtools/cbedtools.pyx":794 | |
1054 * | |
1055 * | |
1056 * cdef class IntervalFile: # <<<<<<<<<<<<<< | |
1057 * cdef BedFile *intervalFile_ptr | |
1058 * cdef bint _loaded | |
1059 */ | |
1060 struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile { | |
1061 PyObject_HEAD | |
1062 BedFile *intervalFile_ptr; | |
1063 int _loaded; | |
1064 int _open; | |
1065 std::string _fn; | |
1066 }; | |
1067 | |
1068 | |
1069 | |
1070 /* "pybedtools/cbedtools.pyx":201 | |
1071 * return self.sep.join(pairs) + self.sep | |
1072 * | |
1073 * cdef class Interval: # <<<<<<<<<<<<<< | |
1074 * """ | |
1075 * Class to represent a genomic interval. | |
1076 */ | |
1077 | |
1078 struct __pyx_vtabstruct_10pybedtools_9cbedtools_Interval { | |
1079 PyObject *(*append)(struct __pyx_obj_10pybedtools_9cbedtools_Interval *, PyObject *, int __pyx_skip_dispatch); | |
1080 PyObject *(*deparse_attrs)(struct __pyx_obj_10pybedtools_9cbedtools_Interval *, int __pyx_skip_dispatch); | |
1081 }; | |
1082 static struct __pyx_vtabstruct_10pybedtools_9cbedtools_Interval *__pyx_vtabptr_10pybedtools_9cbedtools_Interval; | |
1083 | |
1084 /* --- Runtime support code (head) --- */ | |
1085 /* Refnanny.proto */ | |
1086 #ifndef CYTHON_REFNANNY | |
1087 #define CYTHON_REFNANNY 0 | |
1088 #endif | |
1089 #if CYTHON_REFNANNY | |
1090 typedef struct { | |
1091 void (*INCREF)(void*, PyObject*, int); | |
1092 void (*DECREF)(void*, PyObject*, int); | |
1093 void (*GOTREF)(void*, PyObject*, int); | |
1094 void (*GIVEREF)(void*, PyObject*, int); | |
1095 void* (*SetupContext)(const char*, int, const char*); | |
1096 void (*FinishContext)(void**); | |
1097 } __Pyx_RefNannyAPIStruct; | |
1098 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; | |
1099 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); | |
1100 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; | |
1101 #ifdef WITH_THREAD | |
1102 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ | |
1103 if (acquire_gil) {\ | |
1104 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ | |
1105 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ | |
1106 PyGILState_Release(__pyx_gilstate_save);\ | |
1107 } else {\ | |
1108 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ | |
1109 } | |
1110 #else | |
1111 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ | |
1112 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) | |
1113 #endif | |
1114 #define __Pyx_RefNannyFinishContext()\ | |
1115 __Pyx_RefNanny->FinishContext(&__pyx_refnanny) | |
1116 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) | |
1117 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) | |
1118 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) | |
1119 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) | |
1120 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) | |
1121 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) | |
1122 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) | |
1123 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) | |
1124 #else | |
1125 #define __Pyx_RefNannyDeclarations | |
1126 #define __Pyx_RefNannySetupContext(name, acquire_gil) | |
1127 #define __Pyx_RefNannyFinishContext() | |
1128 #define __Pyx_INCREF(r) Py_INCREF(r) | |
1129 #define __Pyx_DECREF(r) Py_DECREF(r) | |
1130 #define __Pyx_GOTREF(r) | |
1131 #define __Pyx_GIVEREF(r) | |
1132 #define __Pyx_XINCREF(r) Py_XINCREF(r) | |
1133 #define __Pyx_XDECREF(r) Py_XDECREF(r) | |
1134 #define __Pyx_XGOTREF(r) | |
1135 #define __Pyx_XGIVEREF(r) | |
1136 #endif | |
1137 #define __Pyx_XDECREF_SET(r, v) do {\ | |
1138 PyObject *tmp = (PyObject *) r;\ | |
1139 r = v; __Pyx_XDECREF(tmp);\ | |
1140 } while (0) | |
1141 #define __Pyx_DECREF_SET(r, v) do {\ | |
1142 PyObject *tmp = (PyObject *) r;\ | |
1143 r = v; __Pyx_DECREF(tmp);\ | |
1144 } while (0) | |
1145 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) | |
1146 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) | |
1147 | |
1148 /* PyObjectGetAttrStr.proto */ | |
1149 #if CYTHON_USE_TYPE_SLOTS | |
1150 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); | |
1151 #else | |
1152 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) | |
1153 #endif | |
1154 | |
1155 /* GetBuiltinName.proto */ | |
1156 static PyObject *__Pyx_GetBuiltinName(PyObject *name); | |
1157 | |
1158 /* PyDictVersioning.proto */ | |
1159 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS | |
1160 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) | |
1161 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) | |
1162 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ | |
1163 (version_var) = __PYX_GET_DICT_VERSION(dict);\ | |
1164 (cache_var) = (value); | |
1165 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ | |
1166 static PY_UINT64_T __pyx_dict_version = 0;\ | |
1167 static PyObject *__pyx_dict_cached_value = NULL;\ | |
1168 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ | |
1169 (VAR) = __pyx_dict_cached_value;\ | |
1170 } else {\ | |
1171 (VAR) = __pyx_dict_cached_value = (LOOKUP);\ | |
1172 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ | |
1173 }\ | |
1174 } | |
1175 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); | |
1176 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); | |
1177 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); | |
1178 #else | |
1179 #define __PYX_GET_DICT_VERSION(dict) (0) | |
1180 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) | |
1181 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); | |
1182 #endif | |
1183 | |
1184 /* GetModuleGlobalName.proto */ | |
1185 #if CYTHON_USE_DICT_VERSIONS | |
1186 #define __Pyx_GetModuleGlobalName(var, name) do {\ | |
1187 static PY_UINT64_T __pyx_dict_version = 0;\ | |
1188 static PyObject *__pyx_dict_cached_value = NULL;\ | |
1189 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ | |
1190 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ | |
1191 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ | |
1192 } while(0) | |
1193 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ | |
1194 PY_UINT64_T __pyx_dict_version;\ | |
1195 PyObject *__pyx_dict_cached_value;\ | |
1196 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ | |
1197 } while(0) | |
1198 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); | |
1199 #else | |
1200 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) | |
1201 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) | |
1202 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); | |
1203 #endif | |
1204 | |
1205 /* PyCFunctionFastCall.proto */ | |
1206 #if CYTHON_FAST_PYCCALL | |
1207 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); | |
1208 #else | |
1209 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) | |
1210 #endif | |
1211 | |
1212 /* PyFunctionFastCall.proto */ | |
1213 #if CYTHON_FAST_PYCALL | |
1214 #define __Pyx_PyFunction_FastCall(func, args, nargs)\ | |
1215 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) | |
1216 #if 1 || PY_VERSION_HEX < 0x030600B1 | |
1217 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); | |
1218 #else | |
1219 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) | |
1220 #endif | |
1221 #define __Pyx_BUILD_ASSERT_EXPR(cond)\ | |
1222 (sizeof(char [1 - 2*!(cond)]) - 1) | |
1223 #ifndef Py_MEMBER_SIZE | |
1224 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) | |
1225 #endif | |
1226 #if CYTHON_FAST_PYCALL | |
1227 static size_t __pyx_pyframe_localsplus_offset = 0; | |
1228 #include "frameobject.h" | |
1229 #if PY_VERSION_HEX >= 0x030b00a6 | |
1230 #ifndef Py_BUILD_CORE | |
1231 #define Py_BUILD_CORE 1 | |
1232 #endif | |
1233 #include "internal/pycore_frame.h" | |
1234 #endif | |
1235 #define __Pxy_PyFrame_Initialize_Offsets()\ | |
1236 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ | |
1237 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) | |
1238 #define __Pyx_PyFrame_GetLocalsplus(frame)\ | |
1239 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) | |
1240 #endif // CYTHON_FAST_PYCALL | |
1241 #endif | |
1242 | |
1243 /* PyObjectCall.proto */ | |
1244 #if CYTHON_COMPILING_IN_CPYTHON | |
1245 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); | |
1246 #else | |
1247 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) | |
1248 #endif | |
1249 | |
1250 /* PyObjectCallMethO.proto */ | |
1251 #if CYTHON_COMPILING_IN_CPYTHON | |
1252 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); | |
1253 #endif | |
1254 | |
1255 /* PyObjectCallOneArg.proto */ | |
1256 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); | |
1257 | |
1258 /* PyObjectCall2Args.proto */ | |
1259 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); | |
1260 | |
1261 /* IncludeCppStringH.proto */ | |
1262 #include <string> | |
1263 | |
1264 /* decode_c_string_utf16.proto */ | |
1265 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { | |
1266 int byteorder = 0; | |
1267 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); | |
1268 } | |
1269 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { | |
1270 int byteorder = -1; | |
1271 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); | |
1272 } | |
1273 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { | |
1274 int byteorder = 1; | |
1275 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); | |
1276 } | |
1277 | |
1278 /* decode_c_bytes.proto */ | |
1279 static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( | |
1280 const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, | |
1281 const char* encoding, const char* errors, | |
1282 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); | |
1283 | |
1284 /* decode_cpp_string.proto */ | |
1285 static CYTHON_INLINE PyObject* __Pyx_decode_cpp_string( | |
1286 std::string cppstring, Py_ssize_t start, Py_ssize_t stop, | |
1287 const char* encoding, const char* errors, | |
1288 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { | |
1289 return __Pyx_decode_c_bytes( | |
1290 cppstring.data(), cppstring.size(), start, stop, encoding, errors, decode_func); | |
1291 } | |
1292 | |
1293 /* RaiseDoubleKeywords.proto */ | |
1294 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); | |
1295 | |
1296 /* ParseKeywords.proto */ | |
1297 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ | |
1298 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ | |
1299 const char* function_name); | |
1300 | |
1301 /* RaiseArgTupleInvalid.proto */ | |
1302 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, | |
1303 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); | |
1304 | |
1305 /* PyObjectSetAttrStr.proto */ | |
1306 #if CYTHON_USE_TYPE_SLOTS | |
1307 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) | |
1308 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); | |
1309 #else | |
1310 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) | |
1311 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) | |
1312 #endif | |
1313 | |
1314 /* PyIntBinop.proto */ | |
1315 #if !CYTHON_COMPILING_IN_PYPY | |
1316 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); | |
1317 #else | |
1318 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ | |
1319 (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) | |
1320 #endif | |
1321 | |
1322 /* IncludeStringH.proto */ | |
1323 #include <string.h> | |
1324 | |
1325 /* BytesEquals.proto */ | |
1326 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); | |
1327 | |
1328 /* UnicodeEquals.proto */ | |
1329 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); | |
1330 | |
1331 /* StrEquals.proto */ | |
1332 #if PY_MAJOR_VERSION >= 3 | |
1333 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals | |
1334 #else | |
1335 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals | |
1336 #endif | |
1337 | |
1338 /* PyObjectCallNoArg.proto */ | |
1339 #if CYTHON_COMPILING_IN_CPYTHON | |
1340 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); | |
1341 #else | |
1342 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) | |
1343 #endif | |
1344 | |
1345 /* ListCompAppend.proto */ | |
1346 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS | |
1347 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { | |
1348 PyListObject* L = (PyListObject*) list; | |
1349 Py_ssize_t len = Py_SIZE(list); | |
1350 if (likely(L->allocated > len)) { | |
1351 Py_INCREF(x); | |
1352 PyList_SET_ITEM(list, len, x); | |
1353 __Pyx_SET_SIZE(list, len + 1); | |
1354 return 0; | |
1355 } | |
1356 return PyList_Append(list, x); | |
1357 } | |
1358 #else | |
1359 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) | |
1360 #endif | |
1361 | |
1362 /* RaiseTooManyValuesToUnpack.proto */ | |
1363 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); | |
1364 | |
1365 /* RaiseNeedMoreValuesToUnpack.proto */ | |
1366 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); | |
1367 | |
1368 /* IterFinish.proto */ | |
1369 static CYTHON_INLINE int __Pyx_IterFinish(void); | |
1370 | |
1371 /* UnpackItemEndCheck.proto */ | |
1372 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); | |
1373 | |
1374 /* PyIntCompare.proto */ | |
1375 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); | |
1376 | |
1377 /* py_dict_iteritems.proto */ | |
1378 static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d); | |
1379 | |
1380 /* UnpackUnboundCMethod.proto */ | |
1381 typedef struct { | |
1382 PyObject *type; | |
1383 PyObject **method_name; | |
1384 PyCFunction func; | |
1385 PyObject *method; | |
1386 int flag; | |
1387 } __Pyx_CachedCFunction; | |
1388 | |
1389 /* CallUnboundCMethod0.proto */ | |
1390 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); | |
1391 #if CYTHON_COMPILING_IN_CPYTHON | |
1392 #define __Pyx_CallUnboundCMethod0(cfunc, self)\ | |
1393 (likely((cfunc)->func) ?\ | |
1394 (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\ | |
1395 (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\ | |
1396 (PY_VERSION_HEX >= 0x030700A0 ?\ | |
1397 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\ | |
1398 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\ | |
1399 (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\ | |
1400 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\ | |
1401 (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\ | |
1402 ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\ | |
1403 __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\ | |
1404 __Pyx__CallUnboundCMethod0(cfunc, self)) | |
1405 #else | |
1406 #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) | |
1407 #endif | |
1408 | |
1409 /* GetItemInt.proto */ | |
1410 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ | |
1411 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ | |
1412 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ | |
1413 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ | |
1414 __Pyx_GetItemInt_Generic(o, to_py_func(i)))) | |
1415 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ | |
1416 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ | |
1417 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ | |
1418 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) | |
1419 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, | |
1420 int wraparound, int boundscheck); | |
1421 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ | |
1422 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ | |
1423 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ | |
1424 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) | |
1425 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, | |
1426 int wraparound, int boundscheck); | |
1427 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); | |
1428 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, | |
1429 int is_list, int wraparound, int boundscheck); | |
1430 | |
1431 /* ObjectGetItem.proto */ | |
1432 #if CYTHON_USE_TYPE_SLOTS | |
1433 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); | |
1434 #else | |
1435 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) | |
1436 #endif | |
1437 | |
1438 /* GetTopmostException.proto */ | |
1439 #if CYTHON_USE_EXC_INFO_STACK | |
1440 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); | |
1441 #endif | |
1442 | |
1443 /* PyThreadStateGet.proto */ | |
1444 #if CYTHON_FAST_THREAD_STATE | |
1445 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; | |
1446 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; | |
1447 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type | |
1448 #else | |
1449 #define __Pyx_PyThreadState_declare | |
1450 #define __Pyx_PyThreadState_assign | |
1451 #define __Pyx_PyErr_Occurred() PyErr_Occurred() | |
1452 #endif | |
1453 | |
1454 /* SaveResetException.proto */ | |
1455 #if CYTHON_FAST_THREAD_STATE | |
1456 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) | |
1457 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); | |
1458 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) | |
1459 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); | |
1460 #else | |
1461 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) | |
1462 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) | |
1463 #endif | |
1464 | |
1465 /* PyErrExceptionMatches.proto */ | |
1466 #if CYTHON_FAST_THREAD_STATE | |
1467 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) | |
1468 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); | |
1469 #else | |
1470 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) | |
1471 #endif | |
1472 | |
1473 /* PyErrFetchRestore.proto */ | |
1474 #if CYTHON_FAST_THREAD_STATE | |
1475 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) | |
1476 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) | |
1477 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) | |
1478 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) | |
1479 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) | |
1480 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); | |
1481 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); | |
1482 #if CYTHON_COMPILING_IN_CPYTHON | |
1483 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) | |
1484 #else | |
1485 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) | |
1486 #endif | |
1487 #else | |
1488 #define __Pyx_PyErr_Clear() PyErr_Clear() | |
1489 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) | |
1490 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) | |
1491 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) | |
1492 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) | |
1493 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) | |
1494 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) | |
1495 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) | |
1496 #endif | |
1497 | |
1498 /* ListAppend.proto */ | |
1499 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS | |
1500 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { | |
1501 PyListObject* L = (PyListObject*) list; | |
1502 Py_ssize_t len = Py_SIZE(list); | |
1503 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { | |
1504 Py_INCREF(x); | |
1505 PyList_SET_ITEM(list, len, x); | |
1506 __Pyx_SET_SIZE(list, len + 1); | |
1507 return 0; | |
1508 } | |
1509 return PyList_Append(list, x); | |
1510 } | |
1511 #else | |
1512 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) | |
1513 #endif | |
1514 | |
1515 /* ListExtend.proto */ | |
1516 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { | |
1517 #if CYTHON_COMPILING_IN_CPYTHON | |
1518 PyObject* none = _PyList_Extend((PyListObject*)L, v); | |
1519 if (unlikely(!none)) | |
1520 return -1; | |
1521 Py_DECREF(none); | |
1522 return 0; | |
1523 #else | |
1524 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); | |
1525 #endif | |
1526 } | |
1527 | |
1528 /* StringJoin.proto */ | |
1529 #if PY_MAJOR_VERSION < 3 | |
1530 #define __Pyx_PyString_Join __Pyx_PyBytes_Join | |
1531 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) | |
1532 #else | |
1533 #define __Pyx_PyString_Join PyUnicode_Join | |
1534 #define __Pyx_PyBaseString_Join PyUnicode_Join | |
1535 #endif | |
1536 #if CYTHON_COMPILING_IN_CPYTHON | |
1537 #if PY_MAJOR_VERSION < 3 | |
1538 #define __Pyx_PyBytes_Join _PyString_Join | |
1539 #else | |
1540 #define __Pyx_PyBytes_Join _PyBytes_Join | |
1541 #endif | |
1542 #else | |
1543 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); | |
1544 #endif | |
1545 | |
1546 /* DictGetItem.proto */ | |
1547 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY | |
1548 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); | |
1549 #define __Pyx_PyObject_Dict_GetItem(obj, name)\ | |
1550 (likely(PyDict_CheckExact(obj)) ?\ | |
1551 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) | |
1552 #else | |
1553 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) | |
1554 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) | |
1555 #endif | |
1556 | |
1557 /* FetchCommonType.proto */ | |
1558 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); | |
1559 | |
1560 /* CythonFunctionShared.proto */ | |
1561 #define __Pyx_CyFunction_USED 1 | |
1562 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 | |
1563 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 | |
1564 #define __Pyx_CYFUNCTION_CCLASS 0x04 | |
1565 #define __Pyx_CyFunction_GetClosure(f)\ | |
1566 (((__pyx_CyFunctionObject *) (f))->func_closure) | |
1567 #define __Pyx_CyFunction_GetClassObj(f)\ | |
1568 (((__pyx_CyFunctionObject *) (f))->func_classobj) | |
1569 #define __Pyx_CyFunction_Defaults(type, f)\ | |
1570 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) | |
1571 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ | |
1572 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) | |
1573 typedef struct { | |
1574 PyCFunctionObject func; | |
1575 #if PY_VERSION_HEX < 0x030500A0 | |
1576 PyObject *func_weakreflist; | |
1577 #endif | |
1578 PyObject *func_dict; | |
1579 PyObject *func_name; | |
1580 PyObject *func_qualname; | |
1581 PyObject *func_doc; | |
1582 PyObject *func_globals; | |
1583 PyObject *func_code; | |
1584 PyObject *func_closure; | |
1585 PyObject *func_classobj; | |
1586 void *defaults; | |
1587 int defaults_pyobjects; | |
1588 size_t defaults_size; // used by FusedFunction for copying defaults | |
1589 int flags; | |
1590 PyObject *defaults_tuple; | |
1591 PyObject *defaults_kwdict; | |
1592 PyObject *(*defaults_getter)(PyObject *); | |
1593 PyObject *func_annotations; | |
1594 } __pyx_CyFunctionObject; | |
1595 static PyTypeObject *__pyx_CyFunctionType = 0; | |
1596 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) | |
1597 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, | |
1598 int flags, PyObject* qualname, | |
1599 PyObject *self, | |
1600 PyObject *module, PyObject *globals, | |
1601 PyObject* code); | |
1602 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, | |
1603 size_t size, | |
1604 int pyobjects); | |
1605 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, | |
1606 PyObject *tuple); | |
1607 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, | |
1608 PyObject *dict); | |
1609 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, | |
1610 PyObject *dict); | |
1611 static int __pyx_CyFunction_init(void); | |
1612 | |
1613 /* CythonFunction.proto */ | |
1614 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, | |
1615 int flags, PyObject* qualname, | |
1616 PyObject *closure, | |
1617 PyObject *module, PyObject *globals, | |
1618 PyObject* code); | |
1619 | |
1620 /* RaiseException.proto */ | |
1621 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); | |
1622 | |
1623 /* PySequenceContains.proto */ | |
1624 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { | |
1625 int result = PySequence_Contains(seq, item); | |
1626 return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); | |
1627 } | |
1628 | |
1629 /* GetException.proto */ | |
1630 #if CYTHON_FAST_THREAD_STATE | |
1631 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) | |
1632 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); | |
1633 #else | |
1634 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); | |
1635 #endif | |
1636 | |
1637 /* GetAttr.proto */ | |
1638 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); | |
1639 | |
1640 /* SliceTupleAndList.proto */ | |
1641 #if CYTHON_COMPILING_IN_CPYTHON | |
1642 static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); | |
1643 static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); | |
1644 #else | |
1645 #define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) | |
1646 #define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) | |
1647 #endif | |
1648 | |
1649 /* PyIntBinop.proto */ | |
1650 #if !CYTHON_COMPILING_IN_PYPY | |
1651 static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); | |
1652 #else | |
1653 #define __Pyx_PyInt_AndObjC(op1, op2, intval, inplace, zerodivision_check)\ | |
1654 (inplace ? PyNumber_InPlaceAnd(op1, op2) : PyNumber_And(op1, op2)) | |
1655 #endif | |
1656 | |
1657 /* PyIntBinop.proto */ | |
1658 #if !CYTHON_COMPILING_IN_PYPY | |
1659 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); | |
1660 #else | |
1661 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ | |
1662 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) | |
1663 #endif | |
1664 | |
1665 /* SetItemInt.proto */ | |
1666 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ | |
1667 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ | |
1668 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ | |
1669 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ | |
1670 __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) | |
1671 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); | |
1672 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, | |
1673 int is_list, int wraparound, int boundscheck); | |
1674 | |
1675 /* ArgTypeTest.proto */ | |
1676 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ | |
1677 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ | |
1678 __Pyx__ArgTypeTest(obj, type, name, exact)) | |
1679 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); | |
1680 | |
1681 /* WriteUnraisableException.proto */ | |
1682 static void __Pyx_WriteUnraisable(const char *name, int clineno, | |
1683 int lineno, const char *filename, | |
1684 int full_traceback, int nogil); | |
1685 | |
1686 /* HasAttr.proto */ | |
1687 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); | |
1688 | |
1689 /* IterNext.proto */ | |
1690 #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) | |
1691 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); | |
1692 | |
1693 /* None.proto */ | |
1694 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); | |
1695 | |
1696 /* GetAttr3.proto */ | |
1697 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); | |
1698 | |
1699 /* FastTypeChecks.proto */ | |
1700 #if CYTHON_COMPILING_IN_CPYTHON | |
1701 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) | |
1702 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); | |
1703 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); | |
1704 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); | |
1705 #else | |
1706 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) | |
1707 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) | |
1708 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) | |
1709 #endif | |
1710 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) | |
1711 | |
1712 /* PyObjectLookupSpecial.proto */ | |
1713 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
1714 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { | |
1715 PyObject *res; | |
1716 PyTypeObject *tp = Py_TYPE(obj); | |
1717 #if PY_MAJOR_VERSION < 3 | |
1718 if (unlikely(PyInstance_Check(obj))) | |
1719 return __Pyx_PyObject_GetAttrStr(obj, attr_name); | |
1720 #endif | |
1721 res = _PyType_Lookup(tp, attr_name); | |
1722 if (likely(res)) { | |
1723 descrgetfunc f = Py_TYPE(res)->tp_descr_get; | |
1724 if (!f) { | |
1725 Py_INCREF(res); | |
1726 } else { | |
1727 res = f(res, obj, (PyObject *)tp); | |
1728 } | |
1729 } else { | |
1730 PyErr_SetObject(PyExc_AttributeError, attr_name); | |
1731 } | |
1732 return res; | |
1733 } | |
1734 #else | |
1735 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) | |
1736 #endif | |
1737 | |
1738 /* SwapException.proto */ | |
1739 #if CYTHON_FAST_THREAD_STATE | |
1740 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) | |
1741 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); | |
1742 #else | |
1743 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); | |
1744 #endif | |
1745 | |
1746 /* Import.proto */ | |
1747 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); | |
1748 | |
1749 /* ImportFrom.proto */ | |
1750 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); | |
1751 | |
1752 /* PyObject_GenericGetAttrNoDict.proto */ | |
1753 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 | |
1754 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); | |
1755 #else | |
1756 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr | |
1757 #endif | |
1758 | |
1759 /* PyObject_GenericGetAttr.proto */ | |
1760 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 | |
1761 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); | |
1762 #else | |
1763 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr | |
1764 #endif | |
1765 | |
1766 /* SetVTable.proto */ | |
1767 static int __Pyx_SetVtable(PyObject *dict, void *vtable); | |
1768 | |
1769 /* PyObjectGetAttrStrNoError.proto */ | |
1770 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); | |
1771 | |
1772 /* SetupReduce.proto */ | |
1773 static int __Pyx_setup_reduce(PyObject* type_obj); | |
1774 | |
1775 /* TypeImport.proto */ | |
1776 #ifndef __PYX_HAVE_RT_ImportType_proto_0_29_37 | |
1777 #define __PYX_HAVE_RT_ImportType_proto_0_29_37 | |
1778 #if __STDC_VERSION__ >= 201112L | |
1779 #include <stdalign.h> | |
1780 #endif | |
1781 #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L | |
1782 #define __PYX_GET_STRUCT_ALIGNMENT_0_29_37(s) alignof(s) | |
1783 #else | |
1784 #define __PYX_GET_STRUCT_ALIGNMENT_0_29_37(s) sizeof(void*) | |
1785 #endif | |
1786 enum __Pyx_ImportType_CheckSize_0_29_37 { | |
1787 __Pyx_ImportType_CheckSize_Error_0_29_37 = 0, | |
1788 __Pyx_ImportType_CheckSize_Warn_0_29_37 = 1, | |
1789 __Pyx_ImportType_CheckSize_Ignore_0_29_37 = 2 | |
1790 }; | |
1791 static PyTypeObject *__Pyx_ImportType_0_29_37(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_0_29_37 check_size); | |
1792 #endif | |
1793 | |
1794 /* py_dict_items.proto */ | |
1795 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); | |
1796 | |
1797 /* CalculateMetaclass.proto */ | |
1798 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); | |
1799 | |
1800 /* Py3ClassCreate.proto */ | |
1801 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, | |
1802 PyObject *mkw, PyObject *modname, PyObject *doc); | |
1803 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, | |
1804 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); | |
1805 | |
1806 /* SetNameInClass.proto */ | |
1807 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 | |
1808 #define __Pyx_SetNameInClass(ns, name, value)\ | |
1809 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) | |
1810 #elif CYTHON_COMPILING_IN_CPYTHON | |
1811 #define __Pyx_SetNameInClass(ns, name, value)\ | |
1812 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) | |
1813 #else | |
1814 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) | |
1815 #endif | |
1816 | |
1817 /* GetNameInClass.proto */ | |
1818 #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) | |
1819 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); | |
1820 | |
1821 /* CLineInTraceback.proto */ | |
1822 #ifdef CYTHON_CLINE_IN_TRACEBACK | |
1823 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) | |
1824 #else | |
1825 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); | |
1826 #endif | |
1827 | |
1828 /* CodeObjectCache.proto */ | |
1829 typedef struct { | |
1830 PyCodeObject* code_object; | |
1831 int code_line; | |
1832 } __Pyx_CodeObjectCacheEntry; | |
1833 struct __Pyx_CodeObjectCache { | |
1834 int count; | |
1835 int max_count; | |
1836 __Pyx_CodeObjectCacheEntry* entries; | |
1837 }; | |
1838 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; | |
1839 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); | |
1840 static PyCodeObject *__pyx_find_code_object(int code_line); | |
1841 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); | |
1842 | |
1843 /* AddTraceback.proto */ | |
1844 static void __Pyx_AddTraceback(const char *funcname, int c_line, | |
1845 int py_line, const char *filename); | |
1846 | |
1847 /* None.proto */ | |
1848 #include <new> | |
1849 | |
1850 /* GCCDiagnostics.proto */ | |
1851 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |
1852 #define __Pyx_HAS_GCC_DIAGNOSTIC | |
1853 #endif | |
1854 | |
1855 /* CppExceptionConversion.proto */ | |
1856 #ifndef __Pyx_CppExn2PyErr | |
1857 #include <new> | |
1858 #include <typeinfo> | |
1859 #include <stdexcept> | |
1860 #include <ios> | |
1861 static void __Pyx_CppExn2PyErr() { | |
1862 try { | |
1863 if (PyErr_Occurred()) | |
1864 ; // let the latest Python exn pass through and ignore the current one | |
1865 else | |
1866 throw; | |
1867 } catch (const std::bad_alloc& exn) { | |
1868 PyErr_SetString(PyExc_MemoryError, exn.what()); | |
1869 } catch (const std::bad_cast& exn) { | |
1870 PyErr_SetString(PyExc_TypeError, exn.what()); | |
1871 } catch (const std::bad_typeid& exn) { | |
1872 PyErr_SetString(PyExc_TypeError, exn.what()); | |
1873 } catch (const std::domain_error& exn) { | |
1874 PyErr_SetString(PyExc_ValueError, exn.what()); | |
1875 } catch (const std::invalid_argument& exn) { | |
1876 PyErr_SetString(PyExc_ValueError, exn.what()); | |
1877 } catch (const std::ios_base::failure& exn) { | |
1878 PyErr_SetString(PyExc_IOError, exn.what()); | |
1879 } catch (const std::out_of_range& exn) { | |
1880 PyErr_SetString(PyExc_IndexError, exn.what()); | |
1881 } catch (const std::overflow_error& exn) { | |
1882 PyErr_SetString(PyExc_OverflowError, exn.what()); | |
1883 } catch (const std::range_error& exn) { | |
1884 PyErr_SetString(PyExc_ArithmeticError, exn.what()); | |
1885 } catch (const std::underflow_error& exn) { | |
1886 PyErr_SetString(PyExc_ArithmeticError, exn.what()); | |
1887 } catch (const std::exception& exn) { | |
1888 PyErr_SetString(PyExc_RuntimeError, exn.what()); | |
1889 } | |
1890 catch (...) | |
1891 { | |
1892 PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); | |
1893 } | |
1894 } | |
1895 #endif | |
1896 | |
1897 /* CIntToPy.proto */ | |
1898 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); | |
1899 | |
1900 /* CIntFromPy.proto */ | |
1901 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); | |
1902 | |
1903 /* CIntFromPy.proto */ | |
1904 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); | |
1905 | |
1906 /* CIntFromPy.proto */ | |
1907 static CYTHON_INLINE CHRPOS __Pyx_PyInt_As_CHRPOS(PyObject *); | |
1908 | |
1909 /* CIntFromPy.proto */ | |
1910 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); | |
1911 | |
1912 /* CIntToPy.proto */ | |
1913 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_CHRPOS(CHRPOS value); | |
1914 | |
1915 /* CIntToPy.proto */ | |
1916 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); | |
1917 | |
1918 /* CIntFromPy.proto */ | |
1919 static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *); | |
1920 | |
1921 /* CheckBinaryVersion.proto */ | |
1922 static int __Pyx_check_binary_version(void); | |
1923 | |
1924 /* InitStrings.proto */ | |
1925 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); | |
1926 | |
1927 static PyObject *__pyx_f_10pybedtools_9cbedtools_8Interval_deparse_attrs(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ | |
1928 static PyObject *__pyx_f_10pybedtools_9cbedtools_8Interval_append(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch); /* proto*/ | |
1929 | |
1930 /* Module declarations from 'cpython.version' */ | |
1931 | |
1932 /* Module declarations from '__builtin__' */ | |
1933 | |
1934 /* Module declarations from 'cpython.type' */ | |
1935 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; | |
1936 | |
1937 /* Module declarations from 'libc.string' */ | |
1938 | |
1939 /* Module declarations from 'libc.stdio' */ | |
1940 | |
1941 /* Module declarations from 'cpython.object' */ | |
1942 | |
1943 /* Module declarations from 'cpython.ref' */ | |
1944 | |
1945 /* Module declarations from 'cpython.exc' */ | |
1946 | |
1947 /* Module declarations from 'cpython.module' */ | |
1948 | |
1949 /* Module declarations from 'cpython.mem' */ | |
1950 | |
1951 /* Module declarations from 'cpython.tuple' */ | |
1952 | |
1953 /* Module declarations from 'cpython.list' */ | |
1954 | |
1955 /* Module declarations from 'cpython.sequence' */ | |
1956 | |
1957 /* Module declarations from 'cpython.mapping' */ | |
1958 | |
1959 /* Module declarations from 'cpython.iterator' */ | |
1960 | |
1961 /* Module declarations from 'cpython.number' */ | |
1962 | |
1963 /* Module declarations from 'cpython.int' */ | |
1964 | |
1965 /* Module declarations from '__builtin__' */ | |
1966 | |
1967 /* Module declarations from 'cpython.bool' */ | |
1968 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; | |
1969 | |
1970 /* Module declarations from 'cpython.long' */ | |
1971 | |
1972 /* Module declarations from 'cpython.float' */ | |
1973 | |
1974 /* Module declarations from '__builtin__' */ | |
1975 | |
1976 /* Module declarations from 'cpython.complex' */ | |
1977 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; | |
1978 | |
1979 /* Module declarations from 'cpython.string' */ | |
1980 | |
1981 /* Module declarations from 'cpython.unicode' */ | |
1982 | |
1983 /* Module declarations from 'cpython.dict' */ | |
1984 | |
1985 /* Module declarations from 'cpython.instance' */ | |
1986 | |
1987 /* Module declarations from 'cpython.function' */ | |
1988 | |
1989 /* Module declarations from 'cpython.method' */ | |
1990 | |
1991 /* Module declarations from 'cpython.weakref' */ | |
1992 | |
1993 /* Module declarations from 'cpython.getargs' */ | |
1994 | |
1995 /* Module declarations from 'cpython.pythread' */ | |
1996 | |
1997 /* Module declarations from 'cpython.pystate' */ | |
1998 | |
1999 /* Module declarations from 'cpython.cobject' */ | |
2000 | |
2001 /* Module declarations from 'cpython.oldbuffer' */ | |
2002 | |
2003 /* Module declarations from 'cpython.set' */ | |
2004 | |
2005 /* Module declarations from 'cpython.buffer' */ | |
2006 | |
2007 /* Module declarations from 'cpython.bytes' */ | |
2008 | |
2009 /* Module declarations from 'cpython.pycapsule' */ | |
2010 | |
2011 /* Module declarations from 'cpython' */ | |
2012 | |
2013 /* Module declarations from 'libcpp.vector' */ | |
2014 | |
2015 /* Module declarations from 'libcpp.string' */ | |
2016 | |
2017 /* Module declarations from 'pybedtools.cbedtools' */ | |
2018 static PyTypeObject *__pyx_ptype_10pybedtools_9cbedtools_Interval = 0; | |
2019 static PyTypeObject *__pyx_ptype_10pybedtools_9cbedtools_IntervalIterator = 0; | |
2020 static PyTypeObject *__pyx_ptype_10pybedtools_9cbedtools_IntervalFile = 0; | |
2021 static PyObject *__pyx_v_10pybedtools_9cbedtools_LOOKUPS = 0; | |
2022 static PyObject *__pyx_f_10pybedtools_9cbedtools__cppstr(PyObject *); /*proto*/ | |
2023 static PyObject *__pyx_f_10pybedtools_9cbedtools__pystr(std::string); /*proto*/ | |
2024 static struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_f_10pybedtools_9cbedtools_create_interval(BED); /*proto*/ | |
2025 static PyObject *__pyx_f_10pybedtools_9cbedtools_isdigit(PyObject *); /*proto*/ | |
2026 static struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_f_10pybedtools_9cbedtools_create_interval_from_list(PyObject *, int __pyx_skip_dispatch); /*proto*/ | |
2027 static std::vector<std::string> __pyx_f_10pybedtools_9cbedtools_list_to_vector(PyObject *); /*proto*/ | |
2028 static PyObject *__pyx_f_10pybedtools_9cbedtools_string_vec2list(std::vector<std::string> ); /*proto*/ | |
2029 static PyObject *__pyx_f_10pybedtools_9cbedtools_bed_vec2list(std::vector<BED> ); /*proto*/ | |
2030 static PyObject *__pyx_f_10pybedtools_9cbedtools___pyx_unpickle_IntervalIterator__set_state(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *, PyObject *); /*proto*/ | |
2031 static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ | |
2032 static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ | |
2033 static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ | |
2034 static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ | |
2035 static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ | |
2036 static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ | |
2037 static std::vector<std::string> __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/ | |
2038 #define __Pyx_MODULE_NAME "pybedtools.cbedtools" | |
2039 extern int __pyx_module_is_main_pybedtools__cbedtools; | |
2040 int __pyx_module_is_main_pybedtools__cbedtools = 0; | |
2041 | |
2042 /* Implementation of 'pybedtools.cbedtools' */ | |
2043 static PyObject *__pyx_builtin_map; | |
2044 static PyObject *__pyx_builtin_KeyError; | |
2045 static PyObject *__pyx_builtin_NotImplementedError; | |
2046 static PyObject *__pyx_builtin_ValueError; | |
2047 static PyObject *__pyx_builtin_IndexError; | |
2048 static PyObject *__pyx_builtin_range; | |
2049 static PyObject *__pyx_builtin_TypeError; | |
2050 static PyObject *__pyx_builtin_AttributeError; | |
2051 static PyObject *__pyx_builtin_StopIteration; | |
2052 static PyObject *__pyx_builtin_open; | |
2053 static const char __pyx_k_[] = ""; | |
2054 static const char __pyx_k_k[] = "k"; | |
2055 static const char __pyx_k_v[] = "v"; | |
2056 static const char __pyx_k_x[] = "x"; | |
2057 static const char __pyx_k_y[] = "y"; | |
2058 static const char __pyx_k_ID[] = "ID"; | |
2059 static const char __pyx_k__2[] = ";"; | |
2060 static const char __pyx_k__3[] = "="; | |
2061 static const char __pyx_k__4[] = "\""; | |
2062 static const char __pyx_k__5[] = " "; | |
2063 static const char __pyx_k__7[] = "."; | |
2064 static const char __pyx_k__8[] = "\t"; | |
2065 static const char __pyx_k_e1[] = "e1"; | |
2066 static const char __pyx_k_e2[] = "e2"; | |
2067 static const char __pyx_k_fn[] = "fn"; | |
2068 static const char __pyx_k_kv[] = "kv"; | |
2069 static const char __pyx_k_np[] = "np"; | |
2070 static const char __pyx_k_s1[] = "s1"; | |
2071 static const char __pyx_k_s2[] = "s2"; | |
2072 static const char __pyx_k__15[] = "\n"; | |
2073 static const char __pyx_k__19[] = "+"; | |
2074 static const char __pyx_k__20[] = "-"; | |
2075 static const char __pyx_k__21[] = "*"; | |
2076 static const char __pyx_k__22[] = "@"; | |
2077 static const char __pyx_k__23[] = "#"; | |
2078 static const char __pyx_k__25[] = "\r\n"; | |
2079 static const char __pyx_k_bed[] = "bed"; | |
2080 static const char __pyx_k_cmp[] = "cmp"; | |
2081 static const char __pyx_k_doc[] = "__doc__"; | |
2082 static const char __pyx_k_end[] = "end"; | |
2083 static const char __pyx_k_gff[] = "gff"; | |
2084 static const char __pyx_k_kvs[] = "kvs"; | |
2085 static const char __pyx_k_map[] = "map"; | |
2086 static const char __pyx_k_new[] = "__new__"; | |
2087 static const char __pyx_k_s_i[] = "%s:%i"; | |
2088 static const char __pyx_k_sam[] = "sam"; | |
2089 static const char __pyx_k_sep[] = "sep"; | |
2090 static const char __pyx_k_str[] = "__str__"; | |
2091 static const char __pyx_k_sys[] = "sys"; | |
2092 static const char __pyx_k_val[] = "val"; | |
2093 static const char __pyx_k_vcf[] = "vcf"; | |
2094 static const char __pyx_k_Name[] = "Name"; | |
2095 static const char __pyx_k_dict[] = "__dict__"; | |
2096 static const char __pyx_k_exit[] = "__exit__"; | |
2097 static const char __pyx_k_init[] = "__init__"; | |
2098 static const char __pyx_k_join[] = "join"; | |
2099 static const char __pyx_k_main[] = "__main__"; | |
2100 static const char __pyx_k_n_eq[] = "n_eq"; | |
2101 static const char __pyx_k_name[] = "name"; | |
2102 static const char __pyx_k_open[] = "open"; | |
2103 static const char __pyx_k_self[] = "self"; | |
2104 static const char __pyx_k_stop[] = "stop"; | |
2105 static const char __pyx_k_test[] = "__test__"; | |
2106 static const char __pyx_k_UTF_8[] = "UTF-8"; | |
2107 static const char __pyx_k_attrs[] = "attrs"; | |
2108 static const char __pyx_k_chrom[] = "chrom"; | |
2109 static const char __pyx_k_close[] = "close"; | |
2110 static const char __pyx_k_count[] = "count"; | |
2111 static const char __pyx_k_enter[] = "__enter__"; | |
2112 static const char __pyx_k_field[] = "field"; | |
2113 static const char __pyx_k_int64[] = "int64"; | |
2114 static const char __pyx_k_items[] = "items"; | |
2115 static const char __pyx_k_kdict[] = "kdict"; | |
2116 static const char __pyx_k_ktype[] = "ktype"; | |
2117 static const char __pyx_k_numpy[] = "numpy"; | |
2118 static const char __pyx_k_pairs[] = "pairs"; | |
2119 static const char __pyx_k_range[] = "range"; | |
2120 static const char __pyx_k_score[] = "score"; | |
2121 static const char __pyx_k_split[] = "split"; | |
2122 static const char __pyx_k_start[] = "start"; | |
2123 static const char __pyx_k_strip[] = "strip"; | |
2124 static const char __pyx_k_track[] = "track"; | |
2125 static const char __pyx_k_value[] = "value"; | |
2126 static const char __pyx_k_Parent[] = "Parent"; | |
2127 static const char __pyx_k_append[] = "append"; | |
2128 static const char __pyx_k_closed[] = "closed"; | |
2129 static const char __pyx_k_encode[] = "encode"; | |
2130 static const char __pyx_k_fields[] = "fields"; | |
2131 static const char __pyx_k_import[] = "__import__"; | |
2132 static const char __pyx_k_module[] = "__module__"; | |
2133 static const char __pyx_k_n_semi[] = "n_semi"; | |
2134 static const char __pyx_k_name_2[] = "__name__"; | |
2135 static const char __pyx_k_pickle[] = "pickle"; | |
2136 static const char __pyx_k_quoted[] = "_quoted"; | |
2137 static const char __pyx_k_reduce[] = "__reduce__"; | |
2138 static const char __pyx_k_rstrip[] = "rstrip"; | |
2139 static const char __pyx_k_search[] = "search"; | |
2140 static const char __pyx_k_strand[] = "strand"; | |
2141 static const char __pyx_k_stream[] = "stream"; | |
2142 static const char __pyx_k_update[] = "update"; | |
2143 static const char __pyx_k_browser[] = "browser"; | |
2144 static const char __pyx_k_gene_id[] = "gene_id"; | |
2145 static const char __pyx_k_indices[] = "indices"; | |
2146 static const char __pyx_k_isdigit[] = "isdigit"; | |
2147 static const char __pyx_k_overlap[] = "overlap"; | |
2148 static const char __pyx_k_prepare[] = "__prepare__"; | |
2149 static const char __pyx_k_replace[] = "replace"; | |
2150 static const char __pyx_k_Interval[] = "Interval"; | |
2151 static const char __pyx_k_KeyError[] = "KeyError"; | |
2152 static const char __pyx_k_all_hits[] = "all_hits"; | |
2153 static const char __pyx_k_attr_str[] = "attr_str"; | |
2154 static const char __pyx_k_getstate[] = "__getstate__"; | |
2155 static const char __pyx_k_interval[] = "interval"; | |
2156 static const char __pyx_k_n_quotes[] = "n_quotes"; | |
2157 static const char __pyx_k_pyx_type[] = "__pyx_type"; | |
2158 static const char __pyx_k_qualname[] = "__qualname__"; | |
2159 static const char __pyx_k_readline[] = "readline"; | |
2160 static const char __pyx_k_setstate[] = "__setstate__"; | |
2161 static const char __pyx_k_TypeError[] = "TypeError"; | |
2162 static const char __pyx_k_field_sep[] = "field_sep"; | |
2163 static const char __pyx_k_file_type[] = "file_type"; | |
2164 static const char __pyx_k_gene_name[] = "gene_name"; | |
2165 static const char __pyx_k_iteritems[] = "iteritems"; | |
2166 static const char __pyx_k_metaclass[] = "__metaclass__"; | |
2167 static const char __pyx_k_pyx_state[] = "__pyx_state"; | |
2168 static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; | |
2169 static const char __pyx_k_sort_keys[] = "sort_keys"; | |
2170 static const char __pyx_k_Attributes[] = "Attributes"; | |
2171 static const char __pyx_k_IndexError[] = "IndexError"; | |
2172 static const char __pyx_k_ValueError[] = "ValueError"; | |
2173 static const char __pyx_k_attr_str_2[] = "_attr_str"; | |
2174 static const char __pyx_k_pyx_result[] = "__pyx_result"; | |
2175 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; | |
2176 static const char __pyx_k_startswith[] = "startswith"; | |
2177 static const char __pyx_k_subprocess[] = "subprocess"; | |
2178 static const char __pyx_k_PickleError[] = "PickleError"; | |
2179 static const char __pyx_k_collections[] = "collections"; | |
2180 static const char __pyx_k_defaultdict[] = "defaultdict"; | |
2181 static const char __pyx_k_loadIntoMap[] = "loadIntoMap"; | |
2182 static const char __pyx_k_otherfields[] = "otherfields"; | |
2183 static const char __pyx_k_same_strand[] = "same_strand"; | |
2184 static const char __pyx_k_IntervalFile[] = "IntervalFile"; | |
2185 static const char __pyx_k_intervalFile[] = "intervalFile"; | |
2186 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; | |
2187 static const char __pyx_k_stringsource[] = "stringsource"; | |
2188 static const char __pyx_k_PROFILES_TRUE[] = "PROFILES_TRUE"; | |
2189 static const char __pyx_k_StopIteration[] = "StopIteration"; | |
2190 static const char __pyx_k_deparse_attrs[] = "deparse_attrs"; | |
2191 static const char __pyx_k_integer_types[] = "integer_types"; | |
2192 static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; | |
2193 static const char __pyx_k_transcript_id[] = "transcript_id"; | |
2194 static const char __pyx_k_AttributeError[] = "AttributeError"; | |
2195 static const char __pyx_k_Interval_s_i_i[] = "Interval(%s:%i-%i)"; | |
2196 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; | |
2197 static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; | |
2198 static const char __pyx_k_Attributes___str[] = "Attributes.__str__"; | |
2199 static const char __pyx_k_IntervalIterator[] = "IntervalIterator"; | |
2200 static const char __pyx_k_malformed_line_s[] = "malformed line: %s"; | |
2201 static const char __pyx_k_Attributes___init[] = "Attributes.__init__"; | |
2202 static const char __pyx_k_BedToolsFileError[] = "BedToolsFileError"; | |
2203 static const char __pyx_k_Error_opening_file[] = "Error opening file"; | |
2204 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; | |
2205 static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; | |
2206 static const char __pyx_k_pybedtools_cbedtools[] = "pybedtools.cbedtools"; | |
2207 static const char __pyx_k_richcmp___locals_cmp[] = "__richcmp__.<locals>.cmp"; | |
2208 static const char __pyx_k_MalformedBedLineError[] = "MalformedBedLineError"; | |
2209 static const char __pyx_k_field_index_out_of_range[] = "field index out of range"; | |
2210 static const char __pyx_k_pybedtools_cbedtools_pyx[] = "pybedtools/cbedtools.pyx"; | |
2211 static const char __pyx_k_Start_is_greater_than_stop[] = "Start is greater than stop"; | |
2212 static const char __pyx_k_pyx_unpickle_IntervalIterator[] = "__pyx_unpickle_IntervalIterator"; | |
2213 static const char __pyx_k_Class_to_map_between_a_dict_of[] = "\n Class to map between a dict of attrs and fields[8] of a GFF Interval obj.\n "; | |
2214 static const char __pyx_k_Create_an_Interval_object_from[] = "\n Create an Interval object from a list of strings.\n\n Constructor::\n\n create_interval_from_list(fields)\n\n Given the list of strings, `fields`, automatically detects the format (BED,\n GFF, VCF, SAM) and creates a new Interval object.\n\n `fields` is a list with an arbitrary number of items (it can be quite long,\n say after a -wao intersection of a BED12 and a GFF), however, the first\n fields must conform to one of the supported formats. For example, if you\n want the resulting Interval to be considered a GFF feature, then the first\n 9 fields must conform to the GFF format. Similarly, if you want the\n resulting Interval to be considered a BED feature, then the first three\n fields must be chrom, start, stop.\n\n Example usage:\n\n >>> # Creates a BED3 feature\n >>> feature = create_interval_from_list(['chr1', '1', '100'])\n\n "; | |
2215 static const char __pyx_k_IntervalFile_all_hits_line_888[] = "IntervalFile.all_hits (line 888)"; | |
2216 static const char __pyx_k_IntervalFile_any_hits_line_934[] = "IntervalFile.any_hits (line 934)"; | |
2217 static const char __pyx_k_Unable_to_detect_format_from_s[] = "Unable to detect format from %s"; | |
2218 static const char __pyx_k_IntervalFile_objects_do_not_yet[] = "IntervalFile objects do not yet natively support SAM. Please convert to BED/GFF/VCF first if you want to use the low-level API of IntervalFile"; | |
2219 static const char __pyx_k_Interval_attrs_was_not_None_but[] = "Interval.attrs was not None, but this was a non-GFF Interval"; | |
2220 static const char __pyx_k_Signature_IntervalFile_all_hits[] = "\n :Signature: `IntervalFile.all_hits(interval, same_strand=False, overlap=0.0)`\n\n Search for the Interval `interval` this file and return **all**\n overlaps as a list.\n\n `same_strand`, if True, will only consider hits on the same strand as `interval`.\n\n `overlap` can be used to specify the fraction of overlap between\n `interval` and each feature in the IntervalFile.\n\n Example usage:\n\n >>> fn = pybedtools.example_filename('a.bed')\n\n >>> # create an Interval to query with\n >>> i = pybedtools.Interval('chr1', 1, 10000, strand='+')\n\n >>> # Create an IntervalFile out of a.bed\n >>> intervalfile = pybedtools.IntervalFile(fn)\n\n >>> # get stranded hits\n >>> intervalfile.all_hits(i, same_strand=True)\n [Interval(chr1:1-100), Interval(chr1:100-200), Interval(chr1:900-950)]\n\n "; | |
2221 static const char __pyx_k_Signature_IntervalFile_any_hits[] = "\n :Signature: `IntervalFile.any_hits(interval, same_strand=False, overlap=0.0)`\n\n Return 1 if the Interval `interval` had >=1 hit in this IntervalFile, 0 otherwise.\n\n `same_strand`, if True, will only consider hits on the same strand as `interval`.\n\n `overlap` can be used to specify the fraction of overlap between\n `interval` and each feature in the IntervalFile.\n\n Example usage:\n\n >>> fn = pybedtools.example_filename('a.bed')\n\n >>> # create an Interval to query with\n >>> i = pybedtools.Interval('chr1', 1, 10000, strand='+')\n\n >>> # Create an IntervalFile out of a.bed\n >>> intervalfile = pybedtools.IntervalFile(fn)\n\n >>> # any stranded hits?\n >>> intervalfile.any_hits(i, same_strand=True)\n 1\n\n "; | |
2222 static const char __pyx_k_Signature_IntervalFile_count_hi[] = "\n :Signature: `IntervalFile.count_hits(interval, same_strand=False, overlap=0.0)`\n\n Return the number of overlaps of the Interval `interval` had with this\n IntervalFile.\n\n `same_strand`, if True, will only consider hits on the same strand as\n `interval`.\n\n `overlap` can be used to specify the fraction of overlap between\n `interval` and each feature in the IntervalFile.\n\n Example usage:\n\n >>> fn = pybedtools.example_filename('a.bed')\n\n >>> # create an Interval to query with\n >>> i = pybedtools.Interval('chr1', 1, 10000, strand='+')\n\n >>> # Create an IntervalFile out of a.bed\n >>> intervalfile = pybedtools.IntervalFile(fn)\n\n >>> # get number of stranded hits\n >>> intervalfile.count_hits(i, same_strand=True)\n 3\n\n "; | |
2223 static const char __pyx_k_self_intervalFile_ptr_cannot_be[] = "self.intervalFile_ptr cannot be converted to a Python object for pickling"; | |
2224 static const char __pyx_k_Currently_unsupported_comparison[] = "Currently unsupported comparison -- please submit a bug report"; | |
2225 static const char __pyx_k_Features_are_nested_comparison_u[] = "Features are nested -- comparison undefined"; | |
2226 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))"; | |
2227 static const char __pyx_k_IntervalFile_count_hits_line_970[] = "IntervalFile.count_hits (line 970)"; | |
2228 static const char __pyx_k_create_interval_from_list_line_5[] = "create_interval_from_list (line 579)"; | |
2229 static const char __pyx_k_self__bed_cannot_be_converted_to[] = "self._bed cannot be converted to a Python object for pickling"; | |
2230 static PyObject *__pyx_kp_s_; | |
2231 static PyObject *__pyx_n_s_AttributeError; | |
2232 static PyObject *__pyx_n_s_Attributes; | |
2233 static PyObject *__pyx_n_s_Attributes___init; | |
2234 static PyObject *__pyx_n_s_Attributes___str; | |
2235 static PyObject *__pyx_n_s_BedToolsFileError; | |
2236 static PyObject *__pyx_kp_s_Class_to_map_between_a_dict_of; | |
2237 static PyObject *__pyx_kp_u_Create_an_Interval_object_from; | |
2238 static PyObject *__pyx_kp_s_Currently_unsupported_comparison; | |
2239 static PyObject *__pyx_kp_s_Error_opening_file; | |
2240 static PyObject *__pyx_kp_s_Features_are_nested_comparison_u; | |
2241 static PyObject *__pyx_n_s_ID; | |
2242 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; | |
2243 static PyObject *__pyx_n_s_IndexError; | |
2244 static PyObject *__pyx_n_s_Interval; | |
2245 static PyObject *__pyx_n_s_IntervalFile; | |
2246 static PyObject *__pyx_kp_u_IntervalFile_all_hits_line_888; | |
2247 static PyObject *__pyx_kp_u_IntervalFile_any_hits_line_934; | |
2248 static PyObject *__pyx_kp_u_IntervalFile_count_hits_line_970; | |
2249 static PyObject *__pyx_kp_s_IntervalFile_objects_do_not_yet; | |
2250 static PyObject *__pyx_n_s_IntervalIterator; | |
2251 static PyObject *__pyx_kp_s_Interval_attrs_was_not_None_but; | |
2252 static PyObject *__pyx_kp_s_Interval_s_i_i; | |
2253 static PyObject *__pyx_n_s_KeyError; | |
2254 static PyObject *__pyx_n_s_MalformedBedLineError; | |
2255 static PyObject *__pyx_n_s_Name; | |
2256 static PyObject *__pyx_n_s_NotImplementedError; | |
2257 static PyObject *__pyx_n_s_PROFILES_TRUE; | |
2258 static PyObject *__pyx_n_s_Parent; | |
2259 static PyObject *__pyx_n_s_PickleError; | |
2260 static PyObject *__pyx_kp_u_Signature_IntervalFile_all_hits; | |
2261 static PyObject *__pyx_kp_u_Signature_IntervalFile_any_hits; | |
2262 static PyObject *__pyx_kp_u_Signature_IntervalFile_count_hi; | |
2263 static PyObject *__pyx_kp_s_Start_is_greater_than_stop; | |
2264 static PyObject *__pyx_n_s_StopIteration; | |
2265 static PyObject *__pyx_n_s_TypeError; | |
2266 static PyObject *__pyx_kp_s_UTF_8; | |
2267 static PyObject *__pyx_kp_s_Unable_to_detect_format_from_s; | |
2268 static PyObject *__pyx_n_s_ValueError; | |
2269 static PyObject *__pyx_kp_s__15; | |
2270 static PyObject *__pyx_kp_s__19; | |
2271 static PyObject *__pyx_kp_s__2; | |
2272 static PyObject *__pyx_kp_s__20; | |
2273 static PyObject *__pyx_kp_s__21; | |
2274 static PyObject *__pyx_kp_s__22; | |
2275 static PyObject *__pyx_kp_s__23; | |
2276 static PyObject *__pyx_kp_s__25; | |
2277 static PyObject *__pyx_kp_s__3; | |
2278 static PyObject *__pyx_kp_s__4; | |
2279 static PyObject *__pyx_kp_s__5; | |
2280 static PyObject *__pyx_kp_s__7; | |
2281 static PyObject *__pyx_kp_s__8; | |
2282 static PyObject *__pyx_n_s_all_hits; | |
2283 static PyObject *__pyx_n_s_append; | |
2284 static PyObject *__pyx_n_s_attr_str; | |
2285 static PyObject *__pyx_n_s_attr_str_2; | |
2286 static PyObject *__pyx_n_s_attrs; | |
2287 static PyObject *__pyx_n_b_bed; | |
2288 static PyObject *__pyx_n_s_bed; | |
2289 static PyObject *__pyx_n_s_browser; | |
2290 static PyObject *__pyx_n_s_chrom; | |
2291 static PyObject *__pyx_n_s_cline_in_traceback; | |
2292 static PyObject *__pyx_n_s_close; | |
2293 static PyObject *__pyx_n_s_closed; | |
2294 static PyObject *__pyx_n_s_cmp; | |
2295 static PyObject *__pyx_n_s_collections; | |
2296 static PyObject *__pyx_n_s_count; | |
2297 static PyObject *__pyx_kp_u_create_interval_from_list_line_5; | |
2298 static PyObject *__pyx_n_s_defaultdict; | |
2299 static PyObject *__pyx_n_s_deparse_attrs; | |
2300 static PyObject *__pyx_n_s_dict; | |
2301 static PyObject *__pyx_n_s_doc; | |
2302 static PyObject *__pyx_n_s_e1; | |
2303 static PyObject *__pyx_n_s_e2; | |
2304 static PyObject *__pyx_n_s_encode; | |
2305 static PyObject *__pyx_n_s_end; | |
2306 static PyObject *__pyx_n_s_enter; | |
2307 static PyObject *__pyx_n_s_exit; | |
2308 static PyObject *__pyx_n_s_field; | |
2309 static PyObject *__pyx_kp_s_field_index_out_of_range; | |
2310 static PyObject *__pyx_n_s_field_sep; | |
2311 static PyObject *__pyx_n_s_fields; | |
2312 static PyObject *__pyx_n_s_file_type; | |
2313 static PyObject *__pyx_n_s_fn; | |
2314 static PyObject *__pyx_n_s_gene_id; | |
2315 static PyObject *__pyx_n_s_gene_name; | |
2316 static PyObject *__pyx_n_s_getstate; | |
2317 static PyObject *__pyx_n_b_gff; | |
2318 static PyObject *__pyx_n_s_gff; | |
2319 static PyObject *__pyx_n_s_import; | |
2320 static PyObject *__pyx_n_s_indices; | |
2321 static PyObject *__pyx_n_s_init; | |
2322 static PyObject *__pyx_n_s_int64; | |
2323 static PyObject *__pyx_n_s_integer_types; | |
2324 static PyObject *__pyx_n_s_interval; | |
2325 static PyObject *__pyx_n_s_intervalFile; | |
2326 static PyObject *__pyx_n_s_isdigit; | |
2327 static PyObject *__pyx_n_s_items; | |
2328 static PyObject *__pyx_n_s_iteritems; | |
2329 static PyObject *__pyx_n_s_join; | |
2330 static PyObject *__pyx_n_s_k; | |
2331 static PyObject *__pyx_n_s_kdict; | |
2332 static PyObject *__pyx_n_s_ktype; | |
2333 static PyObject *__pyx_n_s_kv; | |
2334 static PyObject *__pyx_n_s_kvs; | |
2335 static PyObject *__pyx_n_s_loadIntoMap; | |
2336 static PyObject *__pyx_n_s_main; | |
2337 static PyObject *__pyx_kp_s_malformed_line_s; | |
2338 static PyObject *__pyx_n_s_map; | |
2339 static PyObject *__pyx_n_s_metaclass; | |
2340 static PyObject *__pyx_n_s_module; | |
2341 static PyObject *__pyx_n_s_n_eq; | |
2342 static PyObject *__pyx_n_s_n_quotes; | |
2343 static PyObject *__pyx_n_s_n_semi; | |
2344 static PyObject *__pyx_n_s_name; | |
2345 static PyObject *__pyx_n_s_name_2; | |
2346 static PyObject *__pyx_n_s_new; | |
2347 static PyObject *__pyx_n_s_np; | |
2348 static PyObject *__pyx_n_s_numpy; | |
2349 static PyObject *__pyx_n_s_open; | |
2350 static PyObject *__pyx_n_s_otherfields; | |
2351 static PyObject *__pyx_n_s_overlap; | |
2352 static PyObject *__pyx_n_s_pairs; | |
2353 static PyObject *__pyx_n_s_pickle; | |
2354 static PyObject *__pyx_n_s_prepare; | |
2355 static PyObject *__pyx_n_s_pybedtools_cbedtools; | |
2356 static PyObject *__pyx_kp_s_pybedtools_cbedtools_pyx; | |
2357 static PyObject *__pyx_n_s_pyx_PickleError; | |
2358 static PyObject *__pyx_n_s_pyx_checksum; | |
2359 static PyObject *__pyx_n_s_pyx_result; | |
2360 static PyObject *__pyx_n_s_pyx_state; | |
2361 static PyObject *__pyx_n_s_pyx_type; | |
2362 static PyObject *__pyx_n_s_pyx_unpickle_IntervalIterator; | |
2363 static PyObject *__pyx_n_s_pyx_vtable; | |
2364 static PyObject *__pyx_n_s_qualname; | |
2365 static PyObject *__pyx_n_s_quoted; | |
2366 static PyObject *__pyx_n_s_range; | |
2367 static PyObject *__pyx_n_s_readline; | |
2368 static PyObject *__pyx_n_s_reduce; | |
2369 static PyObject *__pyx_n_s_reduce_cython; | |
2370 static PyObject *__pyx_n_s_reduce_ex; | |
2371 static PyObject *__pyx_n_s_replace; | |
2372 static PyObject *__pyx_n_s_richcmp___locals_cmp; | |
2373 static PyObject *__pyx_n_s_rstrip; | |
2374 static PyObject *__pyx_n_s_s1; | |
2375 static PyObject *__pyx_n_s_s2; | |
2376 static PyObject *__pyx_kp_s_s_i; | |
2377 static PyObject *__pyx_n_s_sam; | |
2378 static PyObject *__pyx_n_s_same_strand; | |
2379 static PyObject *__pyx_n_s_score; | |
2380 static PyObject *__pyx_n_s_search; | |
2381 static PyObject *__pyx_n_s_self; | |
2382 static PyObject *__pyx_kp_s_self__bed_cannot_be_converted_to; | |
2383 static PyObject *__pyx_kp_s_self_intervalFile_ptr_cannot_be; | |
2384 static PyObject *__pyx_n_s_sep; | |
2385 static PyObject *__pyx_n_s_setstate; | |
2386 static PyObject *__pyx_n_s_setstate_cython; | |
2387 static PyObject *__pyx_n_s_sort_keys; | |
2388 static PyObject *__pyx_n_s_split; | |
2389 static PyObject *__pyx_n_s_start; | |
2390 static PyObject *__pyx_n_s_startswith; | |
2391 static PyObject *__pyx_n_s_stop; | |
2392 static PyObject *__pyx_n_s_str; | |
2393 static PyObject *__pyx_n_s_strand; | |
2394 static PyObject *__pyx_n_s_stream; | |
2395 static PyObject *__pyx_kp_s_stringsource; | |
2396 static PyObject *__pyx_n_s_strip; | |
2397 static PyObject *__pyx_n_s_subprocess; | |
2398 static PyObject *__pyx_n_s_sys; | |
2399 static PyObject *__pyx_n_s_test; | |
2400 static PyObject *__pyx_n_s_track; | |
2401 static PyObject *__pyx_n_s_transcript_id; | |
2402 static PyObject *__pyx_n_s_update; | |
2403 static PyObject *__pyx_n_s_v; | |
2404 static PyObject *__pyx_n_s_val; | |
2405 static PyObject *__pyx_n_s_value; | |
2406 static PyObject *__pyx_n_b_vcf; | |
2407 static PyObject *__pyx_n_s_vcf; | |
2408 static PyObject *__pyx_n_s_x; | |
2409 static PyObject *__pyx_n_s_y; | |
2410 static PyObject *__pyx_pf_10pybedtools_9cbedtools_10Attributes___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attr_str); /* proto */ | |
2411 static PyObject *__pyx_pf_10pybedtools_9cbedtools_10Attributes_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ | |
2412 static int __pyx_pf_10pybedtools_9cbedtools_8Interval___init__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_name, PyObject *__pyx_v_score, PyObject *__pyx_v_strand, PyObject *__pyx_v_otherfields); /* proto */ | |
2413 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_2__copy__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2414 static Py_hash_t __pyx_pf_10pybedtools_9cbedtools_8Interval_4__hash__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2415 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5chrom___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2416 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5chrom_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_chrom); /* proto */ | |
2417 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ | |
2418 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6__richcmp__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */ | |
2419 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5start___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2420 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5start_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_v_start); /* proto */ | |
2421 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_3end___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2422 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_3end_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_v_end); /* proto */ | |
2423 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_4stop___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2424 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_4stop_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_v_end); /* proto */ | |
2425 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6strand___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2426 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_6strand_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_strand); /* proto */ | |
2427 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6length___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2428 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_8deparse_attrs(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2429 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6fields___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2430 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5attrs___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2431 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5attrs_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_attrs); /* proto */ | |
2432 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5count___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2433 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_4name___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2434 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_4name_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ | |
2435 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5score___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2436 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5score_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ | |
2437 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_9file_type___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2438 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_9file_type_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ | |
2439 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_7o_start___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2440 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5o_end___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2441 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5o_amt___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2442 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_10__str__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2443 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_12__repr__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2444 static void __pyx_pf_10pybedtools_9cbedtools_8Interval_14__dealloc__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2445 static Py_ssize_t __pyx_pf_10pybedtools_9cbedtools_8Interval_16__len__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2446 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_18__getitem__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ | |
2447 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_20__setitem__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */ | |
2448 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_22append(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ | |
2449 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_24__nonzero__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2450 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self); /* proto */ | |
2451 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ | |
2452 static PyObject *__pyx_pf_10pybedtools_9cbedtools_create_interval_from_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fields); /* proto */ | |
2453 static PyObject *__pyx_pf_10pybedtools_9cbedtools_2overlap(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_s1, int __pyx_v_s2, int __pyx_v_e1, int __pyx_v_e2); /* proto */ | |
2454 static int __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator___init__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */ | |
2455 static void __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_2__dealloc__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self); /* proto */ | |
2456 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_4__iter__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self); /* proto */ | |
2457 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_6__next__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self); /* proto */ | |
2458 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_8__reduce_cython__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self); /* proto */ | |
2459 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_10__setstate_cython__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ | |
2460 static int __pyx_pf_10pybedtools_9cbedtools_12IntervalFile___init__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, PyObject *__pyx_v_intervalFile); /* proto */ | |
2461 static void __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_2__dealloc__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2462 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_4__iter__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2463 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_6__next__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2464 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_2fn___get__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2465 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_9file_type___get__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2466 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_8loadIntoMap(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2467 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_10rewind(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2468 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_12seek(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, PyObject *__pyx_v_offset); /* proto */ | |
2469 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_14all_hits(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval, PyBoolObject *__pyx_v_same_strand, float __pyx_v_overlap); /* proto */ | |
2470 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_16any_hits(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval, PyBoolObject *__pyx_v_same_strand, float __pyx_v_overlap); /* proto */ | |
2471 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_18count_hits(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval, PyBoolObject *__pyx_v_same_strand, float __pyx_v_overlap); /* proto */ | |
2472 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self); /* proto */ | |
2473 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ | |
2474 static PyObject *__pyx_pf_10pybedtools_9cbedtools_4__pyx_unpickle_IntervalIterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ | |
2475 static PyObject *__pyx_tp_new_10pybedtools_9cbedtools_Interval(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ | |
2476 static PyObject *__pyx_tp_new_10pybedtools_9cbedtools_IntervalIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ | |
2477 static PyObject *__pyx_tp_new_10pybedtools_9cbedtools_IntervalFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ | |
2478 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; | |
2479 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_iteritems = {0, &__pyx_n_s_iteritems, 0, 0, 0}; | |
2480 static PyObject *__pyx_int_0; | |
2481 static PyObject *__pyx_int_1; | |
2482 static PyObject *__pyx_int_2; | |
2483 static PyObject *__pyx_int_3; | |
2484 static PyObject *__pyx_int_4; | |
2485 static PyObject *__pyx_int_5; | |
2486 static PyObject *__pyx_int_6; | |
2487 static PyObject *__pyx_int_16; | |
2488 static PyObject *__pyx_int_22915542; | |
2489 static PyObject *__pyx_int_26969663; | |
2490 static PyObject *__pyx_int_172054328; | |
2491 static PyObject *__pyx_int_neg_1; | |
2492 static PyObject *__pyx_tuple__6; | |
2493 static PyObject *__pyx_tuple__9; | |
2494 static PyObject *__pyx_tuple__11; | |
2495 static PyObject *__pyx_tuple__12; | |
2496 static PyObject *__pyx_tuple__13; | |
2497 static PyObject *__pyx_tuple__14; | |
2498 static PyObject *__pyx_tuple__16; | |
2499 static PyObject *__pyx_tuple__17; | |
2500 static PyObject *__pyx_tuple__18; | |
2501 static PyObject *__pyx_tuple__24; | |
2502 static PyObject *__pyx_tuple__26; | |
2503 static PyObject *__pyx_tuple__27; | |
2504 static PyObject *__pyx_tuple__28; | |
2505 static PyObject *__pyx_tuple__29; | |
2506 static PyObject *__pyx_tuple__30; | |
2507 static PyObject *__pyx_tuple__31; | |
2508 static PyObject *__pyx_tuple__32; | |
2509 static PyObject *__pyx_tuple__33; | |
2510 static PyObject *__pyx_tuple__34; | |
2511 static PyObject *__pyx_tuple__35; | |
2512 static PyObject *__pyx_tuple__36; | |
2513 static PyObject *__pyx_tuple__37; | |
2514 static PyObject *__pyx_tuple__38; | |
2515 static PyObject *__pyx_tuple__39; | |
2516 static PyObject *__pyx_tuple__40; | |
2517 static PyObject *__pyx_tuple__41; | |
2518 static PyObject *__pyx_tuple__42; | |
2519 static PyObject *__pyx_tuple__43; | |
2520 static PyObject *__pyx_tuple__44; | |
2521 static PyObject *__pyx_tuple__45; | |
2522 static PyObject *__pyx_tuple__46; | |
2523 static PyObject *__pyx_tuple__47; | |
2524 static PyObject *__pyx_tuple__48; | |
2525 static PyObject *__pyx_tuple__49; | |
2526 static PyObject *__pyx_tuple__50; | |
2527 static PyObject *__pyx_tuple__51; | |
2528 static PyObject *__pyx_tuple__52; | |
2529 static PyObject *__pyx_tuple__53; | |
2530 static PyObject *__pyx_tuple__55; | |
2531 static PyObject *__pyx_tuple__56; | |
2532 static PyObject *__pyx_tuple__58; | |
2533 static PyObject *__pyx_tuple__60; | |
2534 static PyObject *__pyx_codeobj__10; | |
2535 static PyObject *__pyx_codeobj__54; | |
2536 static PyObject *__pyx_codeobj__57; | |
2537 static PyObject *__pyx_codeobj__59; | |
2538 static PyObject *__pyx_codeobj__61; | |
2539 /* Late includes */ | |
2540 | |
2541 /* "pybedtools/cbedtools.pyx":21 | |
2542 * # Python byte strings automatically coerce to/from C++ strings. | |
2543 * | |
2544 * cdef _cppstr(s): # <<<<<<<<<<<<<< | |
2545 * # Use this to handle incoming strings from Python. | |
2546 * # | |
2547 */ | |
2548 | |
2549 static PyObject *__pyx_f_10pybedtools_9cbedtools__cppstr(PyObject *__pyx_v_s) { | |
2550 PyObject *__pyx_r = NULL; | |
2551 __Pyx_RefNannyDeclarations | |
2552 PyObject *__pyx_t_1 = NULL; | |
2553 int __pyx_t_2; | |
2554 int __pyx_t_3; | |
2555 PyObject *__pyx_t_4 = NULL; | |
2556 PyObject *__pyx_t_5 = NULL; | |
2557 std::string __pyx_t_6; | |
2558 int __pyx_lineno = 0; | |
2559 const char *__pyx_filename = NULL; | |
2560 int __pyx_clineno = 0; | |
2561 __Pyx_RefNannySetupContext("_cppstr", 0); | |
2562 __Pyx_INCREF(__pyx_v_s); | |
2563 | |
2564 /* "pybedtools/cbedtools.pyx":26 | |
2565 * # C++ uses bytestrings. PY2 strings need no conversion; bare PY3 strings | |
2566 * # are unicode and so must be encoded to bytestring. | |
2567 * if isinstance(s, integer_types): # <<<<<<<<<<<<<< | |
2568 * s = str(s) | |
2569 * if isinstance(s, unicode): | |
2570 */ | |
2571 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_integer_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) | |
2572 __Pyx_GOTREF(__pyx_t_1); | |
2573 __pyx_t_2 = PyObject_IsInstance(__pyx_v_s, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 26, __pyx_L1_error) | |
2574 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
2575 __pyx_t_3 = (__pyx_t_2 != 0); | |
2576 if (__pyx_t_3) { | |
2577 | |
2578 /* "pybedtools/cbedtools.pyx":27 | |
2579 * # are unicode and so must be encoded to bytestring. | |
2580 * if isinstance(s, integer_types): | |
2581 * s = str(s) # <<<<<<<<<<<<<< | |
2582 * if isinstance(s, unicode): | |
2583 * s = s.encode('UTF-8') | |
2584 */ | |
2585 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) | |
2586 __Pyx_GOTREF(__pyx_t_1); | |
2587 __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1); | |
2588 __pyx_t_1 = 0; | |
2589 | |
2590 /* "pybedtools/cbedtools.pyx":26 | |
2591 * # C++ uses bytestrings. PY2 strings need no conversion; bare PY3 strings | |
2592 * # are unicode and so must be encoded to bytestring. | |
2593 * if isinstance(s, integer_types): # <<<<<<<<<<<<<< | |
2594 * s = str(s) | |
2595 * if isinstance(s, unicode): | |
2596 */ | |
2597 } | |
2598 | |
2599 /* "pybedtools/cbedtools.pyx":28 | |
2600 * if isinstance(s, integer_types): | |
2601 * s = str(s) | |
2602 * if isinstance(s, unicode): # <<<<<<<<<<<<<< | |
2603 * s = s.encode('UTF-8') | |
2604 * return <string> s | |
2605 */ | |
2606 __pyx_t_3 = PyUnicode_Check(__pyx_v_s); | |
2607 __pyx_t_2 = (__pyx_t_3 != 0); | |
2608 if (__pyx_t_2) { | |
2609 | |
2610 /* "pybedtools/cbedtools.pyx":29 | |
2611 * s = str(s) | |
2612 * if isinstance(s, unicode): | |
2613 * s = s.encode('UTF-8') # <<<<<<<<<<<<<< | |
2614 * return <string> s | |
2615 * | |
2616 */ | |
2617 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) | |
2618 __Pyx_GOTREF(__pyx_t_4); | |
2619 __pyx_t_5 = NULL; | |
2620 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { | |
2621 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); | |
2622 if (likely(__pyx_t_5)) { | |
2623 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); | |
2624 __Pyx_INCREF(__pyx_t_5); | |
2625 __Pyx_INCREF(function); | |
2626 __Pyx_DECREF_SET(__pyx_t_4, function); | |
2627 } | |
2628 } | |
2629 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_UTF_8); | |
2630 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
2631 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) | |
2632 __Pyx_GOTREF(__pyx_t_1); | |
2633 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
2634 __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1); | |
2635 __pyx_t_1 = 0; | |
2636 | |
2637 /* "pybedtools/cbedtools.pyx":28 | |
2638 * if isinstance(s, integer_types): | |
2639 * s = str(s) | |
2640 * if isinstance(s, unicode): # <<<<<<<<<<<<<< | |
2641 * s = s.encode('UTF-8') | |
2642 * return <string> s | |
2643 */ | |
2644 } | |
2645 | |
2646 /* "pybedtools/cbedtools.pyx":30 | |
2647 * if isinstance(s, unicode): | |
2648 * s = s.encode('UTF-8') | |
2649 * return <string> s # <<<<<<<<<<<<<< | |
2650 * | |
2651 * cdef _pystr(string s): | |
2652 */ | |
2653 __Pyx_XDECREF(__pyx_r); | |
2654 __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_s); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L1_error) | |
2655 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(((std::string)__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) | |
2656 __Pyx_GOTREF(__pyx_t_1); | |
2657 __pyx_r = __pyx_t_1; | |
2658 __pyx_t_1 = 0; | |
2659 goto __pyx_L0; | |
2660 | |
2661 /* "pybedtools/cbedtools.pyx":21 | |
2662 * # Python byte strings automatically coerce to/from C++ strings. | |
2663 * | |
2664 * cdef _cppstr(s): # <<<<<<<<<<<<<< | |
2665 * # Use this to handle incoming strings from Python. | |
2666 * # | |
2667 */ | |
2668 | |
2669 /* function exit code */ | |
2670 __pyx_L1_error:; | |
2671 __Pyx_XDECREF(__pyx_t_1); | |
2672 __Pyx_XDECREF(__pyx_t_4); | |
2673 __Pyx_XDECREF(__pyx_t_5); | |
2674 __Pyx_AddTraceback("pybedtools.cbedtools._cppstr", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
2675 __pyx_r = 0; | |
2676 __pyx_L0:; | |
2677 __Pyx_XDECREF(__pyx_v_s); | |
2678 __Pyx_XGIVEREF(__pyx_r); | |
2679 __Pyx_RefNannyFinishContext(); | |
2680 return __pyx_r; | |
2681 } | |
2682 | |
2683 /* "pybedtools/cbedtools.pyx":32 | |
2684 * return <string> s | |
2685 * | |
2686 * cdef _pystr(string s): # <<<<<<<<<<<<<< | |
2687 * # Use this to prepare a string for sending to Python. | |
2688 * # | |
2689 */ | |
2690 | |
2691 static PyObject *__pyx_f_10pybedtools_9cbedtools__pystr(std::string __pyx_v_s) { | |
2692 PyObject *__pyx_r = NULL; | |
2693 __Pyx_RefNannyDeclarations | |
2694 PyObject *__pyx_t_1 = NULL; | |
2695 int __pyx_lineno = 0; | |
2696 const char *__pyx_filename = NULL; | |
2697 int __pyx_clineno = 0; | |
2698 __Pyx_RefNannySetupContext("_pystr", 0); | |
2699 | |
2700 /* "pybedtools/cbedtools.pyx":36 | |
2701 * # | |
2702 * # Always returns unicode. | |
2703 * return s.decode('UTF-8', 'strict') # <<<<<<<<<<<<<< | |
2704 * | |
2705 * integer_types = (int, long, np.int64) | |
2706 */ | |
2707 __Pyx_XDECREF(__pyx_r); | |
2708 __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_s, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) | |
2709 __Pyx_GOTREF(__pyx_t_1); | |
2710 __pyx_r = __pyx_t_1; | |
2711 __pyx_t_1 = 0; | |
2712 goto __pyx_L0; | |
2713 | |
2714 /* "pybedtools/cbedtools.pyx":32 | |
2715 * return <string> s | |
2716 * | |
2717 * cdef _pystr(string s): # <<<<<<<<<<<<<< | |
2718 * # Use this to prepare a string for sending to Python. | |
2719 * # | |
2720 */ | |
2721 | |
2722 /* function exit code */ | |
2723 __pyx_L1_error:; | |
2724 __Pyx_XDECREF(__pyx_t_1); | |
2725 __Pyx_AddTraceback("pybedtools.cbedtools._pystr", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
2726 __pyx_r = 0; | |
2727 __pyx_L0:; | |
2728 __Pyx_XGIVEREF(__pyx_r); | |
2729 __Pyx_RefNannyFinishContext(); | |
2730 return __pyx_r; | |
2731 } | |
2732 | |
2733 /* "pybedtools/cbedtools.pyx":146 | |
2734 * """ | |
2735 * | |
2736 * def __init__(self, attr_str=""): # <<<<<<<<<<<<<< | |
2737 * attr_str = str(attr_str) | |
2738 * self._attr_str = attr_str | |
2739 */ | |
2740 | |
2741 /* Python wrapper */ | |
2742 static PyObject *__pyx_pw_10pybedtools_9cbedtools_10Attributes_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
2743 static PyMethodDef __pyx_mdef_10pybedtools_9cbedtools_10Attributes_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_10Attributes_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; | |
2744 static PyObject *__pyx_pw_10pybedtools_9cbedtools_10Attributes_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
2745 PyObject *__pyx_v_self = 0; | |
2746 PyObject *__pyx_v_attr_str = 0; | |
2747 int __pyx_lineno = 0; | |
2748 const char *__pyx_filename = NULL; | |
2749 int __pyx_clineno = 0; | |
2750 PyObject *__pyx_r = 0; | |
2751 __Pyx_RefNannyDeclarations | |
2752 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); | |
2753 { | |
2754 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_attr_str,0}; | |
2755 PyObject* values[2] = {0,0}; | |
2756 values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_)); | |
2757 if (unlikely(__pyx_kwds)) { | |
2758 Py_ssize_t kw_args; | |
2759 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
2760 switch (pos_args) { | |
2761 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
2762 CYTHON_FALLTHROUGH; | |
2763 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
2764 CYTHON_FALLTHROUGH; | |
2765 case 0: break; | |
2766 default: goto __pyx_L5_argtuple_error; | |
2767 } | |
2768 kw_args = PyDict_Size(__pyx_kwds); | |
2769 switch (pos_args) { | |
2770 case 0: | |
2771 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; | |
2772 else goto __pyx_L5_argtuple_error; | |
2773 CYTHON_FALLTHROUGH; | |
2774 case 1: | |
2775 if (kw_args > 0) { | |
2776 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attr_str); | |
2777 if (value) { values[1] = value; kw_args--; } | |
2778 } | |
2779 } | |
2780 if (unlikely(kw_args > 0)) { | |
2781 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 146, __pyx_L3_error) | |
2782 } | |
2783 } else { | |
2784 switch (PyTuple_GET_SIZE(__pyx_args)) { | |
2785 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
2786 CYTHON_FALLTHROUGH; | |
2787 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
2788 break; | |
2789 default: goto __pyx_L5_argtuple_error; | |
2790 } | |
2791 } | |
2792 __pyx_v_self = values[0]; | |
2793 __pyx_v_attr_str = values[1]; | |
2794 } | |
2795 goto __pyx_L4_argument_unpacking_done; | |
2796 __pyx_L5_argtuple_error:; | |
2797 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error) | |
2798 __pyx_L3_error:; | |
2799 __Pyx_AddTraceback("pybedtools.cbedtools.Attributes.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
2800 __Pyx_RefNannyFinishContext(); | |
2801 return NULL; | |
2802 __pyx_L4_argument_unpacking_done:; | |
2803 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_10Attributes___init__(__pyx_self, __pyx_v_self, __pyx_v_attr_str); | |
2804 | |
2805 /* function exit code */ | |
2806 __Pyx_RefNannyFinishContext(); | |
2807 return __pyx_r; | |
2808 } | |
2809 | |
2810 static PyObject *__pyx_pf_10pybedtools_9cbedtools_10Attributes___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attr_str) { | |
2811 PyObject *__pyx_v_n_semi = NULL; | |
2812 PyObject *__pyx_v_n_eq = NULL; | |
2813 CYTHON_UNUSED PyObject *__pyx_v_n_quotes = NULL; | |
2814 PyObject *__pyx_v_kvs = NULL; | |
2815 PyObject *__pyx_v_field = NULL; | |
2816 PyObject *__pyx_v_value = NULL; | |
2817 PyObject *__pyx_v_kv = NULL; | |
2818 PyObject *__pyx_r = NULL; | |
2819 __Pyx_RefNannyDeclarations | |
2820 PyObject *__pyx_t_1 = NULL; | |
2821 PyObject *__pyx_t_2 = NULL; | |
2822 PyObject *__pyx_t_3 = NULL; | |
2823 int __pyx_t_4; | |
2824 PyObject *__pyx_t_5 = NULL; | |
2825 PyObject *__pyx_t_6 = NULL; | |
2826 Py_ssize_t __pyx_t_7; | |
2827 PyObject *(*__pyx_t_8)(PyObject *); | |
2828 PyObject *__pyx_t_9 = NULL; | |
2829 int __pyx_t_10; | |
2830 PyObject *__pyx_t_11 = NULL; | |
2831 PyObject *(*__pyx_t_12)(PyObject *); | |
2832 int __pyx_lineno = 0; | |
2833 const char *__pyx_filename = NULL; | |
2834 int __pyx_clineno = 0; | |
2835 __Pyx_RefNannySetupContext("__init__", 0); | |
2836 __Pyx_INCREF(__pyx_v_attr_str); | |
2837 | |
2838 /* "pybedtools/cbedtools.pyx":147 | |
2839 * | |
2840 * def __init__(self, attr_str=""): | |
2841 * attr_str = str(attr_str) # <<<<<<<<<<<<<< | |
2842 * self._attr_str = attr_str | |
2843 * self.sort_keys = False | |
2844 */ | |
2845 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_attr_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) | |
2846 __Pyx_GOTREF(__pyx_t_1); | |
2847 __Pyx_DECREF_SET(__pyx_v_attr_str, __pyx_t_1); | |
2848 __pyx_t_1 = 0; | |
2849 | |
2850 /* "pybedtools/cbedtools.pyx":148 | |
2851 * def __init__(self, attr_str=""): | |
2852 * attr_str = str(attr_str) | |
2853 * self._attr_str = attr_str # <<<<<<<<<<<<<< | |
2854 * self.sort_keys = False | |
2855 * | |
2856 */ | |
2857 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_attr_str_2, __pyx_v_attr_str) < 0) __PYX_ERR(0, 148, __pyx_L1_error) | |
2858 | |
2859 /* "pybedtools/cbedtools.pyx":149 | |
2860 * attr_str = str(attr_str) | |
2861 * self._attr_str = attr_str | |
2862 * self.sort_keys = False # <<<<<<<<<<<<<< | |
2863 * | |
2864 * # in general, GFF files will have either as many '=' as ';' | |
2865 */ | |
2866 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sort_keys, Py_False) < 0) __PYX_ERR(0, 149, __pyx_L1_error) | |
2867 | |
2868 /* "pybedtools/cbedtools.pyx":153 | |
2869 * # in general, GFF files will have either as many '=' as ';' | |
2870 * # (or ';'-1 if there's no trailing ';') | |
2871 * n_semi = attr_str.count(';') # <<<<<<<<<<<<<< | |
2872 * n_eq = attr_str.count('=') | |
2873 * n_quotes = attr_str.count('"') | |
2874 */ | |
2875 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attr_str, __pyx_n_s_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) | |
2876 __Pyx_GOTREF(__pyx_t_2); | |
2877 __pyx_t_3 = NULL; | |
2878 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
2879 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
2880 if (likely(__pyx_t_3)) { | |
2881 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
2882 __Pyx_INCREF(__pyx_t_3); | |
2883 __Pyx_INCREF(function); | |
2884 __Pyx_DECREF_SET(__pyx_t_2, function); | |
2885 } | |
2886 } | |
2887 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__2); | |
2888 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
2889 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) | |
2890 __Pyx_GOTREF(__pyx_t_1); | |
2891 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2892 __pyx_v_n_semi = __pyx_t_1; | |
2893 __pyx_t_1 = 0; | |
2894 | |
2895 /* "pybedtools/cbedtools.pyx":154 | |
2896 * # (or ';'-1 if there's no trailing ';') | |
2897 * n_semi = attr_str.count(';') | |
2898 * n_eq = attr_str.count('=') # <<<<<<<<<<<<<< | |
2899 * n_quotes = attr_str.count('"') | |
2900 * | |
2901 */ | |
2902 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attr_str, __pyx_n_s_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) | |
2903 __Pyx_GOTREF(__pyx_t_2); | |
2904 __pyx_t_3 = NULL; | |
2905 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
2906 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
2907 if (likely(__pyx_t_3)) { | |
2908 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
2909 __Pyx_INCREF(__pyx_t_3); | |
2910 __Pyx_INCREF(function); | |
2911 __Pyx_DECREF_SET(__pyx_t_2, function); | |
2912 } | |
2913 } | |
2914 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__3); | |
2915 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
2916 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) | |
2917 __Pyx_GOTREF(__pyx_t_1); | |
2918 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2919 __pyx_v_n_eq = __pyx_t_1; | |
2920 __pyx_t_1 = 0; | |
2921 | |
2922 /* "pybedtools/cbedtools.pyx":155 | |
2923 * n_semi = attr_str.count(';') | |
2924 * n_eq = attr_str.count('=') | |
2925 * n_quotes = attr_str.count('"') # <<<<<<<<<<<<<< | |
2926 * | |
2927 * if n_eq > n_semi - 1: | |
2928 */ | |
2929 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attr_str, __pyx_n_s_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) | |
2930 __Pyx_GOTREF(__pyx_t_2); | |
2931 __pyx_t_3 = NULL; | |
2932 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
2933 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
2934 if (likely(__pyx_t_3)) { | |
2935 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
2936 __Pyx_INCREF(__pyx_t_3); | |
2937 __Pyx_INCREF(function); | |
2938 __Pyx_DECREF_SET(__pyx_t_2, function); | |
2939 } | |
2940 } | |
2941 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__4); | |
2942 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
2943 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) | |
2944 __Pyx_GOTREF(__pyx_t_1); | |
2945 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2946 __pyx_v_n_quotes = __pyx_t_1; | |
2947 __pyx_t_1 = 0; | |
2948 | |
2949 /* "pybedtools/cbedtools.pyx":157 | |
2950 * n_quotes = attr_str.count('"') | |
2951 * | |
2952 * if n_eq > n_semi - 1: # <<<<<<<<<<<<<< | |
2953 * self.sep, self.field_sep = (';', '=') | |
2954 * else: | |
2955 */ | |
2956 __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_semi, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) | |
2957 __Pyx_GOTREF(__pyx_t_1); | |
2958 __pyx_t_2 = PyObject_RichCompare(__pyx_v_n_eq, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) | |
2959 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
2960 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 157, __pyx_L1_error) | |
2961 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2962 if (__pyx_t_4) { | |
2963 | |
2964 /* "pybedtools/cbedtools.pyx":158 | |
2965 * | |
2966 * if n_eq > n_semi - 1: | |
2967 * self.sep, self.field_sep = (';', '=') # <<<<<<<<<<<<<< | |
2968 * else: | |
2969 * self.sep, self.field_sep = (';', ' ') | |
2970 */ | |
2971 __pyx_t_2 = __pyx_kp_s__2; | |
2972 __Pyx_INCREF(__pyx_t_2); | |
2973 __pyx_t_1 = __pyx_kp_s__3; | |
2974 __Pyx_INCREF(__pyx_t_1); | |
2975 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sep, __pyx_t_2) < 0) __PYX_ERR(0, 158, __pyx_L1_error) | |
2976 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2977 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_field_sep, __pyx_t_1) < 0) __PYX_ERR(0, 158, __pyx_L1_error) | |
2978 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
2979 | |
2980 /* "pybedtools/cbedtools.pyx":157 | |
2981 * n_quotes = attr_str.count('"') | |
2982 * | |
2983 * if n_eq > n_semi - 1: # <<<<<<<<<<<<<< | |
2984 * self.sep, self.field_sep = (';', '=') | |
2985 * else: | |
2986 */ | |
2987 goto __pyx_L3; | |
2988 } | |
2989 | |
2990 /* "pybedtools/cbedtools.pyx":160 | |
2991 * self.sep, self.field_sep = (';', '=') | |
2992 * else: | |
2993 * self.sep, self.field_sep = (';', ' ') # <<<<<<<<<<<<<< | |
2994 * | |
2995 * self._quoted = {} | |
2996 */ | |
2997 /*else*/ { | |
2998 __pyx_t_1 = __pyx_kp_s__2; | |
2999 __Pyx_INCREF(__pyx_t_1); | |
3000 __pyx_t_2 = __pyx_kp_s__5; | |
3001 __Pyx_INCREF(__pyx_t_2); | |
3002 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sep, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) | |
3003 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3004 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_field_sep, __pyx_t_2) < 0) __PYX_ERR(0, 160, __pyx_L1_error) | |
3005 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3006 } | |
3007 __pyx_L3:; | |
3008 | |
3009 /* "pybedtools/cbedtools.pyx":162 | |
3010 * self.sep, self.field_sep = (';', ' ') | |
3011 * | |
3012 * self._quoted = {} # <<<<<<<<<<<<<< | |
3013 * | |
3014 * # TODO: pathological case . . . detect this as GFF: | |
3015 */ | |
3016 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) | |
3017 __Pyx_GOTREF(__pyx_t_2); | |
3018 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quoted, __pyx_t_2) < 0) __PYX_ERR(0, 162, __pyx_L1_error) | |
3019 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3020 | |
3021 /* "pybedtools/cbedtools.pyx":173 | |
3022 * | |
3023 * # quick exit | |
3024 * if attr_str == "": # <<<<<<<<<<<<<< | |
3025 * return | |
3026 * | |
3027 */ | |
3028 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_attr_str, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 173, __pyx_L1_error) | |
3029 if (__pyx_t_4) { | |
3030 | |
3031 /* "pybedtools/cbedtools.pyx":174 | |
3032 * # quick exit | |
3033 * if attr_str == "": | |
3034 * return # <<<<<<<<<<<<<< | |
3035 * | |
3036 * kvs = map(str.strip, attr_str.strip().split(self.sep)) | |
3037 */ | |
3038 __Pyx_XDECREF(__pyx_r); | |
3039 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
3040 goto __pyx_L0; | |
3041 | |
3042 /* "pybedtools/cbedtools.pyx":173 | |
3043 * | |
3044 * # quick exit | |
3045 * if attr_str == "": # <<<<<<<<<<<<<< | |
3046 * return | |
3047 * | |
3048 */ | |
3049 } | |
3050 | |
3051 /* "pybedtools/cbedtools.pyx":176 | |
3052 * return | |
3053 * | |
3054 * kvs = map(str.strip, attr_str.strip().split(self.sep)) # <<<<<<<<<<<<<< | |
3055 * for field, value in [kv.split(self.field_sep, 1) for kv in kvs if kv]: | |
3056 * if value.count('"') == 2: | |
3057 */ | |
3058 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyString_Type)), __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3059 __Pyx_GOTREF(__pyx_t_2); | |
3060 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_attr_str, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3061 __Pyx_GOTREF(__pyx_t_5); | |
3062 __pyx_t_6 = NULL; | |
3063 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { | |
3064 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); | |
3065 if (likely(__pyx_t_6)) { | |
3066 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); | |
3067 __Pyx_INCREF(__pyx_t_6); | |
3068 __Pyx_INCREF(function); | |
3069 __Pyx_DECREF_SET(__pyx_t_5, function); | |
3070 } | |
3071 } | |
3072 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); | |
3073 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3074 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3075 __Pyx_GOTREF(__pyx_t_3); | |
3076 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3077 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3078 __Pyx_GOTREF(__pyx_t_5); | |
3079 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3080 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3081 __Pyx_GOTREF(__pyx_t_3); | |
3082 __pyx_t_6 = NULL; | |
3083 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { | |
3084 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); | |
3085 if (likely(__pyx_t_6)) { | |
3086 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); | |
3087 __Pyx_INCREF(__pyx_t_6); | |
3088 __Pyx_INCREF(function); | |
3089 __Pyx_DECREF_SET(__pyx_t_5, function); | |
3090 } | |
3091 } | |
3092 __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); | |
3093 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3094 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3095 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3096 __Pyx_GOTREF(__pyx_t_1); | |
3097 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3098 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3099 __Pyx_GOTREF(__pyx_t_5); | |
3100 __Pyx_GIVEREF(__pyx_t_2); | |
3101 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); | |
3102 __Pyx_GIVEREF(__pyx_t_1); | |
3103 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); | |
3104 __pyx_t_2 = 0; | |
3105 __pyx_t_1 = 0; | |
3106 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) | |
3107 __Pyx_GOTREF(__pyx_t_1); | |
3108 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3109 __pyx_v_kvs = __pyx_t_1; | |
3110 __pyx_t_1 = 0; | |
3111 | |
3112 /* "pybedtools/cbedtools.pyx":177 | |
3113 * | |
3114 * kvs = map(str.strip, attr_str.strip().split(self.sep)) | |
3115 * for field, value in [kv.split(self.field_sep, 1) for kv in kvs if kv]: # <<<<<<<<<<<<<< | |
3116 * if value.count('"') == 2: | |
3117 * self._quoted[field] = True | |
3118 */ | |
3119 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3120 __Pyx_GOTREF(__pyx_t_1); | |
3121 if (likely(PyList_CheckExact(__pyx_v_kvs)) || PyTuple_CheckExact(__pyx_v_kvs)) { | |
3122 __pyx_t_5 = __pyx_v_kvs; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; | |
3123 __pyx_t_8 = NULL; | |
3124 } else { | |
3125 __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_kvs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3126 __Pyx_GOTREF(__pyx_t_5); | |
3127 __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3128 } | |
3129 for (;;) { | |
3130 if (likely(!__pyx_t_8)) { | |
3131 if (likely(PyList_CheckExact(__pyx_t_5))) { | |
3132 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; | |
3133 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3134 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3135 #else | |
3136 __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3137 __Pyx_GOTREF(__pyx_t_2); | |
3138 #endif | |
3139 } else { | |
3140 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; | |
3141 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3142 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3143 #else | |
3144 __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3145 __Pyx_GOTREF(__pyx_t_2); | |
3146 #endif | |
3147 } | |
3148 } else { | |
3149 __pyx_t_2 = __pyx_t_8(__pyx_t_5); | |
3150 if (unlikely(!__pyx_t_2)) { | |
3151 PyObject* exc_type = PyErr_Occurred(); | |
3152 if (exc_type) { | |
3153 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); | |
3154 else __PYX_ERR(0, 177, __pyx_L1_error) | |
3155 } | |
3156 break; | |
3157 } | |
3158 __Pyx_GOTREF(__pyx_t_2); | |
3159 } | |
3160 __Pyx_XDECREF_SET(__pyx_v_kv, __pyx_t_2); | |
3161 __pyx_t_2 = 0; | |
3162 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kv); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3163 if (__pyx_t_4) { | |
3164 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3165 __Pyx_GOTREF(__pyx_t_3); | |
3166 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_field_sep); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3167 __Pyx_GOTREF(__pyx_t_6); | |
3168 __pyx_t_9 = NULL; | |
3169 __pyx_t_10 = 0; | |
3170 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { | |
3171 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); | |
3172 if (likely(__pyx_t_9)) { | |
3173 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); | |
3174 __Pyx_INCREF(__pyx_t_9); | |
3175 __Pyx_INCREF(function); | |
3176 __Pyx_DECREF_SET(__pyx_t_3, function); | |
3177 __pyx_t_10 = 1; | |
3178 } | |
3179 } | |
3180 #if CYTHON_FAST_PYCALL | |
3181 if (PyFunction_Check(__pyx_t_3)) { | |
3182 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_int_1}; | |
3183 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3184 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; | |
3185 __Pyx_GOTREF(__pyx_t_2); | |
3186 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3187 } else | |
3188 #endif | |
3189 #if CYTHON_FAST_PYCCALL | |
3190 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { | |
3191 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_int_1}; | |
3192 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3193 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; | |
3194 __Pyx_GOTREF(__pyx_t_2); | |
3195 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3196 } else | |
3197 #endif | |
3198 { | |
3199 __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3200 __Pyx_GOTREF(__pyx_t_11); | |
3201 if (__pyx_t_9) { | |
3202 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; | |
3203 } | |
3204 __Pyx_GIVEREF(__pyx_t_6); | |
3205 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_6); | |
3206 __Pyx_INCREF(__pyx_int_1); | |
3207 __Pyx_GIVEREF(__pyx_int_1); | |
3208 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_int_1); | |
3209 __pyx_t_6 = 0; | |
3210 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3211 __Pyx_GOTREF(__pyx_t_2); | |
3212 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
3213 } | |
3214 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3215 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 177, __pyx_L1_error) | |
3216 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3217 } | |
3218 } | |
3219 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3220 __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; | |
3221 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3222 for (;;) { | |
3223 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; | |
3224 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3225 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3226 #else | |
3227 __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3228 __Pyx_GOTREF(__pyx_t_1); | |
3229 #endif | |
3230 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { | |
3231 PyObject* sequence = __pyx_t_1; | |
3232 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); | |
3233 if (unlikely(size != 2)) { | |
3234 if (size > 2) __Pyx_RaiseTooManyValuesError(2); | |
3235 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); | |
3236 __PYX_ERR(0, 177, __pyx_L1_error) | |
3237 } | |
3238 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3239 if (likely(PyTuple_CheckExact(sequence))) { | |
3240 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); | |
3241 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); | |
3242 } else { | |
3243 __pyx_t_2 = PyList_GET_ITEM(sequence, 0); | |
3244 __pyx_t_3 = PyList_GET_ITEM(sequence, 1); | |
3245 } | |
3246 __Pyx_INCREF(__pyx_t_2); | |
3247 __Pyx_INCREF(__pyx_t_3); | |
3248 #else | |
3249 __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3250 __Pyx_GOTREF(__pyx_t_2); | |
3251 __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3252 __Pyx_GOTREF(__pyx_t_3); | |
3253 #endif | |
3254 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3255 } else { | |
3256 Py_ssize_t index = -1; | |
3257 __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 177, __pyx_L1_error) | |
3258 __Pyx_GOTREF(__pyx_t_11); | |
3259 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3260 __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; | |
3261 index = 0; __pyx_t_2 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed; | |
3262 __Pyx_GOTREF(__pyx_t_2); | |
3263 index = 1; __pyx_t_3 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed; | |
3264 __Pyx_GOTREF(__pyx_t_3); | |
3265 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 177, __pyx_L1_error) | |
3266 __pyx_t_12 = NULL; | |
3267 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
3268 goto __pyx_L11_unpacking_done; | |
3269 __pyx_L10_unpacking_failed:; | |
3270 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
3271 __pyx_t_12 = NULL; | |
3272 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); | |
3273 __PYX_ERR(0, 177, __pyx_L1_error) | |
3274 __pyx_L11_unpacking_done:; | |
3275 } | |
3276 __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); | |
3277 __pyx_t_2 = 0; | |
3278 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_3); | |
3279 __pyx_t_3 = 0; | |
3280 | |
3281 /* "pybedtools/cbedtools.pyx":178 | |
3282 * kvs = map(str.strip, attr_str.strip().split(self.sep)) | |
3283 * for field, value in [kv.split(self.field_sep, 1) for kv in kvs if kv]: | |
3284 * if value.count('"') == 2: # <<<<<<<<<<<<<< | |
3285 * self._quoted[field] = True | |
3286 * self[field] = value.replace('"', '') | |
3287 */ | |
3288 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) | |
3289 __Pyx_GOTREF(__pyx_t_3); | |
3290 __pyx_t_2 = NULL; | |
3291 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { | |
3292 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); | |
3293 if (likely(__pyx_t_2)) { | |
3294 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); | |
3295 __Pyx_INCREF(__pyx_t_2); | |
3296 __Pyx_INCREF(function); | |
3297 __Pyx_DECREF_SET(__pyx_t_3, function); | |
3298 } | |
3299 } | |
3300 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s__4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__4); | |
3301 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3302 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) | |
3303 __Pyx_GOTREF(__pyx_t_1); | |
3304 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3305 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) | |
3306 __Pyx_GOTREF(__pyx_t_3); | |
3307 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3308 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 178, __pyx_L1_error) | |
3309 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3310 if (__pyx_t_4) { | |
3311 | |
3312 /* "pybedtools/cbedtools.pyx":179 | |
3313 * for field, value in [kv.split(self.field_sep, 1) for kv in kvs if kv]: | |
3314 * if value.count('"') == 2: | |
3315 * self._quoted[field] = True # <<<<<<<<<<<<<< | |
3316 * self[field] = value.replace('"', '') | |
3317 * | |
3318 */ | |
3319 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quoted); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) | |
3320 __Pyx_GOTREF(__pyx_t_3); | |
3321 if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_v_field, Py_True) < 0)) __PYX_ERR(0, 179, __pyx_L1_error) | |
3322 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3323 | |
3324 /* "pybedtools/cbedtools.pyx":178 | |
3325 * kvs = map(str.strip, attr_str.strip().split(self.sep)) | |
3326 * for field, value in [kv.split(self.field_sep, 1) for kv in kvs if kv]: | |
3327 * if value.count('"') == 2: # <<<<<<<<<<<<<< | |
3328 * self._quoted[field] = True | |
3329 * self[field] = value.replace('"', '') | |
3330 */ | |
3331 } | |
3332 | |
3333 /* "pybedtools/cbedtools.pyx":180 | |
3334 * if value.count('"') == 2: | |
3335 * self._quoted[field] = True | |
3336 * self[field] = value.replace('"', '') # <<<<<<<<<<<<<< | |
3337 * | |
3338 * def __str__(self): | |
3339 */ | |
3340 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) | |
3341 __Pyx_GOTREF(__pyx_t_3); | |
3342 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) | |
3343 __Pyx_GOTREF(__pyx_t_1); | |
3344 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
3345 if (unlikely(PyObject_SetItem(__pyx_v_self, __pyx_v_field, __pyx_t_1) < 0)) __PYX_ERR(0, 180, __pyx_L1_error) | |
3346 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3347 | |
3348 /* "pybedtools/cbedtools.pyx":177 | |
3349 * | |
3350 * kvs = map(str.strip, attr_str.strip().split(self.sep)) | |
3351 * for field, value in [kv.split(self.field_sep, 1) for kv in kvs if kv]: # <<<<<<<<<<<<<< | |
3352 * if value.count('"') == 2: | |
3353 * self._quoted[field] = True | |
3354 */ | |
3355 } | |
3356 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3357 | |
3358 /* "pybedtools/cbedtools.pyx":146 | |
3359 * """ | |
3360 * | |
3361 * def __init__(self, attr_str=""): # <<<<<<<<<<<<<< | |
3362 * attr_str = str(attr_str) | |
3363 * self._attr_str = attr_str | |
3364 */ | |
3365 | |
3366 /* function exit code */ | |
3367 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
3368 goto __pyx_L0; | |
3369 __pyx_L1_error:; | |
3370 __Pyx_XDECREF(__pyx_t_1); | |
3371 __Pyx_XDECREF(__pyx_t_2); | |
3372 __Pyx_XDECREF(__pyx_t_3); | |
3373 __Pyx_XDECREF(__pyx_t_5); | |
3374 __Pyx_XDECREF(__pyx_t_6); | |
3375 __Pyx_XDECREF(__pyx_t_9); | |
3376 __Pyx_XDECREF(__pyx_t_11); | |
3377 __Pyx_AddTraceback("pybedtools.cbedtools.Attributes.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
3378 __pyx_r = NULL; | |
3379 __pyx_L0:; | |
3380 __Pyx_XDECREF(__pyx_v_n_semi); | |
3381 __Pyx_XDECREF(__pyx_v_n_eq); | |
3382 __Pyx_XDECREF(__pyx_v_n_quotes); | |
3383 __Pyx_XDECREF(__pyx_v_kvs); | |
3384 __Pyx_XDECREF(__pyx_v_field); | |
3385 __Pyx_XDECREF(__pyx_v_value); | |
3386 __Pyx_XDECREF(__pyx_v_kv); | |
3387 __Pyx_XDECREF(__pyx_v_attr_str); | |
3388 __Pyx_XGIVEREF(__pyx_r); | |
3389 __Pyx_RefNannyFinishContext(); | |
3390 return __pyx_r; | |
3391 } | |
3392 | |
3393 /* "pybedtools/cbedtools.pyx":182 | |
3394 * self[field] = value.replace('"', '') | |
3395 * | |
3396 * def __str__(self): # <<<<<<<<<<<<<< | |
3397 * # stringify all items first | |
3398 * items = [] | |
3399 */ | |
3400 | |
3401 /* Python wrapper */ | |
3402 static PyObject *__pyx_pw_10pybedtools_9cbedtools_10Attributes_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ | |
3403 static PyMethodDef __pyx_mdef_10pybedtools_9cbedtools_10Attributes_3__str__ = {"__str__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_10Attributes_3__str__, METH_O, 0}; | |
3404 static PyObject *__pyx_pw_10pybedtools_9cbedtools_10Attributes_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { | |
3405 PyObject *__pyx_r = 0; | |
3406 __Pyx_RefNannyDeclarations | |
3407 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); | |
3408 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_10Attributes_2__str__(__pyx_self, ((PyObject *)__pyx_v_self)); | |
3409 | |
3410 /* function exit code */ | |
3411 __Pyx_RefNannyFinishContext(); | |
3412 return __pyx_r; | |
3413 } | |
3414 | |
3415 static PyObject *__pyx_pf_10pybedtools_9cbedtools_10Attributes_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { | |
3416 PyObject *__pyx_v_items = NULL; | |
3417 PyObject *__pyx_v_field = NULL; | |
3418 PyObject *__pyx_v_val = NULL; | |
3419 PyObject *__pyx_v_pairs = NULL; | |
3420 PyObject *__pyx_v_k = NULL; | |
3421 PyObject *__pyx_v_v = NULL; | |
3422 PyObject *__pyx_r = NULL; | |
3423 __Pyx_RefNannyDeclarations | |
3424 PyObject *__pyx_t_1 = NULL; | |
3425 PyObject *__pyx_t_2 = NULL; | |
3426 Py_ssize_t __pyx_t_3; | |
3427 PyObject *(*__pyx_t_4)(PyObject *); | |
3428 PyObject *__pyx_t_5 = NULL; | |
3429 PyObject *__pyx_t_6 = NULL; | |
3430 PyObject *__pyx_t_7 = NULL; | |
3431 PyObject *(*__pyx_t_8)(PyObject *); | |
3432 PyObject *__pyx_t_9 = NULL; | |
3433 PyObject *__pyx_t_10 = NULL; | |
3434 PyObject *__pyx_t_11 = NULL; | |
3435 int __pyx_t_12; | |
3436 int __pyx_t_13; | |
3437 int __pyx_t_14; | |
3438 int __pyx_lineno = 0; | |
3439 const char *__pyx_filename = NULL; | |
3440 int __pyx_clineno = 0; | |
3441 __Pyx_RefNannySetupContext("__str__", 0); | |
3442 | |
3443 /* "pybedtools/cbedtools.pyx":184 | |
3444 * def __str__(self): | |
3445 * # stringify all items first | |
3446 * items = [] # <<<<<<<<<<<<<< | |
3447 * for field, val in dict.iteritems(self): | |
3448 * try: | |
3449 */ | |
3450 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) | |
3451 __Pyx_GOTREF(__pyx_t_1); | |
3452 __pyx_v_items = ((PyObject*)__pyx_t_1); | |
3453 __pyx_t_1 = 0; | |
3454 | |
3455 /* "pybedtools/cbedtools.pyx":185 | |
3456 * # stringify all items first | |
3457 * items = [] | |
3458 * for field, val in dict.iteritems(self): # <<<<<<<<<<<<<< | |
3459 * try: | |
3460 * if self._quoted[field]: | |
3461 */ | |
3462 if (unlikely(__pyx_v_self == Py_None)) { | |
3463 PyErr_Format(PyExc_TypeError, "descriptor '%s' requires a '%s' object but received a 'NoneType'", "iteritems", "dict"); | |
3464 __PYX_ERR(0, 185, __pyx_L1_error) | |
3465 } | |
3466 if (!(likely(PyDict_Check(__pyx_v_self))||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_self)->tp_name), 0))) __PYX_ERR(0, 185, __pyx_L1_error) | |
3467 __pyx_t_1 = __Pyx_PyDict_IterItems(((PyObject*)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3468 __Pyx_GOTREF(__pyx_t_1); | |
3469 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { | |
3470 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; | |
3471 __pyx_t_4 = NULL; | |
3472 } else { | |
3473 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3474 __Pyx_GOTREF(__pyx_t_2); | |
3475 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3476 } | |
3477 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3478 for (;;) { | |
3479 if (likely(!__pyx_t_4)) { | |
3480 if (likely(PyList_CheckExact(__pyx_t_2))) { | |
3481 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; | |
3482 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3483 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3484 #else | |
3485 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3486 __Pyx_GOTREF(__pyx_t_1); | |
3487 #endif | |
3488 } else { | |
3489 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; | |
3490 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3491 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3492 #else | |
3493 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3494 __Pyx_GOTREF(__pyx_t_1); | |
3495 #endif | |
3496 } | |
3497 } else { | |
3498 __pyx_t_1 = __pyx_t_4(__pyx_t_2); | |
3499 if (unlikely(!__pyx_t_1)) { | |
3500 PyObject* exc_type = PyErr_Occurred(); | |
3501 if (exc_type) { | |
3502 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); | |
3503 else __PYX_ERR(0, 185, __pyx_L1_error) | |
3504 } | |
3505 break; | |
3506 } | |
3507 __Pyx_GOTREF(__pyx_t_1); | |
3508 } | |
3509 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { | |
3510 PyObject* sequence = __pyx_t_1; | |
3511 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); | |
3512 if (unlikely(size != 2)) { | |
3513 if (size > 2) __Pyx_RaiseTooManyValuesError(2); | |
3514 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); | |
3515 __PYX_ERR(0, 185, __pyx_L1_error) | |
3516 } | |
3517 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3518 if (likely(PyTuple_CheckExact(sequence))) { | |
3519 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); | |
3520 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); | |
3521 } else { | |
3522 __pyx_t_5 = PyList_GET_ITEM(sequence, 0); | |
3523 __pyx_t_6 = PyList_GET_ITEM(sequence, 1); | |
3524 } | |
3525 __Pyx_INCREF(__pyx_t_5); | |
3526 __Pyx_INCREF(__pyx_t_6); | |
3527 #else | |
3528 __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3529 __Pyx_GOTREF(__pyx_t_5); | |
3530 __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3531 __Pyx_GOTREF(__pyx_t_6); | |
3532 #endif | |
3533 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3534 } else { | |
3535 Py_ssize_t index = -1; | |
3536 __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __pyx_L1_error) | |
3537 __Pyx_GOTREF(__pyx_t_7); | |
3538 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3539 __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; | |
3540 index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; | |
3541 __Pyx_GOTREF(__pyx_t_5); | |
3542 index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; | |
3543 __Pyx_GOTREF(__pyx_t_6); | |
3544 if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 185, __pyx_L1_error) | |
3545 __pyx_t_8 = NULL; | |
3546 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
3547 goto __pyx_L6_unpacking_done; | |
3548 __pyx_L5_unpacking_failed:; | |
3549 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
3550 __pyx_t_8 = NULL; | |
3551 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); | |
3552 __PYX_ERR(0, 185, __pyx_L1_error) | |
3553 __pyx_L6_unpacking_done:; | |
3554 } | |
3555 __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_5); | |
3556 __pyx_t_5 = 0; | |
3557 __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_6); | |
3558 __pyx_t_6 = 0; | |
3559 | |
3560 /* "pybedtools/cbedtools.pyx":186 | |
3561 * items = [] | |
3562 * for field, val in dict.iteritems(self): | |
3563 * try: # <<<<<<<<<<<<<< | |
3564 * if self._quoted[field]: | |
3565 * val = '"' + str(val) + '"' | |
3566 */ | |
3567 { | |
3568 __Pyx_PyThreadState_declare | |
3569 __Pyx_PyThreadState_assign | |
3570 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); | |
3571 __Pyx_XGOTREF(__pyx_t_9); | |
3572 __Pyx_XGOTREF(__pyx_t_10); | |
3573 __Pyx_XGOTREF(__pyx_t_11); | |
3574 /*try:*/ { | |
3575 | |
3576 /* "pybedtools/cbedtools.pyx":187 | |
3577 * for field, val in dict.iteritems(self): | |
3578 * try: | |
3579 * if self._quoted[field]: # <<<<<<<<<<<<<< | |
3580 * val = '"' + str(val) + '"' | |
3581 * except KeyError: | |
3582 */ | |
3583 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quoted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L7_error) | |
3584 __Pyx_GOTREF(__pyx_t_1); | |
3585 __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_field); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L7_error) | |
3586 __Pyx_GOTREF(__pyx_t_6); | |
3587 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3588 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 187, __pyx_L7_error) | |
3589 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3590 if (__pyx_t_12) { | |
3591 | |
3592 /* "pybedtools/cbedtools.pyx":188 | |
3593 * try: | |
3594 * if self._quoted[field]: | |
3595 * val = '"' + str(val) + '"' # <<<<<<<<<<<<<< | |
3596 * except KeyError: | |
3597 * pass | |
3598 */ | |
3599 __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_val); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L7_error) | |
3600 __Pyx_GOTREF(__pyx_t_6); | |
3601 __pyx_t_1 = PyNumber_Add(__pyx_kp_s__4, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L7_error) | |
3602 __Pyx_GOTREF(__pyx_t_1); | |
3603 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3604 __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_kp_s__4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L7_error) | |
3605 __Pyx_GOTREF(__pyx_t_6); | |
3606 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3607 __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_6); | |
3608 __pyx_t_6 = 0; | |
3609 | |
3610 /* "pybedtools/cbedtools.pyx":187 | |
3611 * for field, val in dict.iteritems(self): | |
3612 * try: | |
3613 * if self._quoted[field]: # <<<<<<<<<<<<<< | |
3614 * val = '"' + str(val) + '"' | |
3615 * except KeyError: | |
3616 */ | |
3617 } | |
3618 | |
3619 /* "pybedtools/cbedtools.pyx":186 | |
3620 * items = [] | |
3621 * for field, val in dict.iteritems(self): | |
3622 * try: # <<<<<<<<<<<<<< | |
3623 * if self._quoted[field]: | |
3624 * val = '"' + str(val) + '"' | |
3625 */ | |
3626 } | |
3627 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; | |
3628 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; | |
3629 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; | |
3630 goto __pyx_L14_try_end; | |
3631 __pyx_L7_error:; | |
3632 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3633 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3634 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3635 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
3636 | |
3637 /* "pybedtools/cbedtools.pyx":189 | |
3638 * if self._quoted[field]: | |
3639 * val = '"' + str(val) + '"' | |
3640 * except KeyError: # <<<<<<<<<<<<<< | |
3641 * pass | |
3642 * items.append((field, val)) | |
3643 */ | |
3644 __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); | |
3645 if (__pyx_t_13) { | |
3646 __Pyx_ErrRestore(0,0,0); | |
3647 goto __pyx_L8_exception_handled; | |
3648 } | |
3649 goto __pyx_L9_except_error; | |
3650 __pyx_L9_except_error:; | |
3651 | |
3652 /* "pybedtools/cbedtools.pyx":186 | |
3653 * items = [] | |
3654 * for field, val in dict.iteritems(self): | |
3655 * try: # <<<<<<<<<<<<<< | |
3656 * if self._quoted[field]: | |
3657 * val = '"' + str(val) + '"' | |
3658 */ | |
3659 __Pyx_XGIVEREF(__pyx_t_9); | |
3660 __Pyx_XGIVEREF(__pyx_t_10); | |
3661 __Pyx_XGIVEREF(__pyx_t_11); | |
3662 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); | |
3663 goto __pyx_L1_error; | |
3664 __pyx_L8_exception_handled:; | |
3665 __Pyx_XGIVEREF(__pyx_t_9); | |
3666 __Pyx_XGIVEREF(__pyx_t_10); | |
3667 __Pyx_XGIVEREF(__pyx_t_11); | |
3668 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); | |
3669 __pyx_L14_try_end:; | |
3670 } | |
3671 | |
3672 /* "pybedtools/cbedtools.pyx":191 | |
3673 * except KeyError: | |
3674 * pass | |
3675 * items.append((field, val)) # <<<<<<<<<<<<<< | |
3676 * | |
3677 * pairs = [] | |
3678 */ | |
3679 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L1_error) | |
3680 __Pyx_GOTREF(__pyx_t_6); | |
3681 __Pyx_INCREF(__pyx_v_field); | |
3682 __Pyx_GIVEREF(__pyx_v_field); | |
3683 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_field); | |
3684 __Pyx_INCREF(__pyx_v_val); | |
3685 __Pyx_GIVEREF(__pyx_v_val); | |
3686 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_val); | |
3687 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_items, __pyx_t_6); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 191, __pyx_L1_error) | |
3688 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3689 | |
3690 /* "pybedtools/cbedtools.pyx":185 | |
3691 * # stringify all items first | |
3692 * items = [] | |
3693 * for field, val in dict.iteritems(self): # <<<<<<<<<<<<<< | |
3694 * try: | |
3695 * if self._quoted[field]: | |
3696 */ | |
3697 } | |
3698 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3699 | |
3700 /* "pybedtools/cbedtools.pyx":193 | |
3701 * items.append((field, val)) | |
3702 * | |
3703 * pairs = [] # <<<<<<<<<<<<<< | |
3704 * if self.sort_keys: | |
3705 * items.sort() | |
3706 */ | |
3707 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) | |
3708 __Pyx_GOTREF(__pyx_t_2); | |
3709 __pyx_v_pairs = ((PyObject*)__pyx_t_2); | |
3710 __pyx_t_2 = 0; | |
3711 | |
3712 /* "pybedtools/cbedtools.pyx":194 | |
3713 * | |
3714 * pairs = [] | |
3715 * if self.sort_keys: # <<<<<<<<<<<<<< | |
3716 * items.sort() | |
3717 * for k, v in items: | |
3718 */ | |
3719 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sort_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) | |
3720 __Pyx_GOTREF(__pyx_t_2); | |
3721 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 194, __pyx_L1_error) | |
3722 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3723 if (__pyx_t_12) { | |
3724 | |
3725 /* "pybedtools/cbedtools.pyx":195 | |
3726 * pairs = [] | |
3727 * if self.sort_keys: | |
3728 * items.sort() # <<<<<<<<<<<<<< | |
3729 * for k, v in items: | |
3730 * pairs.append(self.field_sep.join([k, v])) | |
3731 */ | |
3732 __pyx_t_14 = PyList_Sort(__pyx_v_items); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 195, __pyx_L1_error) | |
3733 | |
3734 /* "pybedtools/cbedtools.pyx":194 | |
3735 * | |
3736 * pairs = [] | |
3737 * if self.sort_keys: # <<<<<<<<<<<<<< | |
3738 * items.sort() | |
3739 * for k, v in items: | |
3740 */ | |
3741 } | |
3742 | |
3743 /* "pybedtools/cbedtools.pyx":196 | |
3744 * if self.sort_keys: | |
3745 * items.sort() | |
3746 * for k, v in items: # <<<<<<<<<<<<<< | |
3747 * pairs.append(self.field_sep.join([k, v])) | |
3748 * | |
3749 */ | |
3750 __pyx_t_2 = __pyx_v_items; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; | |
3751 for (;;) { | |
3752 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; | |
3753 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3754 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 196, __pyx_L1_error) | |
3755 #else | |
3756 __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) | |
3757 __Pyx_GOTREF(__pyx_t_6); | |
3758 #endif | |
3759 if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { | |
3760 PyObject* sequence = __pyx_t_6; | |
3761 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); | |
3762 if (unlikely(size != 2)) { | |
3763 if (size > 2) __Pyx_RaiseTooManyValuesError(2); | |
3764 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); | |
3765 __PYX_ERR(0, 196, __pyx_L1_error) | |
3766 } | |
3767 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3768 if (likely(PyTuple_CheckExact(sequence))) { | |
3769 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); | |
3770 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); | |
3771 } else { | |
3772 __pyx_t_1 = PyList_GET_ITEM(sequence, 0); | |
3773 __pyx_t_5 = PyList_GET_ITEM(sequence, 1); | |
3774 } | |
3775 __Pyx_INCREF(__pyx_t_1); | |
3776 __Pyx_INCREF(__pyx_t_5); | |
3777 #else | |
3778 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) | |
3779 __Pyx_GOTREF(__pyx_t_1); | |
3780 __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) | |
3781 __Pyx_GOTREF(__pyx_t_5); | |
3782 #endif | |
3783 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3784 } else { | |
3785 Py_ssize_t index = -1; | |
3786 __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) | |
3787 __Pyx_GOTREF(__pyx_t_7); | |
3788 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3789 __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; | |
3790 index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed; | |
3791 __Pyx_GOTREF(__pyx_t_1); | |
3792 index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L19_unpacking_failed; | |
3793 __Pyx_GOTREF(__pyx_t_5); | |
3794 if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 196, __pyx_L1_error) | |
3795 __pyx_t_8 = NULL; | |
3796 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
3797 goto __pyx_L20_unpacking_done; | |
3798 __pyx_L19_unpacking_failed:; | |
3799 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
3800 __pyx_t_8 = NULL; | |
3801 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); | |
3802 __PYX_ERR(0, 196, __pyx_L1_error) | |
3803 __pyx_L20_unpacking_done:; | |
3804 } | |
3805 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1); | |
3806 __pyx_t_1 = 0; | |
3807 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5); | |
3808 __pyx_t_5 = 0; | |
3809 | |
3810 /* "pybedtools/cbedtools.pyx":197 | |
3811 * items.sort() | |
3812 * for k, v in items: | |
3813 * pairs.append(self.field_sep.join([k, v])) # <<<<<<<<<<<<<< | |
3814 * | |
3815 * return self.sep.join(pairs) + self.sep | |
3816 */ | |
3817 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_field_sep); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) | |
3818 __Pyx_GOTREF(__pyx_t_5); | |
3819 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) | |
3820 __Pyx_GOTREF(__pyx_t_1); | |
3821 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3822 __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) | |
3823 __Pyx_GOTREF(__pyx_t_5); | |
3824 __Pyx_INCREF(__pyx_v_k); | |
3825 __Pyx_GIVEREF(__pyx_v_k); | |
3826 PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_k); | |
3827 __Pyx_INCREF(__pyx_v_v); | |
3828 __Pyx_GIVEREF(__pyx_v_v); | |
3829 PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_v); | |
3830 __pyx_t_7 = NULL; | |
3831 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { | |
3832 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); | |
3833 if (likely(__pyx_t_7)) { | |
3834 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
3835 __Pyx_INCREF(__pyx_t_7); | |
3836 __Pyx_INCREF(function); | |
3837 __Pyx_DECREF_SET(__pyx_t_1, function); | |
3838 } | |
3839 } | |
3840 __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); | |
3841 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
3842 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
3843 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error) | |
3844 __Pyx_GOTREF(__pyx_t_6); | |
3845 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3846 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_pairs, __pyx_t_6); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 197, __pyx_L1_error) | |
3847 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3848 | |
3849 /* "pybedtools/cbedtools.pyx":196 | |
3850 * if self.sort_keys: | |
3851 * items.sort() | |
3852 * for k, v in items: # <<<<<<<<<<<<<< | |
3853 * pairs.append(self.field_sep.join([k, v])) | |
3854 * | |
3855 */ | |
3856 } | |
3857 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3858 | |
3859 /* "pybedtools/cbedtools.pyx":199 | |
3860 * pairs.append(self.field_sep.join([k, v])) | |
3861 * | |
3862 * return self.sep.join(pairs) + self.sep # <<<<<<<<<<<<<< | |
3863 * | |
3864 * cdef class Interval: | |
3865 */ | |
3866 __Pyx_XDECREF(__pyx_r); | |
3867 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sep); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) | |
3868 __Pyx_GOTREF(__pyx_t_6); | |
3869 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) | |
3870 __Pyx_GOTREF(__pyx_t_1); | |
3871 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3872 __pyx_t_6 = NULL; | |
3873 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { | |
3874 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); | |
3875 if (likely(__pyx_t_6)) { | |
3876 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
3877 __Pyx_INCREF(__pyx_t_6); | |
3878 __Pyx_INCREF(function); | |
3879 __Pyx_DECREF_SET(__pyx_t_1, function); | |
3880 } | |
3881 } | |
3882 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_pairs) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_pairs); | |
3883 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
3884 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) | |
3885 __Pyx_GOTREF(__pyx_t_2); | |
3886 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3887 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) | |
3888 __Pyx_GOTREF(__pyx_t_1); | |
3889 __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) | |
3890 __Pyx_GOTREF(__pyx_t_6); | |
3891 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
3892 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
3893 __pyx_r = __pyx_t_6; | |
3894 __pyx_t_6 = 0; | |
3895 goto __pyx_L0; | |
3896 | |
3897 /* "pybedtools/cbedtools.pyx":182 | |
3898 * self[field] = value.replace('"', '') | |
3899 * | |
3900 * def __str__(self): # <<<<<<<<<<<<<< | |
3901 * # stringify all items first | |
3902 * items = [] | |
3903 */ | |
3904 | |
3905 /* function exit code */ | |
3906 __pyx_L1_error:; | |
3907 __Pyx_XDECREF(__pyx_t_1); | |
3908 __Pyx_XDECREF(__pyx_t_2); | |
3909 __Pyx_XDECREF(__pyx_t_5); | |
3910 __Pyx_XDECREF(__pyx_t_6); | |
3911 __Pyx_XDECREF(__pyx_t_7); | |
3912 __Pyx_AddTraceback("pybedtools.cbedtools.Attributes.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
3913 __pyx_r = NULL; | |
3914 __pyx_L0:; | |
3915 __Pyx_XDECREF(__pyx_v_items); | |
3916 __Pyx_XDECREF(__pyx_v_field); | |
3917 __Pyx_XDECREF(__pyx_v_val); | |
3918 __Pyx_XDECREF(__pyx_v_pairs); | |
3919 __Pyx_XDECREF(__pyx_v_k); | |
3920 __Pyx_XDECREF(__pyx_v_v); | |
3921 __Pyx_XGIVEREF(__pyx_r); | |
3922 __Pyx_RefNannyFinishContext(); | |
3923 return __pyx_r; | |
3924 } | |
3925 | |
3926 /* "pybedtools/cbedtools.pyx":242 | |
3927 * | |
3928 * """ | |
3929 * def __init__(self, chrom, start, end, name=".", score=".", strand=".", otherfields=None): # <<<<<<<<<<<<<< | |
3930 * if otherfields is None: | |
3931 * otherfields = [] | |
3932 */ | |
3933 | |
3934 /* Python wrapper */ | |
3935 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
3936 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
3937 PyObject *__pyx_v_chrom = 0; | |
3938 PyObject *__pyx_v_start = 0; | |
3939 PyObject *__pyx_v_end = 0; | |
3940 PyObject *__pyx_v_name = 0; | |
3941 PyObject *__pyx_v_score = 0; | |
3942 PyObject *__pyx_v_strand = 0; | |
3943 PyObject *__pyx_v_otherfields = 0; | |
3944 int __pyx_lineno = 0; | |
3945 const char *__pyx_filename = NULL; | |
3946 int __pyx_clineno = 0; | |
3947 int __pyx_r; | |
3948 __Pyx_RefNannyDeclarations | |
3949 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); | |
3950 { | |
3951 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chrom,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_name,&__pyx_n_s_score,&__pyx_n_s_strand,&__pyx_n_s_otherfields,0}; | |
3952 PyObject* values[7] = {0,0,0,0,0,0,0}; | |
3953 values[3] = ((PyObject *)__pyx_kp_s__7); | |
3954 values[4] = ((PyObject *)__pyx_kp_s__7); | |
3955 values[5] = ((PyObject *)__pyx_kp_s__7); | |
3956 values[6] = ((PyObject *)Py_None); | |
3957 if (unlikely(__pyx_kwds)) { | |
3958 Py_ssize_t kw_args; | |
3959 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
3960 switch (pos_args) { | |
3961 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); | |
3962 CYTHON_FALLTHROUGH; | |
3963 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); | |
3964 CYTHON_FALLTHROUGH; | |
3965 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); | |
3966 CYTHON_FALLTHROUGH; | |
3967 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); | |
3968 CYTHON_FALLTHROUGH; | |
3969 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
3970 CYTHON_FALLTHROUGH; | |
3971 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
3972 CYTHON_FALLTHROUGH; | |
3973 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
3974 CYTHON_FALLTHROUGH; | |
3975 case 0: break; | |
3976 default: goto __pyx_L5_argtuple_error; | |
3977 } | |
3978 kw_args = PyDict_Size(__pyx_kwds); | |
3979 switch (pos_args) { | |
3980 case 0: | |
3981 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--; | |
3982 else goto __pyx_L5_argtuple_error; | |
3983 CYTHON_FALLTHROUGH; | |
3984 case 1: | |
3985 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; | |
3986 else { | |
3987 __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, 1); __PYX_ERR(0, 242, __pyx_L3_error) | |
3988 } | |
3989 CYTHON_FALLTHROUGH; | |
3990 case 2: | |
3991 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--; | |
3992 else { | |
3993 __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, 2); __PYX_ERR(0, 242, __pyx_L3_error) | |
3994 } | |
3995 CYTHON_FALLTHROUGH; | |
3996 case 3: | |
3997 if (kw_args > 0) { | |
3998 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name); | |
3999 if (value) { values[3] = value; kw_args--; } | |
4000 } | |
4001 CYTHON_FALLTHROUGH; | |
4002 case 4: | |
4003 if (kw_args > 0) { | |
4004 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_score); | |
4005 if (value) { values[4] = value; kw_args--; } | |
4006 } | |
4007 CYTHON_FALLTHROUGH; | |
4008 case 5: | |
4009 if (kw_args > 0) { | |
4010 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strand); | |
4011 if (value) { values[5] = value; kw_args--; } | |
4012 } | |
4013 CYTHON_FALLTHROUGH; | |
4014 case 6: | |
4015 if (kw_args > 0) { | |
4016 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_otherfields); | |
4017 if (value) { values[6] = value; kw_args--; } | |
4018 } | |
4019 } | |
4020 if (unlikely(kw_args > 0)) { | |
4021 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 242, __pyx_L3_error) | |
4022 } | |
4023 } else { | |
4024 switch (PyTuple_GET_SIZE(__pyx_args)) { | |
4025 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); | |
4026 CYTHON_FALLTHROUGH; | |
4027 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); | |
4028 CYTHON_FALLTHROUGH; | |
4029 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); | |
4030 CYTHON_FALLTHROUGH; | |
4031 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); | |
4032 CYTHON_FALLTHROUGH; | |
4033 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
4034 values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
4035 values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
4036 break; | |
4037 default: goto __pyx_L5_argtuple_error; | |
4038 } | |
4039 } | |
4040 __pyx_v_chrom = values[0]; | |
4041 __pyx_v_start = values[1]; | |
4042 __pyx_v_end = values[2]; | |
4043 __pyx_v_name = values[3]; | |
4044 __pyx_v_score = values[4]; | |
4045 __pyx_v_strand = values[5]; | |
4046 __pyx_v_otherfields = values[6]; | |
4047 } | |
4048 goto __pyx_L4_argument_unpacking_done; | |
4049 __pyx_L5_argtuple_error:; | |
4050 __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 242, __pyx_L3_error) | |
4051 __pyx_L3_error:; | |
4052 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4053 __Pyx_RefNannyFinishContext(); | |
4054 return -1; | |
4055 __pyx_L4_argument_unpacking_done:; | |
4056 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval___init__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_name, __pyx_v_score, __pyx_v_strand, __pyx_v_otherfields); | |
4057 | |
4058 /* function exit code */ | |
4059 __Pyx_RefNannyFinishContext(); | |
4060 return __pyx_r; | |
4061 } | |
4062 | |
4063 static int __pyx_pf_10pybedtools_9cbedtools_8Interval___init__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_name, PyObject *__pyx_v_score, PyObject *__pyx_v_strand, PyObject *__pyx_v_otherfields) { | |
4064 PyObject *__pyx_v_fields = NULL; | |
4065 PyObject *__pyx_v_i = NULL; | |
4066 int __pyx_r; | |
4067 __Pyx_RefNannyDeclarations | |
4068 int __pyx_t_1; | |
4069 int __pyx_t_2; | |
4070 PyObject *__pyx_t_3 = NULL; | |
4071 PyObject *__pyx_t_4 = NULL; | |
4072 Py_ssize_t __pyx_t_5; | |
4073 PyObject *(*__pyx_t_6)(PyObject *); | |
4074 PyObject *__pyx_t_7 = NULL; | |
4075 std::string __pyx_t_8; | |
4076 CHRPOS __pyx_t_9; | |
4077 CHRPOS __pyx_t_10; | |
4078 std::string __pyx_t_11; | |
4079 std::string __pyx_t_12; | |
4080 std::string __pyx_t_13; | |
4081 std::vector<std::string> __pyx_t_14; | |
4082 PyObject *__pyx_t_15 = NULL; | |
4083 PyObject *__pyx_t_16 = NULL; | |
4084 PyObject *__pyx_t_17 = NULL; | |
4085 PyObject *__pyx_t_18 = NULL; | |
4086 int __pyx_t_19; | |
4087 int __pyx_lineno = 0; | |
4088 const char *__pyx_filename = NULL; | |
4089 int __pyx_clineno = 0; | |
4090 __Pyx_RefNannySetupContext("__init__", 0); | |
4091 __Pyx_INCREF(__pyx_v_otherfields); | |
4092 | |
4093 /* "pybedtools/cbedtools.pyx":243 | |
4094 * """ | |
4095 * def __init__(self, chrom, start, end, name=".", score=".", strand=".", otherfields=None): | |
4096 * if otherfields is None: # <<<<<<<<<<<<<< | |
4097 * otherfields = [] | |
4098 * otherfields = [_cppstr(i) for i in otherfields] | |
4099 */ | |
4100 __pyx_t_1 = (__pyx_v_otherfields == Py_None); | |
4101 __pyx_t_2 = (__pyx_t_1 != 0); | |
4102 if (__pyx_t_2) { | |
4103 | |
4104 /* "pybedtools/cbedtools.pyx":244 | |
4105 * def __init__(self, chrom, start, end, name=".", score=".", strand=".", otherfields=None): | |
4106 * if otherfields is None: | |
4107 * otherfields = [] # <<<<<<<<<<<<<< | |
4108 * otherfields = [_cppstr(i) for i in otherfields] | |
4109 * self._bed = new BED( | |
4110 */ | |
4111 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error) | |
4112 __Pyx_GOTREF(__pyx_t_3); | |
4113 __Pyx_DECREF_SET(__pyx_v_otherfields, __pyx_t_3); | |
4114 __pyx_t_3 = 0; | |
4115 | |
4116 /* "pybedtools/cbedtools.pyx":243 | |
4117 * """ | |
4118 * def __init__(self, chrom, start, end, name=".", score=".", strand=".", otherfields=None): | |
4119 * if otherfields is None: # <<<<<<<<<<<<<< | |
4120 * otherfields = [] | |
4121 * otherfields = [_cppstr(i) for i in otherfields] | |
4122 */ | |
4123 } | |
4124 | |
4125 /* "pybedtools/cbedtools.pyx":245 | |
4126 * if otherfields is None: | |
4127 * otherfields = [] | |
4128 * otherfields = [_cppstr(i) for i in otherfields] # <<<<<<<<<<<<<< | |
4129 * self._bed = new BED( | |
4130 * _cppstr(chrom), start, end, _cppstr(name), _cppstr(score), | |
4131 */ | |
4132 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4133 __Pyx_GOTREF(__pyx_t_3); | |
4134 if (likely(PyList_CheckExact(__pyx_v_otherfields)) || PyTuple_CheckExact(__pyx_v_otherfields)) { | |
4135 __pyx_t_4 = __pyx_v_otherfields; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; | |
4136 __pyx_t_6 = NULL; | |
4137 } else { | |
4138 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_otherfields); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4139 __Pyx_GOTREF(__pyx_t_4); | |
4140 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4141 } | |
4142 for (;;) { | |
4143 if (likely(!__pyx_t_6)) { | |
4144 if (likely(PyList_CheckExact(__pyx_t_4))) { | |
4145 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; | |
4146 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
4147 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4148 #else | |
4149 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4150 __Pyx_GOTREF(__pyx_t_7); | |
4151 #endif | |
4152 } else { | |
4153 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; | |
4154 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
4155 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4156 #else | |
4157 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4158 __Pyx_GOTREF(__pyx_t_7); | |
4159 #endif | |
4160 } | |
4161 } else { | |
4162 __pyx_t_7 = __pyx_t_6(__pyx_t_4); | |
4163 if (unlikely(!__pyx_t_7)) { | |
4164 PyObject* exc_type = PyErr_Occurred(); | |
4165 if (exc_type) { | |
4166 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); | |
4167 else __PYX_ERR(0, 245, __pyx_L1_error) | |
4168 } | |
4169 break; | |
4170 } | |
4171 __Pyx_GOTREF(__pyx_t_7); | |
4172 } | |
4173 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_7); | |
4174 __pyx_t_7 = 0; | |
4175 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error) | |
4176 __Pyx_GOTREF(__pyx_t_7); | |
4177 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 245, __pyx_L1_error) | |
4178 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
4179 } | |
4180 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
4181 __Pyx_DECREF_SET(__pyx_v_otherfields, __pyx_t_3); | |
4182 __pyx_t_3 = 0; | |
4183 | |
4184 /* "pybedtools/cbedtools.pyx":247 | |
4185 * otherfields = [_cppstr(i) for i in otherfields] | |
4186 * self._bed = new BED( | |
4187 * _cppstr(chrom), start, end, _cppstr(name), _cppstr(score), # <<<<<<<<<<<<<< | |
4188 * _cppstr(strand), otherfields) | |
4189 * | |
4190 */ | |
4191 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) | |
4192 __Pyx_GOTREF(__pyx_t_3); | |
4193 __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) | |
4194 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4195 __pyx_t_9 = __Pyx_PyInt_As_CHRPOS(__pyx_v_start); if (unlikely((__pyx_t_9 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) | |
4196 __pyx_t_10 = __Pyx_PyInt_As_CHRPOS(__pyx_v_end); if (unlikely((__pyx_t_10 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) | |
4197 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) | |
4198 __Pyx_GOTREF(__pyx_t_3); | |
4199 __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) | |
4200 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4201 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_score); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) | |
4202 __Pyx_GOTREF(__pyx_t_3); | |
4203 __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) | |
4204 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4205 | |
4206 /* "pybedtools/cbedtools.pyx":248 | |
4207 * self._bed = new BED( | |
4208 * _cppstr(chrom), start, end, _cppstr(name), _cppstr(score), | |
4209 * _cppstr(strand), otherfields) # <<<<<<<<<<<<<< | |
4210 * | |
4211 * #self._bed.chrom = _cppstr(chrom) | |
4212 */ | |
4213 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_strand); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error) | |
4214 __Pyx_GOTREF(__pyx_t_3); | |
4215 __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) | |
4216 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4217 __pyx_t_14 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_otherfields); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) | |
4218 | |
4219 /* "pybedtools/cbedtools.pyx":246 | |
4220 * otherfields = [] | |
4221 * otherfields = [_cppstr(i) for i in otherfields] | |
4222 * self._bed = new BED( # <<<<<<<<<<<<<< | |
4223 * _cppstr(chrom), start, end, _cppstr(name), _cppstr(score), | |
4224 * _cppstr(strand), otherfields) | |
4225 */ | |
4226 __pyx_v_self->_bed = new BED(__pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14); | |
4227 | |
4228 /* "pybedtools/cbedtools.pyx":256 | |
4229 * #self._bed.score = _cppstr(score) | |
4230 * #self._bed.strand = _cppstr(strand) | |
4231 * fields = [_cppstr(chrom), _cppstr(str(start)), _cppstr(str(end)), _cppstr(name), _cppstr(score), _cppstr(strand)] # <<<<<<<<<<<<<< | |
4232 * fields.extend(otherfields) | |
4233 * self._bed.fields = fields | |
4234 */ | |
4235 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4236 __Pyx_GOTREF(__pyx_t_3); | |
4237 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4238 __Pyx_GOTREF(__pyx_t_4); | |
4239 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4240 __Pyx_GOTREF(__pyx_t_7); | |
4241 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
4242 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4243 __Pyx_GOTREF(__pyx_t_4); | |
4244 __pyx_t_15 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4245 __Pyx_GOTREF(__pyx_t_15); | |
4246 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
4247 __pyx_t_4 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4248 __Pyx_GOTREF(__pyx_t_4); | |
4249 __pyx_t_16 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_score); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4250 __Pyx_GOTREF(__pyx_t_16); | |
4251 __pyx_t_17 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_strand); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4252 __Pyx_GOTREF(__pyx_t_17); | |
4253 __pyx_t_18 = PyList_New(6); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 256, __pyx_L1_error) | |
4254 __Pyx_GOTREF(__pyx_t_18); | |
4255 __Pyx_GIVEREF(__pyx_t_3); | |
4256 PyList_SET_ITEM(__pyx_t_18, 0, __pyx_t_3); | |
4257 __Pyx_GIVEREF(__pyx_t_7); | |
4258 PyList_SET_ITEM(__pyx_t_18, 1, __pyx_t_7); | |
4259 __Pyx_GIVEREF(__pyx_t_15); | |
4260 PyList_SET_ITEM(__pyx_t_18, 2, __pyx_t_15); | |
4261 __Pyx_GIVEREF(__pyx_t_4); | |
4262 PyList_SET_ITEM(__pyx_t_18, 3, __pyx_t_4); | |
4263 __Pyx_GIVEREF(__pyx_t_16); | |
4264 PyList_SET_ITEM(__pyx_t_18, 4, __pyx_t_16); | |
4265 __Pyx_GIVEREF(__pyx_t_17); | |
4266 PyList_SET_ITEM(__pyx_t_18, 5, __pyx_t_17); | |
4267 __pyx_t_3 = 0; | |
4268 __pyx_t_7 = 0; | |
4269 __pyx_t_15 = 0; | |
4270 __pyx_t_4 = 0; | |
4271 __pyx_t_16 = 0; | |
4272 __pyx_t_17 = 0; | |
4273 __pyx_v_fields = ((PyObject*)__pyx_t_18); | |
4274 __pyx_t_18 = 0; | |
4275 | |
4276 /* "pybedtools/cbedtools.pyx":257 | |
4277 * #self._bed.strand = _cppstr(strand) | |
4278 * fields = [_cppstr(chrom), _cppstr(str(start)), _cppstr(str(end)), _cppstr(name), _cppstr(score), _cppstr(strand)] | |
4279 * fields.extend(otherfields) # <<<<<<<<<<<<<< | |
4280 * self._bed.fields = fields | |
4281 * self._attrs = None | |
4282 */ | |
4283 __pyx_t_19 = __Pyx_PyList_Extend(__pyx_v_fields, __pyx_v_otherfields); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error) | |
4284 | |
4285 /* "pybedtools/cbedtools.pyx":258 | |
4286 * fields = [_cppstr(chrom), _cppstr(str(start)), _cppstr(str(end)), _cppstr(name), _cppstr(score), _cppstr(strand)] | |
4287 * fields.extend(otherfields) | |
4288 * self._bed.fields = fields # <<<<<<<<<<<<<< | |
4289 * self._attrs = None | |
4290 * | |
4291 */ | |
4292 __pyx_t_14 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_fields); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error) | |
4293 __pyx_v_self->_bed->fields = __pyx_t_14; | |
4294 | |
4295 /* "pybedtools/cbedtools.pyx":259 | |
4296 * fields.extend(otherfields) | |
4297 * self._bed.fields = fields | |
4298 * self._attrs = None # <<<<<<<<<<<<<< | |
4299 * | |
4300 * def __copy__(self): | |
4301 */ | |
4302 __Pyx_INCREF(Py_None); | |
4303 __Pyx_GIVEREF(Py_None); | |
4304 __Pyx_GOTREF(__pyx_v_self->_attrs); | |
4305 __Pyx_DECREF(__pyx_v_self->_attrs); | |
4306 __pyx_v_self->_attrs = Py_None; | |
4307 | |
4308 /* "pybedtools/cbedtools.pyx":242 | |
4309 * | |
4310 * """ | |
4311 * def __init__(self, chrom, start, end, name=".", score=".", strand=".", otherfields=None): # <<<<<<<<<<<<<< | |
4312 * if otherfields is None: | |
4313 * otherfields = [] | |
4314 */ | |
4315 | |
4316 /* function exit code */ | |
4317 __pyx_r = 0; | |
4318 goto __pyx_L0; | |
4319 __pyx_L1_error:; | |
4320 __Pyx_XDECREF(__pyx_t_3); | |
4321 __Pyx_XDECREF(__pyx_t_4); | |
4322 __Pyx_XDECREF(__pyx_t_7); | |
4323 __Pyx_XDECREF(__pyx_t_15); | |
4324 __Pyx_XDECREF(__pyx_t_16); | |
4325 __Pyx_XDECREF(__pyx_t_17); | |
4326 __Pyx_XDECREF(__pyx_t_18); | |
4327 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4328 __pyx_r = -1; | |
4329 __pyx_L0:; | |
4330 __Pyx_XDECREF(__pyx_v_fields); | |
4331 __Pyx_XDECREF(__pyx_v_i); | |
4332 __Pyx_XDECREF(__pyx_v_otherfields); | |
4333 __Pyx_RefNannyFinishContext(); | |
4334 return __pyx_r; | |
4335 } | |
4336 | |
4337 /* "pybedtools/cbedtools.pyx":261 | |
4338 * self._attrs = None | |
4339 * | |
4340 * def __copy__(self): # <<<<<<<<<<<<<< | |
4341 * return create_interval_from_list(self.fields) | |
4342 * | |
4343 */ | |
4344 | |
4345 /* Python wrapper */ | |
4346 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_3__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
4347 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_3__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
4348 PyObject *__pyx_r = 0; | |
4349 __Pyx_RefNannyDeclarations | |
4350 __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0); | |
4351 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_2__copy__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
4352 | |
4353 /* function exit code */ | |
4354 __Pyx_RefNannyFinishContext(); | |
4355 return __pyx_r; | |
4356 } | |
4357 | |
4358 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_2__copy__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
4359 PyObject *__pyx_r = NULL; | |
4360 __Pyx_RefNannyDeclarations | |
4361 PyObject *__pyx_t_1 = NULL; | |
4362 PyObject *__pyx_t_2 = NULL; | |
4363 int __pyx_lineno = 0; | |
4364 const char *__pyx_filename = NULL; | |
4365 int __pyx_clineno = 0; | |
4366 __Pyx_RefNannySetupContext("__copy__", 0); | |
4367 | |
4368 /* "pybedtools/cbedtools.pyx":262 | |
4369 * | |
4370 * def __copy__(self): | |
4371 * return create_interval_from_list(self.fields) # <<<<<<<<<<<<<< | |
4372 * | |
4373 * def __hash__(self): | |
4374 */ | |
4375 __Pyx_XDECREF(__pyx_r); | |
4376 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) | |
4377 __Pyx_GOTREF(__pyx_t_1); | |
4378 if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 262, __pyx_L1_error) | |
4379 __pyx_t_2 = ((PyObject *)__pyx_f_10pybedtools_9cbedtools_create_interval_from_list(((PyObject*)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error) | |
4380 __Pyx_GOTREF(__pyx_t_2); | |
4381 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4382 __pyx_r = __pyx_t_2; | |
4383 __pyx_t_2 = 0; | |
4384 goto __pyx_L0; | |
4385 | |
4386 /* "pybedtools/cbedtools.pyx":261 | |
4387 * self._attrs = None | |
4388 * | |
4389 * def __copy__(self): # <<<<<<<<<<<<<< | |
4390 * return create_interval_from_list(self.fields) | |
4391 * | |
4392 */ | |
4393 | |
4394 /* function exit code */ | |
4395 __pyx_L1_error:; | |
4396 __Pyx_XDECREF(__pyx_t_1); | |
4397 __Pyx_XDECREF(__pyx_t_2); | |
4398 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4399 __pyx_r = NULL; | |
4400 __pyx_L0:; | |
4401 __Pyx_XGIVEREF(__pyx_r); | |
4402 __Pyx_RefNannyFinishContext(); | |
4403 return __pyx_r; | |
4404 } | |
4405 | |
4406 /* "pybedtools/cbedtools.pyx":264 | |
4407 * return create_interval_from_list(self.fields) | |
4408 * | |
4409 * def __hash__(self): # <<<<<<<<<<<<<< | |
4410 * return hash("\t".join(self.fields)) | |
4411 * | |
4412 */ | |
4413 | |
4414 /* Python wrapper */ | |
4415 static Py_hash_t __pyx_pw_10pybedtools_9cbedtools_8Interval_5__hash__(PyObject *__pyx_v_self); /*proto*/ | |
4416 static Py_hash_t __pyx_pw_10pybedtools_9cbedtools_8Interval_5__hash__(PyObject *__pyx_v_self) { | |
4417 Py_hash_t __pyx_r; | |
4418 __Pyx_RefNannyDeclarations | |
4419 __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); | |
4420 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_4__hash__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
4421 | |
4422 /* function exit code */ | |
4423 __Pyx_RefNannyFinishContext(); | |
4424 return __pyx_r; | |
4425 } | |
4426 | |
4427 static Py_hash_t __pyx_pf_10pybedtools_9cbedtools_8Interval_4__hash__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
4428 Py_hash_t __pyx_r; | |
4429 __Pyx_RefNannyDeclarations | |
4430 PyObject *__pyx_t_1 = NULL; | |
4431 PyObject *__pyx_t_2 = NULL; | |
4432 Py_hash_t __pyx_t_3; | |
4433 int __pyx_lineno = 0; | |
4434 const char *__pyx_filename = NULL; | |
4435 int __pyx_clineno = 0; | |
4436 __Pyx_RefNannySetupContext("__hash__", 0); | |
4437 | |
4438 /* "pybedtools/cbedtools.pyx":265 | |
4439 * | |
4440 * def __hash__(self): | |
4441 * return hash("\t".join(self.fields)) # <<<<<<<<<<<<<< | |
4442 * | |
4443 * property chrom: | |
4444 */ | |
4445 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) | |
4446 __Pyx_GOTREF(__pyx_t_1); | |
4447 __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error) | |
4448 __Pyx_GOTREF(__pyx_t_2); | |
4449 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4450 __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 265, __pyx_L1_error) | |
4451 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
4452 __pyx_r = __pyx_t_3; | |
4453 goto __pyx_L0; | |
4454 | |
4455 /* "pybedtools/cbedtools.pyx":264 | |
4456 * return create_interval_from_list(self.fields) | |
4457 * | |
4458 * def __hash__(self): # <<<<<<<<<<<<<< | |
4459 * return hash("\t".join(self.fields)) | |
4460 * | |
4461 */ | |
4462 | |
4463 /* function exit code */ | |
4464 __pyx_L1_error:; | |
4465 __Pyx_XDECREF(__pyx_t_1); | |
4466 __Pyx_XDECREF(__pyx_t_2); | |
4467 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4468 __pyx_r = -1; | |
4469 __pyx_L0:; | |
4470 if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; | |
4471 __Pyx_RefNannyFinishContext(); | |
4472 return __pyx_r; | |
4473 } | |
4474 | |
4475 /* "pybedtools/cbedtools.pyx":269 | |
4476 * property chrom: | |
4477 * """ the chromosome of the feature""" | |
4478 * def __get__(self): # <<<<<<<<<<<<<< | |
4479 * return _pystr(self._bed.chrom) | |
4480 * | |
4481 */ | |
4482 | |
4483 /* Python wrapper */ | |
4484 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5chrom_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
4485 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5chrom_1__get__(PyObject *__pyx_v_self) { | |
4486 PyObject *__pyx_r = 0; | |
4487 __Pyx_RefNannyDeclarations | |
4488 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
4489 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5chrom___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
4490 | |
4491 /* function exit code */ | |
4492 __Pyx_RefNannyFinishContext(); | |
4493 return __pyx_r; | |
4494 } | |
4495 | |
4496 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5chrom___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
4497 PyObject *__pyx_r = NULL; | |
4498 __Pyx_RefNannyDeclarations | |
4499 PyObject *__pyx_t_1 = NULL; | |
4500 int __pyx_lineno = 0; | |
4501 const char *__pyx_filename = NULL; | |
4502 int __pyx_clineno = 0; | |
4503 __Pyx_RefNannySetupContext("__get__", 0); | |
4504 | |
4505 /* "pybedtools/cbedtools.pyx":270 | |
4506 * """ the chromosome of the feature""" | |
4507 * def __get__(self): | |
4508 * return _pystr(self._bed.chrom) # <<<<<<<<<<<<<< | |
4509 * | |
4510 * def __set__(self, chrom): | |
4511 */ | |
4512 __Pyx_XDECREF(__pyx_r); | |
4513 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) | |
4514 __Pyx_GOTREF(__pyx_t_1); | |
4515 __pyx_r = __pyx_t_1; | |
4516 __pyx_t_1 = 0; | |
4517 goto __pyx_L0; | |
4518 | |
4519 /* "pybedtools/cbedtools.pyx":269 | |
4520 * property chrom: | |
4521 * """ the chromosome of the feature""" | |
4522 * def __get__(self): # <<<<<<<<<<<<<< | |
4523 * return _pystr(self._bed.chrom) | |
4524 * | |
4525 */ | |
4526 | |
4527 /* function exit code */ | |
4528 __pyx_L1_error:; | |
4529 __Pyx_XDECREF(__pyx_t_1); | |
4530 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.chrom.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4531 __pyx_r = NULL; | |
4532 __pyx_L0:; | |
4533 __Pyx_XGIVEREF(__pyx_r); | |
4534 __Pyx_RefNannyFinishContext(); | |
4535 return __pyx_r; | |
4536 } | |
4537 | |
4538 /* "pybedtools/cbedtools.pyx":272 | |
4539 * return _pystr(self._bed.chrom) | |
4540 * | |
4541 * def __set__(self, chrom): # <<<<<<<<<<<<<< | |
4542 * chrom = _cppstr(chrom) | |
4543 * self._bed.chrom = chrom | |
4544 */ | |
4545 | |
4546 /* Python wrapper */ | |
4547 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5chrom_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_chrom); /*proto*/ | |
4548 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5chrom_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_chrom) { | |
4549 int __pyx_r; | |
4550 __Pyx_RefNannyDeclarations | |
4551 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
4552 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5chrom_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_chrom)); | |
4553 | |
4554 /* function exit code */ | |
4555 __Pyx_RefNannyFinishContext(); | |
4556 return __pyx_r; | |
4557 } | |
4558 | |
4559 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5chrom_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_chrom) { | |
4560 PyObject *__pyx_v_idx = NULL; | |
4561 int __pyx_r; | |
4562 __Pyx_RefNannyDeclarations | |
4563 PyObject *__pyx_t_1 = NULL; | |
4564 std::string __pyx_t_2; | |
4565 PyObject *__pyx_t_3 = NULL; | |
4566 std::vector<std::string> ::size_type __pyx_t_4; | |
4567 int __pyx_lineno = 0; | |
4568 const char *__pyx_filename = NULL; | |
4569 int __pyx_clineno = 0; | |
4570 __Pyx_RefNannySetupContext("__set__", 0); | |
4571 __Pyx_INCREF(__pyx_v_chrom); | |
4572 | |
4573 /* "pybedtools/cbedtools.pyx":273 | |
4574 * | |
4575 * def __set__(self, chrom): | |
4576 * chrom = _cppstr(chrom) # <<<<<<<<<<<<<< | |
4577 * self._bed.chrom = chrom | |
4578 * idx = LOOKUPS[self.file_type]["chrom"] | |
4579 */ | |
4580 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) | |
4581 __Pyx_GOTREF(__pyx_t_1); | |
4582 __Pyx_DECREF_SET(__pyx_v_chrom, __pyx_t_1); | |
4583 __pyx_t_1 = 0; | |
4584 | |
4585 /* "pybedtools/cbedtools.pyx":274 | |
4586 * def __set__(self, chrom): | |
4587 * chrom = _cppstr(chrom) | |
4588 * self._bed.chrom = chrom # <<<<<<<<<<<<<< | |
4589 * idx = LOOKUPS[self.file_type]["chrom"] | |
4590 * self._bed.fields[idx] = _cppstr(chrom) | |
4591 */ | |
4592 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_chrom); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error) | |
4593 __pyx_v_self->_bed->chrom = __pyx_t_2; | |
4594 | |
4595 /* "pybedtools/cbedtools.pyx":275 | |
4596 * chrom = _cppstr(chrom) | |
4597 * self._bed.chrom = chrom | |
4598 * idx = LOOKUPS[self.file_type]["chrom"] # <<<<<<<<<<<<<< | |
4599 * self._bed.fields[idx] = _cppstr(chrom) | |
4600 * | |
4601 */ | |
4602 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
4603 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
4604 __PYX_ERR(0, 275, __pyx_L1_error) | |
4605 } | |
4606 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) | |
4607 __Pyx_GOTREF(__pyx_t_1); | |
4608 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) | |
4609 __Pyx_GOTREF(__pyx_t_3); | |
4610 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4611 __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) | |
4612 __Pyx_GOTREF(__pyx_t_1); | |
4613 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4614 __pyx_v_idx = __pyx_t_1; | |
4615 __pyx_t_1 = 0; | |
4616 | |
4617 /* "pybedtools/cbedtools.pyx":276 | |
4618 * self._bed.chrom = chrom | |
4619 * idx = LOOKUPS[self.file_type]["chrom"] | |
4620 * self._bed.fields[idx] = _cppstr(chrom) # <<<<<<<<<<<<<< | |
4621 * | |
4622 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
4623 */ | |
4624 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) | |
4625 __Pyx_GOTREF(__pyx_t_1); | |
4626 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L1_error) | |
4627 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4628 __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L1_error) | |
4629 (__pyx_v_self->_bed->fields[__pyx_t_4]) = __pyx_t_2; | |
4630 | |
4631 /* "pybedtools/cbedtools.pyx":272 | |
4632 * return _pystr(self._bed.chrom) | |
4633 * | |
4634 * def __set__(self, chrom): # <<<<<<<<<<<<<< | |
4635 * chrom = _cppstr(chrom) | |
4636 * self._bed.chrom = chrom | |
4637 */ | |
4638 | |
4639 /* function exit code */ | |
4640 __pyx_r = 0; | |
4641 goto __pyx_L0; | |
4642 __pyx_L1_error:; | |
4643 __Pyx_XDECREF(__pyx_t_1); | |
4644 __Pyx_XDECREF(__pyx_t_3); | |
4645 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.chrom.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4646 __pyx_r = -1; | |
4647 __pyx_L0:; | |
4648 __Pyx_XDECREF(__pyx_v_idx); | |
4649 __Pyx_XDECREF(__pyx_v_chrom); | |
4650 __Pyx_RefNannyFinishContext(); | |
4651 return __pyx_r; | |
4652 } | |
4653 | |
4654 /* "pybedtools/cbedtools.pyx":279 | |
4655 * | |
4656 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
4657 * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< | |
4658 * if (self.chrom != other.chrom) or (self.strand != other.strand): | |
4659 * if op == 3: return True | |
4660 */ | |
4661 | |
4662 /* Python wrapper */ | |
4663 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ | |
4664 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { | |
4665 PyObject *__pyx_r = 0; | |
4666 __Pyx_RefNannyDeclarations | |
4667 __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); | |
4668 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_6__richcmp__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op)); | |
4669 | |
4670 /* function exit code */ | |
4671 __Pyx_RefNannyFinishContext(); | |
4672 return __pyx_r; | |
4673 } | |
4674 | |
4675 /* "pybedtools/cbedtools.pyx":284 | |
4676 * return False | |
4677 * | |
4678 * def cmp(x, y): # <<<<<<<<<<<<<< | |
4679 * if x < y: | |
4680 * return -1 | |
4681 */ | |
4682 | |
4683 /* Python wrapper */ | |
4684 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_11__richcmp___1cmp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
4685 static PyMethodDef __pyx_mdef_10pybedtools_9cbedtools_8Interval_11__richcmp___1cmp = {"cmp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_8Interval_11__richcmp___1cmp, METH_VARARGS|METH_KEYWORDS, 0}; | |
4686 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_11__richcmp___1cmp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
4687 PyObject *__pyx_v_x = 0; | |
4688 PyObject *__pyx_v_y = 0; | |
4689 int __pyx_lineno = 0; | |
4690 const char *__pyx_filename = NULL; | |
4691 int __pyx_clineno = 0; | |
4692 PyObject *__pyx_r = 0; | |
4693 __Pyx_RefNannyDeclarations | |
4694 __Pyx_RefNannySetupContext("cmp (wrapper)", 0); | |
4695 { | |
4696 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0}; | |
4697 PyObject* values[2] = {0,0}; | |
4698 if (unlikely(__pyx_kwds)) { | |
4699 Py_ssize_t kw_args; | |
4700 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
4701 switch (pos_args) { | |
4702 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
4703 CYTHON_FALLTHROUGH; | |
4704 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
4705 CYTHON_FALLTHROUGH; | |
4706 case 0: break; | |
4707 default: goto __pyx_L5_argtuple_error; | |
4708 } | |
4709 kw_args = PyDict_Size(__pyx_kwds); | |
4710 switch (pos_args) { | |
4711 case 0: | |
4712 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; | |
4713 else goto __pyx_L5_argtuple_error; | |
4714 CYTHON_FALLTHROUGH; | |
4715 case 1: | |
4716 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; | |
4717 else { | |
4718 __Pyx_RaiseArgtupleInvalid("cmp", 1, 2, 2, 1); __PYX_ERR(0, 284, __pyx_L3_error) | |
4719 } | |
4720 } | |
4721 if (unlikely(kw_args > 0)) { | |
4722 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cmp") < 0)) __PYX_ERR(0, 284, __pyx_L3_error) | |
4723 } | |
4724 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { | |
4725 goto __pyx_L5_argtuple_error; | |
4726 } else { | |
4727 values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
4728 values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
4729 } | |
4730 __pyx_v_x = values[0]; | |
4731 __pyx_v_y = values[1]; | |
4732 } | |
4733 goto __pyx_L4_argument_unpacking_done; | |
4734 __pyx_L5_argtuple_error:; | |
4735 __Pyx_RaiseArgtupleInvalid("cmp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 284, __pyx_L3_error) | |
4736 __pyx_L3_error:; | |
4737 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__richcmp__.cmp", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4738 __Pyx_RefNannyFinishContext(); | |
4739 return NULL; | |
4740 __pyx_L4_argument_unpacking_done:; | |
4741 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(__pyx_self, __pyx_v_x, __pyx_v_y); | |
4742 | |
4743 /* function exit code */ | |
4744 __Pyx_RefNannyFinishContext(); | |
4745 return __pyx_r; | |
4746 } | |
4747 | |
4748 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) { | |
4749 PyObject *__pyx_r = NULL; | |
4750 __Pyx_RefNannyDeclarations | |
4751 PyObject *__pyx_t_1 = NULL; | |
4752 int __pyx_t_2; | |
4753 int __pyx_lineno = 0; | |
4754 const char *__pyx_filename = NULL; | |
4755 int __pyx_clineno = 0; | |
4756 __Pyx_RefNannySetupContext("cmp", 0); | |
4757 | |
4758 /* "pybedtools/cbedtools.pyx":285 | |
4759 * | |
4760 * def cmp(x, y): | |
4761 * if x < y: # <<<<<<<<<<<<<< | |
4762 * return -1 | |
4763 * if x == y: | |
4764 */ | |
4765 __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_v_y, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) | |
4766 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) | |
4767 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4768 if (__pyx_t_2) { | |
4769 | |
4770 /* "pybedtools/cbedtools.pyx":286 | |
4771 * def cmp(x, y): | |
4772 * if x < y: | |
4773 * return -1 # <<<<<<<<<<<<<< | |
4774 * if x == y: | |
4775 * return 0 | |
4776 */ | |
4777 __Pyx_XDECREF(__pyx_r); | |
4778 __Pyx_INCREF(__pyx_int_neg_1); | |
4779 __pyx_r = __pyx_int_neg_1; | |
4780 goto __pyx_L0; | |
4781 | |
4782 /* "pybedtools/cbedtools.pyx":285 | |
4783 * | |
4784 * def cmp(x, y): | |
4785 * if x < y: # <<<<<<<<<<<<<< | |
4786 * return -1 | |
4787 * if x == y: | |
4788 */ | |
4789 } | |
4790 | |
4791 /* "pybedtools/cbedtools.pyx":287 | |
4792 * if x < y: | |
4793 * return -1 | |
4794 * if x == y: # <<<<<<<<<<<<<< | |
4795 * return 0 | |
4796 * if x > y: | |
4797 */ | |
4798 __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_v_y, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) | |
4799 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 287, __pyx_L1_error) | |
4800 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4801 if (__pyx_t_2) { | |
4802 | |
4803 /* "pybedtools/cbedtools.pyx":288 | |
4804 * return -1 | |
4805 * if x == y: | |
4806 * return 0 # <<<<<<<<<<<<<< | |
4807 * if x > y: | |
4808 * return 1 | |
4809 */ | |
4810 __Pyx_XDECREF(__pyx_r); | |
4811 __Pyx_INCREF(__pyx_int_0); | |
4812 __pyx_r = __pyx_int_0; | |
4813 goto __pyx_L0; | |
4814 | |
4815 /* "pybedtools/cbedtools.pyx":287 | |
4816 * if x < y: | |
4817 * return -1 | |
4818 * if x == y: # <<<<<<<<<<<<<< | |
4819 * return 0 | |
4820 * if x > y: | |
4821 */ | |
4822 } | |
4823 | |
4824 /* "pybedtools/cbedtools.pyx":289 | |
4825 * if x == y: | |
4826 * return 0 | |
4827 * if x > y: # <<<<<<<<<<<<<< | |
4828 * return 1 | |
4829 * | |
4830 */ | |
4831 __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_v_y, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) | |
4832 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 289, __pyx_L1_error) | |
4833 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
4834 if (__pyx_t_2) { | |
4835 | |
4836 /* "pybedtools/cbedtools.pyx":290 | |
4837 * return 0 | |
4838 * if x > y: | |
4839 * return 1 # <<<<<<<<<<<<<< | |
4840 * | |
4841 * | |
4842 */ | |
4843 __Pyx_XDECREF(__pyx_r); | |
4844 __Pyx_INCREF(__pyx_int_1); | |
4845 __pyx_r = __pyx_int_1; | |
4846 goto __pyx_L0; | |
4847 | |
4848 /* "pybedtools/cbedtools.pyx":289 | |
4849 * if x == y: | |
4850 * return 0 | |
4851 * if x > y: # <<<<<<<<<<<<<< | |
4852 * return 1 | |
4853 * | |
4854 */ | |
4855 } | |
4856 | |
4857 /* "pybedtools/cbedtools.pyx":284 | |
4858 * return False | |
4859 * | |
4860 * def cmp(x, y): # <<<<<<<<<<<<<< | |
4861 * if x < y: | |
4862 * return -1 | |
4863 */ | |
4864 | |
4865 /* function exit code */ | |
4866 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
4867 goto __pyx_L0; | |
4868 __pyx_L1_error:; | |
4869 __Pyx_XDECREF(__pyx_t_1); | |
4870 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__richcmp__.cmp", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
4871 __pyx_r = NULL; | |
4872 __pyx_L0:; | |
4873 __Pyx_XGIVEREF(__pyx_r); | |
4874 __Pyx_RefNannyFinishContext(); | |
4875 return __pyx_r; | |
4876 } | |
4877 | |
4878 /* "pybedtools/cbedtools.pyx":279 | |
4879 * | |
4880 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
4881 * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< | |
4882 * if (self.chrom != other.chrom) or (self.strand != other.strand): | |
4883 * if op == 3: return True | |
4884 */ | |
4885 | |
4886 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6__richcmp__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { | |
4887 PyObject *__pyx_v_cmp = 0; | |
4888 PyObject *__pyx_v_profile = NULL; | |
4889 PyObject *__pyx_r = NULL; | |
4890 __Pyx_RefNannyDeclarations | |
4891 int __pyx_t_1; | |
4892 PyObject *__pyx_t_2 = NULL; | |
4893 PyObject *__pyx_t_3 = NULL; | |
4894 PyObject *__pyx_t_4 = NULL; | |
4895 int __pyx_t_5; | |
4896 PyObject *__pyx_t_6 = NULL; | |
4897 PyObject *__pyx_t_7 = NULL; | |
4898 PyObject *__pyx_t_8 = NULL; | |
4899 PyObject *__pyx_t_9 = NULL; | |
4900 PyObject *__pyx_t_10 = NULL; | |
4901 PyObject *__pyx_t_11 = NULL; | |
4902 int __pyx_t_12; | |
4903 int __pyx_lineno = 0; | |
4904 const char *__pyx_filename = NULL; | |
4905 int __pyx_clineno = 0; | |
4906 __Pyx_RefNannySetupContext("__richcmp__", 0); | |
4907 | |
4908 /* "pybedtools/cbedtools.pyx":280 | |
4909 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
4910 * def __richcmp__(self, other, int op): | |
4911 * if (self.chrom != other.chrom) or (self.strand != other.strand): # <<<<<<<<<<<<<< | |
4912 * if op == 3: return True | |
4913 * return False | |
4914 */ | |
4915 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_chrom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4916 __Pyx_GOTREF(__pyx_t_2); | |
4917 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4918 __Pyx_GOTREF(__pyx_t_3); | |
4919 __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4920 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
4921 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4922 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4923 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
4924 if (!__pyx_t_5) { | |
4925 } else { | |
4926 __pyx_t_1 = __pyx_t_5; | |
4927 goto __pyx_L4_bool_binop_done; | |
4928 } | |
4929 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_strand); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4930 __Pyx_GOTREF(__pyx_t_4); | |
4931 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_strand); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4932 __Pyx_GOTREF(__pyx_t_3); | |
4933 __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4934 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
4935 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
4936 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 280, __pyx_L1_error) | |
4937 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
4938 __pyx_t_1 = __pyx_t_5; | |
4939 __pyx_L4_bool_binop_done:; | |
4940 if (__pyx_t_1) { | |
4941 | |
4942 /* "pybedtools/cbedtools.pyx":281 | |
4943 * def __richcmp__(self, other, int op): | |
4944 * if (self.chrom != other.chrom) or (self.strand != other.strand): | |
4945 * if op == 3: return True # <<<<<<<<<<<<<< | |
4946 * return False | |
4947 * | |
4948 */ | |
4949 __pyx_t_1 = ((__pyx_v_op == 3) != 0); | |
4950 if (__pyx_t_1) { | |
4951 __Pyx_XDECREF(__pyx_r); | |
4952 __Pyx_INCREF(Py_True); | |
4953 __pyx_r = Py_True; | |
4954 goto __pyx_L0; | |
4955 } | |
4956 | |
4957 /* "pybedtools/cbedtools.pyx":282 | |
4958 * if (self.chrom != other.chrom) or (self.strand != other.strand): | |
4959 * if op == 3: return True | |
4960 * return False # <<<<<<<<<<<<<< | |
4961 * | |
4962 * def cmp(x, y): | |
4963 */ | |
4964 __Pyx_XDECREF(__pyx_r); | |
4965 __Pyx_INCREF(Py_False); | |
4966 __pyx_r = Py_False; | |
4967 goto __pyx_L0; | |
4968 | |
4969 /* "pybedtools/cbedtools.pyx":280 | |
4970 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
4971 * def __richcmp__(self, other, int op): | |
4972 * if (self.chrom != other.chrom) or (self.strand != other.strand): # <<<<<<<<<<<<<< | |
4973 * if op == 3: return True | |
4974 * return False | |
4975 */ | |
4976 } | |
4977 | |
4978 /* "pybedtools/cbedtools.pyx":284 | |
4979 * return False | |
4980 * | |
4981 * def cmp(x, y): # <<<<<<<<<<<<<< | |
4982 * if x < y: | |
4983 * return -1 | |
4984 */ | |
4985 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10pybedtools_9cbedtools_8Interval_11__richcmp___1cmp, 0, __pyx_n_s_richcmp___locals_cmp, NULL, __pyx_n_s_pybedtools_cbedtools, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) | |
4986 __Pyx_GOTREF(__pyx_t_2); | |
4987 __pyx_v_cmp = __pyx_t_2; | |
4988 __pyx_t_2 = 0; | |
4989 | |
4990 /* "pybedtools/cbedtools.pyx":294 | |
4991 * | |
4992 * # check all 4 so that we can handle nesting and partial overlaps. | |
4993 * profile = (cmp(self.start, other.start), # <<<<<<<<<<<<<< | |
4994 * cmp(self.stop, other.stop), | |
4995 * cmp(self.start, other.stop), | |
4996 */ | |
4997 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) | |
4998 __Pyx_GOTREF(__pyx_t_2); | |
4999 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error) | |
5000 __Pyx_GOTREF(__pyx_t_3); | |
5001 __pyx_t_4 = __pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(__pyx_v_cmp, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error) | |
5002 __Pyx_GOTREF(__pyx_t_4); | |
5003 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5004 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
5005 | |
5006 /* "pybedtools/cbedtools.pyx":295 | |
5007 * # check all 4 so that we can handle nesting and partial overlaps. | |
5008 * profile = (cmp(self.start, other.start), | |
5009 * cmp(self.stop, other.stop), # <<<<<<<<<<<<<< | |
5010 * cmp(self.start, other.stop), | |
5011 * cmp(self.stop, other.start)) | |
5012 */ | |
5013 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) | |
5014 __Pyx_GOTREF(__pyx_t_3); | |
5015 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) | |
5016 __Pyx_GOTREF(__pyx_t_2); | |
5017 __pyx_t_6 = __pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(__pyx_v_cmp, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error) | |
5018 __Pyx_GOTREF(__pyx_t_6); | |
5019 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
5020 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5021 | |
5022 /* "pybedtools/cbedtools.pyx":296 | |
5023 * profile = (cmp(self.start, other.start), | |
5024 * cmp(self.stop, other.stop), | |
5025 * cmp(self.start, other.stop), # <<<<<<<<<<<<<< | |
5026 * cmp(self.stop, other.start)) | |
5027 * | |
5028 */ | |
5029 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) | |
5030 __Pyx_GOTREF(__pyx_t_2); | |
5031 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) | |
5032 __Pyx_GOTREF(__pyx_t_3); | |
5033 __pyx_t_7 = __pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(__pyx_v_cmp, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error) | |
5034 __Pyx_GOTREF(__pyx_t_7); | |
5035 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5036 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
5037 | |
5038 /* "pybedtools/cbedtools.pyx":297 | |
5039 * cmp(self.stop, other.stop), | |
5040 * cmp(self.start, other.stop), | |
5041 * cmp(self.stop, other.start)) # <<<<<<<<<<<<<< | |
5042 * | |
5043 * try: | |
5044 */ | |
5045 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) | |
5046 __Pyx_GOTREF(__pyx_t_3); | |
5047 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error) | |
5048 __Pyx_GOTREF(__pyx_t_2); | |
5049 __pyx_t_8 = __pyx_pf_10pybedtools_9cbedtools_8Interval_11__richcmp___cmp(__pyx_v_cmp, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error) | |
5050 __Pyx_GOTREF(__pyx_t_8); | |
5051 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
5052 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5053 | |
5054 /* "pybedtools/cbedtools.pyx":294 | |
5055 * | |
5056 * # check all 4 so that we can handle nesting and partial overlaps. | |
5057 * profile = (cmp(self.start, other.start), # <<<<<<<<<<<<<< | |
5058 * cmp(self.stop, other.stop), | |
5059 * cmp(self.start, other.stop), | |
5060 */ | |
5061 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) | |
5062 __Pyx_GOTREF(__pyx_t_2); | |
5063 __Pyx_GIVEREF(__pyx_t_4); | |
5064 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); | |
5065 __Pyx_GIVEREF(__pyx_t_6); | |
5066 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6); | |
5067 __Pyx_GIVEREF(__pyx_t_7); | |
5068 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7); | |
5069 __Pyx_GIVEREF(__pyx_t_8); | |
5070 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8); | |
5071 __pyx_t_4 = 0; | |
5072 __pyx_t_6 = 0; | |
5073 __pyx_t_7 = 0; | |
5074 __pyx_t_8 = 0; | |
5075 __pyx_v_profile = ((PyObject*)__pyx_t_2); | |
5076 __pyx_t_2 = 0; | |
5077 | |
5078 /* "pybedtools/cbedtools.pyx":299 | |
5079 * cmp(self.stop, other.start)) | |
5080 * | |
5081 * try: # <<<<<<<<<<<<<< | |
5082 * if PROFILES_TRUE[profile] == tuple(): | |
5083 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5084 */ | |
5085 { | |
5086 __Pyx_PyThreadState_declare | |
5087 __Pyx_PyThreadState_assign | |
5088 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); | |
5089 __Pyx_XGOTREF(__pyx_t_9); | |
5090 __Pyx_XGOTREF(__pyx_t_10); | |
5091 __Pyx_XGOTREF(__pyx_t_11); | |
5092 /*try:*/ { | |
5093 | |
5094 /* "pybedtools/cbedtools.pyx":300 | |
5095 * | |
5096 * try: | |
5097 * if PROFILES_TRUE[profile] == tuple(): # <<<<<<<<<<<<<< | |
5098 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5099 * | |
5100 */ | |
5101 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PROFILES_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L7_error) | |
5102 __Pyx_GOTREF(__pyx_t_2); | |
5103 __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_profile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 300, __pyx_L7_error) | |
5104 __Pyx_GOTREF(__pyx_t_8); | |
5105 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5106 __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L7_error) | |
5107 __Pyx_GOTREF(__pyx_t_2); | |
5108 __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 300, __pyx_L7_error) | |
5109 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
5110 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5111 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 300, __pyx_L7_error) | |
5112 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
5113 if (unlikely(__pyx_t_1)) { | |
5114 | |
5115 /* "pybedtools/cbedtools.pyx":301 | |
5116 * try: | |
5117 * if PROFILES_TRUE[profile] == tuple(): | |
5118 * raise NotImplementedError('Features are nested -- comparison undefined') # <<<<<<<<<<<<<< | |
5119 * | |
5120 * if op != 3: | |
5121 */ | |
5122 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L7_error) | |
5123 __Pyx_GOTREF(__pyx_t_7); | |
5124 __Pyx_Raise(__pyx_t_7, 0, 0, 0); | |
5125 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
5126 __PYX_ERR(0, 301, __pyx_L7_error) | |
5127 | |
5128 /* "pybedtools/cbedtools.pyx":300 | |
5129 * | |
5130 * try: | |
5131 * if PROFILES_TRUE[profile] == tuple(): # <<<<<<<<<<<<<< | |
5132 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5133 * | |
5134 */ | |
5135 } | |
5136 | |
5137 /* "pybedtools/cbedtools.pyx":303 | |
5138 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5139 * | |
5140 * if op != 3: # <<<<<<<<<<<<<< | |
5141 * if op in PROFILES_TRUE[profile]: | |
5142 * return True | |
5143 */ | |
5144 __pyx_t_1 = ((__pyx_v_op != 3) != 0); | |
5145 if (__pyx_t_1) { | |
5146 | |
5147 /* "pybedtools/cbedtools.pyx":304 | |
5148 * | |
5149 * if op != 3: | |
5150 * if op in PROFILES_TRUE[profile]: # <<<<<<<<<<<<<< | |
5151 * return True | |
5152 * return False | |
5153 */ | |
5154 __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_op); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 304, __pyx_L7_error) | |
5155 __Pyx_GOTREF(__pyx_t_7); | |
5156 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PROFILES_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L7_error) | |
5157 __Pyx_GOTREF(__pyx_t_2); | |
5158 __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_profile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L7_error) | |
5159 __Pyx_GOTREF(__pyx_t_8); | |
5160 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5161 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_7, __pyx_t_8, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 304, __pyx_L7_error) | |
5162 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
5163 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
5164 __pyx_t_5 = (__pyx_t_1 != 0); | |
5165 if (__pyx_t_5) { | |
5166 | |
5167 /* "pybedtools/cbedtools.pyx":305 | |
5168 * if op != 3: | |
5169 * if op in PROFILES_TRUE[profile]: | |
5170 * return True # <<<<<<<<<<<<<< | |
5171 * return False | |
5172 * else: | |
5173 */ | |
5174 __Pyx_XDECREF(__pyx_r); | |
5175 __Pyx_INCREF(Py_True); | |
5176 __pyx_r = Py_True; | |
5177 goto __pyx_L11_try_return; | |
5178 | |
5179 /* "pybedtools/cbedtools.pyx":304 | |
5180 * | |
5181 * if op != 3: | |
5182 * if op in PROFILES_TRUE[profile]: # <<<<<<<<<<<<<< | |
5183 * return True | |
5184 * return False | |
5185 */ | |
5186 } | |
5187 | |
5188 /* "pybedtools/cbedtools.pyx":306 | |
5189 * if op in PROFILES_TRUE[profile]: | |
5190 * return True | |
5191 * return False # <<<<<<<<<<<<<< | |
5192 * else: | |
5193 * if 2 in PROFILES_TRUE[profile]: | |
5194 */ | |
5195 __Pyx_XDECREF(__pyx_r); | |
5196 __Pyx_INCREF(Py_False); | |
5197 __pyx_r = Py_False; | |
5198 goto __pyx_L11_try_return; | |
5199 | |
5200 /* "pybedtools/cbedtools.pyx":303 | |
5201 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5202 * | |
5203 * if op != 3: # <<<<<<<<<<<<<< | |
5204 * if op in PROFILES_TRUE[profile]: | |
5205 * return True | |
5206 */ | |
5207 } | |
5208 | |
5209 /* "pybedtools/cbedtools.pyx":308 | |
5210 * return False | |
5211 * else: | |
5212 * if 2 in PROFILES_TRUE[profile]: # <<<<<<<<<<<<<< | |
5213 * return False | |
5214 * return True | |
5215 */ | |
5216 /*else*/ { | |
5217 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PROFILES_TRUE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 308, __pyx_L7_error) | |
5218 __Pyx_GOTREF(__pyx_t_8); | |
5219 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_v_profile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L7_error) | |
5220 __Pyx_GOTREF(__pyx_t_7); | |
5221 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
5222 __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_int_2, __pyx_t_7, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 308, __pyx_L7_error) | |
5223 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
5224 __pyx_t_1 = (__pyx_t_5 != 0); | |
5225 if (__pyx_t_1) { | |
5226 | |
5227 /* "pybedtools/cbedtools.pyx":309 | |
5228 * else: | |
5229 * if 2 in PROFILES_TRUE[profile]: | |
5230 * return False # <<<<<<<<<<<<<< | |
5231 * return True | |
5232 * except KeyError: | |
5233 */ | |
5234 __Pyx_XDECREF(__pyx_r); | |
5235 __Pyx_INCREF(Py_False); | |
5236 __pyx_r = Py_False; | |
5237 goto __pyx_L11_try_return; | |
5238 | |
5239 /* "pybedtools/cbedtools.pyx":308 | |
5240 * return False | |
5241 * else: | |
5242 * if 2 in PROFILES_TRUE[profile]: # <<<<<<<<<<<<<< | |
5243 * return False | |
5244 * return True | |
5245 */ | |
5246 } | |
5247 | |
5248 /* "pybedtools/cbedtools.pyx":310 | |
5249 * if 2 in PROFILES_TRUE[profile]: | |
5250 * return False | |
5251 * return True # <<<<<<<<<<<<<< | |
5252 * except KeyError: | |
5253 * raise ValueError('Currently unsupported comparison -- please ' | |
5254 */ | |
5255 __Pyx_XDECREF(__pyx_r); | |
5256 __Pyx_INCREF(Py_True); | |
5257 __pyx_r = Py_True; | |
5258 goto __pyx_L11_try_return; | |
5259 } | |
5260 | |
5261 /* "pybedtools/cbedtools.pyx":299 | |
5262 * cmp(self.stop, other.start)) | |
5263 * | |
5264 * try: # <<<<<<<<<<<<<< | |
5265 * if PROFILES_TRUE[profile] == tuple(): | |
5266 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5267 */ | |
5268 } | |
5269 __pyx_L7_error:; | |
5270 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5271 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
5272 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
5273 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
5274 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
5275 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; | |
5276 | |
5277 /* "pybedtools/cbedtools.pyx":311 | |
5278 * return False | |
5279 * return True | |
5280 * except KeyError: # <<<<<<<<<<<<<< | |
5281 * raise ValueError('Currently unsupported comparison -- please ' | |
5282 * 'submit a bug report') | |
5283 */ | |
5284 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); | |
5285 if (__pyx_t_12) { | |
5286 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5287 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_2) < 0) __PYX_ERR(0, 311, __pyx_L9_except_error) | |
5288 __Pyx_GOTREF(__pyx_t_7); | |
5289 __Pyx_GOTREF(__pyx_t_8); | |
5290 __Pyx_GOTREF(__pyx_t_2); | |
5291 | |
5292 /* "pybedtools/cbedtools.pyx":312 | |
5293 * return True | |
5294 * except KeyError: | |
5295 * raise ValueError('Currently unsupported comparison -- please ' # <<<<<<<<<<<<<< | |
5296 * 'submit a bug report') | |
5297 * | |
5298 */ | |
5299 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 312, __pyx_L9_except_error) | |
5300 __Pyx_GOTREF(__pyx_t_6); | |
5301 __Pyx_Raise(__pyx_t_6, 0, 0, 0); | |
5302 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
5303 __PYX_ERR(0, 312, __pyx_L9_except_error) | |
5304 } | |
5305 goto __pyx_L9_except_error; | |
5306 __pyx_L9_except_error:; | |
5307 | |
5308 /* "pybedtools/cbedtools.pyx":299 | |
5309 * cmp(self.stop, other.start)) | |
5310 * | |
5311 * try: # <<<<<<<<<<<<<< | |
5312 * if PROFILES_TRUE[profile] == tuple(): | |
5313 * raise NotImplementedError('Features are nested -- comparison undefined') | |
5314 */ | |
5315 __Pyx_XGIVEREF(__pyx_t_9); | |
5316 __Pyx_XGIVEREF(__pyx_t_10); | |
5317 __Pyx_XGIVEREF(__pyx_t_11); | |
5318 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); | |
5319 goto __pyx_L1_error; | |
5320 __pyx_L11_try_return:; | |
5321 __Pyx_XGIVEREF(__pyx_t_9); | |
5322 __Pyx_XGIVEREF(__pyx_t_10); | |
5323 __Pyx_XGIVEREF(__pyx_t_11); | |
5324 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); | |
5325 goto __pyx_L0; | |
5326 } | |
5327 | |
5328 /* "pybedtools/cbedtools.pyx":279 | |
5329 * | |
5330 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
5331 * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< | |
5332 * if (self.chrom != other.chrom) or (self.strand != other.strand): | |
5333 * if op == 3: return True | |
5334 */ | |
5335 | |
5336 /* function exit code */ | |
5337 __pyx_L1_error:; | |
5338 __Pyx_XDECREF(__pyx_t_2); | |
5339 __Pyx_XDECREF(__pyx_t_3); | |
5340 __Pyx_XDECREF(__pyx_t_4); | |
5341 __Pyx_XDECREF(__pyx_t_6); | |
5342 __Pyx_XDECREF(__pyx_t_7); | |
5343 __Pyx_XDECREF(__pyx_t_8); | |
5344 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5345 __pyx_r = NULL; | |
5346 __pyx_L0:; | |
5347 __Pyx_XDECREF(__pyx_v_cmp); | |
5348 __Pyx_XDECREF(__pyx_v_profile); | |
5349 __Pyx_XGIVEREF(__pyx_r); | |
5350 __Pyx_RefNannyFinishContext(); | |
5351 return __pyx_r; | |
5352 } | |
5353 | |
5354 /* "pybedtools/cbedtools.pyx":317 | |
5355 * property start: | |
5356 * """The 0-based start of the feature.""" | |
5357 * def __get__(self): # <<<<<<<<<<<<<< | |
5358 * return self._bed.start | |
5359 * | |
5360 */ | |
5361 | |
5362 /* Python wrapper */ | |
5363 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5start_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
5364 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5start_1__get__(PyObject *__pyx_v_self) { | |
5365 PyObject *__pyx_r = 0; | |
5366 __Pyx_RefNannyDeclarations | |
5367 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
5368 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5start___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
5369 | |
5370 /* function exit code */ | |
5371 __Pyx_RefNannyFinishContext(); | |
5372 return __pyx_r; | |
5373 } | |
5374 | |
5375 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5start___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
5376 PyObject *__pyx_r = NULL; | |
5377 __Pyx_RefNannyDeclarations | |
5378 PyObject *__pyx_t_1 = NULL; | |
5379 int __pyx_lineno = 0; | |
5380 const char *__pyx_filename = NULL; | |
5381 int __pyx_clineno = 0; | |
5382 __Pyx_RefNannySetupContext("__get__", 0); | |
5383 | |
5384 /* "pybedtools/cbedtools.pyx":318 | |
5385 * """The 0-based start of the feature.""" | |
5386 * def __get__(self): | |
5387 * return self._bed.start # <<<<<<<<<<<<<< | |
5388 * | |
5389 * def __set__(self, int start): | |
5390 */ | |
5391 __Pyx_XDECREF(__pyx_r); | |
5392 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS(__pyx_v_self->_bed->start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) | |
5393 __Pyx_GOTREF(__pyx_t_1); | |
5394 __pyx_r = __pyx_t_1; | |
5395 __pyx_t_1 = 0; | |
5396 goto __pyx_L0; | |
5397 | |
5398 /* "pybedtools/cbedtools.pyx":317 | |
5399 * property start: | |
5400 * """The 0-based start of the feature.""" | |
5401 * def __get__(self): # <<<<<<<<<<<<<< | |
5402 * return self._bed.start | |
5403 * | |
5404 */ | |
5405 | |
5406 /* function exit code */ | |
5407 __pyx_L1_error:; | |
5408 __Pyx_XDECREF(__pyx_t_1); | |
5409 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5410 __pyx_r = NULL; | |
5411 __pyx_L0:; | |
5412 __Pyx_XGIVEREF(__pyx_r); | |
5413 __Pyx_RefNannyFinishContext(); | |
5414 return __pyx_r; | |
5415 } | |
5416 | |
5417 /* "pybedtools/cbedtools.pyx":320 | |
5418 * return self._bed.start | |
5419 * | |
5420 * def __set__(self, int start): # <<<<<<<<<<<<<< | |
5421 * self._bed.start = start | |
5422 * idx = LOOKUPS[self.file_type]["start"] | |
5423 */ | |
5424 | |
5425 /* Python wrapper */ | |
5426 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_start); /*proto*/ | |
5427 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_start) { | |
5428 int __pyx_v_start; | |
5429 int __pyx_lineno = 0; | |
5430 const char *__pyx_filename = NULL; | |
5431 int __pyx_clineno = 0; | |
5432 int __pyx_r; | |
5433 __Pyx_RefNannyDeclarations | |
5434 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
5435 assert(__pyx_arg_start); { | |
5436 __pyx_v_start = __Pyx_PyInt_As_int(__pyx_arg_start); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error) | |
5437 } | |
5438 goto __pyx_L4_argument_unpacking_done; | |
5439 __pyx_L3_error:; | |
5440 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5441 __Pyx_RefNannyFinishContext(); | |
5442 return -1; | |
5443 __pyx_L4_argument_unpacking_done:; | |
5444 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5start_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((int)__pyx_v_start)); | |
5445 | |
5446 /* function exit code */ | |
5447 __Pyx_RefNannyFinishContext(); | |
5448 return __pyx_r; | |
5449 } | |
5450 | |
5451 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5start_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_v_start) { | |
5452 PyObject *__pyx_v_idx = NULL; | |
5453 int __pyx_r; | |
5454 __Pyx_RefNannyDeclarations | |
5455 PyObject *__pyx_t_1 = NULL; | |
5456 PyObject *__pyx_t_2 = NULL; | |
5457 int __pyx_t_3; | |
5458 std::string __pyx_t_4; | |
5459 std::vector<std::string> ::size_type __pyx_t_5; | |
5460 int __pyx_lineno = 0; | |
5461 const char *__pyx_filename = NULL; | |
5462 int __pyx_clineno = 0; | |
5463 __Pyx_RefNannySetupContext("__set__", 0); | |
5464 | |
5465 /* "pybedtools/cbedtools.pyx":321 | |
5466 * | |
5467 * def __set__(self, int start): | |
5468 * self._bed.start = start # <<<<<<<<<<<<<< | |
5469 * idx = LOOKUPS[self.file_type]["start"] | |
5470 * | |
5471 */ | |
5472 __pyx_v_self->_bed->start = __pyx_v_start; | |
5473 | |
5474 /* "pybedtools/cbedtools.pyx":322 | |
5475 * def __set__(self, int start): | |
5476 * self._bed.start = start | |
5477 * idx = LOOKUPS[self.file_type]["start"] # <<<<<<<<<<<<<< | |
5478 * | |
5479 * # Non-BED files should have 1-based coords in fields | |
5480 */ | |
5481 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
5482 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
5483 __PYX_ERR(0, 322, __pyx_L1_error) | |
5484 } | |
5485 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error) | |
5486 __Pyx_GOTREF(__pyx_t_1); | |
5487 __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error) | |
5488 __Pyx_GOTREF(__pyx_t_2); | |
5489 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5490 __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error) | |
5491 __Pyx_GOTREF(__pyx_t_1); | |
5492 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5493 __pyx_v_idx = __pyx_t_1; | |
5494 __pyx_t_1 = 0; | |
5495 | |
5496 /* "pybedtools/cbedtools.pyx":325 | |
5497 * | |
5498 * # Non-BED files should have 1-based coords in fields | |
5499 * if self.file_type != 'bed': # <<<<<<<<<<<<<< | |
5500 * start += 1 | |
5501 * self._bed.fields[idx] = _cppstr(str(start)) | |
5502 */ | |
5503 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) | |
5504 __Pyx_GOTREF(__pyx_t_1); | |
5505 __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_bed, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 325, __pyx_L1_error) | |
5506 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5507 if (__pyx_t_3) { | |
5508 | |
5509 /* "pybedtools/cbedtools.pyx":326 | |
5510 * # Non-BED files should have 1-based coords in fields | |
5511 * if self.file_type != 'bed': | |
5512 * start += 1 # <<<<<<<<<<<<<< | |
5513 * self._bed.fields[idx] = _cppstr(str(start)) | |
5514 * | |
5515 */ | |
5516 __pyx_v_start = (__pyx_v_start + 1); | |
5517 | |
5518 /* "pybedtools/cbedtools.pyx":325 | |
5519 * | |
5520 * # Non-BED files should have 1-based coords in fields | |
5521 * if self.file_type != 'bed': # <<<<<<<<<<<<<< | |
5522 * start += 1 | |
5523 * self._bed.fields[idx] = _cppstr(str(start)) | |
5524 */ | |
5525 } | |
5526 | |
5527 /* "pybedtools/cbedtools.pyx":327 | |
5528 * if self.file_type != 'bed': | |
5529 * start += 1 | |
5530 * self._bed.fields[idx] = _cppstr(str(start)) # <<<<<<<<<<<<<< | |
5531 * | |
5532 * property end: | |
5533 */ | |
5534 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) | |
5535 __Pyx_GOTREF(__pyx_t_1); | |
5536 __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) | |
5537 __Pyx_GOTREF(__pyx_t_2); | |
5538 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5539 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) | |
5540 __Pyx_GOTREF(__pyx_t_1); | |
5541 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5542 __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L1_error) | |
5543 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5544 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L1_error) | |
5545 (__pyx_v_self->_bed->fields[__pyx_t_5]) = __pyx_t_4; | |
5546 | |
5547 /* "pybedtools/cbedtools.pyx":320 | |
5548 * return self._bed.start | |
5549 * | |
5550 * def __set__(self, int start): # <<<<<<<<<<<<<< | |
5551 * self._bed.start = start | |
5552 * idx = LOOKUPS[self.file_type]["start"] | |
5553 */ | |
5554 | |
5555 /* function exit code */ | |
5556 __pyx_r = 0; | |
5557 goto __pyx_L0; | |
5558 __pyx_L1_error:; | |
5559 __Pyx_XDECREF(__pyx_t_1); | |
5560 __Pyx_XDECREF(__pyx_t_2); | |
5561 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5562 __pyx_r = -1; | |
5563 __pyx_L0:; | |
5564 __Pyx_XDECREF(__pyx_v_idx); | |
5565 __Pyx_RefNannyFinishContext(); | |
5566 return __pyx_r; | |
5567 } | |
5568 | |
5569 /* "pybedtools/cbedtools.pyx":331 | |
5570 * property end: | |
5571 * """The end of the feature""" | |
5572 * def __get__(self): # <<<<<<<<<<<<<< | |
5573 * return self._bed.end | |
5574 * | |
5575 */ | |
5576 | |
5577 /* Python wrapper */ | |
5578 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_3end_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
5579 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_3end_1__get__(PyObject *__pyx_v_self) { | |
5580 PyObject *__pyx_r = 0; | |
5581 __Pyx_RefNannyDeclarations | |
5582 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
5583 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_3end___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
5584 | |
5585 /* function exit code */ | |
5586 __Pyx_RefNannyFinishContext(); | |
5587 return __pyx_r; | |
5588 } | |
5589 | |
5590 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_3end___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
5591 PyObject *__pyx_r = NULL; | |
5592 __Pyx_RefNannyDeclarations | |
5593 PyObject *__pyx_t_1 = NULL; | |
5594 int __pyx_lineno = 0; | |
5595 const char *__pyx_filename = NULL; | |
5596 int __pyx_clineno = 0; | |
5597 __Pyx_RefNannySetupContext("__get__", 0); | |
5598 | |
5599 /* "pybedtools/cbedtools.pyx":332 | |
5600 * """The end of the feature""" | |
5601 * def __get__(self): | |
5602 * return self._bed.end # <<<<<<<<<<<<<< | |
5603 * | |
5604 * def __set__(self, int end): | |
5605 */ | |
5606 __Pyx_XDECREF(__pyx_r); | |
5607 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS(__pyx_v_self->_bed->end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) | |
5608 __Pyx_GOTREF(__pyx_t_1); | |
5609 __pyx_r = __pyx_t_1; | |
5610 __pyx_t_1 = 0; | |
5611 goto __pyx_L0; | |
5612 | |
5613 /* "pybedtools/cbedtools.pyx":331 | |
5614 * property end: | |
5615 * """The end of the feature""" | |
5616 * def __get__(self): # <<<<<<<<<<<<<< | |
5617 * return self._bed.end | |
5618 * | |
5619 */ | |
5620 | |
5621 /* function exit code */ | |
5622 __pyx_L1_error:; | |
5623 __Pyx_XDECREF(__pyx_t_1); | |
5624 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5625 __pyx_r = NULL; | |
5626 __pyx_L0:; | |
5627 __Pyx_XGIVEREF(__pyx_r); | |
5628 __Pyx_RefNannyFinishContext(); | |
5629 return __pyx_r; | |
5630 } | |
5631 | |
5632 /* "pybedtools/cbedtools.pyx":334 | |
5633 * return self._bed.end | |
5634 * | |
5635 * def __set__(self, int end): # <<<<<<<<<<<<<< | |
5636 * self._bed.end = end | |
5637 * idx = LOOKUPS[self.file_type]["stop"] | |
5638 */ | |
5639 | |
5640 /* Python wrapper */ | |
5641 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_3end_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_end); /*proto*/ | |
5642 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_3end_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_end) { | |
5643 int __pyx_v_end; | |
5644 int __pyx_lineno = 0; | |
5645 const char *__pyx_filename = NULL; | |
5646 int __pyx_clineno = 0; | |
5647 int __pyx_r; | |
5648 __Pyx_RefNannyDeclarations | |
5649 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
5650 assert(__pyx_arg_end); { | |
5651 __pyx_v_end = __Pyx_PyInt_As_int(__pyx_arg_end); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 334, __pyx_L3_error) | |
5652 } | |
5653 goto __pyx_L4_argument_unpacking_done; | |
5654 __pyx_L3_error:; | |
5655 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5656 __Pyx_RefNannyFinishContext(); | |
5657 return -1; | |
5658 __pyx_L4_argument_unpacking_done:; | |
5659 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_3end_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((int)__pyx_v_end)); | |
5660 | |
5661 /* function exit code */ | |
5662 __Pyx_RefNannyFinishContext(); | |
5663 return __pyx_r; | |
5664 } | |
5665 | |
5666 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_3end_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_v_end) { | |
5667 PyObject *__pyx_v_idx = NULL; | |
5668 int __pyx_r; | |
5669 __Pyx_RefNannyDeclarations | |
5670 PyObject *__pyx_t_1 = NULL; | |
5671 PyObject *__pyx_t_2 = NULL; | |
5672 std::string __pyx_t_3; | |
5673 std::vector<std::string> ::size_type __pyx_t_4; | |
5674 int __pyx_lineno = 0; | |
5675 const char *__pyx_filename = NULL; | |
5676 int __pyx_clineno = 0; | |
5677 __Pyx_RefNannySetupContext("__set__", 0); | |
5678 | |
5679 /* "pybedtools/cbedtools.pyx":335 | |
5680 * | |
5681 * def __set__(self, int end): | |
5682 * self._bed.end = end # <<<<<<<<<<<<<< | |
5683 * idx = LOOKUPS[self.file_type]["stop"] | |
5684 * self._bed.fields[idx] = _cppstr(str(end)) | |
5685 */ | |
5686 __pyx_v_self->_bed->end = __pyx_v_end; | |
5687 | |
5688 /* "pybedtools/cbedtools.pyx":336 | |
5689 * def __set__(self, int end): | |
5690 * self._bed.end = end | |
5691 * idx = LOOKUPS[self.file_type]["stop"] # <<<<<<<<<<<<<< | |
5692 * self._bed.fields[idx] = _cppstr(str(end)) | |
5693 * | |
5694 */ | |
5695 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
5696 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
5697 __PYX_ERR(0, 336, __pyx_L1_error) | |
5698 } | |
5699 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error) | |
5700 __Pyx_GOTREF(__pyx_t_1); | |
5701 __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error) | |
5702 __Pyx_GOTREF(__pyx_t_2); | |
5703 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5704 __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error) | |
5705 __Pyx_GOTREF(__pyx_t_1); | |
5706 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5707 __pyx_v_idx = __pyx_t_1; | |
5708 __pyx_t_1 = 0; | |
5709 | |
5710 /* "pybedtools/cbedtools.pyx":337 | |
5711 * self._bed.end = end | |
5712 * idx = LOOKUPS[self.file_type]["stop"] | |
5713 * self._bed.fields[idx] = _cppstr(str(end)) # <<<<<<<<<<<<<< | |
5714 * | |
5715 * property stop: | |
5716 */ | |
5717 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) | |
5718 __Pyx_GOTREF(__pyx_t_1); | |
5719 __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) | |
5720 __Pyx_GOTREF(__pyx_t_2); | |
5721 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5722 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) | |
5723 __Pyx_GOTREF(__pyx_t_1); | |
5724 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5725 __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error) | |
5726 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5727 __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error) | |
5728 (__pyx_v_self->_bed->fields[__pyx_t_4]) = __pyx_t_3; | |
5729 | |
5730 /* "pybedtools/cbedtools.pyx":334 | |
5731 * return self._bed.end | |
5732 * | |
5733 * def __set__(self, int end): # <<<<<<<<<<<<<< | |
5734 * self._bed.end = end | |
5735 * idx = LOOKUPS[self.file_type]["stop"] | |
5736 */ | |
5737 | |
5738 /* function exit code */ | |
5739 __pyx_r = 0; | |
5740 goto __pyx_L0; | |
5741 __pyx_L1_error:; | |
5742 __Pyx_XDECREF(__pyx_t_1); | |
5743 __Pyx_XDECREF(__pyx_t_2); | |
5744 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5745 __pyx_r = -1; | |
5746 __pyx_L0:; | |
5747 __Pyx_XDECREF(__pyx_v_idx); | |
5748 __Pyx_RefNannyFinishContext(); | |
5749 return __pyx_r; | |
5750 } | |
5751 | |
5752 /* "pybedtools/cbedtools.pyx":341 | |
5753 * property stop: | |
5754 * """ the end of the feature""" | |
5755 * def __get__(self): # <<<<<<<<<<<<<< | |
5756 * return self._bed.end | |
5757 * | |
5758 */ | |
5759 | |
5760 /* Python wrapper */ | |
5761 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_4stop_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
5762 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_4stop_1__get__(PyObject *__pyx_v_self) { | |
5763 PyObject *__pyx_r = 0; | |
5764 __Pyx_RefNannyDeclarations | |
5765 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
5766 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_4stop___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
5767 | |
5768 /* function exit code */ | |
5769 __Pyx_RefNannyFinishContext(); | |
5770 return __pyx_r; | |
5771 } | |
5772 | |
5773 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_4stop___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
5774 PyObject *__pyx_r = NULL; | |
5775 __Pyx_RefNannyDeclarations | |
5776 PyObject *__pyx_t_1 = NULL; | |
5777 int __pyx_lineno = 0; | |
5778 const char *__pyx_filename = NULL; | |
5779 int __pyx_clineno = 0; | |
5780 __Pyx_RefNannySetupContext("__get__", 0); | |
5781 | |
5782 /* "pybedtools/cbedtools.pyx":342 | |
5783 * """ the end of the feature""" | |
5784 * def __get__(self): | |
5785 * return self._bed.end # <<<<<<<<<<<<<< | |
5786 * | |
5787 * def __set__(self, int end): | |
5788 */ | |
5789 __Pyx_XDECREF(__pyx_r); | |
5790 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS(__pyx_v_self->_bed->end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) | |
5791 __Pyx_GOTREF(__pyx_t_1); | |
5792 __pyx_r = __pyx_t_1; | |
5793 __pyx_t_1 = 0; | |
5794 goto __pyx_L0; | |
5795 | |
5796 /* "pybedtools/cbedtools.pyx":341 | |
5797 * property stop: | |
5798 * """ the end of the feature""" | |
5799 * def __get__(self): # <<<<<<<<<<<<<< | |
5800 * return self._bed.end | |
5801 * | |
5802 */ | |
5803 | |
5804 /* function exit code */ | |
5805 __pyx_L1_error:; | |
5806 __Pyx_XDECREF(__pyx_t_1); | |
5807 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.stop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5808 __pyx_r = NULL; | |
5809 __pyx_L0:; | |
5810 __Pyx_XGIVEREF(__pyx_r); | |
5811 __Pyx_RefNannyFinishContext(); | |
5812 return __pyx_r; | |
5813 } | |
5814 | |
5815 /* "pybedtools/cbedtools.pyx":344 | |
5816 * return self._bed.end | |
5817 * | |
5818 * def __set__(self, int end): # <<<<<<<<<<<<<< | |
5819 * idx = LOOKUPS[self.file_type]["stop"] | |
5820 * self._bed.fields[idx] = _cppstr(str(end)) | |
5821 */ | |
5822 | |
5823 /* Python wrapper */ | |
5824 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_4stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_end); /*proto*/ | |
5825 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_4stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_end) { | |
5826 int __pyx_v_end; | |
5827 int __pyx_lineno = 0; | |
5828 const char *__pyx_filename = NULL; | |
5829 int __pyx_clineno = 0; | |
5830 int __pyx_r; | |
5831 __Pyx_RefNannyDeclarations | |
5832 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
5833 assert(__pyx_arg_end); { | |
5834 __pyx_v_end = __Pyx_PyInt_As_int(__pyx_arg_end); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 344, __pyx_L3_error) | |
5835 } | |
5836 goto __pyx_L4_argument_unpacking_done; | |
5837 __pyx_L3_error:; | |
5838 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.stop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5839 __Pyx_RefNannyFinishContext(); | |
5840 return -1; | |
5841 __pyx_L4_argument_unpacking_done:; | |
5842 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_4stop_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((int)__pyx_v_end)); | |
5843 | |
5844 /* function exit code */ | |
5845 __Pyx_RefNannyFinishContext(); | |
5846 return __pyx_r; | |
5847 } | |
5848 | |
5849 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_4stop_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_v_end) { | |
5850 PyObject *__pyx_v_idx = NULL; | |
5851 int __pyx_r; | |
5852 __Pyx_RefNannyDeclarations | |
5853 PyObject *__pyx_t_1 = NULL; | |
5854 PyObject *__pyx_t_2 = NULL; | |
5855 std::string __pyx_t_3; | |
5856 std::vector<std::string> ::size_type __pyx_t_4; | |
5857 int __pyx_lineno = 0; | |
5858 const char *__pyx_filename = NULL; | |
5859 int __pyx_clineno = 0; | |
5860 __Pyx_RefNannySetupContext("__set__", 0); | |
5861 | |
5862 /* "pybedtools/cbedtools.pyx":345 | |
5863 * | |
5864 * def __set__(self, int end): | |
5865 * idx = LOOKUPS[self.file_type]["stop"] # <<<<<<<<<<<<<< | |
5866 * self._bed.fields[idx] = _cppstr(str(end)) | |
5867 * self._bed.end = end | |
5868 */ | |
5869 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
5870 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
5871 __PYX_ERR(0, 345, __pyx_L1_error) | |
5872 } | |
5873 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) | |
5874 __Pyx_GOTREF(__pyx_t_1); | |
5875 __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) | |
5876 __Pyx_GOTREF(__pyx_t_2); | |
5877 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5878 __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) | |
5879 __Pyx_GOTREF(__pyx_t_1); | |
5880 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5881 __pyx_v_idx = __pyx_t_1; | |
5882 __pyx_t_1 = 0; | |
5883 | |
5884 /* "pybedtools/cbedtools.pyx":346 | |
5885 * def __set__(self, int end): | |
5886 * idx = LOOKUPS[self.file_type]["stop"] | |
5887 * self._bed.fields[idx] = _cppstr(str(end)) # <<<<<<<<<<<<<< | |
5888 * self._bed.end = end | |
5889 * | |
5890 */ | |
5891 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) | |
5892 __Pyx_GOTREF(__pyx_t_1); | |
5893 __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) | |
5894 __Pyx_GOTREF(__pyx_t_2); | |
5895 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5896 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) | |
5897 __Pyx_GOTREF(__pyx_t_1); | |
5898 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
5899 __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error) | |
5900 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
5901 __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error) | |
5902 (__pyx_v_self->_bed->fields[__pyx_t_4]) = __pyx_t_3; | |
5903 | |
5904 /* "pybedtools/cbedtools.pyx":347 | |
5905 * idx = LOOKUPS[self.file_type]["stop"] | |
5906 * self._bed.fields[idx] = _cppstr(str(end)) | |
5907 * self._bed.end = end # <<<<<<<<<<<<<< | |
5908 * | |
5909 * property strand: | |
5910 */ | |
5911 __pyx_v_self->_bed->end = __pyx_v_end; | |
5912 | |
5913 /* "pybedtools/cbedtools.pyx":344 | |
5914 * return self._bed.end | |
5915 * | |
5916 * def __set__(self, int end): # <<<<<<<<<<<<<< | |
5917 * idx = LOOKUPS[self.file_type]["stop"] | |
5918 * self._bed.fields[idx] = _cppstr(str(end)) | |
5919 */ | |
5920 | |
5921 /* function exit code */ | |
5922 __pyx_r = 0; | |
5923 goto __pyx_L0; | |
5924 __pyx_L1_error:; | |
5925 __Pyx_XDECREF(__pyx_t_1); | |
5926 __Pyx_XDECREF(__pyx_t_2); | |
5927 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.stop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5928 __pyx_r = -1; | |
5929 __pyx_L0:; | |
5930 __Pyx_XDECREF(__pyx_v_idx); | |
5931 __Pyx_RefNannyFinishContext(); | |
5932 return __pyx_r; | |
5933 } | |
5934 | |
5935 /* "pybedtools/cbedtools.pyx":351 | |
5936 * property strand: | |
5937 * """ the strand of the feature""" | |
5938 * def __get__(self): # <<<<<<<<<<<<<< | |
5939 * return _pystr(self._bed.strand) | |
5940 * | |
5941 */ | |
5942 | |
5943 /* Python wrapper */ | |
5944 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_6strand_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
5945 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_6strand_1__get__(PyObject *__pyx_v_self) { | |
5946 PyObject *__pyx_r = 0; | |
5947 __Pyx_RefNannyDeclarations | |
5948 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
5949 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_6strand___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
5950 | |
5951 /* function exit code */ | |
5952 __Pyx_RefNannyFinishContext(); | |
5953 return __pyx_r; | |
5954 } | |
5955 | |
5956 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6strand___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
5957 PyObject *__pyx_r = NULL; | |
5958 __Pyx_RefNannyDeclarations | |
5959 PyObject *__pyx_t_1 = NULL; | |
5960 int __pyx_lineno = 0; | |
5961 const char *__pyx_filename = NULL; | |
5962 int __pyx_clineno = 0; | |
5963 __Pyx_RefNannySetupContext("__get__", 0); | |
5964 | |
5965 /* "pybedtools/cbedtools.pyx":352 | |
5966 * """ the strand of the feature""" | |
5967 * def __get__(self): | |
5968 * return _pystr(self._bed.strand) # <<<<<<<<<<<<<< | |
5969 * | |
5970 * def __set__(self, strand): | |
5971 */ | |
5972 __Pyx_XDECREF(__pyx_r); | |
5973 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->strand); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) | |
5974 __Pyx_GOTREF(__pyx_t_1); | |
5975 __pyx_r = __pyx_t_1; | |
5976 __pyx_t_1 = 0; | |
5977 goto __pyx_L0; | |
5978 | |
5979 /* "pybedtools/cbedtools.pyx":351 | |
5980 * property strand: | |
5981 * """ the strand of the feature""" | |
5982 * def __get__(self): # <<<<<<<<<<<<<< | |
5983 * return _pystr(self._bed.strand) | |
5984 * | |
5985 */ | |
5986 | |
5987 /* function exit code */ | |
5988 __pyx_L1_error:; | |
5989 __Pyx_XDECREF(__pyx_t_1); | |
5990 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.strand.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
5991 __pyx_r = NULL; | |
5992 __pyx_L0:; | |
5993 __Pyx_XGIVEREF(__pyx_r); | |
5994 __Pyx_RefNannyFinishContext(); | |
5995 return __pyx_r; | |
5996 } | |
5997 | |
5998 /* "pybedtools/cbedtools.pyx":354 | |
5999 * return _pystr(self._bed.strand) | |
6000 * | |
6001 * def __set__(self, strand): # <<<<<<<<<<<<<< | |
6002 * idx = LOOKUPS[self.file_type]["strand"] | |
6003 * self._bed.fields[idx] = _cppstr(strand) | |
6004 */ | |
6005 | |
6006 /* Python wrapper */ | |
6007 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_6strand_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_strand); /*proto*/ | |
6008 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_6strand_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_strand) { | |
6009 int __pyx_r; | |
6010 __Pyx_RefNannyDeclarations | |
6011 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
6012 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_6strand_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_strand)); | |
6013 | |
6014 /* function exit code */ | |
6015 __Pyx_RefNannyFinishContext(); | |
6016 return __pyx_r; | |
6017 } | |
6018 | |
6019 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_6strand_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_strand) { | |
6020 PyObject *__pyx_v_idx = NULL; | |
6021 int __pyx_r; | |
6022 __Pyx_RefNannyDeclarations | |
6023 PyObject *__pyx_t_1 = NULL; | |
6024 PyObject *__pyx_t_2 = NULL; | |
6025 std::string __pyx_t_3; | |
6026 std::vector<std::string> ::size_type __pyx_t_4; | |
6027 int __pyx_lineno = 0; | |
6028 const char *__pyx_filename = NULL; | |
6029 int __pyx_clineno = 0; | |
6030 __Pyx_RefNannySetupContext("__set__", 0); | |
6031 | |
6032 /* "pybedtools/cbedtools.pyx":355 | |
6033 * | |
6034 * def __set__(self, strand): | |
6035 * idx = LOOKUPS[self.file_type]["strand"] # <<<<<<<<<<<<<< | |
6036 * self._bed.fields[idx] = _cppstr(strand) | |
6037 * self._bed.strand = _cppstr(strand) | |
6038 */ | |
6039 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
6040 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
6041 __PYX_ERR(0, 355, __pyx_L1_error) | |
6042 } | |
6043 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) | |
6044 __Pyx_GOTREF(__pyx_t_1); | |
6045 __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) | |
6046 __Pyx_GOTREF(__pyx_t_2); | |
6047 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6048 __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_strand); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) | |
6049 __Pyx_GOTREF(__pyx_t_1); | |
6050 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
6051 __pyx_v_idx = __pyx_t_1; | |
6052 __pyx_t_1 = 0; | |
6053 | |
6054 /* "pybedtools/cbedtools.pyx":356 | |
6055 * def __set__(self, strand): | |
6056 * idx = LOOKUPS[self.file_type]["strand"] | |
6057 * self._bed.fields[idx] = _cppstr(strand) # <<<<<<<<<<<<<< | |
6058 * self._bed.strand = _cppstr(strand) | |
6059 * | |
6060 */ | |
6061 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_strand); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) | |
6062 __Pyx_GOTREF(__pyx_t_1); | |
6063 __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error) | |
6064 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6065 __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error) | |
6066 (__pyx_v_self->_bed->fields[__pyx_t_4]) = __pyx_t_3; | |
6067 | |
6068 /* "pybedtools/cbedtools.pyx":357 | |
6069 * idx = LOOKUPS[self.file_type]["strand"] | |
6070 * self._bed.fields[idx] = _cppstr(strand) | |
6071 * self._bed.strand = _cppstr(strand) # <<<<<<<<<<<<<< | |
6072 * | |
6073 * property length: | |
6074 */ | |
6075 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_strand); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error) | |
6076 __Pyx_GOTREF(__pyx_t_1); | |
6077 __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 357, __pyx_L1_error) | |
6078 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6079 __pyx_v_self->_bed->strand = __pyx_t_3; | |
6080 | |
6081 /* "pybedtools/cbedtools.pyx":354 | |
6082 * return _pystr(self._bed.strand) | |
6083 * | |
6084 * def __set__(self, strand): # <<<<<<<<<<<<<< | |
6085 * idx = LOOKUPS[self.file_type]["strand"] | |
6086 * self._bed.fields[idx] = _cppstr(strand) | |
6087 */ | |
6088 | |
6089 /* function exit code */ | |
6090 __pyx_r = 0; | |
6091 goto __pyx_L0; | |
6092 __pyx_L1_error:; | |
6093 __Pyx_XDECREF(__pyx_t_1); | |
6094 __Pyx_XDECREF(__pyx_t_2); | |
6095 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.strand.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6096 __pyx_r = -1; | |
6097 __pyx_L0:; | |
6098 __Pyx_XDECREF(__pyx_v_idx); | |
6099 __Pyx_RefNannyFinishContext(); | |
6100 return __pyx_r; | |
6101 } | |
6102 | |
6103 /* "pybedtools/cbedtools.pyx":361 | |
6104 * property length: | |
6105 * """ the length of the feature""" | |
6106 * def __get__(self): # <<<<<<<<<<<<<< | |
6107 * return self._bed.end - self._bed.start | |
6108 * | |
6109 */ | |
6110 | |
6111 /* Python wrapper */ | |
6112 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_6length_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
6113 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_6length_1__get__(PyObject *__pyx_v_self) { | |
6114 PyObject *__pyx_r = 0; | |
6115 __Pyx_RefNannyDeclarations | |
6116 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
6117 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_6length___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
6118 | |
6119 /* function exit code */ | |
6120 __Pyx_RefNannyFinishContext(); | |
6121 return __pyx_r; | |
6122 } | |
6123 | |
6124 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6length___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
6125 PyObject *__pyx_r = NULL; | |
6126 __Pyx_RefNannyDeclarations | |
6127 PyObject *__pyx_t_1 = NULL; | |
6128 int __pyx_lineno = 0; | |
6129 const char *__pyx_filename = NULL; | |
6130 int __pyx_clineno = 0; | |
6131 __Pyx_RefNannySetupContext("__get__", 0); | |
6132 | |
6133 /* "pybedtools/cbedtools.pyx":362 | |
6134 * """ the length of the feature""" | |
6135 * def __get__(self): | |
6136 * return self._bed.end - self._bed.start # <<<<<<<<<<<<<< | |
6137 * | |
6138 * cpdef deparse_attrs(self): | |
6139 */ | |
6140 __Pyx_XDECREF(__pyx_r); | |
6141 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS((__pyx_v_self->_bed->end - __pyx_v_self->_bed->start)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) | |
6142 __Pyx_GOTREF(__pyx_t_1); | |
6143 __pyx_r = __pyx_t_1; | |
6144 __pyx_t_1 = 0; | |
6145 goto __pyx_L0; | |
6146 | |
6147 /* "pybedtools/cbedtools.pyx":361 | |
6148 * property length: | |
6149 * """ the length of the feature""" | |
6150 * def __get__(self): # <<<<<<<<<<<<<< | |
6151 * return self._bed.end - self._bed.start | |
6152 * | |
6153 */ | |
6154 | |
6155 /* function exit code */ | |
6156 __pyx_L1_error:; | |
6157 __Pyx_XDECREF(__pyx_t_1); | |
6158 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6159 __pyx_r = NULL; | |
6160 __pyx_L0:; | |
6161 __Pyx_XGIVEREF(__pyx_r); | |
6162 __Pyx_RefNannyFinishContext(); | |
6163 return __pyx_r; | |
6164 } | |
6165 | |
6166 /* "pybedtools/cbedtools.pyx":364 | |
6167 * return self._bed.end - self._bed.start | |
6168 * | |
6169 * cpdef deparse_attrs(self): # <<<<<<<<<<<<<< | |
6170 * | |
6171 * if not self._attrs: return | |
6172 */ | |
6173 | |
6174 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_9deparse_attrs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
6175 static PyObject *__pyx_f_10pybedtools_9cbedtools_8Interval_deparse_attrs(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, int __pyx_skip_dispatch) { | |
6176 PyObject *__pyx_v_s = NULL; | |
6177 PyObject *__pyx_r = NULL; | |
6178 __Pyx_RefNannyDeclarations | |
6179 PyObject *__pyx_t_1 = NULL; | |
6180 PyObject *__pyx_t_2 = NULL; | |
6181 PyObject *__pyx_t_3 = NULL; | |
6182 PyObject *__pyx_t_4 = NULL; | |
6183 int __pyx_t_5; | |
6184 int __pyx_t_6; | |
6185 std::string __pyx_t_7; | |
6186 int __pyx_lineno = 0; | |
6187 const char *__pyx_filename = NULL; | |
6188 int __pyx_clineno = 0; | |
6189 __Pyx_RefNannySetupContext("deparse_attrs", 0); | |
6190 /* Check if called by wrapper */ | |
6191 if (unlikely(__pyx_skip_dispatch)) ; | |
6192 /* Check if overridden in Python */ | |
6193 else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { | |
6194 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
6195 static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; | |
6196 if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { | |
6197 PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); | |
6198 #endif | |
6199 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_deparse_attrs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) | |
6200 __Pyx_GOTREF(__pyx_t_1); | |
6201 if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_10pybedtools_9cbedtools_8Interval_9deparse_attrs)) { | |
6202 __Pyx_XDECREF(__pyx_r); | |
6203 __Pyx_INCREF(__pyx_t_1); | |
6204 __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; | |
6205 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { | |
6206 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); | |
6207 if (likely(__pyx_t_4)) { | |
6208 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); | |
6209 __Pyx_INCREF(__pyx_t_4); | |
6210 __Pyx_INCREF(function); | |
6211 __Pyx_DECREF_SET(__pyx_t_3, function); | |
6212 } | |
6213 } | |
6214 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); | |
6215 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
6216 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) | |
6217 __Pyx_GOTREF(__pyx_t_2); | |
6218 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
6219 __pyx_r = __pyx_t_2; | |
6220 __pyx_t_2 = 0; | |
6221 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6222 goto __pyx_L0; | |
6223 } | |
6224 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
6225 __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); | |
6226 __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); | |
6227 if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { | |
6228 __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; | |
6229 } | |
6230 #endif | |
6231 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6232 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
6233 } | |
6234 #endif | |
6235 } | |
6236 | |
6237 /* "pybedtools/cbedtools.pyx":366 | |
6238 * cpdef deparse_attrs(self): | |
6239 * | |
6240 * if not self._attrs: return # <<<<<<<<<<<<<< | |
6241 * | |
6242 * if self.file_type != "gff": | |
6243 */ | |
6244 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_attrs); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 366, __pyx_L1_error) | |
6245 __pyx_t_6 = ((!__pyx_t_5) != 0); | |
6246 if (__pyx_t_6) { | |
6247 __Pyx_XDECREF(__pyx_r); | |
6248 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
6249 goto __pyx_L0; | |
6250 } | |
6251 | |
6252 /* "pybedtools/cbedtools.pyx":368 | |
6253 * if not self._attrs: return | |
6254 * | |
6255 * if self.file_type != "gff": # <<<<<<<<<<<<<< | |
6256 * raise ValueError('Interval.attrs was not None, but this was a non-GFF Interval') | |
6257 * | |
6258 */ | |
6259 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) | |
6260 __Pyx_GOTREF(__pyx_t_1); | |
6261 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_gff, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 368, __pyx_L1_error) | |
6262 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6263 if (unlikely(__pyx_t_6)) { | |
6264 | |
6265 /* "pybedtools/cbedtools.pyx":369 | |
6266 * | |
6267 * if self.file_type != "gff": | |
6268 * raise ValueError('Interval.attrs was not None, but this was a non-GFF Interval') # <<<<<<<<<<<<<< | |
6269 * | |
6270 * s = self._attrs.__str__() | |
6271 */ | |
6272 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) | |
6273 __Pyx_GOTREF(__pyx_t_1); | |
6274 __Pyx_Raise(__pyx_t_1, 0, 0, 0); | |
6275 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6276 __PYX_ERR(0, 369, __pyx_L1_error) | |
6277 | |
6278 /* "pybedtools/cbedtools.pyx":368 | |
6279 * if not self._attrs: return | |
6280 * | |
6281 * if self.file_type != "gff": # <<<<<<<<<<<<<< | |
6282 * raise ValueError('Interval.attrs was not None, but this was a non-GFF Interval') | |
6283 * | |
6284 */ | |
6285 } | |
6286 | |
6287 /* "pybedtools/cbedtools.pyx":371 | |
6288 * raise ValueError('Interval.attrs was not None, but this was a non-GFF Interval') | |
6289 * | |
6290 * s = self._attrs.__str__() # <<<<<<<<<<<<<< | |
6291 * self._bed.fields[8] = _cppstr(s) | |
6292 * | |
6293 */ | |
6294 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_attrs, __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) | |
6295 __Pyx_GOTREF(__pyx_t_2); | |
6296 __pyx_t_3 = NULL; | |
6297 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
6298 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
6299 if (likely(__pyx_t_3)) { | |
6300 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
6301 __Pyx_INCREF(__pyx_t_3); | |
6302 __Pyx_INCREF(function); | |
6303 __Pyx_DECREF_SET(__pyx_t_2, function); | |
6304 } | |
6305 } | |
6306 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); | |
6307 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
6308 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) | |
6309 __Pyx_GOTREF(__pyx_t_1); | |
6310 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
6311 __pyx_v_s = __pyx_t_1; | |
6312 __pyx_t_1 = 0; | |
6313 | |
6314 /* "pybedtools/cbedtools.pyx":372 | |
6315 * | |
6316 * s = self._attrs.__str__() | |
6317 * self._bed.fields[8] = _cppstr(s) # <<<<<<<<<<<<<< | |
6318 * | |
6319 * property fields: | |
6320 */ | |
6321 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) | |
6322 __Pyx_GOTREF(__pyx_t_1); | |
6323 __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L1_error) | |
6324 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6325 (__pyx_v_self->_bed->fields[8]) = __pyx_t_7; | |
6326 | |
6327 /* "pybedtools/cbedtools.pyx":364 | |
6328 * return self._bed.end - self._bed.start | |
6329 * | |
6330 * cpdef deparse_attrs(self): # <<<<<<<<<<<<<< | |
6331 * | |
6332 * if not self._attrs: return | |
6333 */ | |
6334 | |
6335 /* function exit code */ | |
6336 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
6337 goto __pyx_L0; | |
6338 __pyx_L1_error:; | |
6339 __Pyx_XDECREF(__pyx_t_1); | |
6340 __Pyx_XDECREF(__pyx_t_2); | |
6341 __Pyx_XDECREF(__pyx_t_3); | |
6342 __Pyx_XDECREF(__pyx_t_4); | |
6343 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.deparse_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6344 __pyx_r = 0; | |
6345 __pyx_L0:; | |
6346 __Pyx_XDECREF(__pyx_v_s); | |
6347 __Pyx_XGIVEREF(__pyx_r); | |
6348 __Pyx_RefNannyFinishContext(); | |
6349 return __pyx_r; | |
6350 } | |
6351 | |
6352 /* Python wrapper */ | |
6353 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_9deparse_attrs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
6354 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_9deparse_attrs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
6355 PyObject *__pyx_r = 0; | |
6356 __Pyx_RefNannyDeclarations | |
6357 __Pyx_RefNannySetupContext("deparse_attrs (wrapper)", 0); | |
6358 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_8deparse_attrs(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
6359 | |
6360 /* function exit code */ | |
6361 __Pyx_RefNannyFinishContext(); | |
6362 return __pyx_r; | |
6363 } | |
6364 | |
6365 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_8deparse_attrs(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
6366 PyObject *__pyx_r = NULL; | |
6367 __Pyx_RefNannyDeclarations | |
6368 PyObject *__pyx_t_1 = NULL; | |
6369 int __pyx_lineno = 0; | |
6370 const char *__pyx_filename = NULL; | |
6371 int __pyx_clineno = 0; | |
6372 __Pyx_RefNannySetupContext("deparse_attrs", 0); | |
6373 __Pyx_XDECREF(__pyx_r); | |
6374 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_8Interval_deparse_attrs(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) | |
6375 __Pyx_GOTREF(__pyx_t_1); | |
6376 __pyx_r = __pyx_t_1; | |
6377 __pyx_t_1 = 0; | |
6378 goto __pyx_L0; | |
6379 | |
6380 /* function exit code */ | |
6381 __pyx_L1_error:; | |
6382 __Pyx_XDECREF(__pyx_t_1); | |
6383 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.deparse_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6384 __pyx_r = NULL; | |
6385 __pyx_L0:; | |
6386 __Pyx_XGIVEREF(__pyx_r); | |
6387 __Pyx_RefNannyFinishContext(); | |
6388 return __pyx_r; | |
6389 } | |
6390 | |
6391 /* "pybedtools/cbedtools.pyx":375 | |
6392 * | |
6393 * property fields: | |
6394 * def __get__(self): # <<<<<<<<<<<<<< | |
6395 * self.deparse_attrs() | |
6396 * items = [] | |
6397 */ | |
6398 | |
6399 /* Python wrapper */ | |
6400 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_6fields_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
6401 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_6fields_1__get__(PyObject *__pyx_v_self) { | |
6402 PyObject *__pyx_r = 0; | |
6403 __Pyx_RefNannyDeclarations | |
6404 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
6405 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_6fields___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
6406 | |
6407 /* function exit code */ | |
6408 __Pyx_RefNannyFinishContext(); | |
6409 return __pyx_r; | |
6410 } | |
6411 | |
6412 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_6fields___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
6413 PyObject *__pyx_v_items = NULL; | |
6414 std::string __pyx_v_i; | |
6415 PyObject *__pyx_r = NULL; | |
6416 __Pyx_RefNannyDeclarations | |
6417 PyObject *__pyx_t_1 = NULL; | |
6418 std::vector<std::string> ::iterator __pyx_t_2; | |
6419 std::vector<std::string> *__pyx_t_3; | |
6420 std::string __pyx_t_4; | |
6421 int __pyx_t_5; | |
6422 int __pyx_t_6; | |
6423 int __pyx_t_7; | |
6424 int __pyx_lineno = 0; | |
6425 const char *__pyx_filename = NULL; | |
6426 int __pyx_clineno = 0; | |
6427 __Pyx_RefNannySetupContext("__get__", 0); | |
6428 | |
6429 /* "pybedtools/cbedtools.pyx":376 | |
6430 * property fields: | |
6431 * def __get__(self): | |
6432 * self.deparse_attrs() # <<<<<<<<<<<<<< | |
6433 * items = [] | |
6434 * for i in self._bed.fields: | |
6435 */ | |
6436 __pyx_t_1 = ((struct __pyx_vtabstruct_10pybedtools_9cbedtools_Interval *)__pyx_v_self->__pyx_vtab)->deparse_attrs(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error) | |
6437 __Pyx_GOTREF(__pyx_t_1); | |
6438 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6439 | |
6440 /* "pybedtools/cbedtools.pyx":377 | |
6441 * def __get__(self): | |
6442 * self.deparse_attrs() | |
6443 * items = [] # <<<<<<<<<<<<<< | |
6444 * for i in self._bed.fields: | |
6445 * if isinstance(i, int): | |
6446 */ | |
6447 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) | |
6448 __Pyx_GOTREF(__pyx_t_1); | |
6449 __pyx_v_items = ((PyObject*)__pyx_t_1); | |
6450 __pyx_t_1 = 0; | |
6451 | |
6452 /* "pybedtools/cbedtools.pyx":378 | |
6453 * self.deparse_attrs() | |
6454 * items = [] | |
6455 * for i in self._bed.fields: # <<<<<<<<<<<<<< | |
6456 * if isinstance(i, int): | |
6457 * items.append(i) | |
6458 */ | |
6459 __pyx_t_3 = &__pyx_v_self->_bed->fields; | |
6460 __pyx_t_2 = __pyx_t_3->begin(); | |
6461 for (;;) { | |
6462 if (!(__pyx_t_2 != __pyx_t_3->end())) break; | |
6463 __pyx_t_4 = *__pyx_t_2; | |
6464 ++__pyx_t_2; | |
6465 __pyx_v_i = __pyx_t_4; | |
6466 | |
6467 /* "pybedtools/cbedtools.pyx":379 | |
6468 * items = [] | |
6469 * for i in self._bed.fields: | |
6470 * if isinstance(i, int): # <<<<<<<<<<<<<< | |
6471 * items.append(i) | |
6472 * else: | |
6473 */ | |
6474 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error) | |
6475 __Pyx_GOTREF(__pyx_t_1); | |
6476 __pyx_t_5 = PyInt_Check(__pyx_t_1); | |
6477 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6478 __pyx_t_6 = (__pyx_t_5 != 0); | |
6479 if (__pyx_t_6) { | |
6480 | |
6481 /* "pybedtools/cbedtools.pyx":380 | |
6482 * for i in self._bed.fields: | |
6483 * if isinstance(i, int): | |
6484 * items.append(i) # <<<<<<<<<<<<<< | |
6485 * else: | |
6486 * items.append(_pystr(i)) | |
6487 */ | |
6488 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) | |
6489 __Pyx_GOTREF(__pyx_t_1); | |
6490 __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_items, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 380, __pyx_L1_error) | |
6491 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6492 | |
6493 /* "pybedtools/cbedtools.pyx":379 | |
6494 * items = [] | |
6495 * for i in self._bed.fields: | |
6496 * if isinstance(i, int): # <<<<<<<<<<<<<< | |
6497 * items.append(i) | |
6498 * else: | |
6499 */ | |
6500 goto __pyx_L5; | |
6501 } | |
6502 | |
6503 /* "pybedtools/cbedtools.pyx":382 | |
6504 * items.append(i) | |
6505 * else: | |
6506 * items.append(_pystr(i)) # <<<<<<<<<<<<<< | |
6507 * return items | |
6508 * | |
6509 */ | |
6510 /*else*/ { | |
6511 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) | |
6512 __Pyx_GOTREF(__pyx_t_1); | |
6513 __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_items, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 382, __pyx_L1_error) | |
6514 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6515 } | |
6516 __pyx_L5:; | |
6517 | |
6518 /* "pybedtools/cbedtools.pyx":378 | |
6519 * self.deparse_attrs() | |
6520 * items = [] | |
6521 * for i in self._bed.fields: # <<<<<<<<<<<<<< | |
6522 * if isinstance(i, int): | |
6523 * items.append(i) | |
6524 */ | |
6525 } | |
6526 | |
6527 /* "pybedtools/cbedtools.pyx":383 | |
6528 * else: | |
6529 * items.append(_pystr(i)) | |
6530 * return items # <<<<<<<<<<<<<< | |
6531 * | |
6532 * property attrs: | |
6533 */ | |
6534 __Pyx_XDECREF(__pyx_r); | |
6535 __Pyx_INCREF(__pyx_v_items); | |
6536 __pyx_r = __pyx_v_items; | |
6537 goto __pyx_L0; | |
6538 | |
6539 /* "pybedtools/cbedtools.pyx":375 | |
6540 * | |
6541 * property fields: | |
6542 * def __get__(self): # <<<<<<<<<<<<<< | |
6543 * self.deparse_attrs() | |
6544 * items = [] | |
6545 */ | |
6546 | |
6547 /* function exit code */ | |
6548 __pyx_L1_error:; | |
6549 __Pyx_XDECREF(__pyx_t_1); | |
6550 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.fields.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6551 __pyx_r = NULL; | |
6552 __pyx_L0:; | |
6553 __Pyx_XDECREF(__pyx_v_items); | |
6554 __Pyx_XGIVEREF(__pyx_r); | |
6555 __Pyx_RefNannyFinishContext(); | |
6556 return __pyx_r; | |
6557 } | |
6558 | |
6559 /* "pybedtools/cbedtools.pyx":386 | |
6560 * | |
6561 * property attrs: | |
6562 * def __get__(self): # <<<<<<<<<<<<<< | |
6563 * if self._attrs is None: | |
6564 * ft = _pystr(self._bed.file_type) | |
6565 */ | |
6566 | |
6567 /* Python wrapper */ | |
6568 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5attrs_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
6569 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5attrs_1__get__(PyObject *__pyx_v_self) { | |
6570 PyObject *__pyx_r = 0; | |
6571 __Pyx_RefNannyDeclarations | |
6572 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
6573 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5attrs___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
6574 | |
6575 /* function exit code */ | |
6576 __Pyx_RefNannyFinishContext(); | |
6577 return __pyx_r; | |
6578 } | |
6579 | |
6580 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5attrs___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
6581 PyObject *__pyx_v_ft = NULL; | |
6582 PyObject *__pyx_r = NULL; | |
6583 __Pyx_RefNannyDeclarations | |
6584 int __pyx_t_1; | |
6585 int __pyx_t_2; | |
6586 PyObject *__pyx_t_3 = NULL; | |
6587 PyObject *__pyx_t_4 = NULL; | |
6588 PyObject *__pyx_t_5 = NULL; | |
6589 PyObject *__pyx_t_6 = NULL; | |
6590 int __pyx_lineno = 0; | |
6591 const char *__pyx_filename = NULL; | |
6592 int __pyx_clineno = 0; | |
6593 __Pyx_RefNannySetupContext("__get__", 0); | |
6594 | |
6595 /* "pybedtools/cbedtools.pyx":387 | |
6596 * property attrs: | |
6597 * def __get__(self): | |
6598 * if self._attrs is None: # <<<<<<<<<<<<<< | |
6599 * ft = _pystr(self._bed.file_type) | |
6600 * if ft == 'gff': | |
6601 */ | |
6602 __pyx_t_1 = (__pyx_v_self->_attrs == Py_None); | |
6603 __pyx_t_2 = (__pyx_t_1 != 0); | |
6604 if (__pyx_t_2) { | |
6605 | |
6606 /* "pybedtools/cbedtools.pyx":388 | |
6607 * def __get__(self): | |
6608 * if self._attrs is None: | |
6609 * ft = _pystr(self._bed.file_type) # <<<<<<<<<<<<<< | |
6610 * if ft == 'gff': | |
6611 * self._attrs = Attributes(_pystr(self._bed.fields[8])) | |
6612 */ | |
6613 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->file_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error) | |
6614 __Pyx_GOTREF(__pyx_t_3); | |
6615 __pyx_v_ft = __pyx_t_3; | |
6616 __pyx_t_3 = 0; | |
6617 | |
6618 /* "pybedtools/cbedtools.pyx":389 | |
6619 * if self._attrs is None: | |
6620 * ft = _pystr(self._bed.file_type) | |
6621 * if ft == 'gff': # <<<<<<<<<<<<<< | |
6622 * self._attrs = Attributes(_pystr(self._bed.fields[8])) | |
6623 * else: | |
6624 */ | |
6625 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_ft, __pyx_n_s_gff, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 389, __pyx_L1_error) | |
6626 if (__pyx_t_2) { | |
6627 | |
6628 /* "pybedtools/cbedtools.pyx":390 | |
6629 * ft = _pystr(self._bed.file_type) | |
6630 * if ft == 'gff': | |
6631 * self._attrs = Attributes(_pystr(self._bed.fields[8])) # <<<<<<<<<<<<<< | |
6632 * else: | |
6633 * self._attrs = Attributes("") | |
6634 */ | |
6635 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error) | |
6636 __Pyx_GOTREF(__pyx_t_4); | |
6637 __pyx_t_5 = __pyx_f_10pybedtools_9cbedtools__pystr((__pyx_v_self->_bed->fields[8])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) | |
6638 __Pyx_GOTREF(__pyx_t_5); | |
6639 __pyx_t_6 = NULL; | |
6640 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { | |
6641 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); | |
6642 if (likely(__pyx_t_6)) { | |
6643 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); | |
6644 __Pyx_INCREF(__pyx_t_6); | |
6645 __Pyx_INCREF(function); | |
6646 __Pyx_DECREF_SET(__pyx_t_4, function); | |
6647 } | |
6648 } | |
6649 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); | |
6650 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
6651 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
6652 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) | |
6653 __Pyx_GOTREF(__pyx_t_3); | |
6654 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
6655 __Pyx_GIVEREF(__pyx_t_3); | |
6656 __Pyx_GOTREF(__pyx_v_self->_attrs); | |
6657 __Pyx_DECREF(__pyx_v_self->_attrs); | |
6658 __pyx_v_self->_attrs = __pyx_t_3; | |
6659 __pyx_t_3 = 0; | |
6660 | |
6661 /* "pybedtools/cbedtools.pyx":389 | |
6662 * if self._attrs is None: | |
6663 * ft = _pystr(self._bed.file_type) | |
6664 * if ft == 'gff': # <<<<<<<<<<<<<< | |
6665 * self._attrs = Attributes(_pystr(self._bed.fields[8])) | |
6666 * else: | |
6667 */ | |
6668 goto __pyx_L4; | |
6669 } | |
6670 | |
6671 /* "pybedtools/cbedtools.pyx":392 | |
6672 * self._attrs = Attributes(_pystr(self._bed.fields[8])) | |
6673 * else: | |
6674 * self._attrs = Attributes("") # <<<<<<<<<<<<<< | |
6675 * return self._attrs | |
6676 * | |
6677 */ | |
6678 /*else*/ { | |
6679 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 392, __pyx_L1_error) | |
6680 __Pyx_GOTREF(__pyx_t_4); | |
6681 __pyx_t_5 = NULL; | |
6682 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { | |
6683 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); | |
6684 if (likely(__pyx_t_5)) { | |
6685 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); | |
6686 __Pyx_INCREF(__pyx_t_5); | |
6687 __Pyx_INCREF(function); | |
6688 __Pyx_DECREF_SET(__pyx_t_4, function); | |
6689 } | |
6690 } | |
6691 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_); | |
6692 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
6693 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error) | |
6694 __Pyx_GOTREF(__pyx_t_3); | |
6695 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
6696 __Pyx_GIVEREF(__pyx_t_3); | |
6697 __Pyx_GOTREF(__pyx_v_self->_attrs); | |
6698 __Pyx_DECREF(__pyx_v_self->_attrs); | |
6699 __pyx_v_self->_attrs = __pyx_t_3; | |
6700 __pyx_t_3 = 0; | |
6701 } | |
6702 __pyx_L4:; | |
6703 | |
6704 /* "pybedtools/cbedtools.pyx":387 | |
6705 * property attrs: | |
6706 * def __get__(self): | |
6707 * if self._attrs is None: # <<<<<<<<<<<<<< | |
6708 * ft = _pystr(self._bed.file_type) | |
6709 * if ft == 'gff': | |
6710 */ | |
6711 } | |
6712 | |
6713 /* "pybedtools/cbedtools.pyx":393 | |
6714 * else: | |
6715 * self._attrs = Attributes("") | |
6716 * return self._attrs # <<<<<<<<<<<<<< | |
6717 * | |
6718 * def __set__(self, attrs): | |
6719 */ | |
6720 __Pyx_XDECREF(__pyx_r); | |
6721 __Pyx_INCREF(__pyx_v_self->_attrs); | |
6722 __pyx_r = __pyx_v_self->_attrs; | |
6723 goto __pyx_L0; | |
6724 | |
6725 /* "pybedtools/cbedtools.pyx":386 | |
6726 * | |
6727 * property attrs: | |
6728 * def __get__(self): # <<<<<<<<<<<<<< | |
6729 * if self._attrs is None: | |
6730 * ft = _pystr(self._bed.file_type) | |
6731 */ | |
6732 | |
6733 /* function exit code */ | |
6734 __pyx_L1_error:; | |
6735 __Pyx_XDECREF(__pyx_t_3); | |
6736 __Pyx_XDECREF(__pyx_t_4); | |
6737 __Pyx_XDECREF(__pyx_t_5); | |
6738 __Pyx_XDECREF(__pyx_t_6); | |
6739 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.attrs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6740 __pyx_r = NULL; | |
6741 __pyx_L0:; | |
6742 __Pyx_XDECREF(__pyx_v_ft); | |
6743 __Pyx_XGIVEREF(__pyx_r); | |
6744 __Pyx_RefNannyFinishContext(); | |
6745 return __pyx_r; | |
6746 } | |
6747 | |
6748 /* "pybedtools/cbedtools.pyx":395 | |
6749 * return self._attrs | |
6750 * | |
6751 * def __set__(self, attrs): # <<<<<<<<<<<<<< | |
6752 * self._attrs = attrs | |
6753 * | |
6754 */ | |
6755 | |
6756 /* Python wrapper */ | |
6757 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5attrs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_attrs); /*proto*/ | |
6758 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5attrs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_attrs) { | |
6759 int __pyx_r; | |
6760 __Pyx_RefNannyDeclarations | |
6761 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
6762 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5attrs_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_attrs)); | |
6763 | |
6764 /* function exit code */ | |
6765 __Pyx_RefNannyFinishContext(); | |
6766 return __pyx_r; | |
6767 } | |
6768 | |
6769 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5attrs_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_attrs) { | |
6770 int __pyx_r; | |
6771 __Pyx_RefNannyDeclarations | |
6772 __Pyx_RefNannySetupContext("__set__", 0); | |
6773 | |
6774 /* "pybedtools/cbedtools.pyx":396 | |
6775 * | |
6776 * def __set__(self, attrs): | |
6777 * self._attrs = attrs # <<<<<<<<<<<<<< | |
6778 * | |
6779 * # TODO: make this more robust. | |
6780 */ | |
6781 __Pyx_INCREF(__pyx_v_attrs); | |
6782 __Pyx_GIVEREF(__pyx_v_attrs); | |
6783 __Pyx_GOTREF(__pyx_v_self->_attrs); | |
6784 __Pyx_DECREF(__pyx_v_self->_attrs); | |
6785 __pyx_v_self->_attrs = __pyx_v_attrs; | |
6786 | |
6787 /* "pybedtools/cbedtools.pyx":395 | |
6788 * return self._attrs | |
6789 * | |
6790 * def __set__(self, attrs): # <<<<<<<<<<<<<< | |
6791 * self._attrs = attrs | |
6792 * | |
6793 */ | |
6794 | |
6795 /* function exit code */ | |
6796 __pyx_r = 0; | |
6797 __Pyx_RefNannyFinishContext(); | |
6798 return __pyx_r; | |
6799 } | |
6800 | |
6801 /* "pybedtools/cbedtools.pyx":400 | |
6802 * # TODO: make this more robust. | |
6803 * @property | |
6804 * def count(self): # <<<<<<<<<<<<<< | |
6805 * return int(self.fields[-1]) | |
6806 * | |
6807 */ | |
6808 | |
6809 /* Python wrapper */ | |
6810 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
6811 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5count_1__get__(PyObject *__pyx_v_self) { | |
6812 PyObject *__pyx_r = 0; | |
6813 __Pyx_RefNannyDeclarations | |
6814 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
6815 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5count___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
6816 | |
6817 /* function exit code */ | |
6818 __Pyx_RefNannyFinishContext(); | |
6819 return __pyx_r; | |
6820 } | |
6821 | |
6822 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5count___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
6823 PyObject *__pyx_r = NULL; | |
6824 __Pyx_RefNannyDeclarations | |
6825 PyObject *__pyx_t_1 = NULL; | |
6826 PyObject *__pyx_t_2 = NULL; | |
6827 int __pyx_lineno = 0; | |
6828 const char *__pyx_filename = NULL; | |
6829 int __pyx_clineno = 0; | |
6830 __Pyx_RefNannySetupContext("__get__", 0); | |
6831 | |
6832 /* "pybedtools/cbedtools.pyx":401 | |
6833 * @property | |
6834 * def count(self): | |
6835 * return int(self.fields[-1]) # <<<<<<<<<<<<<< | |
6836 * | |
6837 * property name: | |
6838 */ | |
6839 __Pyx_XDECREF(__pyx_r); | |
6840 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) | |
6841 __Pyx_GOTREF(__pyx_t_1); | |
6842 __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) | |
6843 __Pyx_GOTREF(__pyx_t_2); | |
6844 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
6845 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) | |
6846 __Pyx_GOTREF(__pyx_t_1); | |
6847 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
6848 __pyx_r = __pyx_t_1; | |
6849 __pyx_t_1 = 0; | |
6850 goto __pyx_L0; | |
6851 | |
6852 /* "pybedtools/cbedtools.pyx":400 | |
6853 * # TODO: make this more robust. | |
6854 * @property | |
6855 * def count(self): # <<<<<<<<<<<<<< | |
6856 * return int(self.fields[-1]) | |
6857 * | |
6858 */ | |
6859 | |
6860 /* function exit code */ | |
6861 __pyx_L1_error:; | |
6862 __Pyx_XDECREF(__pyx_t_1); | |
6863 __Pyx_XDECREF(__pyx_t_2); | |
6864 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
6865 __pyx_r = NULL; | |
6866 __pyx_L0:; | |
6867 __Pyx_XGIVEREF(__pyx_r); | |
6868 __Pyx_RefNannyFinishContext(); | |
6869 return __pyx_r; | |
6870 } | |
6871 | |
6872 /* "pybedtools/cbedtools.pyx":411 | |
6873 * | |
6874 * """ | |
6875 * def __get__(self): # <<<<<<<<<<<<<< | |
6876 * cdef string ftype = self._bed.file_type | |
6877 * value = None | |
6878 */ | |
6879 | |
6880 /* Python wrapper */ | |
6881 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_4name_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
6882 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_4name_1__get__(PyObject *__pyx_v_self) { | |
6883 PyObject *__pyx_r = 0; | |
6884 __Pyx_RefNannyDeclarations | |
6885 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
6886 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_4name___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
6887 | |
6888 /* function exit code */ | |
6889 __Pyx_RefNannyFinishContext(); | |
6890 return __pyx_r; | |
6891 } | |
6892 | |
6893 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_4name___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
6894 std::string __pyx_v_ftype; | |
6895 PyObject *__pyx_v_value = NULL; | |
6896 PyObject *__pyx_v_key = NULL; | |
6897 PyObject *__pyx_v_s = NULL; | |
6898 PyObject *__pyx_r = NULL; | |
6899 __Pyx_RefNannyDeclarations | |
6900 std::string __pyx_t_1; | |
6901 int __pyx_t_2; | |
6902 PyObject *__pyx_t_3 = NULL; | |
6903 Py_ssize_t __pyx_t_4; | |
6904 PyObject *__pyx_t_5 = NULL; | |
6905 int __pyx_t_6; | |
6906 PyObject *__pyx_t_7 = NULL; | |
6907 int __pyx_lineno = 0; | |
6908 const char *__pyx_filename = NULL; | |
6909 int __pyx_clineno = 0; | |
6910 __Pyx_RefNannySetupContext("__get__", 0); | |
6911 | |
6912 /* "pybedtools/cbedtools.pyx":412 | |
6913 * """ | |
6914 * def __get__(self): | |
6915 * cdef string ftype = self._bed.file_type # <<<<<<<<<<<<<< | |
6916 * value = None | |
6917 * if ftype == <string>"gff": | |
6918 */ | |
6919 __pyx_t_1 = __pyx_v_self->_bed->file_type; | |
6920 __pyx_v_ftype = __pyx_t_1; | |
6921 | |
6922 /* "pybedtools/cbedtools.pyx":413 | |
6923 * def __get__(self): | |
6924 * cdef string ftype = self._bed.file_type | |
6925 * value = None # <<<<<<<<<<<<<< | |
6926 * if ftype == <string>"gff": | |
6927 * """ | |
6928 */ | |
6929 __Pyx_INCREF(Py_None); | |
6930 __pyx_v_value = Py_None; | |
6931 | |
6932 /* "pybedtools/cbedtools.pyx":414 | |
6933 * cdef string ftype = self._bed.file_type | |
6934 * value = None | |
6935 * if ftype == <string>"gff": # <<<<<<<<<<<<<< | |
6936 * """ | |
6937 * # TODO. allow setting a name_key in the BedTool constructor? | |
6938 */ | |
6939 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_gff); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) | |
6940 __pyx_t_2 = ((__pyx_v_ftype == ((std::string)__pyx_t_1)) != 0); | |
6941 if (__pyx_t_2) { | |
6942 | |
6943 /* "pybedtools/cbedtools.pyx":420 | |
6944 * return attrs[self.name_key] | |
6945 * """ | |
6946 * for key in ("ID", "Name", "gene_name", "transcript_id", \ # <<<<<<<<<<<<<< | |
6947 * "gene_id", "Parent"): | |
6948 * if key in self.attrs: | |
6949 */ | |
6950 __pyx_t_3 = __pyx_tuple__14; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; | |
6951 for (;;) { | |
6952 if (__pyx_t_4 >= 6) break; | |
6953 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
6954 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 420, __pyx_L1_error) | |
6955 #else | |
6956 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error) | |
6957 __Pyx_GOTREF(__pyx_t_5); | |
6958 #endif | |
6959 __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); | |
6960 __pyx_t_5 = 0; | |
6961 | |
6962 /* "pybedtools/cbedtools.pyx":422 | |
6963 * for key in ("ID", "Name", "gene_name", "transcript_id", \ | |
6964 * "gene_id", "Parent"): | |
6965 * if key in self.attrs: # <<<<<<<<<<<<<< | |
6966 * value = self.attrs[key] | |
6967 * break | |
6968 */ | |
6969 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error) | |
6970 __Pyx_GOTREF(__pyx_t_5); | |
6971 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_t_5, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 422, __pyx_L1_error) | |
6972 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
6973 __pyx_t_6 = (__pyx_t_2 != 0); | |
6974 if (__pyx_t_6) { | |
6975 | |
6976 /* "pybedtools/cbedtools.pyx":423 | |
6977 * "gene_id", "Parent"): | |
6978 * if key in self.attrs: | |
6979 * value = self.attrs[key] # <<<<<<<<<<<<<< | |
6980 * break | |
6981 * | |
6982 */ | |
6983 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error) | |
6984 __Pyx_GOTREF(__pyx_t_5); | |
6985 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error) | |
6986 __Pyx_GOTREF(__pyx_t_7); | |
6987 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
6988 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_7); | |
6989 __pyx_t_7 = 0; | |
6990 | |
6991 /* "pybedtools/cbedtools.pyx":424 | |
6992 * if key in self.attrs: | |
6993 * value = self.attrs[key] | |
6994 * break # <<<<<<<<<<<<<< | |
6995 * | |
6996 * elif ftype == <string>"vcf": | |
6997 */ | |
6998 goto __pyx_L5_break; | |
6999 | |
7000 /* "pybedtools/cbedtools.pyx":422 | |
7001 * for key in ("ID", "Name", "gene_name", "transcript_id", \ | |
7002 * "gene_id", "Parent"): | |
7003 * if key in self.attrs: # <<<<<<<<<<<<<< | |
7004 * value = self.attrs[key] | |
7005 * break | |
7006 */ | |
7007 } | |
7008 | |
7009 /* "pybedtools/cbedtools.pyx":420 | |
7010 * return attrs[self.name_key] | |
7011 * """ | |
7012 * for key in ("ID", "Name", "gene_name", "transcript_id", \ # <<<<<<<<<<<<<< | |
7013 * "gene_id", "Parent"): | |
7014 * if key in self.attrs: | |
7015 */ | |
7016 } | |
7017 __pyx_L5_break:; | |
7018 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7019 | |
7020 /* "pybedtools/cbedtools.pyx":414 | |
7021 * cdef string ftype = self._bed.file_type | |
7022 * value = None | |
7023 * if ftype == <string>"gff": # <<<<<<<<<<<<<< | |
7024 * """ | |
7025 * # TODO. allow setting a name_key in the BedTool constructor? | |
7026 */ | |
7027 goto __pyx_L3; | |
7028 } | |
7029 | |
7030 /* "pybedtools/cbedtools.pyx":426 | |
7031 * break | |
7032 * | |
7033 * elif ftype == <string>"vcf": # <<<<<<<<<<<<<< | |
7034 * s = self.fields[2] | |
7035 * if s in ("", "."): | |
7036 */ | |
7037 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_vcf); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error) | |
7038 __pyx_t_6 = ((__pyx_v_ftype == ((std::string)__pyx_t_1)) != 0); | |
7039 if (__pyx_t_6) { | |
7040 | |
7041 /* "pybedtools/cbedtools.pyx":427 | |
7042 * | |
7043 * elif ftype == <string>"vcf": | |
7044 * s = self.fields[2] # <<<<<<<<<<<<<< | |
7045 * if s in ("", "."): | |
7046 * value = "%s:%i" % (self.chrom, self.start) | |
7047 */ | |
7048 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fields); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) | |
7049 __Pyx_GOTREF(__pyx_t_3); | |
7050 __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error) | |
7051 __Pyx_GOTREF(__pyx_t_7); | |
7052 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7053 __pyx_v_s = __pyx_t_7; | |
7054 __pyx_t_7 = 0; | |
7055 | |
7056 /* "pybedtools/cbedtools.pyx":428 | |
7057 * elif ftype == <string>"vcf": | |
7058 * s = self.fields[2] | |
7059 * if s in ("", "."): # <<<<<<<<<<<<<< | |
7060 * value = "%s:%i" % (self.chrom, self.start) | |
7061 * else: | |
7062 */ | |
7063 __Pyx_INCREF(__pyx_v_s); | |
7064 __pyx_t_7 = __pyx_v_s; | |
7065 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 428, __pyx_L1_error) | |
7066 if (!__pyx_t_2) { | |
7067 } else { | |
7068 __pyx_t_6 = __pyx_t_2; | |
7069 goto __pyx_L8_bool_binop_done; | |
7070 } | |
7071 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_kp_s__7, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 428, __pyx_L1_error) | |
7072 __pyx_t_6 = __pyx_t_2; | |
7073 __pyx_L8_bool_binop_done:; | |
7074 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
7075 __pyx_t_2 = (__pyx_t_6 != 0); | |
7076 if (__pyx_t_2) { | |
7077 | |
7078 /* "pybedtools/cbedtools.pyx":429 | |
7079 * s = self.fields[2] | |
7080 * if s in ("", "."): | |
7081 * value = "%s:%i" % (self.chrom, self.start) # <<<<<<<<<<<<<< | |
7082 * else: | |
7083 * value = _pystr(s) | |
7084 */ | |
7085 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_chrom); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 429, __pyx_L1_error) | |
7086 __Pyx_GOTREF(__pyx_t_7); | |
7087 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) | |
7088 __Pyx_GOTREF(__pyx_t_3); | |
7089 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L1_error) | |
7090 __Pyx_GOTREF(__pyx_t_5); | |
7091 __Pyx_GIVEREF(__pyx_t_7); | |
7092 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); | |
7093 __Pyx_GIVEREF(__pyx_t_3); | |
7094 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); | |
7095 __pyx_t_7 = 0; | |
7096 __pyx_t_3 = 0; | |
7097 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_i, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) | |
7098 __Pyx_GOTREF(__pyx_t_3); | |
7099 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
7100 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3); | |
7101 __pyx_t_3 = 0; | |
7102 | |
7103 /* "pybedtools/cbedtools.pyx":428 | |
7104 * elif ftype == <string>"vcf": | |
7105 * s = self.fields[2] | |
7106 * if s in ("", "."): # <<<<<<<<<<<<<< | |
7107 * value = "%s:%i" % (self.chrom, self.start) | |
7108 * else: | |
7109 */ | |
7110 goto __pyx_L7; | |
7111 } | |
7112 | |
7113 /* "pybedtools/cbedtools.pyx":431 | |
7114 * value = "%s:%i" % (self.chrom, self.start) | |
7115 * else: | |
7116 * value = _pystr(s) # <<<<<<<<<<<<<< | |
7117 * elif ftype == <string>"bed": | |
7118 * value = _pystr(self._bed.name) | |
7119 */ | |
7120 /*else*/ { | |
7121 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_s); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L1_error) | |
7122 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error) | |
7123 __Pyx_GOTREF(__pyx_t_3); | |
7124 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3); | |
7125 __pyx_t_3 = 0; | |
7126 } | |
7127 __pyx_L7:; | |
7128 | |
7129 /* "pybedtools/cbedtools.pyx":426 | |
7130 * break | |
7131 * | |
7132 * elif ftype == <string>"vcf": # <<<<<<<<<<<<<< | |
7133 * s = self.fields[2] | |
7134 * if s in ("", "."): | |
7135 */ | |
7136 goto __pyx_L3; | |
7137 } | |
7138 | |
7139 /* "pybedtools/cbedtools.pyx":432 | |
7140 * else: | |
7141 * value = _pystr(s) | |
7142 * elif ftype == <string>"bed": # <<<<<<<<<<<<<< | |
7143 * value = _pystr(self._bed.name) | |
7144 * | |
7145 */ | |
7146 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_bed); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 432, __pyx_L1_error) | |
7147 __pyx_t_2 = ((__pyx_v_ftype == ((std::string)__pyx_t_1)) != 0); | |
7148 if (__pyx_t_2) { | |
7149 | |
7150 /* "pybedtools/cbedtools.pyx":433 | |
7151 * value = _pystr(s) | |
7152 * elif ftype == <string>"bed": | |
7153 * value = _pystr(self._bed.name) # <<<<<<<<<<<<<< | |
7154 * | |
7155 * return value | |
7156 */ | |
7157 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 433, __pyx_L1_error) | |
7158 __Pyx_GOTREF(__pyx_t_3); | |
7159 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3); | |
7160 __pyx_t_3 = 0; | |
7161 | |
7162 /* "pybedtools/cbedtools.pyx":432 | |
7163 * else: | |
7164 * value = _pystr(s) | |
7165 * elif ftype == <string>"bed": # <<<<<<<<<<<<<< | |
7166 * value = _pystr(self._bed.name) | |
7167 * | |
7168 */ | |
7169 } | |
7170 __pyx_L3:; | |
7171 | |
7172 /* "pybedtools/cbedtools.pyx":435 | |
7173 * value = _pystr(self._bed.name) | |
7174 * | |
7175 * return value # <<<<<<<<<<<<<< | |
7176 * | |
7177 * def __set__(self, value): | |
7178 */ | |
7179 __Pyx_XDECREF(__pyx_r); | |
7180 __Pyx_INCREF(__pyx_v_value); | |
7181 __pyx_r = __pyx_v_value; | |
7182 goto __pyx_L0; | |
7183 | |
7184 /* "pybedtools/cbedtools.pyx":411 | |
7185 * | |
7186 * """ | |
7187 * def __get__(self): # <<<<<<<<<<<<<< | |
7188 * cdef string ftype = self._bed.file_type | |
7189 * value = None | |
7190 */ | |
7191 | |
7192 /* function exit code */ | |
7193 __pyx_L1_error:; | |
7194 __Pyx_XDECREF(__pyx_t_3); | |
7195 __Pyx_XDECREF(__pyx_t_5); | |
7196 __Pyx_XDECREF(__pyx_t_7); | |
7197 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7198 __pyx_r = NULL; | |
7199 __pyx_L0:; | |
7200 __Pyx_XDECREF(__pyx_v_value); | |
7201 __Pyx_XDECREF(__pyx_v_key); | |
7202 __Pyx_XDECREF(__pyx_v_s); | |
7203 __Pyx_XGIVEREF(__pyx_r); | |
7204 __Pyx_RefNannyFinishContext(); | |
7205 return __pyx_r; | |
7206 } | |
7207 | |
7208 /* "pybedtools/cbedtools.pyx":437 | |
7209 * return value | |
7210 * | |
7211 * def __set__(self, value): # <<<<<<<<<<<<<< | |
7212 * cdef string ftype = self._bed.file_type | |
7213 * | |
7214 */ | |
7215 | |
7216 /* Python wrapper */ | |
7217 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ | |
7218 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { | |
7219 int __pyx_r; | |
7220 __Pyx_RefNannyDeclarations | |
7221 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
7222 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_4name_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value)); | |
7223 | |
7224 /* function exit code */ | |
7225 __Pyx_RefNannyFinishContext(); | |
7226 return __pyx_r; | |
7227 } | |
7228 | |
7229 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_4name_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value) { | |
7230 std::string __pyx_v_ftype; | |
7231 PyObject *__pyx_v_key = NULL; | |
7232 int __pyx_r; | |
7233 __Pyx_RefNannyDeclarations | |
7234 std::string __pyx_t_1; | |
7235 int __pyx_t_2; | |
7236 PyObject *__pyx_t_3 = NULL; | |
7237 Py_ssize_t __pyx_t_4; | |
7238 PyObject *__pyx_t_5 = NULL; | |
7239 int __pyx_t_6; | |
7240 int __pyx_lineno = 0; | |
7241 const char *__pyx_filename = NULL; | |
7242 int __pyx_clineno = 0; | |
7243 __Pyx_RefNannySetupContext("__set__", 0); | |
7244 | |
7245 /* "pybedtools/cbedtools.pyx":438 | |
7246 * | |
7247 * def __set__(self, value): | |
7248 * cdef string ftype = self._bed.file_type # <<<<<<<<<<<<<< | |
7249 * | |
7250 * if ftype == <string>"gff": | |
7251 */ | |
7252 __pyx_t_1 = __pyx_v_self->_bed->file_type; | |
7253 __pyx_v_ftype = __pyx_t_1; | |
7254 | |
7255 /* "pybedtools/cbedtools.pyx":440 | |
7256 * cdef string ftype = self._bed.file_type | |
7257 * | |
7258 * if ftype == <string>"gff": # <<<<<<<<<<<<<< | |
7259 * for key in ("ID", "Name", "gene_name", "transcript_id", \ | |
7260 * "gene_id", "Parent"): | |
7261 */ | |
7262 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_gff); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error) | |
7263 __pyx_t_2 = ((__pyx_v_ftype == ((std::string)__pyx_t_1)) != 0); | |
7264 if (__pyx_t_2) { | |
7265 | |
7266 /* "pybedtools/cbedtools.pyx":441 | |
7267 * | |
7268 * if ftype == <string>"gff": | |
7269 * for key in ("ID", "Name", "gene_name", "transcript_id", \ # <<<<<<<<<<<<<< | |
7270 * "gene_id", "Parent"): | |
7271 * if not key in self.attrs: | |
7272 */ | |
7273 __pyx_t_3 = __pyx_tuple__14; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; | |
7274 for (;;) { | |
7275 if (__pyx_t_4 >= 6) break; | |
7276 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
7277 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 441, __pyx_L1_error) | |
7278 #else | |
7279 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) | |
7280 __Pyx_GOTREF(__pyx_t_5); | |
7281 #endif | |
7282 __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); | |
7283 __pyx_t_5 = 0; | |
7284 | |
7285 /* "pybedtools/cbedtools.pyx":443 | |
7286 * for key in ("ID", "Name", "gene_name", "transcript_id", \ | |
7287 * "gene_id", "Parent"): | |
7288 * if not key in self.attrs: # <<<<<<<<<<<<<< | |
7289 * continue | |
7290 * | |
7291 */ | |
7292 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) | |
7293 __Pyx_GOTREF(__pyx_t_5); | |
7294 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_t_5, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 443, __pyx_L1_error) | |
7295 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
7296 __pyx_t_6 = (__pyx_t_2 != 0); | |
7297 if (__pyx_t_6) { | |
7298 | |
7299 /* "pybedtools/cbedtools.pyx":444 | |
7300 * "gene_id", "Parent"): | |
7301 * if not key in self.attrs: | |
7302 * continue # <<<<<<<<<<<<<< | |
7303 * | |
7304 * # If it's incoming from Python it's unicode, so store that directly | |
7305 */ | |
7306 goto __pyx_L4_continue; | |
7307 | |
7308 /* "pybedtools/cbedtools.pyx":443 | |
7309 * for key in ("ID", "Name", "gene_name", "transcript_id", \ | |
7310 * "gene_id", "Parent"): | |
7311 * if not key in self.attrs: # <<<<<<<<<<<<<< | |
7312 * continue | |
7313 * | |
7314 */ | |
7315 } | |
7316 | |
7317 /* "pybedtools/cbedtools.pyx":449 | |
7318 * # in the attributes (since an Attribute object works on | |
7319 * # unicode)... | |
7320 * self.attrs[key] = value # <<<<<<<<<<<<<< | |
7321 * break | |
7322 * | |
7323 */ | |
7324 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error) | |
7325 __Pyx_GOTREF(__pyx_t_5); | |
7326 if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_v_key, __pyx_v_value) < 0)) __PYX_ERR(0, 449, __pyx_L1_error) | |
7327 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
7328 | |
7329 /* "pybedtools/cbedtools.pyx":450 | |
7330 * # unicode)... | |
7331 * self.attrs[key] = value | |
7332 * break # <<<<<<<<<<<<<< | |
7333 * | |
7334 * # Otherwise use _cppstr() because we're storing it in _bed.fields. | |
7335 */ | |
7336 goto __pyx_L5_break; | |
7337 | |
7338 /* "pybedtools/cbedtools.pyx":441 | |
7339 * | |
7340 * if ftype == <string>"gff": | |
7341 * for key in ("ID", "Name", "gene_name", "transcript_id", \ # <<<<<<<<<<<<<< | |
7342 * "gene_id", "Parent"): | |
7343 * if not key in self.attrs: | |
7344 */ | |
7345 __pyx_L4_continue:; | |
7346 } | |
7347 __pyx_L5_break:; | |
7348 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7349 | |
7350 /* "pybedtools/cbedtools.pyx":440 | |
7351 * cdef string ftype = self._bed.file_type | |
7352 * | |
7353 * if ftype == <string>"gff": # <<<<<<<<<<<<<< | |
7354 * for key in ("ID", "Name", "gene_name", "transcript_id", \ | |
7355 * "gene_id", "Parent"): | |
7356 */ | |
7357 goto __pyx_L3; | |
7358 } | |
7359 | |
7360 /* "pybedtools/cbedtools.pyx":453 | |
7361 * | |
7362 * # Otherwise use _cppstr() because we're storing it in _bed.fields. | |
7363 * elif ftype == <string>"vcf": # <<<<<<<<<<<<<< | |
7364 * self._bed.fields[2] = _cppstr(value) | |
7365 * else: | |
7366 */ | |
7367 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_vcf); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 453, __pyx_L1_error) | |
7368 __pyx_t_6 = ((__pyx_v_ftype == ((std::string)__pyx_t_1)) != 0); | |
7369 if (__pyx_t_6) { | |
7370 | |
7371 /* "pybedtools/cbedtools.pyx":454 | |
7372 * # Otherwise use _cppstr() because we're storing it in _bed.fields. | |
7373 * elif ftype == <string>"vcf": | |
7374 * self._bed.fields[2] = _cppstr(value) # <<<<<<<<<<<<<< | |
7375 * else: | |
7376 * self._bed.name = _cppstr(value) | |
7377 */ | |
7378 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) | |
7379 __Pyx_GOTREF(__pyx_t_3); | |
7380 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 454, __pyx_L1_error) | |
7381 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7382 (__pyx_v_self->_bed->fields[2]) = __pyx_t_1; | |
7383 | |
7384 /* "pybedtools/cbedtools.pyx":453 | |
7385 * | |
7386 * # Otherwise use _cppstr() because we're storing it in _bed.fields. | |
7387 * elif ftype == <string>"vcf": # <<<<<<<<<<<<<< | |
7388 * self._bed.fields[2] = _cppstr(value) | |
7389 * else: | |
7390 */ | |
7391 goto __pyx_L3; | |
7392 } | |
7393 | |
7394 /* "pybedtools/cbedtools.pyx":456 | |
7395 * self._bed.fields[2] = _cppstr(value) | |
7396 * else: | |
7397 * self._bed.name = _cppstr(value) # <<<<<<<<<<<<<< | |
7398 * self._bed.fields[3] = _cppstr(value) | |
7399 * | |
7400 */ | |
7401 /*else*/ { | |
7402 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) | |
7403 __Pyx_GOTREF(__pyx_t_3); | |
7404 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 456, __pyx_L1_error) | |
7405 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7406 __pyx_v_self->_bed->name = __pyx_t_1; | |
7407 | |
7408 /* "pybedtools/cbedtools.pyx":457 | |
7409 * else: | |
7410 * self._bed.name = _cppstr(value) | |
7411 * self._bed.fields[3] = _cppstr(value) # <<<<<<<<<<<<<< | |
7412 * | |
7413 * property score: | |
7414 */ | |
7415 __pyx_t_3 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error) | |
7416 __Pyx_GOTREF(__pyx_t_3); | |
7417 __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 457, __pyx_L1_error) | |
7418 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7419 (__pyx_v_self->_bed->fields[3]) = __pyx_t_1; | |
7420 } | |
7421 __pyx_L3:; | |
7422 | |
7423 /* "pybedtools/cbedtools.pyx":437 | |
7424 * return value | |
7425 * | |
7426 * def __set__(self, value): # <<<<<<<<<<<<<< | |
7427 * cdef string ftype = self._bed.file_type | |
7428 * | |
7429 */ | |
7430 | |
7431 /* function exit code */ | |
7432 __pyx_r = 0; | |
7433 goto __pyx_L0; | |
7434 __pyx_L1_error:; | |
7435 __Pyx_XDECREF(__pyx_t_3); | |
7436 __Pyx_XDECREF(__pyx_t_5); | |
7437 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7438 __pyx_r = -1; | |
7439 __pyx_L0:; | |
7440 __Pyx_XDECREF(__pyx_v_key); | |
7441 __Pyx_RefNannyFinishContext(); | |
7442 return __pyx_r; | |
7443 } | |
7444 | |
7445 /* "pybedtools/cbedtools.pyx":460 | |
7446 * | |
7447 * property score: | |
7448 * def __get__(self): # <<<<<<<<<<<<<< | |
7449 * return _pystr(self._bed.score) | |
7450 * | |
7451 */ | |
7452 | |
7453 /* Python wrapper */ | |
7454 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5score_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
7455 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5score_1__get__(PyObject *__pyx_v_self) { | |
7456 PyObject *__pyx_r = 0; | |
7457 __Pyx_RefNannyDeclarations | |
7458 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
7459 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5score___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
7460 | |
7461 /* function exit code */ | |
7462 __Pyx_RefNannyFinishContext(); | |
7463 return __pyx_r; | |
7464 } | |
7465 | |
7466 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5score___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
7467 PyObject *__pyx_r = NULL; | |
7468 __Pyx_RefNannyDeclarations | |
7469 PyObject *__pyx_t_1 = NULL; | |
7470 int __pyx_lineno = 0; | |
7471 const char *__pyx_filename = NULL; | |
7472 int __pyx_clineno = 0; | |
7473 __Pyx_RefNannySetupContext("__get__", 0); | |
7474 | |
7475 /* "pybedtools/cbedtools.pyx":461 | |
7476 * property score: | |
7477 * def __get__(self): | |
7478 * return _pystr(self._bed.score) # <<<<<<<<<<<<<< | |
7479 * | |
7480 * def __set__(self, value): | |
7481 */ | |
7482 __Pyx_XDECREF(__pyx_r); | |
7483 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) | |
7484 __Pyx_GOTREF(__pyx_t_1); | |
7485 __pyx_r = __pyx_t_1; | |
7486 __pyx_t_1 = 0; | |
7487 goto __pyx_L0; | |
7488 | |
7489 /* "pybedtools/cbedtools.pyx":460 | |
7490 * | |
7491 * property score: | |
7492 * def __get__(self): # <<<<<<<<<<<<<< | |
7493 * return _pystr(self._bed.score) | |
7494 * | |
7495 */ | |
7496 | |
7497 /* function exit code */ | |
7498 __pyx_L1_error:; | |
7499 __Pyx_XDECREF(__pyx_t_1); | |
7500 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7501 __pyx_r = NULL; | |
7502 __pyx_L0:; | |
7503 __Pyx_XGIVEREF(__pyx_r); | |
7504 __Pyx_RefNannyFinishContext(); | |
7505 return __pyx_r; | |
7506 } | |
7507 | |
7508 /* "pybedtools/cbedtools.pyx":463 | |
7509 * return _pystr(self._bed.score) | |
7510 * | |
7511 * def __set__(self, value): # <<<<<<<<<<<<<< | |
7512 * value = _cppstr(value) | |
7513 * self._bed.score = value | |
7514 */ | |
7515 | |
7516 /* Python wrapper */ | |
7517 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5score_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ | |
7518 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_5score_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { | |
7519 int __pyx_r; | |
7520 __Pyx_RefNannyDeclarations | |
7521 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
7522 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5score_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value)); | |
7523 | |
7524 /* function exit code */ | |
7525 __Pyx_RefNannyFinishContext(); | |
7526 return __pyx_r; | |
7527 } | |
7528 | |
7529 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_5score_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value) { | |
7530 PyObject *__pyx_v_idx = NULL; | |
7531 int __pyx_r; | |
7532 __Pyx_RefNannyDeclarations | |
7533 PyObject *__pyx_t_1 = NULL; | |
7534 std::string __pyx_t_2; | |
7535 PyObject *__pyx_t_3 = NULL; | |
7536 std::vector<std::string> ::size_type __pyx_t_4; | |
7537 int __pyx_lineno = 0; | |
7538 const char *__pyx_filename = NULL; | |
7539 int __pyx_clineno = 0; | |
7540 __Pyx_RefNannySetupContext("__set__", 0); | |
7541 __Pyx_INCREF(__pyx_v_value); | |
7542 | |
7543 /* "pybedtools/cbedtools.pyx":464 | |
7544 * | |
7545 * def __set__(self, value): | |
7546 * value = _cppstr(value) # <<<<<<<<<<<<<< | |
7547 * self._bed.score = value | |
7548 * idx = LOOKUPS[self.file_type]["score"] | |
7549 */ | |
7550 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) | |
7551 __Pyx_GOTREF(__pyx_t_1); | |
7552 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1); | |
7553 __pyx_t_1 = 0; | |
7554 | |
7555 /* "pybedtools/cbedtools.pyx":465 | |
7556 * def __set__(self, value): | |
7557 * value = _cppstr(value) | |
7558 * self._bed.score = value # <<<<<<<<<<<<<< | |
7559 * idx = LOOKUPS[self.file_type]["score"] | |
7560 * self._bed.fields[idx] = value | |
7561 */ | |
7562 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error) | |
7563 __pyx_v_self->_bed->score = __pyx_t_2; | |
7564 | |
7565 /* "pybedtools/cbedtools.pyx":466 | |
7566 * value = _cppstr(value) | |
7567 * self._bed.score = value | |
7568 * idx = LOOKUPS[self.file_type]["score"] # <<<<<<<<<<<<<< | |
7569 * self._bed.fields[idx] = value | |
7570 * | |
7571 */ | |
7572 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
7573 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
7574 __PYX_ERR(0, 466, __pyx_L1_error) | |
7575 } | |
7576 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) | |
7577 __Pyx_GOTREF(__pyx_t_1); | |
7578 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) | |
7579 __Pyx_GOTREF(__pyx_t_3); | |
7580 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
7581 __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_score); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) | |
7582 __Pyx_GOTREF(__pyx_t_1); | |
7583 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
7584 __pyx_v_idx = __pyx_t_1; | |
7585 __pyx_t_1 = 0; | |
7586 | |
7587 /* "pybedtools/cbedtools.pyx":467 | |
7588 * self._bed.score = value | |
7589 * idx = LOOKUPS[self.file_type]["score"] | |
7590 * self._bed.fields[idx] = value # <<<<<<<<<<<<<< | |
7591 * | |
7592 * property file_type: | |
7593 */ | |
7594 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error) | |
7595 __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error) | |
7596 (__pyx_v_self->_bed->fields[__pyx_t_4]) = __pyx_t_2; | |
7597 | |
7598 /* "pybedtools/cbedtools.pyx":463 | |
7599 * return _pystr(self._bed.score) | |
7600 * | |
7601 * def __set__(self, value): # <<<<<<<<<<<<<< | |
7602 * value = _cppstr(value) | |
7603 * self._bed.score = value | |
7604 */ | |
7605 | |
7606 /* function exit code */ | |
7607 __pyx_r = 0; | |
7608 goto __pyx_L0; | |
7609 __pyx_L1_error:; | |
7610 __Pyx_XDECREF(__pyx_t_1); | |
7611 __Pyx_XDECREF(__pyx_t_3); | |
7612 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.score.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7613 __pyx_r = -1; | |
7614 __pyx_L0:; | |
7615 __Pyx_XDECREF(__pyx_v_idx); | |
7616 __Pyx_XDECREF(__pyx_v_value); | |
7617 __Pyx_RefNannyFinishContext(); | |
7618 return __pyx_r; | |
7619 } | |
7620 | |
7621 /* "pybedtools/cbedtools.pyx":471 | |
7622 * property file_type: | |
7623 * "bed/vcf/gff" | |
7624 * def __get__(self): # <<<<<<<<<<<<<< | |
7625 * return _pystr(self._bed.file_type) | |
7626 * | |
7627 */ | |
7628 | |
7629 /* Python wrapper */ | |
7630 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_9file_type_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
7631 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_9file_type_1__get__(PyObject *__pyx_v_self) { | |
7632 PyObject *__pyx_r = 0; | |
7633 __Pyx_RefNannyDeclarations | |
7634 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
7635 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_9file_type___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
7636 | |
7637 /* function exit code */ | |
7638 __Pyx_RefNannyFinishContext(); | |
7639 return __pyx_r; | |
7640 } | |
7641 | |
7642 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_9file_type___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
7643 PyObject *__pyx_r = NULL; | |
7644 __Pyx_RefNannyDeclarations | |
7645 PyObject *__pyx_t_1 = NULL; | |
7646 int __pyx_lineno = 0; | |
7647 const char *__pyx_filename = NULL; | |
7648 int __pyx_clineno = 0; | |
7649 __Pyx_RefNannySetupContext("__get__", 0); | |
7650 | |
7651 /* "pybedtools/cbedtools.pyx":472 | |
7652 * "bed/vcf/gff" | |
7653 * def __get__(self): | |
7654 * return _pystr(self._bed.file_type) # <<<<<<<<<<<<<< | |
7655 * | |
7656 * def __set__(self, value): | |
7657 */ | |
7658 __Pyx_XDECREF(__pyx_r); | |
7659 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) | |
7660 __Pyx_GOTREF(__pyx_t_1); | |
7661 __pyx_r = __pyx_t_1; | |
7662 __pyx_t_1 = 0; | |
7663 goto __pyx_L0; | |
7664 | |
7665 /* "pybedtools/cbedtools.pyx":471 | |
7666 * property file_type: | |
7667 * "bed/vcf/gff" | |
7668 * def __get__(self): # <<<<<<<<<<<<<< | |
7669 * return _pystr(self._bed.file_type) | |
7670 * | |
7671 */ | |
7672 | |
7673 /* function exit code */ | |
7674 __pyx_L1_error:; | |
7675 __Pyx_XDECREF(__pyx_t_1); | |
7676 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.file_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7677 __pyx_r = NULL; | |
7678 __pyx_L0:; | |
7679 __Pyx_XGIVEREF(__pyx_r); | |
7680 __Pyx_RefNannyFinishContext(); | |
7681 return __pyx_r; | |
7682 } | |
7683 | |
7684 /* "pybedtools/cbedtools.pyx":474 | |
7685 * return _pystr(self._bed.file_type) | |
7686 * | |
7687 * def __set__(self, value): # <<<<<<<<<<<<<< | |
7688 * self._bed.file_type = _cppstr(value) | |
7689 * | |
7690 */ | |
7691 | |
7692 /* Python wrapper */ | |
7693 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_9file_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ | |
7694 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_9file_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { | |
7695 int __pyx_r; | |
7696 __Pyx_RefNannyDeclarations | |
7697 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); | |
7698 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_9file_type_2__set__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value)); | |
7699 | |
7700 /* function exit code */ | |
7701 __Pyx_RefNannyFinishContext(); | |
7702 return __pyx_r; | |
7703 } | |
7704 | |
7705 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_9file_type_2__set__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value) { | |
7706 int __pyx_r; | |
7707 __Pyx_RefNannyDeclarations | |
7708 PyObject *__pyx_t_1 = NULL; | |
7709 std::string __pyx_t_2; | |
7710 int __pyx_lineno = 0; | |
7711 const char *__pyx_filename = NULL; | |
7712 int __pyx_clineno = 0; | |
7713 __Pyx_RefNannySetupContext("__set__", 0); | |
7714 | |
7715 /* "pybedtools/cbedtools.pyx":475 | |
7716 * | |
7717 * def __set__(self, value): | |
7718 * self._bed.file_type = _cppstr(value) # <<<<<<<<<<<<<< | |
7719 * | |
7720 * # TODO: maybe bed.overlap_start or bed.overlap.start ?? | |
7721 */ | |
7722 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error) | |
7723 __Pyx_GOTREF(__pyx_t_1); | |
7724 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error) | |
7725 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
7726 __pyx_v_self->_bed->file_type = __pyx_t_2; | |
7727 | |
7728 /* "pybedtools/cbedtools.pyx":474 | |
7729 * return _pystr(self._bed.file_type) | |
7730 * | |
7731 * def __set__(self, value): # <<<<<<<<<<<<<< | |
7732 * self._bed.file_type = _cppstr(value) | |
7733 * | |
7734 */ | |
7735 | |
7736 /* function exit code */ | |
7737 __pyx_r = 0; | |
7738 goto __pyx_L0; | |
7739 __pyx_L1_error:; | |
7740 __Pyx_XDECREF(__pyx_t_1); | |
7741 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.file_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7742 __pyx_r = -1; | |
7743 __pyx_L0:; | |
7744 __Pyx_RefNannyFinishContext(); | |
7745 return __pyx_r; | |
7746 } | |
7747 | |
7748 /* "pybedtools/cbedtools.pyx":479 | |
7749 * # TODO: maybe bed.overlap_start or bed.overlap.start ?? | |
7750 * @property | |
7751 * def o_start(self): # <<<<<<<<<<<<<< | |
7752 * return self._bed.o_start | |
7753 * | |
7754 */ | |
7755 | |
7756 /* Python wrapper */ | |
7757 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_7o_start_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
7758 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_7o_start_1__get__(PyObject *__pyx_v_self) { | |
7759 PyObject *__pyx_r = 0; | |
7760 __Pyx_RefNannyDeclarations | |
7761 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
7762 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_7o_start___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
7763 | |
7764 /* function exit code */ | |
7765 __Pyx_RefNannyFinishContext(); | |
7766 return __pyx_r; | |
7767 } | |
7768 | |
7769 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_7o_start___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
7770 PyObject *__pyx_r = NULL; | |
7771 __Pyx_RefNannyDeclarations | |
7772 PyObject *__pyx_t_1 = NULL; | |
7773 int __pyx_lineno = 0; | |
7774 const char *__pyx_filename = NULL; | |
7775 int __pyx_clineno = 0; | |
7776 __Pyx_RefNannySetupContext("__get__", 0); | |
7777 | |
7778 /* "pybedtools/cbedtools.pyx":480 | |
7779 * @property | |
7780 * def o_start(self): | |
7781 * return self._bed.o_start # <<<<<<<<<<<<<< | |
7782 * | |
7783 * @property | |
7784 */ | |
7785 __Pyx_XDECREF(__pyx_r); | |
7786 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS(__pyx_v_self->_bed->o_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) | |
7787 __Pyx_GOTREF(__pyx_t_1); | |
7788 __pyx_r = __pyx_t_1; | |
7789 __pyx_t_1 = 0; | |
7790 goto __pyx_L0; | |
7791 | |
7792 /* "pybedtools/cbedtools.pyx":479 | |
7793 * # TODO: maybe bed.overlap_start or bed.overlap.start ?? | |
7794 * @property | |
7795 * def o_start(self): # <<<<<<<<<<<<<< | |
7796 * return self._bed.o_start | |
7797 * | |
7798 */ | |
7799 | |
7800 /* function exit code */ | |
7801 __pyx_L1_error:; | |
7802 __Pyx_XDECREF(__pyx_t_1); | |
7803 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.o_start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7804 __pyx_r = NULL; | |
7805 __pyx_L0:; | |
7806 __Pyx_XGIVEREF(__pyx_r); | |
7807 __Pyx_RefNannyFinishContext(); | |
7808 return __pyx_r; | |
7809 } | |
7810 | |
7811 /* "pybedtools/cbedtools.pyx":483 | |
7812 * | |
7813 * @property | |
7814 * def o_end(self): # <<<<<<<<<<<<<< | |
7815 * return self._bed.o_end | |
7816 * | |
7817 */ | |
7818 | |
7819 /* Python wrapper */ | |
7820 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5o_end_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
7821 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5o_end_1__get__(PyObject *__pyx_v_self) { | |
7822 PyObject *__pyx_r = 0; | |
7823 __Pyx_RefNannyDeclarations | |
7824 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
7825 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5o_end___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
7826 | |
7827 /* function exit code */ | |
7828 __Pyx_RefNannyFinishContext(); | |
7829 return __pyx_r; | |
7830 } | |
7831 | |
7832 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5o_end___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
7833 PyObject *__pyx_r = NULL; | |
7834 __Pyx_RefNannyDeclarations | |
7835 PyObject *__pyx_t_1 = NULL; | |
7836 int __pyx_lineno = 0; | |
7837 const char *__pyx_filename = NULL; | |
7838 int __pyx_clineno = 0; | |
7839 __Pyx_RefNannySetupContext("__get__", 0); | |
7840 | |
7841 /* "pybedtools/cbedtools.pyx":484 | |
7842 * @property | |
7843 * def o_end(self): | |
7844 * return self._bed.o_end # <<<<<<<<<<<<<< | |
7845 * | |
7846 * @property | |
7847 */ | |
7848 __Pyx_XDECREF(__pyx_r); | |
7849 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS(__pyx_v_self->_bed->o_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) | |
7850 __Pyx_GOTREF(__pyx_t_1); | |
7851 __pyx_r = __pyx_t_1; | |
7852 __pyx_t_1 = 0; | |
7853 goto __pyx_L0; | |
7854 | |
7855 /* "pybedtools/cbedtools.pyx":483 | |
7856 * | |
7857 * @property | |
7858 * def o_end(self): # <<<<<<<<<<<<<< | |
7859 * return self._bed.o_end | |
7860 * | |
7861 */ | |
7862 | |
7863 /* function exit code */ | |
7864 __pyx_L1_error:; | |
7865 __Pyx_XDECREF(__pyx_t_1); | |
7866 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.o_end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7867 __pyx_r = NULL; | |
7868 __pyx_L0:; | |
7869 __Pyx_XGIVEREF(__pyx_r); | |
7870 __Pyx_RefNannyFinishContext(); | |
7871 return __pyx_r; | |
7872 } | |
7873 | |
7874 /* "pybedtools/cbedtools.pyx":487 | |
7875 * | |
7876 * @property | |
7877 * def o_amt(self): # <<<<<<<<<<<<<< | |
7878 * return self._bed.o_end - self._bed.o_start | |
7879 * | |
7880 */ | |
7881 | |
7882 /* Python wrapper */ | |
7883 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5o_amt_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
7884 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_5o_amt_1__get__(PyObject *__pyx_v_self) { | |
7885 PyObject *__pyx_r = 0; | |
7886 __Pyx_RefNannyDeclarations | |
7887 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
7888 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_5o_amt___get__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
7889 | |
7890 /* function exit code */ | |
7891 __Pyx_RefNannyFinishContext(); | |
7892 return __pyx_r; | |
7893 } | |
7894 | |
7895 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_5o_amt___get__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
7896 PyObject *__pyx_r = NULL; | |
7897 __Pyx_RefNannyDeclarations | |
7898 PyObject *__pyx_t_1 = NULL; | |
7899 int __pyx_lineno = 0; | |
7900 const char *__pyx_filename = NULL; | |
7901 int __pyx_clineno = 0; | |
7902 __Pyx_RefNannySetupContext("__get__", 0); | |
7903 | |
7904 /* "pybedtools/cbedtools.pyx":488 | |
7905 * @property | |
7906 * def o_amt(self): | |
7907 * return self._bed.o_end - self._bed.o_start # <<<<<<<<<<<<<< | |
7908 * | |
7909 * def __str__(self): | |
7910 */ | |
7911 __Pyx_XDECREF(__pyx_r); | |
7912 __pyx_t_1 = __Pyx_PyInt_From_CHRPOS((__pyx_v_self->_bed->o_end - __pyx_v_self->_bed->o_start)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) | |
7913 __Pyx_GOTREF(__pyx_t_1); | |
7914 __pyx_r = __pyx_t_1; | |
7915 __pyx_t_1 = 0; | |
7916 goto __pyx_L0; | |
7917 | |
7918 /* "pybedtools/cbedtools.pyx":487 | |
7919 * | |
7920 * @property | |
7921 * def o_amt(self): # <<<<<<<<<<<<<< | |
7922 * return self._bed.o_end - self._bed.o_start | |
7923 * | |
7924 */ | |
7925 | |
7926 /* function exit code */ | |
7927 __pyx_L1_error:; | |
7928 __Pyx_XDECREF(__pyx_t_1); | |
7929 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.o_amt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
7930 __pyx_r = NULL; | |
7931 __pyx_L0:; | |
7932 __Pyx_XGIVEREF(__pyx_r); | |
7933 __Pyx_RefNannyFinishContext(); | |
7934 return __pyx_r; | |
7935 } | |
7936 | |
7937 /* "pybedtools/cbedtools.pyx":490 | |
7938 * return self._bed.o_end - self._bed.o_start | |
7939 * | |
7940 * def __str__(self): # <<<<<<<<<<<<<< | |
7941 * """ | |
7942 * Interval objects always print with a newline to mimic a line in a | |
7943 */ | |
7944 | |
7945 /* Python wrapper */ | |
7946 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_11__str__(PyObject *__pyx_v_self); /*proto*/ | |
7947 static char __pyx_doc_10pybedtools_9cbedtools_8Interval_10__str__[] = "\n Interval objects always print with a newline to mimic a line in a\n BED/GFF/VCF file\n "; | |
7948 #if CYTHON_UPDATE_DESCRIPTOR_DOC | |
7949 struct wrapperbase __pyx_wrapperbase_10pybedtools_9cbedtools_8Interval_10__str__; | |
7950 #endif | |
7951 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_11__str__(PyObject *__pyx_v_self) { | |
7952 PyObject *__pyx_r = 0; | |
7953 __Pyx_RefNannyDeclarations | |
7954 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); | |
7955 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_10__str__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
7956 | |
7957 /* function exit code */ | |
7958 __Pyx_RefNannyFinishContext(); | |
7959 return __pyx_r; | |
7960 } | |
7961 | |
7962 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_10__str__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
7963 PyObject *__pyx_v_items = NULL; | |
7964 PyObject *__pyx_v_i = NULL; | |
7965 PyObject *__pyx_r = NULL; | |
7966 __Pyx_RefNannyDeclarations | |
7967 PyObject *__pyx_t_1 = NULL; | |
7968 PyObject *__pyx_t_2 = NULL; | |
7969 Py_ssize_t __pyx_t_3; | |
7970 PyObject *(*__pyx_t_4)(PyObject *); | |
7971 int __pyx_t_5; | |
7972 int __pyx_t_6; | |
7973 int __pyx_t_7; | |
7974 int __pyx_lineno = 0; | |
7975 const char *__pyx_filename = NULL; | |
7976 int __pyx_clineno = 0; | |
7977 __Pyx_RefNannySetupContext("__str__", 0); | |
7978 | |
7979 /* "pybedtools/cbedtools.pyx":495 | |
7980 * BED/GFF/VCF file | |
7981 * """ | |
7982 * items = [] # <<<<<<<<<<<<<< | |
7983 * for i in self.fields: | |
7984 * if isinstance(i, int): | |
7985 */ | |
7986 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) | |
7987 __Pyx_GOTREF(__pyx_t_1); | |
7988 __pyx_v_items = ((PyObject*)__pyx_t_1); | |
7989 __pyx_t_1 = 0; | |
7990 | |
7991 /* "pybedtools/cbedtools.pyx":496 | |
7992 * """ | |
7993 * items = [] | |
7994 * for i in self.fields: # <<<<<<<<<<<<<< | |
7995 * if isinstance(i, int): | |
7996 * i = str(i) | |
7997 */ | |
7998 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) | |
7999 __Pyx_GOTREF(__pyx_t_1); | |
8000 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { | |
8001 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; | |
8002 __pyx_t_4 = NULL; | |
8003 } else { | |
8004 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error) | |
8005 __Pyx_GOTREF(__pyx_t_2); | |
8006 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 496, __pyx_L1_error) | |
8007 } | |
8008 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8009 for (;;) { | |
8010 if (likely(!__pyx_t_4)) { | |
8011 if (likely(PyList_CheckExact(__pyx_t_2))) { | |
8012 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; | |
8013 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
8014 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 496, __pyx_L1_error) | |
8015 #else | |
8016 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) | |
8017 __Pyx_GOTREF(__pyx_t_1); | |
8018 #endif | |
8019 } else { | |
8020 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; | |
8021 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
8022 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 496, __pyx_L1_error) | |
8023 #else | |
8024 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) | |
8025 __Pyx_GOTREF(__pyx_t_1); | |
8026 #endif | |
8027 } | |
8028 } else { | |
8029 __pyx_t_1 = __pyx_t_4(__pyx_t_2); | |
8030 if (unlikely(!__pyx_t_1)) { | |
8031 PyObject* exc_type = PyErr_Occurred(); | |
8032 if (exc_type) { | |
8033 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); | |
8034 else __PYX_ERR(0, 496, __pyx_L1_error) | |
8035 } | |
8036 break; | |
8037 } | |
8038 __Pyx_GOTREF(__pyx_t_1); | |
8039 } | |
8040 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); | |
8041 __pyx_t_1 = 0; | |
8042 | |
8043 /* "pybedtools/cbedtools.pyx":497 | |
8044 * items = [] | |
8045 * for i in self.fields: | |
8046 * if isinstance(i, int): # <<<<<<<<<<<<<< | |
8047 * i = str(i) | |
8048 * items.append(i) | |
8049 */ | |
8050 __pyx_t_5 = PyInt_Check(__pyx_v_i); | |
8051 __pyx_t_6 = (__pyx_t_5 != 0); | |
8052 if (__pyx_t_6) { | |
8053 | |
8054 /* "pybedtools/cbedtools.pyx":498 | |
8055 * for i in self.fields: | |
8056 * if isinstance(i, int): | |
8057 * i = str(i) # <<<<<<<<<<<<<< | |
8058 * items.append(i) | |
8059 * | |
8060 */ | |
8061 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error) | |
8062 __Pyx_GOTREF(__pyx_t_1); | |
8063 __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1); | |
8064 __pyx_t_1 = 0; | |
8065 | |
8066 /* "pybedtools/cbedtools.pyx":497 | |
8067 * items = [] | |
8068 * for i in self.fields: | |
8069 * if isinstance(i, int): # <<<<<<<<<<<<<< | |
8070 * i = str(i) | |
8071 * items.append(i) | |
8072 */ | |
8073 } | |
8074 | |
8075 /* "pybedtools/cbedtools.pyx":499 | |
8076 * if isinstance(i, int): | |
8077 * i = str(i) | |
8078 * items.append(i) # <<<<<<<<<<<<<< | |
8079 * | |
8080 * return '\t'.join(items) + '\n' | |
8081 */ | |
8082 __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_items, __pyx_v_i); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 499, __pyx_L1_error) | |
8083 | |
8084 /* "pybedtools/cbedtools.pyx":496 | |
8085 * """ | |
8086 * items = [] | |
8087 * for i in self.fields: # <<<<<<<<<<<<<< | |
8088 * if isinstance(i, int): | |
8089 * i = str(i) | |
8090 */ | |
8091 } | |
8092 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
8093 | |
8094 /* "pybedtools/cbedtools.pyx":501 | |
8095 * items.append(i) | |
8096 * | |
8097 * return '\t'.join(items) + '\n' # <<<<<<<<<<<<<< | |
8098 * | |
8099 * def __repr__(self): | |
8100 */ | |
8101 __Pyx_XDECREF(__pyx_r); | |
8102 __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__8, __pyx_v_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) | |
8103 __Pyx_GOTREF(__pyx_t_2); | |
8104 __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) | |
8105 __Pyx_GOTREF(__pyx_t_1); | |
8106 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
8107 __pyx_r = __pyx_t_1; | |
8108 __pyx_t_1 = 0; | |
8109 goto __pyx_L0; | |
8110 | |
8111 /* "pybedtools/cbedtools.pyx":490 | |
8112 * return self._bed.o_end - self._bed.o_start | |
8113 * | |
8114 * def __str__(self): # <<<<<<<<<<<<<< | |
8115 * """ | |
8116 * Interval objects always print with a newline to mimic a line in a | |
8117 */ | |
8118 | |
8119 /* function exit code */ | |
8120 __pyx_L1_error:; | |
8121 __Pyx_XDECREF(__pyx_t_1); | |
8122 __Pyx_XDECREF(__pyx_t_2); | |
8123 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
8124 __pyx_r = NULL; | |
8125 __pyx_L0:; | |
8126 __Pyx_XDECREF(__pyx_v_items); | |
8127 __Pyx_XDECREF(__pyx_v_i); | |
8128 __Pyx_XGIVEREF(__pyx_r); | |
8129 __Pyx_RefNannyFinishContext(); | |
8130 return __pyx_r; | |
8131 } | |
8132 | |
8133 /* "pybedtools/cbedtools.pyx":503 | |
8134 * return '\t'.join(items) + '\n' | |
8135 * | |
8136 * def __repr__(self): # <<<<<<<<<<<<<< | |
8137 * return "Interval(%s:%i-%i)" % (self.chrom, self.start, self.end) | |
8138 * | |
8139 */ | |
8140 | |
8141 /* Python wrapper */ | |
8142 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_13__repr__(PyObject *__pyx_v_self); /*proto*/ | |
8143 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_13__repr__(PyObject *__pyx_v_self) { | |
8144 PyObject *__pyx_r = 0; | |
8145 __Pyx_RefNannyDeclarations | |
8146 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); | |
8147 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_12__repr__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
8148 | |
8149 /* function exit code */ | |
8150 __Pyx_RefNannyFinishContext(); | |
8151 return __pyx_r; | |
8152 } | |
8153 | |
8154 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_12__repr__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
8155 PyObject *__pyx_r = NULL; | |
8156 __Pyx_RefNannyDeclarations | |
8157 PyObject *__pyx_t_1 = NULL; | |
8158 PyObject *__pyx_t_2 = NULL; | |
8159 PyObject *__pyx_t_3 = NULL; | |
8160 PyObject *__pyx_t_4 = NULL; | |
8161 int __pyx_lineno = 0; | |
8162 const char *__pyx_filename = NULL; | |
8163 int __pyx_clineno = 0; | |
8164 __Pyx_RefNannySetupContext("__repr__", 0); | |
8165 | |
8166 /* "pybedtools/cbedtools.pyx":504 | |
8167 * | |
8168 * def __repr__(self): | |
8169 * return "Interval(%s:%i-%i)" % (self.chrom, self.start, self.end) # <<<<<<<<<<<<<< | |
8170 * | |
8171 * def __dealloc__(self): | |
8172 */ | |
8173 __Pyx_XDECREF(__pyx_r); | |
8174 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error) | |
8175 __Pyx_GOTREF(__pyx_t_1); | |
8176 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) | |
8177 __Pyx_GOTREF(__pyx_t_2); | |
8178 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) | |
8179 __Pyx_GOTREF(__pyx_t_3); | |
8180 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error) | |
8181 __Pyx_GOTREF(__pyx_t_4); | |
8182 __Pyx_GIVEREF(__pyx_t_1); | |
8183 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); | |
8184 __Pyx_GIVEREF(__pyx_t_2); | |
8185 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); | |
8186 __Pyx_GIVEREF(__pyx_t_3); | |
8187 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); | |
8188 __pyx_t_1 = 0; | |
8189 __pyx_t_2 = 0; | |
8190 __pyx_t_3 = 0; | |
8191 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Interval_s_i_i, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) | |
8192 __Pyx_GOTREF(__pyx_t_3); | |
8193 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
8194 __pyx_r = __pyx_t_3; | |
8195 __pyx_t_3 = 0; | |
8196 goto __pyx_L0; | |
8197 | |
8198 /* "pybedtools/cbedtools.pyx":503 | |
8199 * return '\t'.join(items) + '\n' | |
8200 * | |
8201 * def __repr__(self): # <<<<<<<<<<<<<< | |
8202 * return "Interval(%s:%i-%i)" % (self.chrom, self.start, self.end) | |
8203 * | |
8204 */ | |
8205 | |
8206 /* function exit code */ | |
8207 __pyx_L1_error:; | |
8208 __Pyx_XDECREF(__pyx_t_1); | |
8209 __Pyx_XDECREF(__pyx_t_2); | |
8210 __Pyx_XDECREF(__pyx_t_3); | |
8211 __Pyx_XDECREF(__pyx_t_4); | |
8212 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
8213 __pyx_r = NULL; | |
8214 __pyx_L0:; | |
8215 __Pyx_XGIVEREF(__pyx_r); | |
8216 __Pyx_RefNannyFinishContext(); | |
8217 return __pyx_r; | |
8218 } | |
8219 | |
8220 /* "pybedtools/cbedtools.pyx":506 | |
8221 * return "Interval(%s:%i-%i)" % (self.chrom, self.start, self.end) | |
8222 * | |
8223 * def __dealloc__(self): # <<<<<<<<<<<<<< | |
8224 * del self._bed | |
8225 * | |
8226 */ | |
8227 | |
8228 /* Python wrapper */ | |
8229 static void __pyx_pw_10pybedtools_9cbedtools_8Interval_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ | |
8230 static void __pyx_pw_10pybedtools_9cbedtools_8Interval_15__dealloc__(PyObject *__pyx_v_self) { | |
8231 __Pyx_RefNannyDeclarations | |
8232 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); | |
8233 __pyx_pf_10pybedtools_9cbedtools_8Interval_14__dealloc__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
8234 | |
8235 /* function exit code */ | |
8236 __Pyx_RefNannyFinishContext(); | |
8237 } | |
8238 | |
8239 static void __pyx_pf_10pybedtools_9cbedtools_8Interval_14__dealloc__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
8240 __Pyx_RefNannyDeclarations | |
8241 __Pyx_RefNannySetupContext("__dealloc__", 0); | |
8242 | |
8243 /* "pybedtools/cbedtools.pyx":507 | |
8244 * | |
8245 * def __dealloc__(self): | |
8246 * del self._bed # <<<<<<<<<<<<<< | |
8247 * | |
8248 * def __len__(self): | |
8249 */ | |
8250 delete __pyx_v_self->_bed; | |
8251 | |
8252 /* "pybedtools/cbedtools.pyx":506 | |
8253 * return "Interval(%s:%i-%i)" % (self.chrom, self.start, self.end) | |
8254 * | |
8255 * def __dealloc__(self): # <<<<<<<<<<<<<< | |
8256 * del self._bed | |
8257 * | |
8258 */ | |
8259 | |
8260 /* function exit code */ | |
8261 __Pyx_RefNannyFinishContext(); | |
8262 } | |
8263 | |
8264 /* "pybedtools/cbedtools.pyx":509 | |
8265 * del self._bed | |
8266 * | |
8267 * def __len__(self): # <<<<<<<<<<<<<< | |
8268 * return self._bed.end - self._bed.start | |
8269 * | |
8270 */ | |
8271 | |
8272 /* Python wrapper */ | |
8273 static Py_ssize_t __pyx_pw_10pybedtools_9cbedtools_8Interval_17__len__(PyObject *__pyx_v_self); /*proto*/ | |
8274 static Py_ssize_t __pyx_pw_10pybedtools_9cbedtools_8Interval_17__len__(PyObject *__pyx_v_self) { | |
8275 Py_ssize_t __pyx_r; | |
8276 __Pyx_RefNannyDeclarations | |
8277 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); | |
8278 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_16__len__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
8279 | |
8280 /* function exit code */ | |
8281 __Pyx_RefNannyFinishContext(); | |
8282 return __pyx_r; | |
8283 } | |
8284 | |
8285 static Py_ssize_t __pyx_pf_10pybedtools_9cbedtools_8Interval_16__len__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
8286 Py_ssize_t __pyx_r; | |
8287 __Pyx_RefNannyDeclarations | |
8288 __Pyx_RefNannySetupContext("__len__", 0); | |
8289 | |
8290 /* "pybedtools/cbedtools.pyx":510 | |
8291 * | |
8292 * def __len__(self): | |
8293 * return self._bed.end - self._bed.start # <<<<<<<<<<<<<< | |
8294 * | |
8295 * def __getitem__(self, object key): | |
8296 */ | |
8297 __pyx_r = (__pyx_v_self->_bed->end - __pyx_v_self->_bed->start); | |
8298 goto __pyx_L0; | |
8299 | |
8300 /* "pybedtools/cbedtools.pyx":509 | |
8301 * del self._bed | |
8302 * | |
8303 * def __len__(self): # <<<<<<<<<<<<<< | |
8304 * return self._bed.end - self._bed.start | |
8305 * | |
8306 */ | |
8307 | |
8308 /* function exit code */ | |
8309 __pyx_L0:; | |
8310 __Pyx_RefNannyFinishContext(); | |
8311 return __pyx_r; | |
8312 } | |
8313 | |
8314 /* "pybedtools/cbedtools.pyx":512 | |
8315 * return self._bed.end - self._bed.start | |
8316 * | |
8317 * def __getitem__(self, object key): # <<<<<<<<<<<<<< | |
8318 * cdef int i | |
8319 * ftype = _pystr(self._bed.file_type) | |
8320 */ | |
8321 | |
8322 /* Python wrapper */ | |
8323 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ | |
8324 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { | |
8325 PyObject *__pyx_r = 0; | |
8326 __Pyx_RefNannyDeclarations | |
8327 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); | |
8328 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_18__getitem__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_key)); | |
8329 | |
8330 /* function exit code */ | |
8331 __Pyx_RefNannyFinishContext(); | |
8332 return __pyx_r; | |
8333 } | |
8334 | |
8335 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_18__getitem__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_key) { | |
8336 int __pyx_v_i; | |
8337 PyObject *__pyx_v_ftype = NULL; | |
8338 PyObject *__pyx_v_nfields = NULL; | |
8339 PyObject *__pyx_v_indices = NULL; | |
8340 PyObject *__pyx_r = NULL; | |
8341 __Pyx_RefNannyDeclarations | |
8342 PyObject *__pyx_t_1 = NULL; | |
8343 int __pyx_t_2; | |
8344 int __pyx_t_3; | |
8345 int __pyx_t_4; | |
8346 std::vector<std::string> ::size_type __pyx_t_5; | |
8347 __Pyx_FakeReference<std::string> __pyx_t_6; | |
8348 PyObject *__pyx_t_7 = NULL; | |
8349 PyObject *__pyx_t_8 = NULL; | |
8350 PyObject *__pyx_t_9 = NULL; | |
8351 Py_ssize_t __pyx_t_10; | |
8352 PyObject *(*__pyx_t_11)(PyObject *); | |
8353 int __pyx_t_12; | |
8354 __Pyx_FakeReference<std::string> __pyx_t_13; | |
8355 PyObject *__pyx_t_14 = NULL; | |
8356 PyObject *__pyx_t_15 = NULL; | |
8357 PyObject *__pyx_t_16 = NULL; | |
8358 int __pyx_lineno = 0; | |
8359 const char *__pyx_filename = NULL; | |
8360 int __pyx_clineno = 0; | |
8361 __Pyx_RefNannySetupContext("__getitem__", 0); | |
8362 __Pyx_INCREF(__pyx_v_key); | |
8363 | |
8364 /* "pybedtools/cbedtools.pyx":514 | |
8365 * def __getitem__(self, object key): | |
8366 * cdef int i | |
8367 * ftype = _pystr(self._bed.file_type) # <<<<<<<<<<<<<< | |
8368 * | |
8369 * self.deparse_attrs() | |
8370 */ | |
8371 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->file_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) | |
8372 __Pyx_GOTREF(__pyx_t_1); | |
8373 __pyx_v_ftype = __pyx_t_1; | |
8374 __pyx_t_1 = 0; | |
8375 | |
8376 /* "pybedtools/cbedtools.pyx":516 | |
8377 * ftype = _pystr(self._bed.file_type) | |
8378 * | |
8379 * self.deparse_attrs() # <<<<<<<<<<<<<< | |
8380 * | |
8381 * if isinstance(key, (int, long)): | |
8382 */ | |
8383 __pyx_t_1 = ((struct __pyx_vtabstruct_10pybedtools_9cbedtools_Interval *)__pyx_v_self->__pyx_vtab)->deparse_attrs(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) | |
8384 __Pyx_GOTREF(__pyx_t_1); | |
8385 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8386 | |
8387 /* "pybedtools/cbedtools.pyx":518 | |
8388 * self.deparse_attrs() | |
8389 * | |
8390 * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< | |
8391 * nfields = self._bed.fields.size() | |
8392 * if key >= nfields: | |
8393 */ | |
8394 __pyx_t_3 = PyInt_Check(__pyx_v_key); | |
8395 __pyx_t_4 = (__pyx_t_3 != 0); | |
8396 if (!__pyx_t_4) { | |
8397 } else { | |
8398 __pyx_t_2 = __pyx_t_4; | |
8399 goto __pyx_L4_bool_binop_done; | |
8400 } | |
8401 __pyx_t_4 = PyLong_Check(__pyx_v_key); | |
8402 __pyx_t_3 = (__pyx_t_4 != 0); | |
8403 __pyx_t_2 = __pyx_t_3; | |
8404 __pyx_L4_bool_binop_done:; | |
8405 __pyx_t_3 = (__pyx_t_2 != 0); | |
8406 if (__pyx_t_3) { | |
8407 | |
8408 /* "pybedtools/cbedtools.pyx":519 | |
8409 * | |
8410 * if isinstance(key, (int, long)): | |
8411 * nfields = self._bed.fields.size() # <<<<<<<<<<<<<< | |
8412 * if key >= nfields: | |
8413 * raise IndexError('field index out of range') | |
8414 */ | |
8415 __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_bed->fields.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) | |
8416 __Pyx_GOTREF(__pyx_t_1); | |
8417 __pyx_v_nfields = __pyx_t_1; | |
8418 __pyx_t_1 = 0; | |
8419 | |
8420 /* "pybedtools/cbedtools.pyx":520 | |
8421 * if isinstance(key, (int, long)): | |
8422 * nfields = self._bed.fields.size() | |
8423 * if key >= nfields: # <<<<<<<<<<<<<< | |
8424 * raise IndexError('field index out of range') | |
8425 * elif key < 0: | |
8426 */ | |
8427 __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, __pyx_v_nfields, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) | |
8428 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) | |
8429 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8430 if (unlikely(__pyx_t_3)) { | |
8431 | |
8432 /* "pybedtools/cbedtools.pyx":521 | |
8433 * nfields = self._bed.fields.size() | |
8434 * if key >= nfields: | |
8435 * raise IndexError('field index out of range') # <<<<<<<<<<<<<< | |
8436 * elif key < 0: | |
8437 * key = nfields + key | |
8438 */ | |
8439 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) | |
8440 __Pyx_GOTREF(__pyx_t_1); | |
8441 __Pyx_Raise(__pyx_t_1, 0, 0, 0); | |
8442 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8443 __PYX_ERR(0, 521, __pyx_L1_error) | |
8444 | |
8445 /* "pybedtools/cbedtools.pyx":520 | |
8446 * if isinstance(key, (int, long)): | |
8447 * nfields = self._bed.fields.size() | |
8448 * if key >= nfields: # <<<<<<<<<<<<<< | |
8449 * raise IndexError('field index out of range') | |
8450 * elif key < 0: | |
8451 */ | |
8452 } | |
8453 | |
8454 /* "pybedtools/cbedtools.pyx":522 | |
8455 * if key >= nfields: | |
8456 * raise IndexError('field index out of range') | |
8457 * elif key < 0: # <<<<<<<<<<<<<< | |
8458 * key = nfields + key | |
8459 * return _pystr(self._bed.fields.at(key)) | |
8460 */ | |
8461 __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) | |
8462 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 522, __pyx_L1_error) | |
8463 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8464 if (__pyx_t_3) { | |
8465 | |
8466 /* "pybedtools/cbedtools.pyx":523 | |
8467 * raise IndexError('field index out of range') | |
8468 * elif key < 0: | |
8469 * key = nfields + key # <<<<<<<<<<<<<< | |
8470 * return _pystr(self._bed.fields.at(key)) | |
8471 * elif isinstance(key, slice): | |
8472 */ | |
8473 __pyx_t_1 = PyNumber_Add(__pyx_v_nfields, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) | |
8474 __Pyx_GOTREF(__pyx_t_1); | |
8475 __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_1); | |
8476 __pyx_t_1 = 0; | |
8477 | |
8478 /* "pybedtools/cbedtools.pyx":522 | |
8479 * if key >= nfields: | |
8480 * raise IndexError('field index out of range') | |
8481 * elif key < 0: # <<<<<<<<<<<<<< | |
8482 * key = nfields + key | |
8483 * return _pystr(self._bed.fields.at(key)) | |
8484 */ | |
8485 } | |
8486 | |
8487 /* "pybedtools/cbedtools.pyx":524 | |
8488 * elif key < 0: | |
8489 * key = nfields + key | |
8490 * return _pystr(self._bed.fields.at(key)) # <<<<<<<<<<<<<< | |
8491 * elif isinstance(key, slice): | |
8492 * indices = key.indices(self._bed.fields.size()) | |
8493 */ | |
8494 __Pyx_XDECREF(__pyx_r); | |
8495 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_key); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L1_error) | |
8496 try { | |
8497 __pyx_t_6 = __pyx_v_self->_bed->fields.at(__pyx_t_5); | |
8498 } catch(...) { | |
8499 __Pyx_CppExn2PyErr(); | |
8500 __PYX_ERR(0, 524, __pyx_L1_error) | |
8501 } | |
8502 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error) | |
8503 __Pyx_GOTREF(__pyx_t_1); | |
8504 __pyx_r = __pyx_t_1; | |
8505 __pyx_t_1 = 0; | |
8506 goto __pyx_L0; | |
8507 | |
8508 /* "pybedtools/cbedtools.pyx":518 | |
8509 * self.deparse_attrs() | |
8510 * | |
8511 * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< | |
8512 * nfields = self._bed.fields.size() | |
8513 * if key >= nfields: | |
8514 */ | |
8515 } | |
8516 | |
8517 /* "pybedtools/cbedtools.pyx":525 | |
8518 * key = nfields + key | |
8519 * return _pystr(self._bed.fields.at(key)) | |
8520 * elif isinstance(key, slice): # <<<<<<<<<<<<<< | |
8521 * indices = key.indices(self._bed.fields.size()) | |
8522 * return [_pystr(self._bed.fields.at(i)) for i in range(*indices)] | |
8523 */ | |
8524 __pyx_t_3 = PySlice_Check(__pyx_v_key); | |
8525 __pyx_t_2 = (__pyx_t_3 != 0); | |
8526 if (__pyx_t_2) { | |
8527 | |
8528 /* "pybedtools/cbedtools.pyx":526 | |
8529 * return _pystr(self._bed.fields.at(key)) | |
8530 * elif isinstance(key, slice): | |
8531 * indices = key.indices(self._bed.fields.size()) # <<<<<<<<<<<<<< | |
8532 * return [_pystr(self._bed.fields.at(i)) for i in range(*indices)] | |
8533 * | |
8534 */ | |
8535 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_indices); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error) | |
8536 __Pyx_GOTREF(__pyx_t_7); | |
8537 __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_bed->fields.size()); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 526, __pyx_L1_error) | |
8538 __Pyx_GOTREF(__pyx_t_8); | |
8539 __pyx_t_9 = NULL; | |
8540 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { | |
8541 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); | |
8542 if (likely(__pyx_t_9)) { | |
8543 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); | |
8544 __Pyx_INCREF(__pyx_t_9); | |
8545 __Pyx_INCREF(function); | |
8546 __Pyx_DECREF_SET(__pyx_t_7, function); | |
8547 } | |
8548 } | |
8549 __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); | |
8550 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; | |
8551 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
8552 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) | |
8553 __Pyx_GOTREF(__pyx_t_1); | |
8554 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
8555 __pyx_v_indices = __pyx_t_1; | |
8556 __pyx_t_1 = 0; | |
8557 | |
8558 /* "pybedtools/cbedtools.pyx":527 | |
8559 * elif isinstance(key, slice): | |
8560 * indices = key.indices(self._bed.fields.size()) | |
8561 * return [_pystr(self._bed.fields.at(i)) for i in range(*indices)] # <<<<<<<<<<<<<< | |
8562 * | |
8563 * elif isinstance(key, str): | |
8564 */ | |
8565 __Pyx_XDECREF(__pyx_r); | |
8566 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8567 __Pyx_GOTREF(__pyx_t_1); | |
8568 __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_v_indices); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8569 __Pyx_GOTREF(__pyx_t_7); | |
8570 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8571 __Pyx_GOTREF(__pyx_t_8); | |
8572 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
8573 if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { | |
8574 __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7); __pyx_t_10 = 0; | |
8575 __pyx_t_11 = NULL; | |
8576 } else { | |
8577 __pyx_t_10 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8578 __Pyx_GOTREF(__pyx_t_7); | |
8579 __pyx_t_11 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8580 } | |
8581 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
8582 for (;;) { | |
8583 if (likely(!__pyx_t_11)) { | |
8584 if (likely(PyList_CheckExact(__pyx_t_7))) { | |
8585 if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_7)) break; | |
8586 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
8587 __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8588 #else | |
8589 __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8590 __Pyx_GOTREF(__pyx_t_8); | |
8591 #endif | |
8592 } else { | |
8593 if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_7)) break; | |
8594 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
8595 __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8596 #else | |
8597 __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8598 __Pyx_GOTREF(__pyx_t_8); | |
8599 #endif | |
8600 } | |
8601 } else { | |
8602 __pyx_t_8 = __pyx_t_11(__pyx_t_7); | |
8603 if (unlikely(!__pyx_t_8)) { | |
8604 PyObject* exc_type = PyErr_Occurred(); | |
8605 if (exc_type) { | |
8606 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); | |
8607 else __PYX_ERR(0, 527, __pyx_L1_error) | |
8608 } | |
8609 break; | |
8610 } | |
8611 __Pyx_GOTREF(__pyx_t_8); | |
8612 } | |
8613 __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 527, __pyx_L1_error) | |
8614 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
8615 __pyx_v_i = __pyx_t_12; | |
8616 try { | |
8617 __pyx_t_13 = __pyx_v_self->_bed->fields.at(__pyx_v_i); | |
8618 } catch(...) { | |
8619 __Pyx_CppExn2PyErr(); | |
8620 __PYX_ERR(0, 527, __pyx_L1_error) | |
8621 } | |
8622 __pyx_t_8 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 527, __pyx_L1_error) | |
8623 __Pyx_GOTREF(__pyx_t_8); | |
8624 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 527, __pyx_L1_error) | |
8625 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
8626 } | |
8627 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
8628 __pyx_r = __pyx_t_1; | |
8629 __pyx_t_1 = 0; | |
8630 goto __pyx_L0; | |
8631 | |
8632 /* "pybedtools/cbedtools.pyx":525 | |
8633 * key = nfields + key | |
8634 * return _pystr(self._bed.fields.at(key)) | |
8635 * elif isinstance(key, slice): # <<<<<<<<<<<<<< | |
8636 * indices = key.indices(self._bed.fields.size()) | |
8637 * return [_pystr(self._bed.fields.at(i)) for i in range(*indices)] | |
8638 */ | |
8639 } | |
8640 | |
8641 /* "pybedtools/cbedtools.pyx":529 | |
8642 * return [_pystr(self._bed.fields.at(i)) for i in range(*indices)] | |
8643 * | |
8644 * elif isinstance(key, str): # <<<<<<<<<<<<<< | |
8645 * if ftype == "gff": | |
8646 * try: | |
8647 */ | |
8648 __pyx_t_2 = PyString_Check(__pyx_v_key); | |
8649 __pyx_t_3 = (__pyx_t_2 != 0); | |
8650 if (__pyx_t_3) { | |
8651 | |
8652 /* "pybedtools/cbedtools.pyx":530 | |
8653 * | |
8654 * elif isinstance(key, str): | |
8655 * if ftype == "gff": # <<<<<<<<<<<<<< | |
8656 * try: | |
8657 * return self.attrs[key] | |
8658 */ | |
8659 __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_ftype, __pyx_n_s_gff, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 530, __pyx_L1_error) | |
8660 if (__pyx_t_3) { | |
8661 | |
8662 /* "pybedtools/cbedtools.pyx":531 | |
8663 * elif isinstance(key, str): | |
8664 * if ftype == "gff": | |
8665 * try: # <<<<<<<<<<<<<< | |
8666 * return self.attrs[key] | |
8667 * except KeyError: | |
8668 */ | |
8669 { | |
8670 __Pyx_PyThreadState_declare | |
8671 __Pyx_PyThreadState_assign | |
8672 __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); | |
8673 __Pyx_XGOTREF(__pyx_t_14); | |
8674 __Pyx_XGOTREF(__pyx_t_15); | |
8675 __Pyx_XGOTREF(__pyx_t_16); | |
8676 /*try:*/ { | |
8677 | |
8678 /* "pybedtools/cbedtools.pyx":532 | |
8679 * if ftype == "gff": | |
8680 * try: | |
8681 * return self.attrs[key] # <<<<<<<<<<<<<< | |
8682 * except KeyError: | |
8683 * pass | |
8684 */ | |
8685 __Pyx_XDECREF(__pyx_r); | |
8686 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L10_error) | |
8687 __Pyx_GOTREF(__pyx_t_1); | |
8688 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 532, __pyx_L10_error) | |
8689 __Pyx_GOTREF(__pyx_t_7); | |
8690 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8691 __pyx_r = __pyx_t_7; | |
8692 __pyx_t_7 = 0; | |
8693 goto __pyx_L14_try_return; | |
8694 | |
8695 /* "pybedtools/cbedtools.pyx":531 | |
8696 * elif isinstance(key, str): | |
8697 * if ftype == "gff": | |
8698 * try: # <<<<<<<<<<<<<< | |
8699 * return self.attrs[key] | |
8700 * except KeyError: | |
8701 */ | |
8702 } | |
8703 __pyx_L10_error:; | |
8704 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
8705 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
8706 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; | |
8707 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; | |
8708 | |
8709 /* "pybedtools/cbedtools.pyx":533 | |
8710 * try: | |
8711 * return self.attrs[key] | |
8712 * except KeyError: # <<<<<<<<<<<<<< | |
8713 * pass | |
8714 * # We don't have to convert using _pystr() because the __get__ | |
8715 */ | |
8716 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); | |
8717 if (__pyx_t_12) { | |
8718 __Pyx_ErrRestore(0,0,0); | |
8719 goto __pyx_L11_exception_handled; | |
8720 } | |
8721 goto __pyx_L12_except_error; | |
8722 __pyx_L12_except_error:; | |
8723 | |
8724 /* "pybedtools/cbedtools.pyx":531 | |
8725 * elif isinstance(key, str): | |
8726 * if ftype == "gff": | |
8727 * try: # <<<<<<<<<<<<<< | |
8728 * return self.attrs[key] | |
8729 * except KeyError: | |
8730 */ | |
8731 __Pyx_XGIVEREF(__pyx_t_14); | |
8732 __Pyx_XGIVEREF(__pyx_t_15); | |
8733 __Pyx_XGIVEREF(__pyx_t_16); | |
8734 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); | |
8735 goto __pyx_L1_error; | |
8736 __pyx_L14_try_return:; | |
8737 __Pyx_XGIVEREF(__pyx_t_14); | |
8738 __Pyx_XGIVEREF(__pyx_t_15); | |
8739 __Pyx_XGIVEREF(__pyx_t_16); | |
8740 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); | |
8741 goto __pyx_L0; | |
8742 __pyx_L11_exception_handled:; | |
8743 __Pyx_XGIVEREF(__pyx_t_14); | |
8744 __Pyx_XGIVEREF(__pyx_t_15); | |
8745 __Pyx_XGIVEREF(__pyx_t_16); | |
8746 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); | |
8747 } | |
8748 | |
8749 /* "pybedtools/cbedtools.pyx":530 | |
8750 * | |
8751 * elif isinstance(key, str): | |
8752 * if ftype == "gff": # <<<<<<<<<<<<<< | |
8753 * try: | |
8754 * return self.attrs[key] | |
8755 */ | |
8756 } | |
8757 | |
8758 /* "pybedtools/cbedtools.pyx":537 | |
8759 * # We don't have to convert using _pystr() because the __get__ | |
8760 * # methods do that already. | |
8761 * return getattr(self, key) # <<<<<<<<<<<<<< | |
8762 * | |
8763 * def __setitem__(self, object key, object value): | |
8764 */ | |
8765 __Pyx_XDECREF(__pyx_r); | |
8766 __pyx_t_7 = __Pyx_GetAttr(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) | |
8767 __Pyx_GOTREF(__pyx_t_7); | |
8768 __pyx_r = __pyx_t_7; | |
8769 __pyx_t_7 = 0; | |
8770 goto __pyx_L0; | |
8771 | |
8772 /* "pybedtools/cbedtools.pyx":529 | |
8773 * return [_pystr(self._bed.fields.at(i)) for i in range(*indices)] | |
8774 * | |
8775 * elif isinstance(key, str): # <<<<<<<<<<<<<< | |
8776 * if ftype == "gff": | |
8777 * try: | |
8778 */ | |
8779 } | |
8780 | |
8781 /* "pybedtools/cbedtools.pyx":512 | |
8782 * return self._bed.end - self._bed.start | |
8783 * | |
8784 * def __getitem__(self, object key): # <<<<<<<<<<<<<< | |
8785 * cdef int i | |
8786 * ftype = _pystr(self._bed.file_type) | |
8787 */ | |
8788 | |
8789 /* function exit code */ | |
8790 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
8791 goto __pyx_L0; | |
8792 __pyx_L1_error:; | |
8793 __Pyx_XDECREF(__pyx_t_1); | |
8794 __Pyx_XDECREF(__pyx_t_7); | |
8795 __Pyx_XDECREF(__pyx_t_8); | |
8796 __Pyx_XDECREF(__pyx_t_9); | |
8797 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
8798 __pyx_r = NULL; | |
8799 __pyx_L0:; | |
8800 __Pyx_XDECREF(__pyx_v_ftype); | |
8801 __Pyx_XDECREF(__pyx_v_nfields); | |
8802 __Pyx_XDECREF(__pyx_v_indices); | |
8803 __Pyx_XDECREF(__pyx_v_key); | |
8804 __Pyx_XGIVEREF(__pyx_r); | |
8805 __Pyx_RefNannyFinishContext(); | |
8806 return __pyx_r; | |
8807 } | |
8808 | |
8809 /* "pybedtools/cbedtools.pyx":539 | |
8810 * return getattr(self, key) | |
8811 * | |
8812 * def __setitem__(self, object key, object value): # <<<<<<<<<<<<<< | |
8813 * if isinstance(key, (int, long)): | |
8814 * nfields = self._bed.fields.size() | |
8815 */ | |
8816 | |
8817 /* Python wrapper */ | |
8818 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ | |
8819 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_21__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { | |
8820 int __pyx_r; | |
8821 __Pyx_RefNannyDeclarations | |
8822 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); | |
8823 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_20__setitem__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value)); | |
8824 | |
8825 /* function exit code */ | |
8826 __Pyx_RefNannyFinishContext(); | |
8827 return __pyx_r; | |
8828 } | |
8829 | |
8830 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_20__setitem__(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { | |
8831 PyObject *__pyx_v_nfields = NULL; | |
8832 PyObject *__pyx_v_ft = NULL; | |
8833 int __pyx_r; | |
8834 __Pyx_RefNannyDeclarations | |
8835 int __pyx_t_1; | |
8836 int __pyx_t_2; | |
8837 int __pyx_t_3; | |
8838 PyObject *__pyx_t_4 = NULL; | |
8839 std::string __pyx_t_5; | |
8840 std::vector<std::string> ::size_type __pyx_t_6; | |
8841 PyObject *__pyx_t_7 = NULL; | |
8842 int __pyx_t_8; | |
8843 int __pyx_lineno = 0; | |
8844 const char *__pyx_filename = NULL; | |
8845 int __pyx_clineno = 0; | |
8846 __Pyx_RefNannySetupContext("__setitem__", 0); | |
8847 __Pyx_INCREF(__pyx_v_key); | |
8848 | |
8849 /* "pybedtools/cbedtools.pyx":540 | |
8850 * | |
8851 * def __setitem__(self, object key, object value): | |
8852 * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< | |
8853 * nfields = self._bed.fields.size() | |
8854 * if key >= nfields: | |
8855 */ | |
8856 __pyx_t_2 = PyInt_Check(__pyx_v_key); | |
8857 __pyx_t_3 = (__pyx_t_2 != 0); | |
8858 if (!__pyx_t_3) { | |
8859 } else { | |
8860 __pyx_t_1 = __pyx_t_3; | |
8861 goto __pyx_L4_bool_binop_done; | |
8862 } | |
8863 __pyx_t_3 = PyLong_Check(__pyx_v_key); | |
8864 __pyx_t_2 = (__pyx_t_3 != 0); | |
8865 __pyx_t_1 = __pyx_t_2; | |
8866 __pyx_L4_bool_binop_done:; | |
8867 __pyx_t_2 = (__pyx_t_1 != 0); | |
8868 if (__pyx_t_2) { | |
8869 | |
8870 /* "pybedtools/cbedtools.pyx":541 | |
8871 * def __setitem__(self, object key, object value): | |
8872 * if isinstance(key, (int, long)): | |
8873 * nfields = self._bed.fields.size() # <<<<<<<<<<<<<< | |
8874 * if key >= nfields: | |
8875 * raise IndexError('field index out of range') | |
8876 */ | |
8877 __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_bed->fields.size()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 541, __pyx_L1_error) | |
8878 __Pyx_GOTREF(__pyx_t_4); | |
8879 __pyx_v_nfields = __pyx_t_4; | |
8880 __pyx_t_4 = 0; | |
8881 | |
8882 /* "pybedtools/cbedtools.pyx":542 | |
8883 * if isinstance(key, (int, long)): | |
8884 * nfields = self._bed.fields.size() | |
8885 * if key >= nfields: # <<<<<<<<<<<<<< | |
8886 * raise IndexError('field index out of range') | |
8887 * elif key < 0: | |
8888 */ | |
8889 __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, __pyx_v_nfields, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error) | |
8890 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 542, __pyx_L1_error) | |
8891 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
8892 if (unlikely(__pyx_t_2)) { | |
8893 | |
8894 /* "pybedtools/cbedtools.pyx":543 | |
8895 * nfields = self._bed.fields.size() | |
8896 * if key >= nfields: | |
8897 * raise IndexError('field index out of range') # <<<<<<<<<<<<<< | |
8898 * elif key < 0: | |
8899 * key = nfields + key | |
8900 */ | |
8901 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) | |
8902 __Pyx_GOTREF(__pyx_t_4); | |
8903 __Pyx_Raise(__pyx_t_4, 0, 0, 0); | |
8904 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
8905 __PYX_ERR(0, 543, __pyx_L1_error) | |
8906 | |
8907 /* "pybedtools/cbedtools.pyx":542 | |
8908 * if isinstance(key, (int, long)): | |
8909 * nfields = self._bed.fields.size() | |
8910 * if key >= nfields: # <<<<<<<<<<<<<< | |
8911 * raise IndexError('field index out of range') | |
8912 * elif key < 0: | |
8913 */ | |
8914 } | |
8915 | |
8916 /* "pybedtools/cbedtools.pyx":544 | |
8917 * if key >= nfields: | |
8918 * raise IndexError('field index out of range') | |
8919 * elif key < 0: # <<<<<<<<<<<<<< | |
8920 * key = nfields + key | |
8921 * self._bed.fields[key] = _cppstr(value) | |
8922 */ | |
8923 __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) | |
8924 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) | |
8925 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
8926 if (__pyx_t_2) { | |
8927 | |
8928 /* "pybedtools/cbedtools.pyx":545 | |
8929 * raise IndexError('field index out of range') | |
8930 * elif key < 0: | |
8931 * key = nfields + key # <<<<<<<<<<<<<< | |
8932 * self._bed.fields[key] = _cppstr(value) | |
8933 * | |
8934 */ | |
8935 __pyx_t_4 = PyNumber_Add(__pyx_v_nfields, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) | |
8936 __Pyx_GOTREF(__pyx_t_4); | |
8937 __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); | |
8938 __pyx_t_4 = 0; | |
8939 | |
8940 /* "pybedtools/cbedtools.pyx":544 | |
8941 * if key >= nfields: | |
8942 * raise IndexError('field index out of range') | |
8943 * elif key < 0: # <<<<<<<<<<<<<< | |
8944 * key = nfields + key | |
8945 * self._bed.fields[key] = _cppstr(value) | |
8946 */ | |
8947 } | |
8948 | |
8949 /* "pybedtools/cbedtools.pyx":546 | |
8950 * elif key < 0: | |
8951 * key = nfields + key | |
8952 * self._bed.fields[key] = _cppstr(value) # <<<<<<<<<<<<<< | |
8953 * | |
8954 * ft = _pystr(self._bed.file_type) | |
8955 */ | |
8956 __pyx_t_4 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error) | |
8957 __Pyx_GOTREF(__pyx_t_4); | |
8958 __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L1_error) | |
8959 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
8960 __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_key); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L1_error) | |
8961 (__pyx_v_self->_bed->fields[__pyx_t_6]) = __pyx_t_5; | |
8962 | |
8963 /* "pybedtools/cbedtools.pyx":548 | |
8964 * self._bed.fields[key] = _cppstr(value) | |
8965 * | |
8966 * ft = _pystr(self._bed.file_type) # <<<<<<<<<<<<<< | |
8967 * if key in LOOKUPS[ft]: | |
8968 * setattr(self, LOOKUPS[ft][key], value) | |
8969 */ | |
8970 __pyx_t_4 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_bed->file_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error) | |
8971 __Pyx_GOTREF(__pyx_t_4); | |
8972 __pyx_v_ft = __pyx_t_4; | |
8973 __pyx_t_4 = 0; | |
8974 | |
8975 /* "pybedtools/cbedtools.pyx":549 | |
8976 * | |
8977 * ft = _pystr(self._bed.file_type) | |
8978 * if key in LOOKUPS[ft]: # <<<<<<<<<<<<<< | |
8979 * setattr(self, LOOKUPS[ft][key], value) | |
8980 * | |
8981 */ | |
8982 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
8983 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
8984 __PYX_ERR(0, 549, __pyx_L1_error) | |
8985 } | |
8986 __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_v_ft); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) | |
8987 __Pyx_GOTREF(__pyx_t_4); | |
8988 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 549, __pyx_L1_error) | |
8989 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
8990 __pyx_t_1 = (__pyx_t_2 != 0); | |
8991 if (__pyx_t_1) { | |
8992 | |
8993 /* "pybedtools/cbedtools.pyx":550 | |
8994 * ft = _pystr(self._bed.file_type) | |
8995 * if key in LOOKUPS[ft]: | |
8996 * setattr(self, LOOKUPS[ft][key], value) # <<<<<<<<<<<<<< | |
8997 * | |
8998 * elif isinstance(key, (basestring)): | |
8999 */ | |
9000 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
9001 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9002 __PYX_ERR(0, 550, __pyx_L1_error) | |
9003 } | |
9004 __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, __pyx_v_ft); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 550, __pyx_L1_error) | |
9005 __Pyx_GOTREF(__pyx_t_4); | |
9006 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 550, __pyx_L1_error) | |
9007 __Pyx_GOTREF(__pyx_t_7); | |
9008 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
9009 __pyx_t_8 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_t_7, __pyx_v_value); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 550, __pyx_L1_error) | |
9010 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
9011 | |
9012 /* "pybedtools/cbedtools.pyx":549 | |
9013 * | |
9014 * ft = _pystr(self._bed.file_type) | |
9015 * if key in LOOKUPS[ft]: # <<<<<<<<<<<<<< | |
9016 * setattr(self, LOOKUPS[ft][key], value) | |
9017 * | |
9018 */ | |
9019 } | |
9020 | |
9021 /* "pybedtools/cbedtools.pyx":540 | |
9022 * | |
9023 * def __setitem__(self, object key, object value): | |
9024 * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< | |
9025 * nfields = self._bed.fields.size() | |
9026 * if key >= nfields: | |
9027 */ | |
9028 goto __pyx_L3; | |
9029 } | |
9030 | |
9031 /* "pybedtools/cbedtools.pyx":552 | |
9032 * setattr(self, LOOKUPS[ft][key], value) | |
9033 * | |
9034 * elif isinstance(key, (basestring)): # <<<<<<<<<<<<<< | |
9035 * setattr(self, key, value) | |
9036 * | |
9037 */ | |
9038 __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_key); | |
9039 __pyx_t_2 = (__pyx_t_1 != 0); | |
9040 if (__pyx_t_2) { | |
9041 | |
9042 /* "pybedtools/cbedtools.pyx":553 | |
9043 * | |
9044 * elif isinstance(key, (basestring)): | |
9045 * setattr(self, key, value) # <<<<<<<<<<<<<< | |
9046 * | |
9047 * cpdef append(self, object value): | |
9048 */ | |
9049 __pyx_t_8 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 553, __pyx_L1_error) | |
9050 | |
9051 /* "pybedtools/cbedtools.pyx":552 | |
9052 * setattr(self, LOOKUPS[ft][key], value) | |
9053 * | |
9054 * elif isinstance(key, (basestring)): # <<<<<<<<<<<<<< | |
9055 * setattr(self, key, value) | |
9056 * | |
9057 */ | |
9058 } | |
9059 __pyx_L3:; | |
9060 | |
9061 /* "pybedtools/cbedtools.pyx":539 | |
9062 * return getattr(self, key) | |
9063 * | |
9064 * def __setitem__(self, object key, object value): # <<<<<<<<<<<<<< | |
9065 * if isinstance(key, (int, long)): | |
9066 * nfields = self._bed.fields.size() | |
9067 */ | |
9068 | |
9069 /* function exit code */ | |
9070 __pyx_r = 0; | |
9071 goto __pyx_L0; | |
9072 __pyx_L1_error:; | |
9073 __Pyx_XDECREF(__pyx_t_4); | |
9074 __Pyx_XDECREF(__pyx_t_7); | |
9075 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9076 __pyx_r = -1; | |
9077 __pyx_L0:; | |
9078 __Pyx_XDECREF(__pyx_v_nfields); | |
9079 __Pyx_XDECREF(__pyx_v_ft); | |
9080 __Pyx_XDECREF(__pyx_v_key); | |
9081 __Pyx_RefNannyFinishContext(); | |
9082 return __pyx_r; | |
9083 } | |
9084 | |
9085 /* "pybedtools/cbedtools.pyx":555 | |
9086 * setattr(self, key, value) | |
9087 * | |
9088 * cpdef append(self, object value): # <<<<<<<<<<<<<< | |
9089 * self._bed.fields.push_back(_cppstr(value)) | |
9090 * | |
9091 */ | |
9092 | |
9093 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_23append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ | |
9094 static PyObject *__pyx_f_10pybedtools_9cbedtools_8Interval_append(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch) { | |
9095 PyObject *__pyx_r = NULL; | |
9096 __Pyx_RefNannyDeclarations | |
9097 PyObject *__pyx_t_1 = NULL; | |
9098 PyObject *__pyx_t_2 = NULL; | |
9099 PyObject *__pyx_t_3 = NULL; | |
9100 PyObject *__pyx_t_4 = NULL; | |
9101 std::string __pyx_t_5; | |
9102 int __pyx_lineno = 0; | |
9103 const char *__pyx_filename = NULL; | |
9104 int __pyx_clineno = 0; | |
9105 __Pyx_RefNannySetupContext("append", 0); | |
9106 /* Check if called by wrapper */ | |
9107 if (unlikely(__pyx_skip_dispatch)) ; | |
9108 /* Check if overridden in Python */ | |
9109 else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { | |
9110 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
9111 static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; | |
9112 if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { | |
9113 PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); | |
9114 #endif | |
9115 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) | |
9116 __Pyx_GOTREF(__pyx_t_1); | |
9117 if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_10pybedtools_9cbedtools_8Interval_23append)) { | |
9118 __Pyx_XDECREF(__pyx_r); | |
9119 __Pyx_INCREF(__pyx_t_1); | |
9120 __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; | |
9121 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { | |
9122 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); | |
9123 if (likely(__pyx_t_4)) { | |
9124 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); | |
9125 __Pyx_INCREF(__pyx_t_4); | |
9126 __Pyx_INCREF(function); | |
9127 __Pyx_DECREF_SET(__pyx_t_3, function); | |
9128 } | |
9129 } | |
9130 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_value); | |
9131 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
9132 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error) | |
9133 __Pyx_GOTREF(__pyx_t_2); | |
9134 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
9135 __pyx_r = __pyx_t_2; | |
9136 __pyx_t_2 = 0; | |
9137 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9138 goto __pyx_L0; | |
9139 } | |
9140 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
9141 __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); | |
9142 __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); | |
9143 if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { | |
9144 __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; | |
9145 } | |
9146 #endif | |
9147 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9148 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS | |
9149 } | |
9150 #endif | |
9151 } | |
9152 | |
9153 /* "pybedtools/cbedtools.pyx":556 | |
9154 * | |
9155 * cpdef append(self, object value): | |
9156 * self._bed.fields.push_back(_cppstr(value)) # <<<<<<<<<<<<<< | |
9157 * | |
9158 * def __nonzero__(self): | |
9159 */ | |
9160 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) | |
9161 __Pyx_GOTREF(__pyx_t_1); | |
9162 __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 556, __pyx_L1_error) | |
9163 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9164 try { | |
9165 __pyx_v_self->_bed->fields.push_back(__pyx_t_5); | |
9166 } catch(...) { | |
9167 __Pyx_CppExn2PyErr(); | |
9168 __PYX_ERR(0, 556, __pyx_L1_error) | |
9169 } | |
9170 | |
9171 /* "pybedtools/cbedtools.pyx":555 | |
9172 * setattr(self, key, value) | |
9173 * | |
9174 * cpdef append(self, object value): # <<<<<<<<<<<<<< | |
9175 * self._bed.fields.push_back(_cppstr(value)) | |
9176 * | |
9177 */ | |
9178 | |
9179 /* function exit code */ | |
9180 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
9181 goto __pyx_L0; | |
9182 __pyx_L1_error:; | |
9183 __Pyx_XDECREF(__pyx_t_1); | |
9184 __Pyx_XDECREF(__pyx_t_2); | |
9185 __Pyx_XDECREF(__pyx_t_3); | |
9186 __Pyx_XDECREF(__pyx_t_4); | |
9187 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.append", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9188 __pyx_r = 0; | |
9189 __pyx_L0:; | |
9190 __Pyx_XGIVEREF(__pyx_r); | |
9191 __Pyx_RefNannyFinishContext(); | |
9192 return __pyx_r; | |
9193 } | |
9194 | |
9195 /* Python wrapper */ | |
9196 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_23append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ | |
9197 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_23append(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { | |
9198 PyObject *__pyx_r = 0; | |
9199 __Pyx_RefNannyDeclarations | |
9200 __Pyx_RefNannySetupContext("append (wrapper)", 0); | |
9201 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_22append(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value)); | |
9202 | |
9203 /* function exit code */ | |
9204 __Pyx_RefNannyFinishContext(); | |
9205 return __pyx_r; | |
9206 } | |
9207 | |
9208 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_22append(struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, PyObject *__pyx_v_value) { | |
9209 PyObject *__pyx_r = NULL; | |
9210 __Pyx_RefNannyDeclarations | |
9211 PyObject *__pyx_t_1 = NULL; | |
9212 int __pyx_lineno = 0; | |
9213 const char *__pyx_filename = NULL; | |
9214 int __pyx_clineno = 0; | |
9215 __Pyx_RefNannySetupContext("append", 0); | |
9216 __Pyx_XDECREF(__pyx_r); | |
9217 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_8Interval_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) | |
9218 __Pyx_GOTREF(__pyx_t_1); | |
9219 __pyx_r = __pyx_t_1; | |
9220 __pyx_t_1 = 0; | |
9221 goto __pyx_L0; | |
9222 | |
9223 /* function exit code */ | |
9224 __pyx_L1_error:; | |
9225 __Pyx_XDECREF(__pyx_t_1); | |
9226 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.append", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9227 __pyx_r = NULL; | |
9228 __pyx_L0:; | |
9229 __Pyx_XGIVEREF(__pyx_r); | |
9230 __Pyx_RefNannyFinishContext(); | |
9231 return __pyx_r; | |
9232 } | |
9233 | |
9234 /* "pybedtools/cbedtools.pyx":558 | |
9235 * self._bed.fields.push_back(_cppstr(value)) | |
9236 * | |
9237 * def __nonzero__(self): # <<<<<<<<<<<<<< | |
9238 * return True | |
9239 * | |
9240 */ | |
9241 | |
9242 /* Python wrapper */ | |
9243 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_25__nonzero__(PyObject *__pyx_v_self); /*proto*/ | |
9244 static int __pyx_pw_10pybedtools_9cbedtools_8Interval_25__nonzero__(PyObject *__pyx_v_self) { | |
9245 int __pyx_r; | |
9246 __Pyx_RefNannyDeclarations | |
9247 __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0); | |
9248 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_24__nonzero__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
9249 | |
9250 /* function exit code */ | |
9251 __Pyx_RefNannyFinishContext(); | |
9252 return __pyx_r; | |
9253 } | |
9254 | |
9255 static int __pyx_pf_10pybedtools_9cbedtools_8Interval_24__nonzero__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
9256 int __pyx_r; | |
9257 __Pyx_RefNannyDeclarations | |
9258 __Pyx_RefNannySetupContext("__nonzero__", 0); | |
9259 | |
9260 /* "pybedtools/cbedtools.pyx":559 | |
9261 * | |
9262 * def __nonzero__(self): | |
9263 * return True # <<<<<<<<<<<<<< | |
9264 * | |
9265 * | |
9266 */ | |
9267 __pyx_r = 1; | |
9268 goto __pyx_L0; | |
9269 | |
9270 /* "pybedtools/cbedtools.pyx":558 | |
9271 * self._bed.fields.push_back(_cppstr(value)) | |
9272 * | |
9273 * def __nonzero__(self): # <<<<<<<<<<<<<< | |
9274 * return True | |
9275 * | |
9276 */ | |
9277 | |
9278 /* function exit code */ | |
9279 __pyx_L0:; | |
9280 __Pyx_RefNannyFinishContext(); | |
9281 return __pyx_r; | |
9282 } | |
9283 | |
9284 /* "(tree fragment)":1 | |
9285 * def __reduce_cython__(self): # <<<<<<<<<<<<<< | |
9286 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9287 * def __setstate_cython__(self, __pyx_state): | |
9288 */ | |
9289 | |
9290 /* Python wrapper */ | |
9291 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
9292 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
9293 PyObject *__pyx_r = 0; | |
9294 __Pyx_RefNannyDeclarations | |
9295 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); | |
9296 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_26__reduce_cython__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self)); | |
9297 | |
9298 /* function exit code */ | |
9299 __Pyx_RefNannyFinishContext(); | |
9300 return __pyx_r; | |
9301 } | |
9302 | |
9303 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self) { | |
9304 PyObject *__pyx_r = NULL; | |
9305 __Pyx_RefNannyDeclarations | |
9306 PyObject *__pyx_t_1 = NULL; | |
9307 int __pyx_lineno = 0; | |
9308 const char *__pyx_filename = NULL; | |
9309 int __pyx_clineno = 0; | |
9310 __Pyx_RefNannySetupContext("__reduce_cython__", 0); | |
9311 | |
9312 /* "(tree fragment)":2 | |
9313 * def __reduce_cython__(self): | |
9314 * raise TypeError("self._bed cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
9315 * def __setstate_cython__(self, __pyx_state): | |
9316 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9317 */ | |
9318 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) | |
9319 __Pyx_GOTREF(__pyx_t_1); | |
9320 __Pyx_Raise(__pyx_t_1, 0, 0, 0); | |
9321 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9322 __PYX_ERR(1, 2, __pyx_L1_error) | |
9323 | |
9324 /* "(tree fragment)":1 | |
9325 * def __reduce_cython__(self): # <<<<<<<<<<<<<< | |
9326 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9327 * def __setstate_cython__(self, __pyx_state): | |
9328 */ | |
9329 | |
9330 /* function exit code */ | |
9331 __pyx_L1_error:; | |
9332 __Pyx_XDECREF(__pyx_t_1); | |
9333 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9334 __pyx_r = NULL; | |
9335 __Pyx_XGIVEREF(__pyx_r); | |
9336 __Pyx_RefNannyFinishContext(); | |
9337 return __pyx_r; | |
9338 } | |
9339 | |
9340 /* "(tree fragment)":3 | |
9341 * def __reduce_cython__(self): | |
9342 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9343 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< | |
9344 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9345 */ | |
9346 | |
9347 /* Python wrapper */ | |
9348 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ | |
9349 static PyObject *__pyx_pw_10pybedtools_9cbedtools_8Interval_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { | |
9350 PyObject *__pyx_r = 0; | |
9351 __Pyx_RefNannyDeclarations | |
9352 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); | |
9353 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_8Interval_28__setstate_cython__(((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); | |
9354 | |
9355 /* function exit code */ | |
9356 __Pyx_RefNannyFinishContext(); | |
9357 return __pyx_r; | |
9358 } | |
9359 | |
9360 static PyObject *__pyx_pf_10pybedtools_9cbedtools_8Interval_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { | |
9361 PyObject *__pyx_r = NULL; | |
9362 __Pyx_RefNannyDeclarations | |
9363 PyObject *__pyx_t_1 = NULL; | |
9364 int __pyx_lineno = 0; | |
9365 const char *__pyx_filename = NULL; | |
9366 int __pyx_clineno = 0; | |
9367 __Pyx_RefNannySetupContext("__setstate_cython__", 0); | |
9368 | |
9369 /* "(tree fragment)":4 | |
9370 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9371 * def __setstate_cython__(self, __pyx_state): | |
9372 * raise TypeError("self._bed cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
9373 */ | |
9374 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) | |
9375 __Pyx_GOTREF(__pyx_t_1); | |
9376 __Pyx_Raise(__pyx_t_1, 0, 0, 0); | |
9377 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9378 __PYX_ERR(1, 4, __pyx_L1_error) | |
9379 | |
9380 /* "(tree fragment)":3 | |
9381 * def __reduce_cython__(self): | |
9382 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9383 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< | |
9384 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
9385 */ | |
9386 | |
9387 /* function exit code */ | |
9388 __pyx_L1_error:; | |
9389 __Pyx_XDECREF(__pyx_t_1); | |
9390 __Pyx_AddTraceback("pybedtools.cbedtools.Interval.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9391 __pyx_r = NULL; | |
9392 __Pyx_XGIVEREF(__pyx_r); | |
9393 __Pyx_RefNannyFinishContext(); | |
9394 return __pyx_r; | |
9395 } | |
9396 | |
9397 /* "pybedtools/cbedtools.pyx":562 | |
9398 * | |
9399 * | |
9400 * cdef Interval create_interval(BED b): # <<<<<<<<<<<<<< | |
9401 * cdef Interval pyb = Interval.__new__(Interval) | |
9402 * pyb._bed = new BED(b.chrom, b.start, b.end, b.name, | |
9403 */ | |
9404 | |
9405 static struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_f_10pybedtools_9cbedtools_create_interval(BED __pyx_v_b) { | |
9406 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_pyb = 0; | |
9407 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_r = NULL; | |
9408 __Pyx_RefNannyDeclarations | |
9409 PyObject *__pyx_t_1 = NULL; | |
9410 std::vector<std::string> __pyx_t_2; | |
9411 int __pyx_lineno = 0; | |
9412 const char *__pyx_filename = NULL; | |
9413 int __pyx_clineno = 0; | |
9414 __Pyx_RefNannySetupContext("create_interval", 0); | |
9415 | |
9416 /* "pybedtools/cbedtools.pyx":563 | |
9417 * | |
9418 * cdef Interval create_interval(BED b): | |
9419 * cdef Interval pyb = Interval.__new__(Interval) # <<<<<<<<<<<<<< | |
9420 * pyb._bed = new BED(b.chrom, b.start, b.end, b.name, | |
9421 * b.score, b.strand, b.fields, | |
9422 */ | |
9423 __pyx_t_1 = ((PyObject *)__pyx_tp_new_10pybedtools_9cbedtools_Interval(((PyTypeObject *)__pyx_ptype_10pybedtools_9cbedtools_Interval), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) | |
9424 __Pyx_GOTREF(((PyObject *)__pyx_t_1)); | |
9425 __pyx_v_pyb = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_t_1); | |
9426 __pyx_t_1 = 0; | |
9427 | |
9428 /* "pybedtools/cbedtools.pyx":564 | |
9429 * cdef Interval create_interval(BED b): | |
9430 * cdef Interval pyb = Interval.__new__(Interval) | |
9431 * pyb._bed = new BED(b.chrom, b.start, b.end, b.name, # <<<<<<<<<<<<<< | |
9432 * b.score, b.strand, b.fields, | |
9433 * b.o_start, b.o_end, b.bedType, b.file_type, b.status) | |
9434 */ | |
9435 __pyx_v_pyb->_bed = new BED(__pyx_v_b.chrom, __pyx_v_b.start, __pyx_v_b.end, __pyx_v_b.name, __pyx_v_b.score, __pyx_v_b.strand, __pyx_v_b.fields, __pyx_v_b.o_start, __pyx_v_b.o_end, __pyx_v_b.bedType, __pyx_v_b.file_type, __pyx_v_b.status); | |
9436 | |
9437 /* "pybedtools/cbedtools.pyx":567 | |
9438 * b.score, b.strand, b.fields, | |
9439 * b.o_start, b.o_end, b.bedType, b.file_type, b.status) | |
9440 * pyb._bed.fields = b.fields # <<<<<<<<<<<<<< | |
9441 * return pyb | |
9442 * | |
9443 */ | |
9444 __pyx_t_2 = __pyx_v_b.fields; | |
9445 __pyx_v_pyb->_bed->fields = __pyx_t_2; | |
9446 | |
9447 /* "pybedtools/cbedtools.pyx":568 | |
9448 * b.o_start, b.o_end, b.bedType, b.file_type, b.status) | |
9449 * pyb._bed.fields = b.fields | |
9450 * return pyb # <<<<<<<<<<<<<< | |
9451 * | |
9452 * # TODO: optimization: Previously we had (fields[1] + fields[2]).isdigit() when | |
9453 */ | |
9454 __Pyx_XDECREF(((PyObject *)__pyx_r)); | |
9455 __Pyx_INCREF(((PyObject *)__pyx_v_pyb)); | |
9456 __pyx_r = __pyx_v_pyb; | |
9457 goto __pyx_L0; | |
9458 | |
9459 /* "pybedtools/cbedtools.pyx":562 | |
9460 * | |
9461 * | |
9462 * cdef Interval create_interval(BED b): # <<<<<<<<<<<<<< | |
9463 * cdef Interval pyb = Interval.__new__(Interval) | |
9464 * pyb._bed = new BED(b.chrom, b.start, b.end, b.name, | |
9465 */ | |
9466 | |
9467 /* function exit code */ | |
9468 __pyx_L1_error:; | |
9469 __Pyx_XDECREF(__pyx_t_1); | |
9470 __Pyx_AddTraceback("pybedtools.cbedtools.create_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9471 __pyx_r = 0; | |
9472 __pyx_L0:; | |
9473 __Pyx_XDECREF((PyObject *)__pyx_v_pyb); | |
9474 __Pyx_XGIVEREF((PyObject *)__pyx_r); | |
9475 __Pyx_RefNannyFinishContext(); | |
9476 return __pyx_r; | |
9477 } | |
9478 | |
9479 /* "pybedtools/cbedtools.pyx":573 | |
9480 * # checking in create_interval_from_list for filetype heuruistics. Is there | |
9481 * # a performance hit by checking instances? | |
9482 * cdef isdigit(s): # <<<<<<<<<<<<<< | |
9483 * if isinstance(s, integer_types): | |
9484 * return True | |
9485 */ | |
9486 | |
9487 static PyObject *__pyx_f_10pybedtools_9cbedtools_isdigit(PyObject *__pyx_v_s) { | |
9488 PyObject *__pyx_r = NULL; | |
9489 __Pyx_RefNannyDeclarations | |
9490 PyObject *__pyx_t_1 = NULL; | |
9491 int __pyx_t_2; | |
9492 int __pyx_t_3; | |
9493 PyObject *__pyx_t_4 = NULL; | |
9494 PyObject *__pyx_t_5 = NULL; | |
9495 int __pyx_lineno = 0; | |
9496 const char *__pyx_filename = NULL; | |
9497 int __pyx_clineno = 0; | |
9498 __Pyx_RefNannySetupContext("isdigit", 0); | |
9499 | |
9500 /* "pybedtools/cbedtools.pyx":574 | |
9501 * # a performance hit by checking instances? | |
9502 * cdef isdigit(s): | |
9503 * if isinstance(s, integer_types): # <<<<<<<<<<<<<< | |
9504 * return True | |
9505 * return s.isdigit() | |
9506 */ | |
9507 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_integer_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error) | |
9508 __Pyx_GOTREF(__pyx_t_1); | |
9509 __pyx_t_2 = PyObject_IsInstance(__pyx_v_s, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 574, __pyx_L1_error) | |
9510 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9511 __pyx_t_3 = (__pyx_t_2 != 0); | |
9512 if (__pyx_t_3) { | |
9513 | |
9514 /* "pybedtools/cbedtools.pyx":575 | |
9515 * cdef isdigit(s): | |
9516 * if isinstance(s, integer_types): | |
9517 * return True # <<<<<<<<<<<<<< | |
9518 * return s.isdigit() | |
9519 * | |
9520 */ | |
9521 __Pyx_XDECREF(__pyx_r); | |
9522 __Pyx_INCREF(Py_True); | |
9523 __pyx_r = Py_True; | |
9524 goto __pyx_L0; | |
9525 | |
9526 /* "pybedtools/cbedtools.pyx":574 | |
9527 * # a performance hit by checking instances? | |
9528 * cdef isdigit(s): | |
9529 * if isinstance(s, integer_types): # <<<<<<<<<<<<<< | |
9530 * return True | |
9531 * return s.isdigit() | |
9532 */ | |
9533 } | |
9534 | |
9535 /* "pybedtools/cbedtools.pyx":576 | |
9536 * if isinstance(s, integer_types): | |
9537 * return True | |
9538 * return s.isdigit() # <<<<<<<<<<<<<< | |
9539 * | |
9540 * | |
9541 */ | |
9542 __Pyx_XDECREF(__pyx_r); | |
9543 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_isdigit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) | |
9544 __Pyx_GOTREF(__pyx_t_4); | |
9545 __pyx_t_5 = NULL; | |
9546 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { | |
9547 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); | |
9548 if (likely(__pyx_t_5)) { | |
9549 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); | |
9550 __Pyx_INCREF(__pyx_t_5); | |
9551 __Pyx_INCREF(function); | |
9552 __Pyx_DECREF_SET(__pyx_t_4, function); | |
9553 } | |
9554 } | |
9555 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); | |
9556 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9557 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) | |
9558 __Pyx_GOTREF(__pyx_t_1); | |
9559 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
9560 __pyx_r = __pyx_t_1; | |
9561 __pyx_t_1 = 0; | |
9562 goto __pyx_L0; | |
9563 | |
9564 /* "pybedtools/cbedtools.pyx":573 | |
9565 * # checking in create_interval_from_list for filetype heuruistics. Is there | |
9566 * # a performance hit by checking instances? | |
9567 * cdef isdigit(s): # <<<<<<<<<<<<<< | |
9568 * if isinstance(s, integer_types): | |
9569 * return True | |
9570 */ | |
9571 | |
9572 /* function exit code */ | |
9573 __pyx_L1_error:; | |
9574 __Pyx_XDECREF(__pyx_t_1); | |
9575 __Pyx_XDECREF(__pyx_t_4); | |
9576 __Pyx_XDECREF(__pyx_t_5); | |
9577 __Pyx_AddTraceback("pybedtools.cbedtools.isdigit", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
9578 __pyx_r = 0; | |
9579 __pyx_L0:; | |
9580 __Pyx_XGIVEREF(__pyx_r); | |
9581 __Pyx_RefNannyFinishContext(); | |
9582 return __pyx_r; | |
9583 } | |
9584 | |
9585 /* "pybedtools/cbedtools.pyx":579 | |
9586 * | |
9587 * | |
9588 * cpdef Interval create_interval_from_list(list fields): # <<<<<<<<<<<<<< | |
9589 * """ | |
9590 * Create an Interval object from a list of strings. | |
9591 */ | |
9592 | |
9593 static PyObject *__pyx_pw_10pybedtools_9cbedtools_1create_interval_from_list(PyObject *__pyx_self, PyObject *__pyx_v_fields); /*proto*/ | |
9594 static struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_f_10pybedtools_9cbedtools_create_interval_from_list(PyObject *__pyx_v_fields, CYTHON_UNUSED int __pyx_skip_dispatch) { | |
9595 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_pyb = 0; | |
9596 PyObject *__pyx_v_orig_fields = NULL; | |
9597 PyObject *__pyx_v_chrom = NULL; | |
9598 PyObject *__pyx_v_start = NULL; | |
9599 PyObject *__pyx_v_stop = NULL; | |
9600 PyObject *__pyx_v_name = NULL; | |
9601 PyObject *__pyx_v_score = NULL; | |
9602 PyObject *__pyx_v_strand = NULL; | |
9603 PyObject *__pyx_v_other_fields = NULL; | |
9604 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_r = NULL; | |
9605 __Pyx_RefNannyDeclarations | |
9606 PyObject *__pyx_t_1 = NULL; | |
9607 int __pyx_t_2; | |
9608 Py_ssize_t __pyx_t_3; | |
9609 int __pyx_t_4; | |
9610 PyObject *__pyx_t_5 = NULL; | |
9611 int __pyx_t_6; | |
9612 PyObject *__pyx_t_7 = NULL; | |
9613 std::string __pyx_t_8; | |
9614 CHRPOS __pyx_t_9; | |
9615 CHRPOS __pyx_t_10; | |
9616 std::string __pyx_t_11; | |
9617 std::string __pyx_t_12; | |
9618 std::string __pyx_t_13; | |
9619 int __pyx_t_14; | |
9620 PyObject *__pyx_t_15 = NULL; | |
9621 int __pyx_lineno = 0; | |
9622 const char *__pyx_filename = NULL; | |
9623 int __pyx_clineno = 0; | |
9624 __Pyx_RefNannySetupContext("create_interval_from_list", 0); | |
9625 | |
9626 /* "pybedtools/cbedtools.pyx":608 | |
9627 * # have an optimized version that is directly provided the filetype. | |
9628 * | |
9629 * cdef Interval pyb = Interval.__new__(Interval) # <<<<<<<<<<<<<< | |
9630 * orig_fields = fields[:] | |
9631 * # BED -- though a VCF will be detected as BED if its 2nd field, id, is a | |
9632 */ | |
9633 __pyx_t_1 = ((PyObject *)__pyx_tp_new_10pybedtools_9cbedtools_Interval(((PyTypeObject *)__pyx_ptype_10pybedtools_9cbedtools_Interval), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error) | |
9634 __Pyx_GOTREF(((PyObject *)__pyx_t_1)); | |
9635 __pyx_v_pyb = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_t_1); | |
9636 __pyx_t_1 = 0; | |
9637 | |
9638 /* "pybedtools/cbedtools.pyx":609 | |
9639 * | |
9640 * cdef Interval pyb = Interval.__new__(Interval) | |
9641 * orig_fields = fields[:] # <<<<<<<<<<<<<< | |
9642 * # BED -- though a VCF will be detected as BED if its 2nd field, id, is a | |
9643 * # digit | |
9644 */ | |
9645 if (unlikely(__pyx_v_fields == Py_None)) { | |
9646 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9647 __PYX_ERR(0, 609, __pyx_L1_error) | |
9648 } | |
9649 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_fields, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) | |
9650 __Pyx_GOTREF(__pyx_t_1); | |
9651 __pyx_v_orig_fields = ((PyObject*)__pyx_t_1); | |
9652 __pyx_t_1 = 0; | |
9653 | |
9654 /* "pybedtools/cbedtools.pyx":615 | |
9655 * # SAM | |
9656 * if ( | |
9657 * (len(fields) >= 11) # <<<<<<<<<<<<<< | |
9658 * and isdigit(fields[1]) | |
9659 * and isdigit(fields[3]) | |
9660 */ | |
9661 if (unlikely(__pyx_v_fields == Py_None)) { | |
9662 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
9663 __PYX_ERR(0, 615, __pyx_L1_error) | |
9664 } | |
9665 __pyx_t_3 = PyList_GET_SIZE(__pyx_v_fields); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 615, __pyx_L1_error) | |
9666 __pyx_t_4 = ((__pyx_t_3 >= 11) != 0); | |
9667 if (__pyx_t_4) { | |
9668 } else { | |
9669 __pyx_t_2 = __pyx_t_4; | |
9670 goto __pyx_L4_bool_binop_done; | |
9671 } | |
9672 | |
9673 /* "pybedtools/cbedtools.pyx":616 | |
9674 * if ( | |
9675 * (len(fields) >= 11) | |
9676 * and isdigit(fields[1]) # <<<<<<<<<<<<<< | |
9677 * and isdigit(fields[3]) | |
9678 * and isdigit(fields[4]) | |
9679 */ | |
9680 if (unlikely(__pyx_v_fields == Py_None)) { | |
9681 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9682 __PYX_ERR(0, 616, __pyx_L1_error) | |
9683 } | |
9684 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error) | |
9685 __Pyx_GOTREF(__pyx_t_1); | |
9686 __pyx_t_5 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) | |
9687 __Pyx_GOTREF(__pyx_t_5); | |
9688 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9689 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 616, __pyx_L1_error) | |
9690 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9691 if (__pyx_t_4) { | |
9692 } else { | |
9693 __pyx_t_2 = __pyx_t_4; | |
9694 goto __pyx_L4_bool_binop_done; | |
9695 } | |
9696 | |
9697 /* "pybedtools/cbedtools.pyx":617 | |
9698 * (len(fields) >= 11) | |
9699 * and isdigit(fields[1]) | |
9700 * and isdigit(fields[3]) # <<<<<<<<<<<<<< | |
9701 * and isdigit(fields[4]) | |
9702 * and (fields[5] not in ['.', '+', '-']) | |
9703 */ | |
9704 if (unlikely(__pyx_v_fields == Py_None)) { | |
9705 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9706 __PYX_ERR(0, 617, __pyx_L1_error) | |
9707 } | |
9708 __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) | |
9709 __Pyx_GOTREF(__pyx_t_5); | |
9710 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) | |
9711 __Pyx_GOTREF(__pyx_t_1); | |
9712 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9713 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 617, __pyx_L1_error) | |
9714 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9715 if (__pyx_t_4) { | |
9716 } else { | |
9717 __pyx_t_2 = __pyx_t_4; | |
9718 goto __pyx_L4_bool_binop_done; | |
9719 } | |
9720 | |
9721 /* "pybedtools/cbedtools.pyx":618 | |
9722 * and isdigit(fields[1]) | |
9723 * and isdigit(fields[3]) | |
9724 * and isdigit(fields[4]) # <<<<<<<<<<<<<< | |
9725 * and (fields[5] not in ['.', '+', '-']) | |
9726 * ): | |
9727 */ | |
9728 if (unlikely(__pyx_v_fields == Py_None)) { | |
9729 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9730 __PYX_ERR(0, 618, __pyx_L1_error) | |
9731 } | |
9732 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) | |
9733 __Pyx_GOTREF(__pyx_t_1); | |
9734 __pyx_t_5 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 618, __pyx_L1_error) | |
9735 __Pyx_GOTREF(__pyx_t_5); | |
9736 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9737 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 618, __pyx_L1_error) | |
9738 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9739 if (__pyx_t_4) { | |
9740 } else { | |
9741 __pyx_t_2 = __pyx_t_4; | |
9742 goto __pyx_L4_bool_binop_done; | |
9743 } | |
9744 | |
9745 /* "pybedtools/cbedtools.pyx":619 | |
9746 * and isdigit(fields[3]) | |
9747 * and isdigit(fields[4]) | |
9748 * and (fields[5] not in ['.', '+', '-']) # <<<<<<<<<<<<<< | |
9749 * ): | |
9750 * # TODO: what should the stop position be? Here, it's just the start | |
9751 */ | |
9752 if (unlikely(__pyx_v_fields == Py_None)) { | |
9753 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9754 __PYX_ERR(0, 619, __pyx_L1_error) | |
9755 } | |
9756 __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_fields, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error) | |
9757 __Pyx_GOTREF(__pyx_t_5); | |
9758 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__7, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) | |
9759 if (__pyx_t_6) { | |
9760 } else { | |
9761 __pyx_t_4 = __pyx_t_6; | |
9762 goto __pyx_L9_bool_binop_done; | |
9763 } | |
9764 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__19, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) | |
9765 if (__pyx_t_6) { | |
9766 } else { | |
9767 __pyx_t_4 = __pyx_t_6; | |
9768 goto __pyx_L9_bool_binop_done; | |
9769 } | |
9770 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__20, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) | |
9771 __pyx_t_4 = __pyx_t_6; | |
9772 __pyx_L9_bool_binop_done:; | |
9773 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9774 __pyx_t_6 = (__pyx_t_4 != 0); | |
9775 __pyx_t_2 = __pyx_t_6; | |
9776 __pyx_L4_bool_binop_done:; | |
9777 | |
9778 /* "pybedtools/cbedtools.pyx":614 | |
9779 * | |
9780 * # SAM | |
9781 * if ( # <<<<<<<<<<<<<< | |
9782 * (len(fields) >= 11) | |
9783 * and isdigit(fields[1]) | |
9784 */ | |
9785 if (__pyx_t_2) { | |
9786 | |
9787 /* "pybedtools/cbedtools.pyx":624 | |
9788 * # plus the length of the sequence, but perhaps this should eventually | |
9789 * # do CIGAR string parsing. | |
9790 * if int(fields[1]) & 0x04: # <<<<<<<<<<<<<< | |
9791 * # handle unmapped reads | |
9792 * chrom = _cppstr("*") | |
9793 */ | |
9794 if (unlikely(__pyx_v_fields == Py_None)) { | |
9795 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9796 __PYX_ERR(0, 624, __pyx_L1_error) | |
9797 } | |
9798 __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error) | |
9799 __Pyx_GOTREF(__pyx_t_5); | |
9800 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error) | |
9801 __Pyx_GOTREF(__pyx_t_1); | |
9802 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9803 __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_4, 0x04, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error) | |
9804 __Pyx_GOTREF(__pyx_t_5); | |
9805 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9806 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 624, __pyx_L1_error) | |
9807 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9808 if (__pyx_t_2) { | |
9809 | |
9810 /* "pybedtools/cbedtools.pyx":626 | |
9811 * if int(fields[1]) & 0x04: | |
9812 * # handle unmapped reads | |
9813 * chrom = _cppstr("*") # <<<<<<<<<<<<<< | |
9814 * start = 0 | |
9815 * stop = 0 | |
9816 */ | |
9817 __pyx_t_5 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_kp_s__21); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error) | |
9818 __Pyx_GOTREF(__pyx_t_5); | |
9819 __pyx_v_chrom = __pyx_t_5; | |
9820 __pyx_t_5 = 0; | |
9821 | |
9822 /* "pybedtools/cbedtools.pyx":627 | |
9823 * # handle unmapped reads | |
9824 * chrom = _cppstr("*") | |
9825 * start = 0 # <<<<<<<<<<<<<< | |
9826 * stop = 0 | |
9827 * else: | |
9828 */ | |
9829 __Pyx_INCREF(__pyx_int_0); | |
9830 __pyx_v_start = __pyx_int_0; | |
9831 | |
9832 /* "pybedtools/cbedtools.pyx":628 | |
9833 * chrom = _cppstr("*") | |
9834 * start = 0 | |
9835 * stop = 0 # <<<<<<<<<<<<<< | |
9836 * else: | |
9837 * chrom = _cppstr(fields[2]) | |
9838 */ | |
9839 __Pyx_INCREF(__pyx_int_0); | |
9840 __pyx_v_stop = __pyx_int_0; | |
9841 | |
9842 /* "pybedtools/cbedtools.pyx":624 | |
9843 * # plus the length of the sequence, but perhaps this should eventually | |
9844 * # do CIGAR string parsing. | |
9845 * if int(fields[1]) & 0x04: # <<<<<<<<<<<<<< | |
9846 * # handle unmapped reads | |
9847 * chrom = _cppstr("*") | |
9848 */ | |
9849 goto __pyx_L12; | |
9850 } | |
9851 | |
9852 /* "pybedtools/cbedtools.pyx":630 | |
9853 * stop = 0 | |
9854 * else: | |
9855 * chrom = _cppstr(fields[2]) # <<<<<<<<<<<<<< | |
9856 * start = int(fields[3]) - 1 | |
9857 * stop = int(fields[3]) + len(fields[9]) - 1 | |
9858 */ | |
9859 /*else*/ { | |
9860 if (unlikely(__pyx_v_fields == Py_None)) { | |
9861 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9862 __PYX_ERR(0, 630, __pyx_L1_error) | |
9863 } | |
9864 __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_fields, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error) | |
9865 __Pyx_GOTREF(__pyx_t_5); | |
9866 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error) | |
9867 __Pyx_GOTREF(__pyx_t_1); | |
9868 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9869 __pyx_v_chrom = __pyx_t_1; | |
9870 __pyx_t_1 = 0; | |
9871 | |
9872 /* "pybedtools/cbedtools.pyx":631 | |
9873 * else: | |
9874 * chrom = _cppstr(fields[2]) | |
9875 * start = int(fields[3]) - 1 # <<<<<<<<<<<<<< | |
9876 * stop = int(fields[3]) + len(fields[9]) - 1 | |
9877 * name = _cppstr(fields[0]) | |
9878 */ | |
9879 if (unlikely(__pyx_v_fields == Py_None)) { | |
9880 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9881 __PYX_ERR(0, 631, __pyx_L1_error) | |
9882 } | |
9883 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error) | |
9884 __Pyx_GOTREF(__pyx_t_1); | |
9885 __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 631, __pyx_L1_error) | |
9886 __Pyx_GOTREF(__pyx_t_5); | |
9887 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9888 __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error) | |
9889 __Pyx_GOTREF(__pyx_t_1); | |
9890 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9891 __pyx_v_start = __pyx_t_1; | |
9892 __pyx_t_1 = 0; | |
9893 | |
9894 /* "pybedtools/cbedtools.pyx":632 | |
9895 * chrom = _cppstr(fields[2]) | |
9896 * start = int(fields[3]) - 1 | |
9897 * stop = int(fields[3]) + len(fields[9]) - 1 # <<<<<<<<<<<<<< | |
9898 * name = _cppstr(fields[0]) | |
9899 * score = _cppstr(fields[1]) | |
9900 */ | |
9901 if (unlikely(__pyx_v_fields == Py_None)) { | |
9902 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9903 __PYX_ERR(0, 632, __pyx_L1_error) | |
9904 } | |
9905 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error) | |
9906 __Pyx_GOTREF(__pyx_t_1); | |
9907 __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 632, __pyx_L1_error) | |
9908 __Pyx_GOTREF(__pyx_t_5); | |
9909 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9910 if (unlikely(__pyx_v_fields == Py_None)) { | |
9911 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9912 __PYX_ERR(0, 632, __pyx_L1_error) | |
9913 } | |
9914 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 9, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error) | |
9915 __Pyx_GOTREF(__pyx_t_1); | |
9916 __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 632, __pyx_L1_error) | |
9917 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9918 __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error) | |
9919 __Pyx_GOTREF(__pyx_t_1); | |
9920 __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 632, __pyx_L1_error) | |
9921 __Pyx_GOTREF(__pyx_t_7); | |
9922 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
9923 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9924 __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error) | |
9925 __Pyx_GOTREF(__pyx_t_1); | |
9926 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
9927 __pyx_v_stop = __pyx_t_1; | |
9928 __pyx_t_1 = 0; | |
9929 } | |
9930 __pyx_L12:; | |
9931 | |
9932 /* "pybedtools/cbedtools.pyx":633 | |
9933 * start = int(fields[3]) - 1 | |
9934 * stop = int(fields[3]) + len(fields[9]) - 1 | |
9935 * name = _cppstr(fields[0]) # <<<<<<<<<<<<<< | |
9936 * score = _cppstr(fields[1]) | |
9937 * if int(fields[1]) & 0x10: | |
9938 */ | |
9939 if (unlikely(__pyx_v_fields == Py_None)) { | |
9940 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9941 __PYX_ERR(0, 633, __pyx_L1_error) | |
9942 } | |
9943 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) | |
9944 __Pyx_GOTREF(__pyx_t_1); | |
9945 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 633, __pyx_L1_error) | |
9946 __Pyx_GOTREF(__pyx_t_7); | |
9947 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9948 __pyx_v_name = __pyx_t_7; | |
9949 __pyx_t_7 = 0; | |
9950 | |
9951 /* "pybedtools/cbedtools.pyx":634 | |
9952 * stop = int(fields[3]) + len(fields[9]) - 1 | |
9953 * name = _cppstr(fields[0]) | |
9954 * score = _cppstr(fields[1]) # <<<<<<<<<<<<<< | |
9955 * if int(fields[1]) & 0x10: | |
9956 * strand = _cppstr('-') | |
9957 */ | |
9958 if (unlikely(__pyx_v_fields == Py_None)) { | |
9959 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9960 __PYX_ERR(0, 634, __pyx_L1_error) | |
9961 } | |
9962 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) | |
9963 __Pyx_GOTREF(__pyx_t_7); | |
9964 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) | |
9965 __Pyx_GOTREF(__pyx_t_1); | |
9966 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
9967 __pyx_v_score = __pyx_t_1; | |
9968 __pyx_t_1 = 0; | |
9969 | |
9970 /* "pybedtools/cbedtools.pyx":635 | |
9971 * name = _cppstr(fields[0]) | |
9972 * score = _cppstr(fields[1]) | |
9973 * if int(fields[1]) & 0x10: # <<<<<<<<<<<<<< | |
9974 * strand = _cppstr('-') | |
9975 * else: | |
9976 */ | |
9977 if (unlikely(__pyx_v_fields == Py_None)) { | |
9978 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
9979 __PYX_ERR(0, 635, __pyx_L1_error) | |
9980 } | |
9981 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) | |
9982 __Pyx_GOTREF(__pyx_t_1); | |
9983 __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 635, __pyx_L1_error) | |
9984 __Pyx_GOTREF(__pyx_t_7); | |
9985 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9986 __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_7, __pyx_int_16, 0x10, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) | |
9987 __Pyx_GOTREF(__pyx_t_1); | |
9988 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
9989 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 635, __pyx_L1_error) | |
9990 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
9991 if (__pyx_t_2) { | |
9992 | |
9993 /* "pybedtools/cbedtools.pyx":636 | |
9994 * score = _cppstr(fields[1]) | |
9995 * if int(fields[1]) & 0x10: | |
9996 * strand = _cppstr('-') # <<<<<<<<<<<<<< | |
9997 * else: | |
9998 * strand = _cppstr('+') | |
9999 */ | |
10000 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_kp_s__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error) | |
10001 __Pyx_GOTREF(__pyx_t_1); | |
10002 __pyx_v_strand = __pyx_t_1; | |
10003 __pyx_t_1 = 0; | |
10004 | |
10005 /* "pybedtools/cbedtools.pyx":635 | |
10006 * name = _cppstr(fields[0]) | |
10007 * score = _cppstr(fields[1]) | |
10008 * if int(fields[1]) & 0x10: # <<<<<<<<<<<<<< | |
10009 * strand = _cppstr('-') | |
10010 * else: | |
10011 */ | |
10012 goto __pyx_L13; | |
10013 } | |
10014 | |
10015 /* "pybedtools/cbedtools.pyx":638 | |
10016 * strand = _cppstr('-') | |
10017 * else: | |
10018 * strand = _cppstr('+') # <<<<<<<<<<<<<< | |
10019 * | |
10020 * # Fields is in SAM format | |
10021 */ | |
10022 /*else*/ { | |
10023 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_kp_s__19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) | |
10024 __Pyx_GOTREF(__pyx_t_1); | |
10025 __pyx_v_strand = __pyx_t_1; | |
10026 __pyx_t_1 = 0; | |
10027 } | |
10028 __pyx_L13:; | |
10029 | |
10030 /* "pybedtools/cbedtools.pyx":641 | |
10031 * | |
10032 * # Fields is in SAM format | |
10033 * fields[3] = str(start + 1) # <<<<<<<<<<<<<< | |
10034 * | |
10035 * pyb._bed = new BED( | |
10036 */ | |
10037 __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) | |
10038 __Pyx_GOTREF(__pyx_t_1); | |
10039 __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 641, __pyx_L1_error) | |
10040 __Pyx_GOTREF(__pyx_t_7); | |
10041 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10042 if (unlikely(__pyx_v_fields == Py_None)) { | |
10043 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10044 __PYX_ERR(0, 641, __pyx_L1_error) | |
10045 } | |
10046 if (unlikely(__Pyx_SetItemInt(__pyx_v_fields, 3, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 641, __pyx_L1_error) | |
10047 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10048 | |
10049 /* "pybedtools/cbedtools.pyx":644 | |
10050 * | |
10051 * pyb._bed = new BED( | |
10052 * chrom, # <<<<<<<<<<<<<< | |
10053 * start, | |
10054 * stop, | |
10055 */ | |
10056 __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_chrom); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 644, __pyx_L1_error) | |
10057 | |
10058 /* "pybedtools/cbedtools.pyx":645 | |
10059 * pyb._bed = new BED( | |
10060 * chrom, | |
10061 * start, # <<<<<<<<<<<<<< | |
10062 * stop, | |
10063 * strand, | |
10064 */ | |
10065 __pyx_t_9 = __Pyx_PyInt_As_CHRPOS(__pyx_v_start); if (unlikely((__pyx_t_9 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 645, __pyx_L1_error) | |
10066 | |
10067 /* "pybedtools/cbedtools.pyx":646 | |
10068 * chrom, | |
10069 * start, | |
10070 * stop, # <<<<<<<<<<<<<< | |
10071 * strand, | |
10072 * name, | |
10073 */ | |
10074 __pyx_t_10 = __Pyx_PyInt_As_CHRPOS(__pyx_v_stop); if (unlikely((__pyx_t_10 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L1_error) | |
10075 | |
10076 /* "pybedtools/cbedtools.pyx":647 | |
10077 * start, | |
10078 * stop, | |
10079 * strand, # <<<<<<<<<<<<<< | |
10080 * name, | |
10081 * score, | |
10082 */ | |
10083 __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_v_strand); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 647, __pyx_L1_error) | |
10084 | |
10085 /* "pybedtools/cbedtools.pyx":648 | |
10086 * stop, | |
10087 * strand, | |
10088 * name, # <<<<<<<<<<<<<< | |
10089 * score, | |
10090 * list_to_vector(fields)) | |
10091 */ | |
10092 __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L1_error) | |
10093 | |
10094 /* "pybedtools/cbedtools.pyx":649 | |
10095 * strand, | |
10096 * name, | |
10097 * score, # <<<<<<<<<<<<<< | |
10098 * list_to_vector(fields)) | |
10099 * pyb.file_type = _cppstr('sam') | |
10100 */ | |
10101 __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_v_score); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L1_error) | |
10102 | |
10103 /* "pybedtools/cbedtools.pyx":643 | |
10104 * fields[3] = str(start + 1) | |
10105 * | |
10106 * pyb._bed = new BED( # <<<<<<<<<<<<<< | |
10107 * chrom, | |
10108 * start, | |
10109 */ | |
10110 __pyx_v_pyb->_bed = new BED(__pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_f_10pybedtools_9cbedtools_list_to_vector(__pyx_v_fields)); | |
10111 | |
10112 /* "pybedtools/cbedtools.pyx":651 | |
10113 * score, | |
10114 * list_to_vector(fields)) | |
10115 * pyb.file_type = _cppstr('sam') # <<<<<<<<<<<<<< | |
10116 * | |
10117 * | |
10118 */ | |
10119 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_n_s_sam); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 651, __pyx_L1_error) | |
10120 __Pyx_GOTREF(__pyx_t_7); | |
10121 if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_pyb), __pyx_n_s_file_type, __pyx_t_7) < 0) __PYX_ERR(0, 651, __pyx_L1_error) | |
10122 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10123 | |
10124 /* "pybedtools/cbedtools.pyx":614 | |
10125 * | |
10126 * # SAM | |
10127 * if ( # <<<<<<<<<<<<<< | |
10128 * (len(fields) >= 11) | |
10129 * and isdigit(fields[1]) | |
10130 */ | |
10131 goto __pyx_L3; | |
10132 } | |
10133 | |
10134 /* "pybedtools/cbedtools.pyx":654 | |
10135 * | |
10136 * | |
10137 * elif isdigit(fields[1]) and isdigit(fields[2]): # <<<<<<<<<<<<<< | |
10138 * # if it's too short, just add some empty fields. | |
10139 * if len(fields) < 7: | |
10140 */ | |
10141 if (unlikely(__pyx_v_fields == Py_None)) { | |
10142 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10143 __PYX_ERR(0, 654, __pyx_L1_error) | |
10144 } | |
10145 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 654, __pyx_L1_error) | |
10146 __Pyx_GOTREF(__pyx_t_7); | |
10147 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) | |
10148 __Pyx_GOTREF(__pyx_t_1); | |
10149 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10150 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 654, __pyx_L1_error) | |
10151 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10152 if (__pyx_t_6) { | |
10153 } else { | |
10154 __pyx_t_2 = __pyx_t_6; | |
10155 goto __pyx_L14_bool_binop_done; | |
10156 } | |
10157 if (unlikely(__pyx_v_fields == Py_None)) { | |
10158 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10159 __PYX_ERR(0, 654, __pyx_L1_error) | |
10160 } | |
10161 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) | |
10162 __Pyx_GOTREF(__pyx_t_1); | |
10163 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 654, __pyx_L1_error) | |
10164 __Pyx_GOTREF(__pyx_t_7); | |
10165 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10166 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 654, __pyx_L1_error) | |
10167 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10168 __pyx_t_2 = __pyx_t_6; | |
10169 __pyx_L14_bool_binop_done:; | |
10170 if (__pyx_t_2) { | |
10171 | |
10172 /* "pybedtools/cbedtools.pyx":656 | |
10173 * elif isdigit(fields[1]) and isdigit(fields[2]): | |
10174 * # if it's too short, just add some empty fields. | |
10175 * if len(fields) < 7: # <<<<<<<<<<<<<< | |
10176 * fields.extend([".".encode('UTF-8')] * (6 - len(fields))) | |
10177 * other_fields = [] | |
10178 */ | |
10179 if (unlikely(__pyx_v_fields == Py_None)) { | |
10180 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
10181 __PYX_ERR(0, 656, __pyx_L1_error) | |
10182 } | |
10183 __pyx_t_3 = PyList_GET_SIZE(__pyx_v_fields); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 656, __pyx_L1_error) | |
10184 __pyx_t_2 = ((__pyx_t_3 < 7) != 0); | |
10185 if (__pyx_t_2) { | |
10186 | |
10187 /* "pybedtools/cbedtools.pyx":657 | |
10188 * # if it's too short, just add some empty fields. | |
10189 * if len(fields) < 7: | |
10190 * fields.extend([".".encode('UTF-8')] * (6 - len(fields))) # <<<<<<<<<<<<<< | |
10191 * other_fields = [] | |
10192 * else: | |
10193 */ | |
10194 if (unlikely(__pyx_v_fields == Py_None)) { | |
10195 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); | |
10196 __PYX_ERR(0, 657, __pyx_L1_error) | |
10197 } | |
10198 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s__7, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) | |
10199 __Pyx_GOTREF(__pyx_t_1); | |
10200 __pyx_t_5 = NULL; | |
10201 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { | |
10202 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); | |
10203 if (likely(__pyx_t_5)) { | |
10204 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
10205 __Pyx_INCREF(__pyx_t_5); | |
10206 __Pyx_INCREF(function); | |
10207 __Pyx_DECREF_SET(__pyx_t_1, function); | |
10208 } | |
10209 } | |
10210 __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_kp_s_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_UTF_8); | |
10211 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
10212 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 657, __pyx_L1_error) | |
10213 __Pyx_GOTREF(__pyx_t_7); | |
10214 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10215 if (unlikely(__pyx_v_fields == Py_None)) { | |
10216 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
10217 __PYX_ERR(0, 657, __pyx_L1_error) | |
10218 } | |
10219 __pyx_t_3 = PyList_GET_SIZE(__pyx_v_fields); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 657, __pyx_L1_error) | |
10220 __pyx_t_1 = PyList_New(1 * (((6 - __pyx_t_3)<0) ? 0:(6 - __pyx_t_3))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) | |
10221 __Pyx_GOTREF(__pyx_t_1); | |
10222 { Py_ssize_t __pyx_temp; | |
10223 for (__pyx_temp=0; __pyx_temp < (6 - __pyx_t_3); __pyx_temp++) { | |
10224 __Pyx_INCREF(__pyx_t_7); | |
10225 __Pyx_GIVEREF(__pyx_t_7); | |
10226 PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_t_7); | |
10227 } | |
10228 } | |
10229 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10230 __pyx_t_14 = __Pyx_PyList_Extend(__pyx_v_fields, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 657, __pyx_L1_error) | |
10231 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10232 | |
10233 /* "pybedtools/cbedtools.pyx":658 | |
10234 * if len(fields) < 7: | |
10235 * fields.extend([".".encode('UTF-8')] * (6 - len(fields))) | |
10236 * other_fields = [] # <<<<<<<<<<<<<< | |
10237 * else: | |
10238 * other_fields = fields[6:] | |
10239 */ | |
10240 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) | |
10241 __Pyx_GOTREF(__pyx_t_1); | |
10242 __pyx_v_other_fields = ((PyObject*)__pyx_t_1); | |
10243 __pyx_t_1 = 0; | |
10244 | |
10245 /* "pybedtools/cbedtools.pyx":656 | |
10246 * elif isdigit(fields[1]) and isdigit(fields[2]): | |
10247 * # if it's too short, just add some empty fields. | |
10248 * if len(fields) < 7: # <<<<<<<<<<<<<< | |
10249 * fields.extend([".".encode('UTF-8')] * (6 - len(fields))) | |
10250 * other_fields = [] | |
10251 */ | |
10252 goto __pyx_L16; | |
10253 } | |
10254 | |
10255 /* "pybedtools/cbedtools.pyx":660 | |
10256 * other_fields = [] | |
10257 * else: | |
10258 * other_fields = fields[6:] # <<<<<<<<<<<<<< | |
10259 * | |
10260 * pyb._bed = new BED( | |
10261 */ | |
10262 /*else*/ { | |
10263 if (unlikely(__pyx_v_fields == Py_None)) { | |
10264 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10265 __PYX_ERR(0, 660, __pyx_L1_error) | |
10266 } | |
10267 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_fields, 6, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) | |
10268 __Pyx_GOTREF(__pyx_t_1); | |
10269 __pyx_v_other_fields = ((PyObject*)__pyx_t_1); | |
10270 __pyx_t_1 = 0; | |
10271 } | |
10272 __pyx_L16:; | |
10273 | |
10274 /* "pybedtools/cbedtools.pyx":663 | |
10275 * | |
10276 * pyb._bed = new BED( | |
10277 * _cppstr(fields[0]), # <<<<<<<<<<<<<< | |
10278 * int(fields[1]), | |
10279 * int(fields[2]), | |
10280 */ | |
10281 if (unlikely(__pyx_v_fields == Py_None)) { | |
10282 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10283 __PYX_ERR(0, 663, __pyx_L1_error) | |
10284 } | |
10285 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error) | |
10286 __Pyx_GOTREF(__pyx_t_1); | |
10287 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 663, __pyx_L1_error) | |
10288 __Pyx_GOTREF(__pyx_t_7); | |
10289 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10290 __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error) | |
10291 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10292 | |
10293 /* "pybedtools/cbedtools.pyx":664 | |
10294 * pyb._bed = new BED( | |
10295 * _cppstr(fields[0]), | |
10296 * int(fields[1]), # <<<<<<<<<<<<<< | |
10297 * int(fields[2]), | |
10298 * _cppstr(fields[3]), | |
10299 */ | |
10300 if (unlikely(__pyx_v_fields == Py_None)) { | |
10301 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10302 __PYX_ERR(0, 664, __pyx_L1_error) | |
10303 } | |
10304 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 664, __pyx_L1_error) | |
10305 __Pyx_GOTREF(__pyx_t_7); | |
10306 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error) | |
10307 __Pyx_GOTREF(__pyx_t_1); | |
10308 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10309 __pyx_t_10 = __Pyx_PyInt_As_CHRPOS(__pyx_t_1); if (unlikely((__pyx_t_10 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error) | |
10310 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10311 | |
10312 /* "pybedtools/cbedtools.pyx":665 | |
10313 * _cppstr(fields[0]), | |
10314 * int(fields[1]), | |
10315 * int(fields[2]), # <<<<<<<<<<<<<< | |
10316 * _cppstr(fields[3]), | |
10317 * _cppstr(fields[4]), | |
10318 */ | |
10319 if (unlikely(__pyx_v_fields == Py_None)) { | |
10320 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10321 __PYX_ERR(0, 665, __pyx_L1_error) | |
10322 } | |
10323 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error) | |
10324 __Pyx_GOTREF(__pyx_t_1); | |
10325 __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 665, __pyx_L1_error) | |
10326 __Pyx_GOTREF(__pyx_t_7); | |
10327 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10328 __pyx_t_9 = __Pyx_PyInt_As_CHRPOS(__pyx_t_7); if (unlikely((__pyx_t_9 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 665, __pyx_L1_error) | |
10329 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10330 | |
10331 /* "pybedtools/cbedtools.pyx":666 | |
10332 * int(fields[1]), | |
10333 * int(fields[2]), | |
10334 * _cppstr(fields[3]), # <<<<<<<<<<<<<< | |
10335 * _cppstr(fields[4]), | |
10336 * _cppstr(fields[5]), | |
10337 */ | |
10338 if (unlikely(__pyx_v_fields == Py_None)) { | |
10339 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10340 __PYX_ERR(0, 666, __pyx_L1_error) | |
10341 } | |
10342 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 666, __pyx_L1_error) | |
10343 __Pyx_GOTREF(__pyx_t_7); | |
10344 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error) | |
10345 __Pyx_GOTREF(__pyx_t_1); | |
10346 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10347 __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 666, __pyx_L1_error) | |
10348 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10349 | |
10350 /* "pybedtools/cbedtools.pyx":667 | |
10351 * int(fields[2]), | |
10352 * _cppstr(fields[3]), | |
10353 * _cppstr(fields[4]), # <<<<<<<<<<<<<< | |
10354 * _cppstr(fields[5]), | |
10355 * list_to_vector(other_fields)) | |
10356 */ | |
10357 if (unlikely(__pyx_v_fields == Py_None)) { | |
10358 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10359 __PYX_ERR(0, 667, __pyx_L1_error) | |
10360 } | |
10361 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) | |
10362 __Pyx_GOTREF(__pyx_t_1); | |
10363 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 667, __pyx_L1_error) | |
10364 __Pyx_GOTREF(__pyx_t_7); | |
10365 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10366 __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L1_error) | |
10367 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10368 | |
10369 /* "pybedtools/cbedtools.pyx":668 | |
10370 * _cppstr(fields[3]), | |
10371 * _cppstr(fields[4]), | |
10372 * _cppstr(fields[5]), # <<<<<<<<<<<<<< | |
10373 * list_to_vector(other_fields)) | |
10374 * pyb.file_type = _cppstr('bed') | |
10375 */ | |
10376 if (unlikely(__pyx_v_fields == Py_None)) { | |
10377 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10378 __PYX_ERR(0, 668, __pyx_L1_error) | |
10379 } | |
10380 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 668, __pyx_L1_error) | |
10381 __Pyx_GOTREF(__pyx_t_7); | |
10382 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) | |
10383 __Pyx_GOTREF(__pyx_t_1); | |
10384 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10385 __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L1_error) | |
10386 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10387 | |
10388 /* "pybedtools/cbedtools.pyx":662 | |
10389 * other_fields = fields[6:] | |
10390 * | |
10391 * pyb._bed = new BED( # <<<<<<<<<<<<<< | |
10392 * _cppstr(fields[0]), | |
10393 * int(fields[1]), | |
10394 */ | |
10395 __pyx_v_pyb->_bed = new BED(__pyx_t_13, __pyx_t_10, __pyx_t_9, __pyx_t_12, __pyx_t_11, __pyx_t_8, __pyx_f_10pybedtools_9cbedtools_list_to_vector(__pyx_v_other_fields)); | |
10396 | |
10397 /* "pybedtools/cbedtools.pyx":670 | |
10398 * _cppstr(fields[5]), | |
10399 * list_to_vector(other_fields)) | |
10400 * pyb.file_type = _cppstr('bed') # <<<<<<<<<<<<<< | |
10401 * | |
10402 * # VCF | |
10403 */ | |
10404 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_n_s_bed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error) | |
10405 __Pyx_GOTREF(__pyx_t_1); | |
10406 if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_pyb), __pyx_n_s_file_type, __pyx_t_1) < 0) __PYX_ERR(0, 670, __pyx_L1_error) | |
10407 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10408 | |
10409 /* "pybedtools/cbedtools.pyx":654 | |
10410 * | |
10411 * | |
10412 * elif isdigit(fields[1]) and isdigit(fields[2]): # <<<<<<<<<<<<<< | |
10413 * # if it's too short, just add some empty fields. | |
10414 * if len(fields) < 7: | |
10415 */ | |
10416 goto __pyx_L3; | |
10417 } | |
10418 | |
10419 /* "pybedtools/cbedtools.pyx":673 | |
10420 * | |
10421 * # VCF | |
10422 * elif isdigit(fields[1]) and not isdigit(fields[3]) and len(fields) >= 8: # <<<<<<<<<<<<<< | |
10423 * pyb._bed = new BED( | |
10424 * _cppstr(fields[0]), | |
10425 */ | |
10426 if (unlikely(__pyx_v_fields == Py_None)) { | |
10427 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10428 __PYX_ERR(0, 673, __pyx_L1_error) | |
10429 } | |
10430 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error) | |
10431 __Pyx_GOTREF(__pyx_t_1); | |
10432 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 673, __pyx_L1_error) | |
10433 __Pyx_GOTREF(__pyx_t_7); | |
10434 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10435 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 673, __pyx_L1_error) | |
10436 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10437 if (__pyx_t_6) { | |
10438 } else { | |
10439 __pyx_t_2 = __pyx_t_6; | |
10440 goto __pyx_L17_bool_binop_done; | |
10441 } | |
10442 if (unlikely(__pyx_v_fields == Py_None)) { | |
10443 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10444 __PYX_ERR(0, 673, __pyx_L1_error) | |
10445 } | |
10446 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 673, __pyx_L1_error) | |
10447 __Pyx_GOTREF(__pyx_t_7); | |
10448 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error) | |
10449 __Pyx_GOTREF(__pyx_t_1); | |
10450 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10451 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 673, __pyx_L1_error) | |
10452 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10453 __pyx_t_4 = ((!__pyx_t_6) != 0); | |
10454 if (__pyx_t_4) { | |
10455 } else { | |
10456 __pyx_t_2 = __pyx_t_4; | |
10457 goto __pyx_L17_bool_binop_done; | |
10458 } | |
10459 if (unlikely(__pyx_v_fields == Py_None)) { | |
10460 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
10461 __PYX_ERR(0, 673, __pyx_L1_error) | |
10462 } | |
10463 __pyx_t_3 = PyList_GET_SIZE(__pyx_v_fields); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 673, __pyx_L1_error) | |
10464 __pyx_t_4 = ((__pyx_t_3 >= 8) != 0); | |
10465 __pyx_t_2 = __pyx_t_4; | |
10466 __pyx_L17_bool_binop_done:; | |
10467 if (__pyx_t_2) { | |
10468 | |
10469 /* "pybedtools/cbedtools.pyx":675 | |
10470 * elif isdigit(fields[1]) and not isdigit(fields[3]) and len(fields) >= 8: | |
10471 * pyb._bed = new BED( | |
10472 * _cppstr(fields[0]), # <<<<<<<<<<<<<< | |
10473 * int(fields[1]) - 1, | |
10474 * int(fields[1]), | |
10475 */ | |
10476 if (unlikely(__pyx_v_fields == Py_None)) { | |
10477 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10478 __PYX_ERR(0, 675, __pyx_L1_error) | |
10479 } | |
10480 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error) | |
10481 __Pyx_GOTREF(__pyx_t_1); | |
10482 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 675, __pyx_L1_error) | |
10483 __Pyx_GOTREF(__pyx_t_7); | |
10484 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10485 __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 675, __pyx_L1_error) | |
10486 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10487 | |
10488 /* "pybedtools/cbedtools.pyx":676 | |
10489 * pyb._bed = new BED( | |
10490 * _cppstr(fields[0]), | |
10491 * int(fields[1]) - 1, # <<<<<<<<<<<<<< | |
10492 * int(fields[1]), | |
10493 * _cppstr(fields[2]), | |
10494 */ | |
10495 if (unlikely(__pyx_v_fields == Py_None)) { | |
10496 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10497 __PYX_ERR(0, 676, __pyx_L1_error) | |
10498 } | |
10499 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 676, __pyx_L1_error) | |
10500 __Pyx_GOTREF(__pyx_t_7); | |
10501 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) | |
10502 __Pyx_GOTREF(__pyx_t_1); | |
10503 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10504 __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 676, __pyx_L1_error) | |
10505 __Pyx_GOTREF(__pyx_t_7); | |
10506 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10507 __pyx_t_9 = __Pyx_PyInt_As_CHRPOS(__pyx_t_7); if (unlikely((__pyx_t_9 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L1_error) | |
10508 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10509 | |
10510 /* "pybedtools/cbedtools.pyx":677 | |
10511 * _cppstr(fields[0]), | |
10512 * int(fields[1]) - 1, | |
10513 * int(fields[1]), # <<<<<<<<<<<<<< | |
10514 * _cppstr(fields[2]), | |
10515 * _cppstr(fields[5]), | |
10516 */ | |
10517 if (unlikely(__pyx_v_fields == Py_None)) { | |
10518 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10519 __PYX_ERR(0, 677, __pyx_L1_error) | |
10520 } | |
10521 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 677, __pyx_L1_error) | |
10522 __Pyx_GOTREF(__pyx_t_7); | |
10523 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) | |
10524 __Pyx_GOTREF(__pyx_t_1); | |
10525 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10526 __pyx_t_10 = __Pyx_PyInt_As_CHRPOS(__pyx_t_1); if (unlikely((__pyx_t_10 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 677, __pyx_L1_error) | |
10527 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10528 | |
10529 /* "pybedtools/cbedtools.pyx":678 | |
10530 * int(fields[1]) - 1, | |
10531 * int(fields[1]), | |
10532 * _cppstr(fields[2]), # <<<<<<<<<<<<<< | |
10533 * _cppstr(fields[5]), | |
10534 * _cppstr('.'), | |
10535 */ | |
10536 if (unlikely(__pyx_v_fields == Py_None)) { | |
10537 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10538 __PYX_ERR(0, 678, __pyx_L1_error) | |
10539 } | |
10540 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error) | |
10541 __Pyx_GOTREF(__pyx_t_1); | |
10542 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 678, __pyx_L1_error) | |
10543 __Pyx_GOTREF(__pyx_t_7); | |
10544 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10545 __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 678, __pyx_L1_error) | |
10546 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10547 | |
10548 /* "pybedtools/cbedtools.pyx":679 | |
10549 * int(fields[1]), | |
10550 * _cppstr(fields[2]), | |
10551 * _cppstr(fields[5]), # <<<<<<<<<<<<<< | |
10552 * _cppstr('.'), | |
10553 * list_to_vector(fields)) | |
10554 */ | |
10555 if (unlikely(__pyx_v_fields == Py_None)) { | |
10556 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10557 __PYX_ERR(0, 679, __pyx_L1_error) | |
10558 } | |
10559 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 679, __pyx_L1_error) | |
10560 __Pyx_GOTREF(__pyx_t_7); | |
10561 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) | |
10562 __Pyx_GOTREF(__pyx_t_1); | |
10563 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10564 __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 679, __pyx_L1_error) | |
10565 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10566 | |
10567 /* "pybedtools/cbedtools.pyx":680 | |
10568 * _cppstr(fields[2]), | |
10569 * _cppstr(fields[5]), | |
10570 * _cppstr('.'), # <<<<<<<<<<<<<< | |
10571 * list_to_vector(fields)) | |
10572 * pyb.file_type = b'vcf' | |
10573 */ | |
10574 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_kp_s__7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) | |
10575 __Pyx_GOTREF(__pyx_t_1); | |
10576 __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 680, __pyx_L1_error) | |
10577 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10578 | |
10579 /* "pybedtools/cbedtools.pyx":674 | |
10580 * # VCF | |
10581 * elif isdigit(fields[1]) and not isdigit(fields[3]) and len(fields) >= 8: | |
10582 * pyb._bed = new BED( # <<<<<<<<<<<<<< | |
10583 * _cppstr(fields[0]), | |
10584 * int(fields[1]) - 1, | |
10585 */ | |
10586 __pyx_v_pyb->_bed = new BED(__pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_f_10pybedtools_9cbedtools_list_to_vector(__pyx_v_fields)); | |
10587 | |
10588 /* "pybedtools/cbedtools.pyx":682 | |
10589 * _cppstr('.'), | |
10590 * list_to_vector(fields)) | |
10591 * pyb.file_type = b'vcf' # <<<<<<<<<<<<<< | |
10592 * | |
10593 * | |
10594 */ | |
10595 if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_pyb), __pyx_n_s_file_type, __pyx_n_b_vcf) < 0) __PYX_ERR(0, 682, __pyx_L1_error) | |
10596 | |
10597 /* "pybedtools/cbedtools.pyx":673 | |
10598 * | |
10599 * # VCF | |
10600 * elif isdigit(fields[1]) and not isdigit(fields[3]) and len(fields) >= 8: # <<<<<<<<<<<<<< | |
10601 * pyb._bed = new BED( | |
10602 * _cppstr(fields[0]), | |
10603 */ | |
10604 goto __pyx_L3; | |
10605 } | |
10606 | |
10607 /* "pybedtools/cbedtools.pyx":686 | |
10608 * | |
10609 * # GFF | |
10610 * elif len(fields) >= 9 and isdigit(fields[3]) and isdigit(fields[4]): # <<<<<<<<<<<<<< | |
10611 * pyb._bed = new BED( | |
10612 * _cppstr(fields[0]), | |
10613 */ | |
10614 if (unlikely(__pyx_v_fields == Py_None)) { | |
10615 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
10616 __PYX_ERR(0, 686, __pyx_L1_error) | |
10617 } | |
10618 __pyx_t_3 = PyList_GET_SIZE(__pyx_v_fields); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 686, __pyx_L1_error) | |
10619 __pyx_t_4 = ((__pyx_t_3 >= 9) != 0); | |
10620 if (__pyx_t_4) { | |
10621 } else { | |
10622 __pyx_t_2 = __pyx_t_4; | |
10623 goto __pyx_L20_bool_binop_done; | |
10624 } | |
10625 if (unlikely(__pyx_v_fields == Py_None)) { | |
10626 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10627 __PYX_ERR(0, 686, __pyx_L1_error) | |
10628 } | |
10629 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error) | |
10630 __Pyx_GOTREF(__pyx_t_1); | |
10631 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 686, __pyx_L1_error) | |
10632 __Pyx_GOTREF(__pyx_t_7); | |
10633 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10634 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 686, __pyx_L1_error) | |
10635 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10636 if (__pyx_t_4) { | |
10637 } else { | |
10638 __pyx_t_2 = __pyx_t_4; | |
10639 goto __pyx_L20_bool_binop_done; | |
10640 } | |
10641 if (unlikely(__pyx_v_fields == Py_None)) { | |
10642 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10643 __PYX_ERR(0, 686, __pyx_L1_error) | |
10644 } | |
10645 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 686, __pyx_L1_error) | |
10646 __Pyx_GOTREF(__pyx_t_7); | |
10647 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_isdigit(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error) | |
10648 __Pyx_GOTREF(__pyx_t_1); | |
10649 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10650 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 686, __pyx_L1_error) | |
10651 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10652 __pyx_t_2 = __pyx_t_4; | |
10653 __pyx_L20_bool_binop_done:; | |
10654 if (likely(__pyx_t_2)) { | |
10655 | |
10656 /* "pybedtools/cbedtools.pyx":688 | |
10657 * elif len(fields) >= 9 and isdigit(fields[3]) and isdigit(fields[4]): | |
10658 * pyb._bed = new BED( | |
10659 * _cppstr(fields[0]), # <<<<<<<<<<<<<< | |
10660 * int(fields[3])-1, int(fields[4]), | |
10661 * _cppstr(fields[2]), | |
10662 */ | |
10663 if (unlikely(__pyx_v_fields == Py_None)) { | |
10664 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10665 __PYX_ERR(0, 688, __pyx_L1_error) | |
10666 } | |
10667 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error) | |
10668 __Pyx_GOTREF(__pyx_t_1); | |
10669 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 688, __pyx_L1_error) | |
10670 __Pyx_GOTREF(__pyx_t_7); | |
10671 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10672 __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 688, __pyx_L1_error) | |
10673 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10674 | |
10675 /* "pybedtools/cbedtools.pyx":689 | |
10676 * pyb._bed = new BED( | |
10677 * _cppstr(fields[0]), | |
10678 * int(fields[3])-1, int(fields[4]), # <<<<<<<<<<<<<< | |
10679 * _cppstr(fields[2]), | |
10680 * _cppstr(fields[5]), | |
10681 */ | |
10682 if (unlikely(__pyx_v_fields == Py_None)) { | |
10683 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10684 __PYX_ERR(0, 689, __pyx_L1_error) | |
10685 } | |
10686 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 689, __pyx_L1_error) | |
10687 __Pyx_GOTREF(__pyx_t_7); | |
10688 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) | |
10689 __Pyx_GOTREF(__pyx_t_1); | |
10690 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10691 __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 689, __pyx_L1_error) | |
10692 __Pyx_GOTREF(__pyx_t_7); | |
10693 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10694 __pyx_t_10 = __Pyx_PyInt_As_CHRPOS(__pyx_t_7); if (unlikely((__pyx_t_10 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 689, __pyx_L1_error) | |
10695 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10696 if (unlikely(__pyx_v_fields == Py_None)) { | |
10697 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10698 __PYX_ERR(0, 689, __pyx_L1_error) | |
10699 } | |
10700 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 689, __pyx_L1_error) | |
10701 __Pyx_GOTREF(__pyx_t_7); | |
10702 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) | |
10703 __Pyx_GOTREF(__pyx_t_1); | |
10704 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10705 __pyx_t_9 = __Pyx_PyInt_As_CHRPOS(__pyx_t_1); if (unlikely((__pyx_t_9 == ((CHRPOS)-1)) && PyErr_Occurred())) __PYX_ERR(0, 689, __pyx_L1_error) | |
10706 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10707 | |
10708 /* "pybedtools/cbedtools.pyx":690 | |
10709 * _cppstr(fields[0]), | |
10710 * int(fields[3])-1, int(fields[4]), | |
10711 * _cppstr(fields[2]), # <<<<<<<<<<<<<< | |
10712 * _cppstr(fields[5]), | |
10713 * _cppstr(fields[6]), | |
10714 */ | |
10715 if (unlikely(__pyx_v_fields == Py_None)) { | |
10716 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10717 __PYX_ERR(0, 690, __pyx_L1_error) | |
10718 } | |
10719 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) | |
10720 __Pyx_GOTREF(__pyx_t_1); | |
10721 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 690, __pyx_L1_error) | |
10722 __Pyx_GOTREF(__pyx_t_7); | |
10723 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10724 __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L1_error) | |
10725 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10726 | |
10727 /* "pybedtools/cbedtools.pyx":691 | |
10728 * int(fields[3])-1, int(fields[4]), | |
10729 * _cppstr(fields[2]), | |
10730 * _cppstr(fields[5]), # <<<<<<<<<<<<<< | |
10731 * _cppstr(fields[6]), | |
10732 * list_to_vector(fields[7:])) | |
10733 */ | |
10734 if (unlikely(__pyx_v_fields == Py_None)) { | |
10735 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10736 __PYX_ERR(0, 691, __pyx_L1_error) | |
10737 } | |
10738 __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_fields, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 691, __pyx_L1_error) | |
10739 __Pyx_GOTREF(__pyx_t_7); | |
10740 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error) | |
10741 __Pyx_GOTREF(__pyx_t_1); | |
10742 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10743 __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error) | |
10744 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10745 | |
10746 /* "pybedtools/cbedtools.pyx":692 | |
10747 * _cppstr(fields[2]), | |
10748 * _cppstr(fields[5]), | |
10749 * _cppstr(fields[6]), # <<<<<<<<<<<<<< | |
10750 * list_to_vector(fields[7:])) | |
10751 * pyb.file_type = _cppstr('gff') | |
10752 */ | |
10753 if (unlikely(__pyx_v_fields == Py_None)) { | |
10754 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10755 __PYX_ERR(0, 692, __pyx_L1_error) | |
10756 } | |
10757 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_fields, 6, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) | |
10758 __Pyx_GOTREF(__pyx_t_1); | |
10759 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 692, __pyx_L1_error) | |
10760 __Pyx_GOTREF(__pyx_t_7); | |
10761 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10762 __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L1_error) | |
10763 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10764 | |
10765 /* "pybedtools/cbedtools.pyx":693 | |
10766 * _cppstr(fields[5]), | |
10767 * _cppstr(fields[6]), | |
10768 * list_to_vector(fields[7:])) # <<<<<<<<<<<<<< | |
10769 * pyb.file_type = _cppstr('gff') | |
10770 * else: | |
10771 */ | |
10772 if (unlikely(__pyx_v_fields == Py_None)) { | |
10773 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
10774 __PYX_ERR(0, 693, __pyx_L1_error) | |
10775 } | |
10776 __pyx_t_7 = __Pyx_PyList_GetSlice(__pyx_v_fields, 7, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 693, __pyx_L1_error) | |
10777 __Pyx_GOTREF(__pyx_t_7); | |
10778 | |
10779 /* "pybedtools/cbedtools.pyx":687 | |
10780 * # GFF | |
10781 * elif len(fields) >= 9 and isdigit(fields[3]) and isdigit(fields[4]): | |
10782 * pyb._bed = new BED( # <<<<<<<<<<<<<< | |
10783 * _cppstr(fields[0]), | |
10784 * int(fields[3])-1, int(fields[4]), | |
10785 */ | |
10786 __pyx_v_pyb->_bed = new BED(__pyx_t_13, __pyx_t_10, __pyx_t_9, __pyx_t_12, __pyx_t_11, __pyx_t_8, __pyx_f_10pybedtools_9cbedtools_list_to_vector(((PyObject*)__pyx_t_7))); | |
10787 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10788 | |
10789 /* "pybedtools/cbedtools.pyx":694 | |
10790 * _cppstr(fields[6]), | |
10791 * list_to_vector(fields[7:])) | |
10792 * pyb.file_type = _cppstr('gff') # <<<<<<<<<<<<<< | |
10793 * else: | |
10794 * raise MalformedBedLineError('Unable to detect format from %s' % fields) | |
10795 */ | |
10796 __pyx_t_7 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_n_s_gff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 694, __pyx_L1_error) | |
10797 __Pyx_GOTREF(__pyx_t_7); | |
10798 if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_pyb), __pyx_n_s_file_type, __pyx_t_7) < 0) __PYX_ERR(0, 694, __pyx_L1_error) | |
10799 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10800 | |
10801 /* "pybedtools/cbedtools.pyx":686 | |
10802 * | |
10803 * # GFF | |
10804 * elif len(fields) >= 9 and isdigit(fields[3]) and isdigit(fields[4]): # <<<<<<<<<<<<<< | |
10805 * pyb._bed = new BED( | |
10806 * _cppstr(fields[0]), | |
10807 */ | |
10808 goto __pyx_L3; | |
10809 } | |
10810 | |
10811 /* "pybedtools/cbedtools.pyx":696 | |
10812 * pyb.file_type = _cppstr('gff') | |
10813 * else: | |
10814 * raise MalformedBedLineError('Unable to detect format from %s' % fields) # <<<<<<<<<<<<<< | |
10815 * | |
10816 * if pyb.start > pyb.end: | |
10817 */ | |
10818 /*else*/ { | |
10819 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MalformedBedLineError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) | |
10820 __Pyx_GOTREF(__pyx_t_1); | |
10821 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Unable_to_detect_format_from_s, __pyx_v_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L1_error) | |
10822 __Pyx_GOTREF(__pyx_t_5); | |
10823 __pyx_t_15 = NULL; | |
10824 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { | |
10825 __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1); | |
10826 if (likely(__pyx_t_15)) { | |
10827 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
10828 __Pyx_INCREF(__pyx_t_15); | |
10829 __Pyx_INCREF(function); | |
10830 __Pyx_DECREF_SET(__pyx_t_1, function); | |
10831 } | |
10832 } | |
10833 __pyx_t_7 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_15, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); | |
10834 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; | |
10835 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
10836 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L1_error) | |
10837 __Pyx_GOTREF(__pyx_t_7); | |
10838 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10839 __Pyx_Raise(__pyx_t_7, 0, 0, 0); | |
10840 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10841 __PYX_ERR(0, 696, __pyx_L1_error) | |
10842 } | |
10843 __pyx_L3:; | |
10844 | |
10845 /* "pybedtools/cbedtools.pyx":698 | |
10846 * raise MalformedBedLineError('Unable to detect format from %s' % fields) | |
10847 * | |
10848 * if pyb.start > pyb.end: # <<<<<<<<<<<<<< | |
10849 * raise MalformedBedLineError("Start is greater than stop") | |
10850 * pyb._bed.fields = list_to_vector(orig_fields) | |
10851 */ | |
10852 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pyb), __pyx_n_s_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error) | |
10853 __Pyx_GOTREF(__pyx_t_7); | |
10854 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pyb), __pyx_n_s_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error) | |
10855 __Pyx_GOTREF(__pyx_t_1); | |
10856 __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error) | |
10857 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10858 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10859 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 698, __pyx_L1_error) | |
10860 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
10861 if (unlikely(__pyx_t_2)) { | |
10862 | |
10863 /* "pybedtools/cbedtools.pyx":699 | |
10864 * | |
10865 * if pyb.start > pyb.end: | |
10866 * raise MalformedBedLineError("Start is greater than stop") # <<<<<<<<<<<<<< | |
10867 * pyb._bed.fields = list_to_vector(orig_fields) | |
10868 * return pyb | |
10869 */ | |
10870 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MalformedBedLineError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error) | |
10871 __Pyx_GOTREF(__pyx_t_1); | |
10872 __pyx_t_7 = NULL; | |
10873 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { | |
10874 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); | |
10875 if (likely(__pyx_t_7)) { | |
10876 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
10877 __Pyx_INCREF(__pyx_t_7); | |
10878 __Pyx_INCREF(function); | |
10879 __Pyx_DECREF_SET(__pyx_t_1, function); | |
10880 } | |
10881 } | |
10882 __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_kp_s_Start_is_greater_than_stop) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Start_is_greater_than_stop); | |
10883 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
10884 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error) | |
10885 __Pyx_GOTREF(__pyx_t_5); | |
10886 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
10887 __Pyx_Raise(__pyx_t_5, 0, 0, 0); | |
10888 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
10889 __PYX_ERR(0, 699, __pyx_L1_error) | |
10890 | |
10891 /* "pybedtools/cbedtools.pyx":698 | |
10892 * raise MalformedBedLineError('Unable to detect format from %s' % fields) | |
10893 * | |
10894 * if pyb.start > pyb.end: # <<<<<<<<<<<<<< | |
10895 * raise MalformedBedLineError("Start is greater than stop") | |
10896 * pyb._bed.fields = list_to_vector(orig_fields) | |
10897 */ | |
10898 } | |
10899 | |
10900 /* "pybedtools/cbedtools.pyx":700 | |
10901 * if pyb.start > pyb.end: | |
10902 * raise MalformedBedLineError("Start is greater than stop") | |
10903 * pyb._bed.fields = list_to_vector(orig_fields) # <<<<<<<<<<<<<< | |
10904 * return pyb | |
10905 * | |
10906 */ | |
10907 __pyx_v_pyb->_bed->fields = __pyx_f_10pybedtools_9cbedtools_list_to_vector(__pyx_v_orig_fields); | |
10908 | |
10909 /* "pybedtools/cbedtools.pyx":701 | |
10910 * raise MalformedBedLineError("Start is greater than stop") | |
10911 * pyb._bed.fields = list_to_vector(orig_fields) | |
10912 * return pyb # <<<<<<<<<<<<<< | |
10913 * | |
10914 * cdef vector[string] list_to_vector(list li): | |
10915 */ | |
10916 __Pyx_XDECREF(((PyObject *)__pyx_r)); | |
10917 __Pyx_INCREF(((PyObject *)__pyx_v_pyb)); | |
10918 __pyx_r = __pyx_v_pyb; | |
10919 goto __pyx_L0; | |
10920 | |
10921 /* "pybedtools/cbedtools.pyx":579 | |
10922 * | |
10923 * | |
10924 * cpdef Interval create_interval_from_list(list fields): # <<<<<<<<<<<<<< | |
10925 * """ | |
10926 * Create an Interval object from a list of strings. | |
10927 */ | |
10928 | |
10929 /* function exit code */ | |
10930 __pyx_L1_error:; | |
10931 __Pyx_XDECREF(__pyx_t_1); | |
10932 __Pyx_XDECREF(__pyx_t_5); | |
10933 __Pyx_XDECREF(__pyx_t_7); | |
10934 __Pyx_XDECREF(__pyx_t_15); | |
10935 __Pyx_AddTraceback("pybedtools.cbedtools.create_interval_from_list", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
10936 __pyx_r = 0; | |
10937 __pyx_L0:; | |
10938 __Pyx_XDECREF((PyObject *)__pyx_v_pyb); | |
10939 __Pyx_XDECREF(__pyx_v_orig_fields); | |
10940 __Pyx_XDECREF(__pyx_v_chrom); | |
10941 __Pyx_XDECREF(__pyx_v_start); | |
10942 __Pyx_XDECREF(__pyx_v_stop); | |
10943 __Pyx_XDECREF(__pyx_v_name); | |
10944 __Pyx_XDECREF(__pyx_v_score); | |
10945 __Pyx_XDECREF(__pyx_v_strand); | |
10946 __Pyx_XDECREF(__pyx_v_other_fields); | |
10947 __Pyx_XGIVEREF((PyObject *)__pyx_r); | |
10948 __Pyx_RefNannyFinishContext(); | |
10949 return __pyx_r; | |
10950 } | |
10951 | |
10952 /* Python wrapper */ | |
10953 static PyObject *__pyx_pw_10pybedtools_9cbedtools_1create_interval_from_list(PyObject *__pyx_self, PyObject *__pyx_v_fields); /*proto*/ | |
10954 static char __pyx_doc_10pybedtools_9cbedtools_create_interval_from_list[] = "\n Create an Interval object from a list of strings.\n\n Constructor::\n\n create_interval_from_list(fields)\n\n Given the list of strings, `fields`, automatically detects the format (BED,\n GFF, VCF, SAM) and creates a new Interval object.\n\n `fields` is a list with an arbitrary number of items (it can be quite long,\n say after a -wao intersection of a BED12 and a GFF), however, the first\n fields must conform to one of the supported formats. For example, if you\n want the resulting Interval to be considered a GFF feature, then the first\n 9 fields must conform to the GFF format. Similarly, if you want the\n resulting Interval to be considered a BED feature, then the first three\n fields must be chrom, start, stop.\n\n Example usage:\n\n >>> # Creates a BED3 feature\n >>> feature = create_interval_from_list(['chr1', '1', '100'])\n\n "; | |
10955 static PyObject *__pyx_pw_10pybedtools_9cbedtools_1create_interval_from_list(PyObject *__pyx_self, PyObject *__pyx_v_fields) { | |
10956 int __pyx_lineno = 0; | |
10957 const char *__pyx_filename = NULL; | |
10958 int __pyx_clineno = 0; | |
10959 PyObject *__pyx_r = 0; | |
10960 __Pyx_RefNannyDeclarations | |
10961 __Pyx_RefNannySetupContext("create_interval_from_list (wrapper)", 0); | |
10962 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fields), (&PyList_Type), 1, "fields", 1))) __PYX_ERR(0, 579, __pyx_L1_error) | |
10963 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_create_interval_from_list(__pyx_self, ((PyObject*)__pyx_v_fields)); | |
10964 | |
10965 /* function exit code */ | |
10966 goto __pyx_L0; | |
10967 __pyx_L1_error:; | |
10968 __pyx_r = NULL; | |
10969 __pyx_L0:; | |
10970 __Pyx_RefNannyFinishContext(); | |
10971 return __pyx_r; | |
10972 } | |
10973 | |
10974 static PyObject *__pyx_pf_10pybedtools_9cbedtools_create_interval_from_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fields) { | |
10975 PyObject *__pyx_r = NULL; | |
10976 __Pyx_RefNannyDeclarations | |
10977 PyObject *__pyx_t_1 = NULL; | |
10978 int __pyx_lineno = 0; | |
10979 const char *__pyx_filename = NULL; | |
10980 int __pyx_clineno = 0; | |
10981 __Pyx_RefNannySetupContext("create_interval_from_list", 0); | |
10982 __Pyx_XDECREF(__pyx_r); | |
10983 __pyx_t_1 = ((PyObject *)__pyx_f_10pybedtools_9cbedtools_create_interval_from_list(__pyx_v_fields, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) | |
10984 __Pyx_GOTREF(__pyx_t_1); | |
10985 __pyx_r = __pyx_t_1; | |
10986 __pyx_t_1 = 0; | |
10987 goto __pyx_L0; | |
10988 | |
10989 /* function exit code */ | |
10990 __pyx_L1_error:; | |
10991 __Pyx_XDECREF(__pyx_t_1); | |
10992 __Pyx_AddTraceback("pybedtools.cbedtools.create_interval_from_list", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
10993 __pyx_r = NULL; | |
10994 __pyx_L0:; | |
10995 __Pyx_XGIVEREF(__pyx_r); | |
10996 __Pyx_RefNannyFinishContext(); | |
10997 return __pyx_r; | |
10998 } | |
10999 | |
11000 /* "pybedtools/cbedtools.pyx":703 | |
11001 * return pyb | |
11002 * | |
11003 * cdef vector[string] list_to_vector(list li): # <<<<<<<<<<<<<< | |
11004 * cdef vector[string] s | |
11005 * cdef int i | |
11006 */ | |
11007 | |
11008 static std::vector<std::string> __pyx_f_10pybedtools_9cbedtools_list_to_vector(PyObject *__pyx_v_li) { | |
11009 std::vector<std::string> __pyx_v_s; | |
11010 int __pyx_v_i; | |
11011 PyObject *__pyx_v__s = NULL; | |
11012 std::vector<std::string> __pyx_r; | |
11013 __Pyx_RefNannyDeclarations | |
11014 Py_ssize_t __pyx_t_1; | |
11015 Py_ssize_t __pyx_t_2; | |
11016 int __pyx_t_3; | |
11017 PyObject *__pyx_t_4 = NULL; | |
11018 std::string __pyx_t_5; | |
11019 int __pyx_lineno = 0; | |
11020 const char *__pyx_filename = NULL; | |
11021 int __pyx_clineno = 0; | |
11022 __Pyx_RefNannySetupContext("list_to_vector", 0); | |
11023 | |
11024 /* "pybedtools/cbedtools.pyx":706 | |
11025 * cdef vector[string] s | |
11026 * cdef int i | |
11027 * for i in range(len(li)): # <<<<<<<<<<<<<< | |
11028 * _s = li[i] | |
11029 * s.push_back(_cppstr(_s)) | |
11030 */ | |
11031 if (unlikely(__pyx_v_li == Py_None)) { | |
11032 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
11033 __PYX_ERR(0, 706, __pyx_L1_error) | |
11034 } | |
11035 __pyx_t_1 = PyList_GET_SIZE(__pyx_v_li); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 706, __pyx_L1_error) | |
11036 __pyx_t_2 = __pyx_t_1; | |
11037 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { | |
11038 __pyx_v_i = __pyx_t_3; | |
11039 | |
11040 /* "pybedtools/cbedtools.pyx":707 | |
11041 * cdef int i | |
11042 * for i in range(len(li)): | |
11043 * _s = li[i] # <<<<<<<<<<<<<< | |
11044 * s.push_back(_cppstr(_s)) | |
11045 * return s | |
11046 */ | |
11047 if (unlikely(__pyx_v_li == Py_None)) { | |
11048 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
11049 __PYX_ERR(0, 707, __pyx_L1_error) | |
11050 } | |
11051 __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_li, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 707, __pyx_L1_error) | |
11052 __Pyx_GOTREF(__pyx_t_4); | |
11053 __Pyx_XDECREF_SET(__pyx_v__s, __pyx_t_4); | |
11054 __pyx_t_4 = 0; | |
11055 | |
11056 /* "pybedtools/cbedtools.pyx":708 | |
11057 * for i in range(len(li)): | |
11058 * _s = li[i] | |
11059 * s.push_back(_cppstr(_s)) # <<<<<<<<<<<<<< | |
11060 * return s | |
11061 * | |
11062 */ | |
11063 __pyx_t_4 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v__s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error) | |
11064 __Pyx_GOTREF(__pyx_t_4); | |
11065 __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L1_error) | |
11066 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
11067 try { | |
11068 __pyx_v_s.push_back(__pyx_t_5); | |
11069 } catch(...) { | |
11070 __Pyx_CppExn2PyErr(); | |
11071 __PYX_ERR(0, 708, __pyx_L1_error) | |
11072 } | |
11073 } | |
11074 | |
11075 /* "pybedtools/cbedtools.pyx":709 | |
11076 * _s = li[i] | |
11077 * s.push_back(_cppstr(_s)) | |
11078 * return s # <<<<<<<<<<<<<< | |
11079 * | |
11080 * cdef list string_vec2list(vector[string] sv): | |
11081 */ | |
11082 __pyx_r = __pyx_v_s; | |
11083 goto __pyx_L0; | |
11084 | |
11085 /* "pybedtools/cbedtools.pyx":703 | |
11086 * return pyb | |
11087 * | |
11088 * cdef vector[string] list_to_vector(list li): # <<<<<<<<<<<<<< | |
11089 * cdef vector[string] s | |
11090 * cdef int i | |
11091 */ | |
11092 | |
11093 /* function exit code */ | |
11094 __pyx_L1_error:; | |
11095 __Pyx_XDECREF(__pyx_t_4); | |
11096 __Pyx_WriteUnraisable("pybedtools.cbedtools.list_to_vector", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); | |
11097 __Pyx_pretend_to_initialize(&__pyx_r); | |
11098 __pyx_L0:; | |
11099 __Pyx_XDECREF(__pyx_v__s); | |
11100 __Pyx_RefNannyFinishContext(); | |
11101 return __pyx_r; | |
11102 } | |
11103 | |
11104 /* "pybedtools/cbedtools.pyx":711 | |
11105 * return s | |
11106 * | |
11107 * cdef list string_vec2list(vector[string] sv): # <<<<<<<<<<<<<< | |
11108 * cdef size_t size = sv.size(), i | |
11109 * return [_pystr(sv.at(i)) for i in range(size)] | |
11110 */ | |
11111 | |
11112 static PyObject *__pyx_f_10pybedtools_9cbedtools_string_vec2list(std::vector<std::string> __pyx_v_sv) { | |
11113 size_t __pyx_v_size; | |
11114 size_t __pyx_v_i; | |
11115 PyObject *__pyx_r = NULL; | |
11116 __Pyx_RefNannyDeclarations | |
11117 PyObject *__pyx_t_1 = NULL; | |
11118 size_t __pyx_t_2; | |
11119 size_t __pyx_t_3; | |
11120 size_t __pyx_t_4; | |
11121 __Pyx_FakeReference<std::string> __pyx_t_5; | |
11122 PyObject *__pyx_t_6 = NULL; | |
11123 int __pyx_lineno = 0; | |
11124 const char *__pyx_filename = NULL; | |
11125 int __pyx_clineno = 0; | |
11126 __Pyx_RefNannySetupContext("string_vec2list", 0); | |
11127 | |
11128 /* "pybedtools/cbedtools.pyx":712 | |
11129 * | |
11130 * cdef list string_vec2list(vector[string] sv): | |
11131 * cdef size_t size = sv.size(), i # <<<<<<<<<<<<<< | |
11132 * return [_pystr(sv.at(i)) for i in range(size)] | |
11133 * | |
11134 */ | |
11135 __pyx_v_size = __pyx_v_sv.size(); | |
11136 | |
11137 /* "pybedtools/cbedtools.pyx":713 | |
11138 * cdef list string_vec2list(vector[string] sv): | |
11139 * cdef size_t size = sv.size(), i | |
11140 * return [_pystr(sv.at(i)) for i in range(size)] # <<<<<<<<<<<<<< | |
11141 * | |
11142 * cdef list bed_vec2list(vector[BED] bv): | |
11143 */ | |
11144 __Pyx_XDECREF(__pyx_r); | |
11145 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error) | |
11146 __Pyx_GOTREF(__pyx_t_1); | |
11147 __pyx_t_2 = __pyx_v_size; | |
11148 __pyx_t_3 = __pyx_t_2; | |
11149 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { | |
11150 __pyx_v_i = __pyx_t_4; | |
11151 try { | |
11152 __pyx_t_5 = __pyx_v_sv.at(__pyx_v_i); | |
11153 } catch(...) { | |
11154 __Pyx_CppExn2PyErr(); | |
11155 __PYX_ERR(0, 713, __pyx_L1_error) | |
11156 } | |
11157 __pyx_t_6 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 713, __pyx_L1_error) | |
11158 __Pyx_GOTREF(__pyx_t_6); | |
11159 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 713, __pyx_L1_error) | |
11160 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
11161 } | |
11162 __pyx_r = ((PyObject*)__pyx_t_1); | |
11163 __pyx_t_1 = 0; | |
11164 goto __pyx_L0; | |
11165 | |
11166 /* "pybedtools/cbedtools.pyx":711 | |
11167 * return s | |
11168 * | |
11169 * cdef list string_vec2list(vector[string] sv): # <<<<<<<<<<<<<< | |
11170 * cdef size_t size = sv.size(), i | |
11171 * return [_pystr(sv.at(i)) for i in range(size)] | |
11172 */ | |
11173 | |
11174 /* function exit code */ | |
11175 __pyx_L1_error:; | |
11176 __Pyx_XDECREF(__pyx_t_1); | |
11177 __Pyx_XDECREF(__pyx_t_6); | |
11178 __Pyx_AddTraceback("pybedtools.cbedtools.string_vec2list", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
11179 __pyx_r = 0; | |
11180 __pyx_L0:; | |
11181 __Pyx_XGIVEREF(__pyx_r); | |
11182 __Pyx_RefNannyFinishContext(); | |
11183 return __pyx_r; | |
11184 } | |
11185 | |
11186 /* "pybedtools/cbedtools.pyx":715 | |
11187 * return [_pystr(sv.at(i)) for i in range(size)] | |
11188 * | |
11189 * cdef list bed_vec2list(vector[BED] bv): # <<<<<<<<<<<<<< | |
11190 * cdef size_t size = bv.size(), i | |
11191 * cdef list l = [] | |
11192 */ | |
11193 | |
11194 static PyObject *__pyx_f_10pybedtools_9cbedtools_bed_vec2list(std::vector<BED> __pyx_v_bv) { | |
11195 size_t __pyx_v_size; | |
11196 size_t __pyx_v_i; | |
11197 PyObject *__pyx_v_l = 0; | |
11198 BED __pyx_v_b; | |
11199 PyObject *__pyx_r = NULL; | |
11200 __Pyx_RefNannyDeclarations | |
11201 PyObject *__pyx_t_1 = NULL; | |
11202 size_t __pyx_t_2; | |
11203 size_t __pyx_t_3; | |
11204 size_t __pyx_t_4; | |
11205 __Pyx_FakeReference<BED> __pyx_t_5; | |
11206 int __pyx_t_6; | |
11207 int __pyx_lineno = 0; | |
11208 const char *__pyx_filename = NULL; | |
11209 int __pyx_clineno = 0; | |
11210 __Pyx_RefNannySetupContext("bed_vec2list", 0); | |
11211 | |
11212 /* "pybedtools/cbedtools.pyx":716 | |
11213 * | |
11214 * cdef list bed_vec2list(vector[BED] bv): | |
11215 * cdef size_t size = bv.size(), i # <<<<<<<<<<<<<< | |
11216 * cdef list l = [] | |
11217 * cdef BED b | |
11218 */ | |
11219 __pyx_v_size = __pyx_v_bv.size(); | |
11220 | |
11221 /* "pybedtools/cbedtools.pyx":717 | |
11222 * cdef list bed_vec2list(vector[BED] bv): | |
11223 * cdef size_t size = bv.size(), i | |
11224 * cdef list l = [] # <<<<<<<<<<<<<< | |
11225 * cdef BED b | |
11226 * for i in range(size): | |
11227 */ | |
11228 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) | |
11229 __Pyx_GOTREF(__pyx_t_1); | |
11230 __pyx_v_l = ((PyObject*)__pyx_t_1); | |
11231 __pyx_t_1 = 0; | |
11232 | |
11233 /* "pybedtools/cbedtools.pyx":719 | |
11234 * cdef list l = [] | |
11235 * cdef BED b | |
11236 * for i in range(size): # <<<<<<<<<<<<<< | |
11237 * b = bv.at(i) | |
11238 * l.append(create_interval(b)) | |
11239 */ | |
11240 __pyx_t_2 = __pyx_v_size; | |
11241 __pyx_t_3 = __pyx_t_2; | |
11242 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { | |
11243 __pyx_v_i = __pyx_t_4; | |
11244 | |
11245 /* "pybedtools/cbedtools.pyx":720 | |
11246 * cdef BED b | |
11247 * for i in range(size): | |
11248 * b = bv.at(i) # <<<<<<<<<<<<<< | |
11249 * l.append(create_interval(b)) | |
11250 * return l | |
11251 */ | |
11252 try { | |
11253 __pyx_t_5 = __pyx_v_bv.at(__pyx_v_i); | |
11254 } catch(...) { | |
11255 __Pyx_CppExn2PyErr(); | |
11256 __PYX_ERR(0, 720, __pyx_L1_error) | |
11257 } | |
11258 __pyx_v_b = __pyx_t_5; | |
11259 | |
11260 /* "pybedtools/cbedtools.pyx":721 | |
11261 * for i in range(size): | |
11262 * b = bv.at(i) | |
11263 * l.append(create_interval(b)) # <<<<<<<<<<<<<< | |
11264 * return l | |
11265 * | |
11266 */ | |
11267 __pyx_t_1 = ((PyObject *)__pyx_f_10pybedtools_9cbedtools_create_interval(__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error) | |
11268 __Pyx_GOTREF(__pyx_t_1); | |
11269 __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_l, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 721, __pyx_L1_error) | |
11270 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
11271 } | |
11272 | |
11273 /* "pybedtools/cbedtools.pyx":722 | |
11274 * b = bv.at(i) | |
11275 * l.append(create_interval(b)) | |
11276 * return l # <<<<<<<<<<<<<< | |
11277 * | |
11278 * | |
11279 */ | |
11280 __Pyx_XDECREF(__pyx_r); | |
11281 __Pyx_INCREF(__pyx_v_l); | |
11282 __pyx_r = __pyx_v_l; | |
11283 goto __pyx_L0; | |
11284 | |
11285 /* "pybedtools/cbedtools.pyx":715 | |
11286 * return [_pystr(sv.at(i)) for i in range(size)] | |
11287 * | |
11288 * cdef list bed_vec2list(vector[BED] bv): # <<<<<<<<<<<<<< | |
11289 * cdef size_t size = bv.size(), i | |
11290 * cdef list l = [] | |
11291 */ | |
11292 | |
11293 /* function exit code */ | |
11294 __pyx_L1_error:; | |
11295 __Pyx_XDECREF(__pyx_t_1); | |
11296 __Pyx_AddTraceback("pybedtools.cbedtools.bed_vec2list", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
11297 __pyx_r = 0; | |
11298 __pyx_L0:; | |
11299 __Pyx_XDECREF(__pyx_v_l); | |
11300 __Pyx_XGIVEREF(__pyx_r); | |
11301 __Pyx_RefNannyFinishContext(); | |
11302 return __pyx_r; | |
11303 } | |
11304 | |
11305 /* "pybedtools/cbedtools.pyx":725 | |
11306 * | |
11307 * | |
11308 * def overlap(int s1, int s2, int e1, int e2): # <<<<<<<<<<<<<< | |
11309 * return min(e1, e2) - max(s1, s2) | |
11310 * | |
11311 */ | |
11312 | |
11313 /* Python wrapper */ | |
11314 static PyObject *__pyx_pw_10pybedtools_9cbedtools_3overlap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
11315 static PyMethodDef __pyx_mdef_10pybedtools_9cbedtools_3overlap = {"overlap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_3overlap, METH_VARARGS|METH_KEYWORDS, 0}; | |
11316 static PyObject *__pyx_pw_10pybedtools_9cbedtools_3overlap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
11317 int __pyx_v_s1; | |
11318 int __pyx_v_s2; | |
11319 int __pyx_v_e1; | |
11320 int __pyx_v_e2; | |
11321 int __pyx_lineno = 0; | |
11322 const char *__pyx_filename = NULL; | |
11323 int __pyx_clineno = 0; | |
11324 PyObject *__pyx_r = 0; | |
11325 __Pyx_RefNannyDeclarations | |
11326 __Pyx_RefNannySetupContext("overlap (wrapper)", 0); | |
11327 { | |
11328 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_e1,&__pyx_n_s_e2,0}; | |
11329 PyObject* values[4] = {0,0,0,0}; | |
11330 if (unlikely(__pyx_kwds)) { | |
11331 Py_ssize_t kw_args; | |
11332 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
11333 switch (pos_args) { | |
11334 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); | |
11335 CYTHON_FALLTHROUGH; | |
11336 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
11337 CYTHON_FALLTHROUGH; | |
11338 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
11339 CYTHON_FALLTHROUGH; | |
11340 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
11341 CYTHON_FALLTHROUGH; | |
11342 case 0: break; | |
11343 default: goto __pyx_L5_argtuple_error; | |
11344 } | |
11345 kw_args = PyDict_Size(__pyx_kwds); | |
11346 switch (pos_args) { | |
11347 case 0: | |
11348 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s1)) != 0)) kw_args--; | |
11349 else goto __pyx_L5_argtuple_error; | |
11350 CYTHON_FALLTHROUGH; | |
11351 case 1: | |
11352 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s2)) != 0)) kw_args--; | |
11353 else { | |
11354 __Pyx_RaiseArgtupleInvalid("overlap", 1, 4, 4, 1); __PYX_ERR(0, 725, __pyx_L3_error) | |
11355 } | |
11356 CYTHON_FALLTHROUGH; | |
11357 case 2: | |
11358 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e1)) != 0)) kw_args--; | |
11359 else { | |
11360 __Pyx_RaiseArgtupleInvalid("overlap", 1, 4, 4, 2); __PYX_ERR(0, 725, __pyx_L3_error) | |
11361 } | |
11362 CYTHON_FALLTHROUGH; | |
11363 case 3: | |
11364 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e2)) != 0)) kw_args--; | |
11365 else { | |
11366 __Pyx_RaiseArgtupleInvalid("overlap", 1, 4, 4, 3); __PYX_ERR(0, 725, __pyx_L3_error) | |
11367 } | |
11368 } | |
11369 if (unlikely(kw_args > 0)) { | |
11370 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "overlap") < 0)) __PYX_ERR(0, 725, __pyx_L3_error) | |
11371 } | |
11372 } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { | |
11373 goto __pyx_L5_argtuple_error; | |
11374 } else { | |
11375 values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
11376 values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
11377 values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
11378 values[3] = PyTuple_GET_ITEM(__pyx_args, 3); | |
11379 } | |
11380 __pyx_v_s1 = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_s1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) | |
11381 __pyx_v_s2 = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_s2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) | |
11382 __pyx_v_e1 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_e1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) | |
11383 __pyx_v_e2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_e2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) | |
11384 } | |
11385 goto __pyx_L4_argument_unpacking_done; | |
11386 __pyx_L5_argtuple_error:; | |
11387 __Pyx_RaiseArgtupleInvalid("overlap", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 725, __pyx_L3_error) | |
11388 __pyx_L3_error:; | |
11389 __Pyx_AddTraceback("pybedtools.cbedtools.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
11390 __Pyx_RefNannyFinishContext(); | |
11391 return NULL; | |
11392 __pyx_L4_argument_unpacking_done:; | |
11393 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_2overlap(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_e1, __pyx_v_e2); | |
11394 | |
11395 /* function exit code */ | |
11396 __Pyx_RefNannyFinishContext(); | |
11397 return __pyx_r; | |
11398 } | |
11399 | |
11400 static PyObject *__pyx_pf_10pybedtools_9cbedtools_2overlap(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_s1, int __pyx_v_s2, int __pyx_v_e1, int __pyx_v_e2) { | |
11401 PyObject *__pyx_r = NULL; | |
11402 __Pyx_RefNannyDeclarations | |
11403 int __pyx_t_1; | |
11404 int __pyx_t_2; | |
11405 int __pyx_t_3; | |
11406 int __pyx_t_4; | |
11407 PyObject *__pyx_t_5 = NULL; | |
11408 int __pyx_lineno = 0; | |
11409 const char *__pyx_filename = NULL; | |
11410 int __pyx_clineno = 0; | |
11411 __Pyx_RefNannySetupContext("overlap", 0); | |
11412 | |
11413 /* "pybedtools/cbedtools.pyx":726 | |
11414 * | |
11415 * def overlap(int s1, int s2, int e1, int e2): | |
11416 * return min(e1, e2) - max(s1, s2) # <<<<<<<<<<<<<< | |
11417 * | |
11418 * | |
11419 */ | |
11420 __Pyx_XDECREF(__pyx_r); | |
11421 __pyx_t_1 = __pyx_v_e2; | |
11422 __pyx_t_2 = __pyx_v_e1; | |
11423 if (((__pyx_t_1 < __pyx_t_2) != 0)) { | |
11424 __pyx_t_3 = __pyx_t_1; | |
11425 } else { | |
11426 __pyx_t_3 = __pyx_t_2; | |
11427 } | |
11428 __pyx_t_1 = __pyx_v_s2; | |
11429 __pyx_t_2 = __pyx_v_s1; | |
11430 if (((__pyx_t_1 > __pyx_t_2) != 0)) { | |
11431 __pyx_t_4 = __pyx_t_1; | |
11432 } else { | |
11433 __pyx_t_4 = __pyx_t_2; | |
11434 } | |
11435 __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_t_3 - __pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) | |
11436 __Pyx_GOTREF(__pyx_t_5); | |
11437 __pyx_r = __pyx_t_5; | |
11438 __pyx_t_5 = 0; | |
11439 goto __pyx_L0; | |
11440 | |
11441 /* "pybedtools/cbedtools.pyx":725 | |
11442 * | |
11443 * | |
11444 * def overlap(int s1, int s2, int e1, int e2): # <<<<<<<<<<<<<< | |
11445 * return min(e1, e2) - max(s1, s2) | |
11446 * | |
11447 */ | |
11448 | |
11449 /* function exit code */ | |
11450 __pyx_L1_error:; | |
11451 __Pyx_XDECREF(__pyx_t_5); | |
11452 __Pyx_AddTraceback("pybedtools.cbedtools.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
11453 __pyx_r = NULL; | |
11454 __pyx_L0:; | |
11455 __Pyx_XGIVEREF(__pyx_r); | |
11456 __Pyx_RefNannyFinishContext(); | |
11457 return __pyx_r; | |
11458 } | |
11459 | |
11460 /* "pybedtools/cbedtools.pyx":732 | |
11461 * cdef object stream | |
11462 * cdef int _itemtype | |
11463 * def __init__(self, stream): # <<<<<<<<<<<<<< | |
11464 * self.stream = stream | |
11465 * | |
11466 */ | |
11467 | |
11468 /* Python wrapper */ | |
11469 static int __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
11470 static int __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
11471 PyObject *__pyx_v_stream = 0; | |
11472 int __pyx_lineno = 0; | |
11473 const char *__pyx_filename = NULL; | |
11474 int __pyx_clineno = 0; | |
11475 int __pyx_r; | |
11476 __Pyx_RefNannyDeclarations | |
11477 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); | |
11478 { | |
11479 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stream,0}; | |
11480 PyObject* values[1] = {0}; | |
11481 if (unlikely(__pyx_kwds)) { | |
11482 Py_ssize_t kw_args; | |
11483 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
11484 switch (pos_args) { | |
11485 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
11486 CYTHON_FALLTHROUGH; | |
11487 case 0: break; | |
11488 default: goto __pyx_L5_argtuple_error; | |
11489 } | |
11490 kw_args = PyDict_Size(__pyx_kwds); | |
11491 switch (pos_args) { | |
11492 case 0: | |
11493 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream)) != 0)) kw_args--; | |
11494 else goto __pyx_L5_argtuple_error; | |
11495 } | |
11496 if (unlikely(kw_args > 0)) { | |
11497 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 732, __pyx_L3_error) | |
11498 } | |
11499 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { | |
11500 goto __pyx_L5_argtuple_error; | |
11501 } else { | |
11502 values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
11503 } | |
11504 __pyx_v_stream = values[0]; | |
11505 } | |
11506 goto __pyx_L4_argument_unpacking_done; | |
11507 __pyx_L5_argtuple_error:; | |
11508 __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error) | |
11509 __pyx_L3_error:; | |
11510 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
11511 __Pyx_RefNannyFinishContext(); | |
11512 return -1; | |
11513 __pyx_L4_argument_unpacking_done:; | |
11514 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator___init__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v_self), __pyx_v_stream); | |
11515 | |
11516 /* function exit code */ | |
11517 __Pyx_RefNannyFinishContext(); | |
11518 return __pyx_r; | |
11519 } | |
11520 | |
11521 static int __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator___init__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self, PyObject *__pyx_v_stream) { | |
11522 int __pyx_r; | |
11523 __Pyx_RefNannyDeclarations | |
11524 __Pyx_RefNannySetupContext("__init__", 0); | |
11525 | |
11526 /* "pybedtools/cbedtools.pyx":733 | |
11527 * cdef int _itemtype | |
11528 * def __init__(self, stream): | |
11529 * self.stream = stream # <<<<<<<<<<<<<< | |
11530 * | |
11531 * # For speed, check int rather than call isinstance(). | |
11532 */ | |
11533 __Pyx_INCREF(__pyx_v_stream); | |
11534 __Pyx_GIVEREF(__pyx_v_stream); | |
11535 __Pyx_GOTREF(__pyx_v_self->stream); | |
11536 __Pyx_DECREF(__pyx_v_self->stream); | |
11537 __pyx_v_self->stream = __pyx_v_stream; | |
11538 | |
11539 /* "pybedtools/cbedtools.pyx":740 | |
11540 * # Also assumes that all items in the iterable `stream` are the same | |
11541 * # type...this seems like a reasonable assumption. | |
11542 * self._itemtype = -1 # <<<<<<<<<<<<<< | |
11543 * | |
11544 * def __dealloc__(self): | |
11545 */ | |
11546 __pyx_v_self->_itemtype = -1; | |
11547 | |
11548 /* "pybedtools/cbedtools.pyx":732 | |
11549 * cdef object stream | |
11550 * cdef int _itemtype | |
11551 * def __init__(self, stream): # <<<<<<<<<<<<<< | |
11552 * self.stream = stream | |
11553 * | |
11554 */ | |
11555 | |
11556 /* function exit code */ | |
11557 __pyx_r = 0; | |
11558 __Pyx_RefNannyFinishContext(); | |
11559 return __pyx_r; | |
11560 } | |
11561 | |
11562 /* "pybedtools/cbedtools.pyx":742 | |
11563 * self._itemtype = -1 | |
11564 * | |
11565 * def __dealloc__(self): # <<<<<<<<<<<<<< | |
11566 * try: | |
11567 * self.stream.close() | |
11568 */ | |
11569 | |
11570 /* Python wrapper */ | |
11571 static void __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ | |
11572 static void __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_3__dealloc__(PyObject *__pyx_v_self) { | |
11573 __Pyx_RefNannyDeclarations | |
11574 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); | |
11575 __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_2__dealloc__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v_self)); | |
11576 | |
11577 /* function exit code */ | |
11578 __Pyx_RefNannyFinishContext(); | |
11579 } | |
11580 | |
11581 static void __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_2__dealloc__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self) { | |
11582 __Pyx_RefNannyDeclarations | |
11583 PyObject *__pyx_t_1 = NULL; | |
11584 PyObject *__pyx_t_2 = NULL; | |
11585 PyObject *__pyx_t_3 = NULL; | |
11586 PyObject *__pyx_t_4 = NULL; | |
11587 PyObject *__pyx_t_5 = NULL; | |
11588 PyObject *__pyx_t_6 = NULL; | |
11589 int __pyx_t_7; | |
11590 int __pyx_lineno = 0; | |
11591 const char *__pyx_filename = NULL; | |
11592 int __pyx_clineno = 0; | |
11593 __Pyx_RefNannySetupContext("__dealloc__", 0); | |
11594 | |
11595 /* "pybedtools/cbedtools.pyx":743 | |
11596 * | |
11597 * def __dealloc__(self): | |
11598 * try: # <<<<<<<<<<<<<< | |
11599 * self.stream.close() | |
11600 * except AttributeError: | |
11601 */ | |
11602 { | |
11603 __Pyx_PyThreadState_declare | |
11604 __Pyx_PyThreadState_assign | |
11605 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); | |
11606 __Pyx_XGOTREF(__pyx_t_1); | |
11607 __Pyx_XGOTREF(__pyx_t_2); | |
11608 __Pyx_XGOTREF(__pyx_t_3); | |
11609 /*try:*/ { | |
11610 | |
11611 /* "pybedtools/cbedtools.pyx":744 | |
11612 * def __dealloc__(self): | |
11613 * try: | |
11614 * self.stream.close() # <<<<<<<<<<<<<< | |
11615 * except AttributeError: | |
11616 * pass | |
11617 */ | |
11618 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->stream, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 744, __pyx_L3_error) | |
11619 __Pyx_GOTREF(__pyx_t_5); | |
11620 __pyx_t_6 = NULL; | |
11621 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { | |
11622 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); | |
11623 if (likely(__pyx_t_6)) { | |
11624 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); | |
11625 __Pyx_INCREF(__pyx_t_6); | |
11626 __Pyx_INCREF(function); | |
11627 __Pyx_DECREF_SET(__pyx_t_5, function); | |
11628 } | |
11629 } | |
11630 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); | |
11631 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
11632 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L3_error) | |
11633 __Pyx_GOTREF(__pyx_t_4); | |
11634 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
11635 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
11636 | |
11637 /* "pybedtools/cbedtools.pyx":743 | |
11638 * | |
11639 * def __dealloc__(self): | |
11640 * try: # <<<<<<<<<<<<<< | |
11641 * self.stream.close() | |
11642 * except AttributeError: | |
11643 */ | |
11644 } | |
11645 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
11646 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; | |
11647 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
11648 goto __pyx_L8_try_end; | |
11649 __pyx_L3_error:; | |
11650 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
11651 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
11652 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
11653 | |
11654 /* "pybedtools/cbedtools.pyx":745 | |
11655 * try: | |
11656 * self.stream.close() | |
11657 * except AttributeError: # <<<<<<<<<<<<<< | |
11658 * pass | |
11659 * | |
11660 */ | |
11661 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); | |
11662 if (__pyx_t_7) { | |
11663 __Pyx_ErrRestore(0,0,0); | |
11664 goto __pyx_L4_exception_handled; | |
11665 } | |
11666 goto __pyx_L5_except_error; | |
11667 __pyx_L5_except_error:; | |
11668 | |
11669 /* "pybedtools/cbedtools.pyx":743 | |
11670 * | |
11671 * def __dealloc__(self): | |
11672 * try: # <<<<<<<<<<<<<< | |
11673 * self.stream.close() | |
11674 * except AttributeError: | |
11675 */ | |
11676 __Pyx_XGIVEREF(__pyx_t_1); | |
11677 __Pyx_XGIVEREF(__pyx_t_2); | |
11678 __Pyx_XGIVEREF(__pyx_t_3); | |
11679 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); | |
11680 goto __pyx_L1_error; | |
11681 __pyx_L4_exception_handled:; | |
11682 __Pyx_XGIVEREF(__pyx_t_1); | |
11683 __Pyx_XGIVEREF(__pyx_t_2); | |
11684 __Pyx_XGIVEREF(__pyx_t_3); | |
11685 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); | |
11686 __pyx_L8_try_end:; | |
11687 } | |
11688 | |
11689 /* "pybedtools/cbedtools.pyx":742 | |
11690 * self._itemtype = -1 | |
11691 * | |
11692 * def __dealloc__(self): # <<<<<<<<<<<<<< | |
11693 * try: | |
11694 * self.stream.close() | |
11695 */ | |
11696 | |
11697 /* function exit code */ | |
11698 goto __pyx_L0; | |
11699 __pyx_L1_error:; | |
11700 __Pyx_XDECREF(__pyx_t_4); | |
11701 __Pyx_XDECREF(__pyx_t_5); | |
11702 __Pyx_XDECREF(__pyx_t_6); | |
11703 __Pyx_WriteUnraisable("pybedtools.cbedtools.IntervalIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); | |
11704 __pyx_L0:; | |
11705 __Pyx_RefNannyFinishContext(); | |
11706 } | |
11707 | |
11708 /* "pybedtools/cbedtools.pyx":748 | |
11709 * pass | |
11710 * | |
11711 * def __iter__(self): # <<<<<<<<<<<<<< | |
11712 * return self | |
11713 * | |
11714 */ | |
11715 | |
11716 /* Python wrapper */ | |
11717 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/ | |
11718 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_5__iter__(PyObject *__pyx_v_self) { | |
11719 PyObject *__pyx_r = 0; | |
11720 __Pyx_RefNannyDeclarations | |
11721 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); | |
11722 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_4__iter__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v_self)); | |
11723 | |
11724 /* function exit code */ | |
11725 __Pyx_RefNannyFinishContext(); | |
11726 return __pyx_r; | |
11727 } | |
11728 | |
11729 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_4__iter__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self) { | |
11730 PyObject *__pyx_r = NULL; | |
11731 __Pyx_RefNannyDeclarations | |
11732 __Pyx_RefNannySetupContext("__iter__", 0); | |
11733 | |
11734 /* "pybedtools/cbedtools.pyx":749 | |
11735 * | |
11736 * def __iter__(self): | |
11737 * return self # <<<<<<<<<<<<<< | |
11738 * | |
11739 * def __next__(self): | |
11740 */ | |
11741 __Pyx_XDECREF(__pyx_r); | |
11742 __Pyx_INCREF(((PyObject *)__pyx_v_self)); | |
11743 __pyx_r = ((PyObject *)__pyx_v_self); | |
11744 goto __pyx_L0; | |
11745 | |
11746 /* "pybedtools/cbedtools.pyx":748 | |
11747 * pass | |
11748 * | |
11749 * def __iter__(self): # <<<<<<<<<<<<<< | |
11750 * return self | |
11751 * | |
11752 */ | |
11753 | |
11754 /* function exit code */ | |
11755 __pyx_L0:; | |
11756 __Pyx_XGIVEREF(__pyx_r); | |
11757 __Pyx_RefNannyFinishContext(); | |
11758 return __pyx_r; | |
11759 } | |
11760 | |
11761 /* "pybedtools/cbedtools.pyx":751 | |
11762 * return self | |
11763 * | |
11764 * def __next__(self): # <<<<<<<<<<<<<< | |
11765 * while True: | |
11766 * if hasattr(self.stream, 'closed'): | |
11767 */ | |
11768 | |
11769 /* Python wrapper */ | |
11770 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_7__next__(PyObject *__pyx_v_self); /*proto*/ | |
11771 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_7__next__(PyObject *__pyx_v_self) { | |
11772 PyObject *__pyx_r = 0; | |
11773 __Pyx_RefNannyDeclarations | |
11774 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); | |
11775 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_6__next__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v_self)); | |
11776 | |
11777 /* function exit code */ | |
11778 __Pyx_RefNannyFinishContext(); | |
11779 return __pyx_r; | |
11780 } | |
11781 | |
11782 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_6__next__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self) { | |
11783 PyObject *__pyx_v_line = NULL; | |
11784 PyObject *__pyx_v_fields = NULL; | |
11785 PyObject *__pyx_r = NULL; | |
11786 __Pyx_RefNannyDeclarations | |
11787 PyObject *__pyx_t_1 = NULL; | |
11788 int __pyx_t_2; | |
11789 int __pyx_t_3; | |
11790 PyObject *__pyx_t_4 = NULL; | |
11791 PyObject *__pyx_t_5 = NULL; | |
11792 PyObject *__pyx_t_6 = NULL; | |
11793 PyObject *__pyx_t_7 = NULL; | |
11794 int __pyx_t_8; | |
11795 PyObject *__pyx_t_9 = NULL; | |
11796 PyObject *__pyx_t_10 = NULL; | |
11797 PyObject *__pyx_t_11 = NULL; | |
11798 PyObject *__pyx_t_12 = NULL; | |
11799 Py_ssize_t __pyx_t_13; | |
11800 int __pyx_lineno = 0; | |
11801 const char *__pyx_filename = NULL; | |
11802 int __pyx_clineno = 0; | |
11803 __Pyx_RefNannySetupContext("__next__", 0); | |
11804 | |
11805 /* "pybedtools/cbedtools.pyx":752 | |
11806 * | |
11807 * def __next__(self): | |
11808 * while True: # <<<<<<<<<<<<<< | |
11809 * if hasattr(self.stream, 'closed'): | |
11810 * if self.stream.closed: | |
11811 */ | |
11812 while (1) { | |
11813 | |
11814 /* "pybedtools/cbedtools.pyx":753 | |
11815 * def __next__(self): | |
11816 * while True: | |
11817 * if hasattr(self.stream, 'closed'): # <<<<<<<<<<<<<< | |
11818 * if self.stream.closed: | |
11819 * raise StopIteration | |
11820 */ | |
11821 __pyx_t_1 = __pyx_v_self->stream; | |
11822 __Pyx_INCREF(__pyx_t_1); | |
11823 __pyx_t_2 = __Pyx_HasAttr(__pyx_t_1, __pyx_n_s_closed); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 753, __pyx_L1_error) | |
11824 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
11825 __pyx_t_3 = (__pyx_t_2 != 0); | |
11826 if (__pyx_t_3) { | |
11827 | |
11828 /* "pybedtools/cbedtools.pyx":754 | |
11829 * while True: | |
11830 * if hasattr(self.stream, 'closed'): | |
11831 * if self.stream.closed: # <<<<<<<<<<<<<< | |
11832 * raise StopIteration | |
11833 * try: | |
11834 */ | |
11835 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->stream, __pyx_n_s_closed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) | |
11836 __Pyx_GOTREF(__pyx_t_1); | |
11837 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 754, __pyx_L1_error) | |
11838 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
11839 if (unlikely(__pyx_t_3)) { | |
11840 | |
11841 /* "pybedtools/cbedtools.pyx":755 | |
11842 * if hasattr(self.stream, 'closed'): | |
11843 * if self.stream.closed: | |
11844 * raise StopIteration # <<<<<<<<<<<<<< | |
11845 * try: | |
11846 * line = next(self.stream) | |
11847 */ | |
11848 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); | |
11849 __PYX_ERR(0, 755, __pyx_L1_error) | |
11850 | |
11851 /* "pybedtools/cbedtools.pyx":754 | |
11852 * while True: | |
11853 * if hasattr(self.stream, 'closed'): | |
11854 * if self.stream.closed: # <<<<<<<<<<<<<< | |
11855 * raise StopIteration | |
11856 * try: | |
11857 */ | |
11858 } | |
11859 | |
11860 /* "pybedtools/cbedtools.pyx":753 | |
11861 * def __next__(self): | |
11862 * while True: | |
11863 * if hasattr(self.stream, 'closed'): # <<<<<<<<<<<<<< | |
11864 * if self.stream.closed: | |
11865 * raise StopIteration | |
11866 */ | |
11867 } | |
11868 | |
11869 /* "pybedtools/cbedtools.pyx":756 | |
11870 * if self.stream.closed: | |
11871 * raise StopIteration | |
11872 * try: # <<<<<<<<<<<<<< | |
11873 * line = next(self.stream) | |
11874 * except StopIteration: | |
11875 */ | |
11876 { | |
11877 __Pyx_PyThreadState_declare | |
11878 __Pyx_PyThreadState_assign | |
11879 __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); | |
11880 __Pyx_XGOTREF(__pyx_t_4); | |
11881 __Pyx_XGOTREF(__pyx_t_5); | |
11882 __Pyx_XGOTREF(__pyx_t_6); | |
11883 /*try:*/ { | |
11884 | |
11885 /* "pybedtools/cbedtools.pyx":757 | |
11886 * raise StopIteration | |
11887 * try: | |
11888 * line = next(self.stream) # <<<<<<<<<<<<<< | |
11889 * except StopIteration: | |
11890 * if hasattr(self.stream, 'close'): | |
11891 */ | |
11892 __pyx_t_1 = __pyx_v_self->stream; | |
11893 __Pyx_INCREF(__pyx_t_1); | |
11894 __pyx_t_7 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 757, __pyx_L7_error) | |
11895 __Pyx_GOTREF(__pyx_t_7); | |
11896 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
11897 __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_7); | |
11898 __pyx_t_7 = 0; | |
11899 | |
11900 /* "pybedtools/cbedtools.pyx":756 | |
11901 * if self.stream.closed: | |
11902 * raise StopIteration | |
11903 * try: # <<<<<<<<<<<<<< | |
11904 * line = next(self.stream) | |
11905 * except StopIteration: | |
11906 */ | |
11907 } | |
11908 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
11909 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
11910 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
11911 goto __pyx_L14_try_end; | |
11912 __pyx_L7_error:; | |
11913 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
11914 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
11915 | |
11916 /* "pybedtools/cbedtools.pyx":758 | |
11917 * try: | |
11918 * line = next(self.stream) | |
11919 * except StopIteration: # <<<<<<<<<<<<<< | |
11920 * if hasattr(self.stream, 'close'): | |
11921 * self.stream.close() | |
11922 */ | |
11923 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); | |
11924 if (__pyx_t_8) { | |
11925 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
11926 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 758, __pyx_L9_except_error) | |
11927 __Pyx_GOTREF(__pyx_t_7); | |
11928 __Pyx_GOTREF(__pyx_t_1); | |
11929 __Pyx_GOTREF(__pyx_t_9); | |
11930 | |
11931 /* "pybedtools/cbedtools.pyx":759 | |
11932 * line = next(self.stream) | |
11933 * except StopIteration: | |
11934 * if hasattr(self.stream, 'close'): # <<<<<<<<<<<<<< | |
11935 * self.stream.close() | |
11936 * raise StopIteration | |
11937 */ | |
11938 __pyx_t_10 = __pyx_v_self->stream; | |
11939 __Pyx_INCREF(__pyx_t_10); | |
11940 __pyx_t_3 = __Pyx_HasAttr(__pyx_t_10, __pyx_n_s_close); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 759, __pyx_L9_except_error) | |
11941 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; | |
11942 __pyx_t_2 = (__pyx_t_3 != 0); | |
11943 if (__pyx_t_2) { | |
11944 | |
11945 /* "pybedtools/cbedtools.pyx":760 | |
11946 * except StopIteration: | |
11947 * if hasattr(self.stream, 'close'): | |
11948 * self.stream.close() # <<<<<<<<<<<<<< | |
11949 * raise StopIteration | |
11950 * | |
11951 */ | |
11952 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->stream, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 760, __pyx_L9_except_error) | |
11953 __Pyx_GOTREF(__pyx_t_11); | |
11954 __pyx_t_12 = NULL; | |
11955 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { | |
11956 __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); | |
11957 if (likely(__pyx_t_12)) { | |
11958 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); | |
11959 __Pyx_INCREF(__pyx_t_12); | |
11960 __Pyx_INCREF(function); | |
11961 __Pyx_DECREF_SET(__pyx_t_11, function); | |
11962 } | |
11963 } | |
11964 __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_11); | |
11965 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; | |
11966 if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 760, __pyx_L9_except_error) | |
11967 __Pyx_GOTREF(__pyx_t_10); | |
11968 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
11969 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; | |
11970 | |
11971 /* "pybedtools/cbedtools.pyx":759 | |
11972 * line = next(self.stream) | |
11973 * except StopIteration: | |
11974 * if hasattr(self.stream, 'close'): # <<<<<<<<<<<<<< | |
11975 * self.stream.close() | |
11976 * raise StopIteration | |
11977 */ | |
11978 } | |
11979 | |
11980 /* "pybedtools/cbedtools.pyx":761 | |
11981 * if hasattr(self.stream, 'close'): | |
11982 * self.stream.close() | |
11983 * raise StopIteration # <<<<<<<<<<<<<< | |
11984 * | |
11985 * if self._itemtype < 0: | |
11986 */ | |
11987 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); | |
11988 __PYX_ERR(0, 761, __pyx_L9_except_error) | |
11989 } | |
11990 goto __pyx_L9_except_error; | |
11991 __pyx_L9_except_error:; | |
11992 | |
11993 /* "pybedtools/cbedtools.pyx":756 | |
11994 * if self.stream.closed: | |
11995 * raise StopIteration | |
11996 * try: # <<<<<<<<<<<<<< | |
11997 * line = next(self.stream) | |
11998 * except StopIteration: | |
11999 */ | |
12000 __Pyx_XGIVEREF(__pyx_t_4); | |
12001 __Pyx_XGIVEREF(__pyx_t_5); | |
12002 __Pyx_XGIVEREF(__pyx_t_6); | |
12003 __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); | |
12004 goto __pyx_L1_error; | |
12005 __pyx_L14_try_end:; | |
12006 } | |
12007 | |
12008 /* "pybedtools/cbedtools.pyx":763 | |
12009 * raise StopIteration | |
12010 * | |
12011 * if self._itemtype < 0: # <<<<<<<<<<<<<< | |
12012 * if isinstance(line, Interval): | |
12013 * self._itemtype = 2 | |
12014 */ | |
12015 __pyx_t_2 = ((__pyx_v_self->_itemtype < 0) != 0); | |
12016 if (__pyx_t_2) { | |
12017 | |
12018 /* "pybedtools/cbedtools.pyx":764 | |
12019 * | |
12020 * if self._itemtype < 0: | |
12021 * if isinstance(line, Interval): # <<<<<<<<<<<<<< | |
12022 * self._itemtype = 2 | |
12023 * elif isinstance(line, basestring): | |
12024 */ | |
12025 __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_line, __pyx_ptype_10pybedtools_9cbedtools_Interval); | |
12026 __pyx_t_3 = (__pyx_t_2 != 0); | |
12027 if (__pyx_t_3) { | |
12028 | |
12029 /* "pybedtools/cbedtools.pyx":765 | |
12030 * if self._itemtype < 0: | |
12031 * if isinstance(line, Interval): | |
12032 * self._itemtype = 2 # <<<<<<<<<<<<<< | |
12033 * elif isinstance(line, basestring): | |
12034 * self._itemtype = 1 | |
12035 */ | |
12036 __pyx_v_self->_itemtype = 2; | |
12037 | |
12038 /* "pybedtools/cbedtools.pyx":764 | |
12039 * | |
12040 * if self._itemtype < 0: | |
12041 * if isinstance(line, Interval): # <<<<<<<<<<<<<< | |
12042 * self._itemtype = 2 | |
12043 * elif isinstance(line, basestring): | |
12044 */ | |
12045 goto __pyx_L19; | |
12046 } | |
12047 | |
12048 /* "pybedtools/cbedtools.pyx":766 | |
12049 * if isinstance(line, Interval): | |
12050 * self._itemtype = 2 | |
12051 * elif isinstance(line, basestring): # <<<<<<<<<<<<<< | |
12052 * self._itemtype = 1 | |
12053 * else: | |
12054 */ | |
12055 __pyx_t_3 = __Pyx_PyBaseString_Check(__pyx_v_line); | |
12056 __pyx_t_2 = (__pyx_t_3 != 0); | |
12057 if (__pyx_t_2) { | |
12058 | |
12059 /* "pybedtools/cbedtools.pyx":767 | |
12060 * self._itemtype = 2 | |
12061 * elif isinstance(line, basestring): | |
12062 * self._itemtype = 1 # <<<<<<<<<<<<<< | |
12063 * else: | |
12064 * self._itemtype = 0 | |
12065 */ | |
12066 __pyx_v_self->_itemtype = 1; | |
12067 | |
12068 /* "pybedtools/cbedtools.pyx":766 | |
12069 * if isinstance(line, Interval): | |
12070 * self._itemtype = 2 | |
12071 * elif isinstance(line, basestring): # <<<<<<<<<<<<<< | |
12072 * self._itemtype = 1 | |
12073 * else: | |
12074 */ | |
12075 goto __pyx_L19; | |
12076 } | |
12077 | |
12078 /* "pybedtools/cbedtools.pyx":769 | |
12079 * self._itemtype = 1 | |
12080 * else: | |
12081 * self._itemtype = 0 # <<<<<<<<<<<<<< | |
12082 * | |
12083 * if self._itemtype == 1: | |
12084 */ | |
12085 /*else*/ { | |
12086 __pyx_v_self->_itemtype = 0; | |
12087 } | |
12088 __pyx_L19:; | |
12089 | |
12090 /* "pybedtools/cbedtools.pyx":763 | |
12091 * raise StopIteration | |
12092 * | |
12093 * if self._itemtype < 0: # <<<<<<<<<<<<<< | |
12094 * if isinstance(line, Interval): | |
12095 * self._itemtype = 2 | |
12096 */ | |
12097 } | |
12098 | |
12099 /* "pybedtools/cbedtools.pyx":771 | |
12100 * self._itemtype = 0 | |
12101 * | |
12102 * if self._itemtype == 1: # <<<<<<<<<<<<<< | |
12103 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: | |
12104 * continue | |
12105 */ | |
12106 __pyx_t_2 = ((__pyx_v_self->_itemtype == 1) != 0); | |
12107 if (__pyx_t_2) { | |
12108 | |
12109 /* "pybedtools/cbedtools.pyx":772 | |
12110 * | |
12111 * if self._itemtype == 1: | |
12112 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: # <<<<<<<<<<<<<< | |
12113 * continue | |
12114 * break | |
12115 */ | |
12116 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_startswith); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) | |
12117 __Pyx_GOTREF(__pyx_t_1); | |
12118 __pyx_t_7 = NULL; | |
12119 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { | |
12120 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); | |
12121 if (likely(__pyx_t_7)) { | |
12122 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
12123 __Pyx_INCREF(__pyx_t_7); | |
12124 __Pyx_INCREF(function); | |
12125 __Pyx_DECREF_SET(__pyx_t_1, function); | |
12126 } | |
12127 } | |
12128 __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_tuple__24) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_tuple__24); | |
12129 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
12130 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error) | |
12131 __Pyx_GOTREF(__pyx_t_9); | |
12132 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12133 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 772, __pyx_L1_error) | |
12134 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; | |
12135 if (!__pyx_t_3) { | |
12136 } else { | |
12137 __pyx_t_2 = __pyx_t_3; | |
12138 goto __pyx_L22_bool_binop_done; | |
12139 } | |
12140 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) | |
12141 __Pyx_GOTREF(__pyx_t_1); | |
12142 __pyx_t_7 = NULL; | |
12143 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { | |
12144 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); | |
12145 if (likely(__pyx_t_7)) { | |
12146 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
12147 __Pyx_INCREF(__pyx_t_7); | |
12148 __Pyx_INCREF(function); | |
12149 __Pyx_DECREF_SET(__pyx_t_1, function); | |
12150 } | |
12151 } | |
12152 __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_1); | |
12153 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; | |
12154 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error) | |
12155 __Pyx_GOTREF(__pyx_t_9); | |
12156 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12157 __pyx_t_13 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 772, __pyx_L1_error) | |
12158 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; | |
12159 __pyx_t_3 = ((__pyx_t_13 == 0) != 0); | |
12160 __pyx_t_2 = __pyx_t_3; | |
12161 __pyx_L22_bool_binop_done:; | |
12162 if (__pyx_t_2) { | |
12163 | |
12164 /* "pybedtools/cbedtools.pyx":773 | |
12165 * if self._itemtype == 1: | |
12166 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: | |
12167 * continue # <<<<<<<<<<<<<< | |
12168 * break | |
12169 * | |
12170 */ | |
12171 goto __pyx_L3_continue; | |
12172 | |
12173 /* "pybedtools/cbedtools.pyx":772 | |
12174 * | |
12175 * if self._itemtype == 1: | |
12176 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: # <<<<<<<<<<<<<< | |
12177 * continue | |
12178 * break | |
12179 */ | |
12180 } | |
12181 | |
12182 /* "pybedtools/cbedtools.pyx":771 | |
12183 * self._itemtype = 0 | |
12184 * | |
12185 * if self._itemtype == 1: # <<<<<<<<<<<<<< | |
12186 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: | |
12187 * continue | |
12188 */ | |
12189 } | |
12190 | |
12191 /* "pybedtools/cbedtools.pyx":774 | |
12192 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: | |
12193 * continue | |
12194 * break # <<<<<<<<<<<<<< | |
12195 * | |
12196 * # Iterable of Interval objects | |
12197 */ | |
12198 goto __pyx_L4_break; | |
12199 __pyx_L3_continue:; | |
12200 } | |
12201 __pyx_L4_break:; | |
12202 | |
12203 /* "pybedtools/cbedtools.pyx":777 | |
12204 * | |
12205 * # Iterable of Interval objects | |
12206 * if self._itemtype == 2: # <<<<<<<<<<<<<< | |
12207 * return line | |
12208 * | |
12209 */ | |
12210 switch (__pyx_v_self->_itemtype) { | |
12211 case 2: | |
12212 | |
12213 /* "pybedtools/cbedtools.pyx":778 | |
12214 * # Iterable of Interval objects | |
12215 * if self._itemtype == 2: | |
12216 * return line # <<<<<<<<<<<<<< | |
12217 * | |
12218 * # Iterable of strings, in which case we need to split | |
12219 */ | |
12220 __Pyx_XDECREF(__pyx_r); | |
12221 if (unlikely(!__pyx_v_line)) { __Pyx_RaiseUnboundLocalError("line"); __PYX_ERR(0, 778, __pyx_L1_error) } | |
12222 __Pyx_INCREF(__pyx_v_line); | |
12223 __pyx_r = __pyx_v_line; | |
12224 goto __pyx_L0; | |
12225 | |
12226 /* "pybedtools/cbedtools.pyx":777 | |
12227 * | |
12228 * # Iterable of Interval objects | |
12229 * if self._itemtype == 2: # <<<<<<<<<<<<<< | |
12230 * return line | |
12231 * | |
12232 */ | |
12233 break; | |
12234 case 1: | |
12235 | |
12236 /* "pybedtools/cbedtools.pyx":782 | |
12237 * # Iterable of strings, in which case we need to split | |
12238 * elif self._itemtype == 1: | |
12239 * fields = line.rstrip('\r\n').split('\t') # <<<<<<<<<<<<<< | |
12240 * | |
12241 * # Otherwise assume list/tuple/iterable of fields | |
12242 */ | |
12243 if (unlikely(!__pyx_v_line)) { __Pyx_RaiseUnboundLocalError("line"); __PYX_ERR(0, 782, __pyx_L1_error) } | |
12244 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 782, __pyx_L1_error) | |
12245 __Pyx_GOTREF(__pyx_t_7); | |
12246 __pyx_t_10 = NULL; | |
12247 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { | |
12248 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7); | |
12249 if (likely(__pyx_t_10)) { | |
12250 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); | |
12251 __Pyx_INCREF(__pyx_t_10); | |
12252 __Pyx_INCREF(function); | |
12253 __Pyx_DECREF_SET(__pyx_t_7, function); | |
12254 } | |
12255 } | |
12256 __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_kp_s__25) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s__25); | |
12257 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; | |
12258 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) | |
12259 __Pyx_GOTREF(__pyx_t_1); | |
12260 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
12261 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 782, __pyx_L1_error) | |
12262 __Pyx_GOTREF(__pyx_t_7); | |
12263 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12264 __pyx_t_1 = NULL; | |
12265 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { | |
12266 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); | |
12267 if (likely(__pyx_t_1)) { | |
12268 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); | |
12269 __Pyx_INCREF(__pyx_t_1); | |
12270 __Pyx_INCREF(function); | |
12271 __Pyx_DECREF_SET(__pyx_t_7, function); | |
12272 } | |
12273 } | |
12274 __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_kp_s__8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s__8); | |
12275 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12276 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 782, __pyx_L1_error) | |
12277 __Pyx_GOTREF(__pyx_t_9); | |
12278 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
12279 __pyx_v_fields = __pyx_t_9; | |
12280 __pyx_t_9 = 0; | |
12281 | |
12282 /* "pybedtools/cbedtools.pyx":781 | |
12283 * | |
12284 * # Iterable of strings, in which case we need to split | |
12285 * elif self._itemtype == 1: # <<<<<<<<<<<<<< | |
12286 * fields = line.rstrip('\r\n').split('\t') | |
12287 * | |
12288 */ | |
12289 break; | |
12290 default: | |
12291 | |
12292 /* "pybedtools/cbedtools.pyx":786 | |
12293 * # Otherwise assume list/tuple/iterable of fields | |
12294 * else: | |
12295 * fields = list(line) # <<<<<<<<<<<<<< | |
12296 * | |
12297 * # TODO: optimization: create_interval_from_list should have a version | |
12298 */ | |
12299 if (unlikely(!__pyx_v_line)) { __Pyx_RaiseUnboundLocalError("line"); __PYX_ERR(0, 786, __pyx_L1_error) } | |
12300 __pyx_t_9 = PySequence_List(__pyx_v_line); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 786, __pyx_L1_error) | |
12301 __Pyx_GOTREF(__pyx_t_9); | |
12302 __pyx_v_fields = __pyx_t_9; | |
12303 __pyx_t_9 = 0; | |
12304 break; | |
12305 } | |
12306 | |
12307 /* "pybedtools/cbedtools.pyx":790 | |
12308 * # TODO: optimization: create_interval_from_list should have a version | |
12309 * # that accepts C++ string instances | |
12310 * return create_interval_from_list(fields) # <<<<<<<<<<<<<< | |
12311 * | |
12312 * | |
12313 */ | |
12314 __Pyx_XDECREF(__pyx_r); | |
12315 if (!(likely(PyList_CheckExact(__pyx_v_fields))||((__pyx_v_fields) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_fields)->tp_name), 0))) __PYX_ERR(0, 790, __pyx_L1_error) | |
12316 __pyx_t_9 = ((PyObject *)__pyx_f_10pybedtools_9cbedtools_create_interval_from_list(((PyObject*)__pyx_v_fields), 0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 790, __pyx_L1_error) | |
12317 __Pyx_GOTREF(__pyx_t_9); | |
12318 __pyx_r = __pyx_t_9; | |
12319 __pyx_t_9 = 0; | |
12320 goto __pyx_L0; | |
12321 | |
12322 /* "pybedtools/cbedtools.pyx":751 | |
12323 * return self | |
12324 * | |
12325 * def __next__(self): # <<<<<<<<<<<<<< | |
12326 * while True: | |
12327 * if hasattr(self.stream, 'closed'): | |
12328 */ | |
12329 | |
12330 /* function exit code */ | |
12331 __pyx_L1_error:; | |
12332 __Pyx_XDECREF(__pyx_t_1); | |
12333 __Pyx_XDECREF(__pyx_t_7); | |
12334 __Pyx_XDECREF(__pyx_t_9); | |
12335 __Pyx_XDECREF(__pyx_t_10); | |
12336 __Pyx_XDECREF(__pyx_t_11); | |
12337 __Pyx_XDECREF(__pyx_t_12); | |
12338 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
12339 __pyx_r = NULL; | |
12340 __pyx_L0:; | |
12341 __Pyx_XDECREF(__pyx_v_line); | |
12342 __Pyx_XDECREF(__pyx_v_fields); | |
12343 __Pyx_XGIVEREF(__pyx_r); | |
12344 __Pyx_RefNannyFinishContext(); | |
12345 return __pyx_r; | |
12346 } | |
12347 | |
12348 /* "(tree fragment)":1 | |
12349 * def __reduce_cython__(self): # <<<<<<<<<<<<<< | |
12350 * cdef tuple state | |
12351 * cdef object _dict | |
12352 */ | |
12353 | |
12354 /* Python wrapper */ | |
12355 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
12356 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
12357 PyObject *__pyx_r = 0; | |
12358 __Pyx_RefNannyDeclarations | |
12359 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); | |
12360 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_8__reduce_cython__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v_self)); | |
12361 | |
12362 /* function exit code */ | |
12363 __Pyx_RefNannyFinishContext(); | |
12364 return __pyx_r; | |
12365 } | |
12366 | |
12367 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_8__reduce_cython__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self) { | |
12368 PyObject *__pyx_v_state = 0; | |
12369 PyObject *__pyx_v__dict = 0; | |
12370 int __pyx_v_use_setstate; | |
12371 PyObject *__pyx_r = NULL; | |
12372 __Pyx_RefNannyDeclarations | |
12373 PyObject *__pyx_t_1 = NULL; | |
12374 PyObject *__pyx_t_2 = NULL; | |
12375 int __pyx_t_3; | |
12376 int __pyx_t_4; | |
12377 PyObject *__pyx_t_5 = NULL; | |
12378 int __pyx_lineno = 0; | |
12379 const char *__pyx_filename = NULL; | |
12380 int __pyx_clineno = 0; | |
12381 __Pyx_RefNannySetupContext("__reduce_cython__", 0); | |
12382 | |
12383 /* "(tree fragment)":5 | |
12384 * cdef object _dict | |
12385 * cdef bint use_setstate | |
12386 * state = (self._itemtype, self.stream) # <<<<<<<<<<<<<< | |
12387 * _dict = getattr(self, '__dict__', None) | |
12388 * if _dict is not None: | |
12389 */ | |
12390 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_itemtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) | |
12391 __Pyx_GOTREF(__pyx_t_1); | |
12392 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) | |
12393 __Pyx_GOTREF(__pyx_t_2); | |
12394 __Pyx_GIVEREF(__pyx_t_1); | |
12395 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); | |
12396 __Pyx_INCREF(__pyx_v_self->stream); | |
12397 __Pyx_GIVEREF(__pyx_v_self->stream); | |
12398 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->stream); | |
12399 __pyx_t_1 = 0; | |
12400 __pyx_v_state = ((PyObject*)__pyx_t_2); | |
12401 __pyx_t_2 = 0; | |
12402 | |
12403 /* "(tree fragment)":6 | |
12404 * cdef bint use_setstate | |
12405 * state = (self._itemtype, self.stream) | |
12406 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< | |
12407 * if _dict is not None: | |
12408 * state += (_dict,) | |
12409 */ | |
12410 __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) | |
12411 __Pyx_GOTREF(__pyx_t_2); | |
12412 __pyx_v__dict = __pyx_t_2; | |
12413 __pyx_t_2 = 0; | |
12414 | |
12415 /* "(tree fragment)":7 | |
12416 * state = (self._itemtype, self.stream) | |
12417 * _dict = getattr(self, '__dict__', None) | |
12418 * if _dict is not None: # <<<<<<<<<<<<<< | |
12419 * state += (_dict,) | |
12420 * use_setstate = True | |
12421 */ | |
12422 __pyx_t_3 = (__pyx_v__dict != Py_None); | |
12423 __pyx_t_4 = (__pyx_t_3 != 0); | |
12424 if (__pyx_t_4) { | |
12425 | |
12426 /* "(tree fragment)":8 | |
12427 * _dict = getattr(self, '__dict__', None) | |
12428 * if _dict is not None: | |
12429 * state += (_dict,) # <<<<<<<<<<<<<< | |
12430 * use_setstate = True | |
12431 * else: | |
12432 */ | |
12433 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error) | |
12434 __Pyx_GOTREF(__pyx_t_2); | |
12435 __Pyx_INCREF(__pyx_v__dict); | |
12436 __Pyx_GIVEREF(__pyx_v__dict); | |
12437 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict); | |
12438 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) | |
12439 __Pyx_GOTREF(__pyx_t_1); | |
12440 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
12441 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1)); | |
12442 __pyx_t_1 = 0; | |
12443 | |
12444 /* "(tree fragment)":9 | |
12445 * if _dict is not None: | |
12446 * state += (_dict,) | |
12447 * use_setstate = True # <<<<<<<<<<<<<< | |
12448 * else: | |
12449 * use_setstate = self.stream is not None | |
12450 */ | |
12451 __pyx_v_use_setstate = 1; | |
12452 | |
12453 /* "(tree fragment)":7 | |
12454 * state = (self._itemtype, self.stream) | |
12455 * _dict = getattr(self, '__dict__', None) | |
12456 * if _dict is not None: # <<<<<<<<<<<<<< | |
12457 * state += (_dict,) | |
12458 * use_setstate = True | |
12459 */ | |
12460 goto __pyx_L3; | |
12461 } | |
12462 | |
12463 /* "(tree fragment)":11 | |
12464 * use_setstate = True | |
12465 * else: | |
12466 * use_setstate = self.stream is not None # <<<<<<<<<<<<<< | |
12467 * if use_setstate: | |
12468 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, None), state | |
12469 */ | |
12470 /*else*/ { | |
12471 __pyx_t_4 = (__pyx_v_self->stream != Py_None); | |
12472 __pyx_v_use_setstate = __pyx_t_4; | |
12473 } | |
12474 __pyx_L3:; | |
12475 | |
12476 /* "(tree fragment)":12 | |
12477 * else: | |
12478 * use_setstate = self.stream is not None | |
12479 * if use_setstate: # <<<<<<<<<<<<<< | |
12480 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, None), state | |
12481 * else: | |
12482 */ | |
12483 __pyx_t_4 = (__pyx_v_use_setstate != 0); | |
12484 if (__pyx_t_4) { | |
12485 | |
12486 /* "(tree fragment)":13 | |
12487 * use_setstate = self.stream is not None | |
12488 * if use_setstate: | |
12489 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, None), state # <<<<<<<<<<<<<< | |
12490 * else: | |
12491 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, state) | |
12492 */ | |
12493 __Pyx_XDECREF(__pyx_r); | |
12494 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_IntervalIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) | |
12495 __Pyx_GOTREF(__pyx_t_1); | |
12496 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) | |
12497 __Pyx_GOTREF(__pyx_t_2); | |
12498 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); | |
12499 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); | |
12500 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); | |
12501 __Pyx_INCREF(__pyx_int_22915542); | |
12502 __Pyx_GIVEREF(__pyx_int_22915542); | |
12503 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_22915542); | |
12504 __Pyx_INCREF(Py_None); | |
12505 __Pyx_GIVEREF(Py_None); | |
12506 PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None); | |
12507 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) | |
12508 __Pyx_GOTREF(__pyx_t_5); | |
12509 __Pyx_GIVEREF(__pyx_t_1); | |
12510 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); | |
12511 __Pyx_GIVEREF(__pyx_t_2); | |
12512 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); | |
12513 __Pyx_INCREF(__pyx_v_state); | |
12514 __Pyx_GIVEREF(__pyx_v_state); | |
12515 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); | |
12516 __pyx_t_1 = 0; | |
12517 __pyx_t_2 = 0; | |
12518 __pyx_r = __pyx_t_5; | |
12519 __pyx_t_5 = 0; | |
12520 goto __pyx_L0; | |
12521 | |
12522 /* "(tree fragment)":12 | |
12523 * else: | |
12524 * use_setstate = self.stream is not None | |
12525 * if use_setstate: # <<<<<<<<<<<<<< | |
12526 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, None), state | |
12527 * else: | |
12528 */ | |
12529 } | |
12530 | |
12531 /* "(tree fragment)":15 | |
12532 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, None), state | |
12533 * else: | |
12534 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, state) # <<<<<<<<<<<<<< | |
12535 * def __setstate_cython__(self, __pyx_state): | |
12536 * __pyx_unpickle_IntervalIterator__set_state(self, __pyx_state) | |
12537 */ | |
12538 /*else*/ { | |
12539 __Pyx_XDECREF(__pyx_r); | |
12540 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_IntervalIterator); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) | |
12541 __Pyx_GOTREF(__pyx_t_5); | |
12542 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) | |
12543 __Pyx_GOTREF(__pyx_t_2); | |
12544 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); | |
12545 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); | |
12546 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); | |
12547 __Pyx_INCREF(__pyx_int_22915542); | |
12548 __Pyx_GIVEREF(__pyx_int_22915542); | |
12549 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_22915542); | |
12550 __Pyx_INCREF(__pyx_v_state); | |
12551 __Pyx_GIVEREF(__pyx_v_state); | |
12552 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state); | |
12553 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) | |
12554 __Pyx_GOTREF(__pyx_t_1); | |
12555 __Pyx_GIVEREF(__pyx_t_5); | |
12556 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); | |
12557 __Pyx_GIVEREF(__pyx_t_2); | |
12558 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); | |
12559 __pyx_t_5 = 0; | |
12560 __pyx_t_2 = 0; | |
12561 __pyx_r = __pyx_t_1; | |
12562 __pyx_t_1 = 0; | |
12563 goto __pyx_L0; | |
12564 } | |
12565 | |
12566 /* "(tree fragment)":1 | |
12567 * def __reduce_cython__(self): # <<<<<<<<<<<<<< | |
12568 * cdef tuple state | |
12569 * cdef object _dict | |
12570 */ | |
12571 | |
12572 /* function exit code */ | |
12573 __pyx_L1_error:; | |
12574 __Pyx_XDECREF(__pyx_t_1); | |
12575 __Pyx_XDECREF(__pyx_t_2); | |
12576 __Pyx_XDECREF(__pyx_t_5); | |
12577 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
12578 __pyx_r = NULL; | |
12579 __pyx_L0:; | |
12580 __Pyx_XDECREF(__pyx_v_state); | |
12581 __Pyx_XDECREF(__pyx_v__dict); | |
12582 __Pyx_XGIVEREF(__pyx_r); | |
12583 __Pyx_RefNannyFinishContext(); | |
12584 return __pyx_r; | |
12585 } | |
12586 | |
12587 /* "(tree fragment)":16 | |
12588 * else: | |
12589 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, state) | |
12590 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< | |
12591 * __pyx_unpickle_IntervalIterator__set_state(self, __pyx_state) | |
12592 */ | |
12593 | |
12594 /* Python wrapper */ | |
12595 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ | |
12596 static PyObject *__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { | |
12597 PyObject *__pyx_r = 0; | |
12598 __Pyx_RefNannyDeclarations | |
12599 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); | |
12600 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_10__setstate_cython__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); | |
12601 | |
12602 /* function exit code */ | |
12603 __Pyx_RefNannyFinishContext(); | |
12604 return __pyx_r; | |
12605 } | |
12606 | |
12607 static PyObject *__pyx_pf_10pybedtools_9cbedtools_16IntervalIterator_10__setstate_cython__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v_self, PyObject *__pyx_v___pyx_state) { | |
12608 PyObject *__pyx_r = NULL; | |
12609 __Pyx_RefNannyDeclarations | |
12610 PyObject *__pyx_t_1 = NULL; | |
12611 int __pyx_lineno = 0; | |
12612 const char *__pyx_filename = NULL; | |
12613 int __pyx_clineno = 0; | |
12614 __Pyx_RefNannySetupContext("__setstate_cython__", 0); | |
12615 | |
12616 /* "(tree fragment)":17 | |
12617 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, state) | |
12618 * def __setstate_cython__(self, __pyx_state): | |
12619 * __pyx_unpickle_IntervalIterator__set_state(self, __pyx_state) # <<<<<<<<<<<<<< | |
12620 */ | |
12621 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)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) | |
12622 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools___pyx_unpickle_IntervalIterator__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) | |
12623 __Pyx_GOTREF(__pyx_t_1); | |
12624 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12625 | |
12626 /* "(tree fragment)":16 | |
12627 * else: | |
12628 * return __pyx_unpickle_IntervalIterator, (type(self), 0x15da9d6, state) | |
12629 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< | |
12630 * __pyx_unpickle_IntervalIterator__set_state(self, __pyx_state) | |
12631 */ | |
12632 | |
12633 /* function exit code */ | |
12634 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
12635 goto __pyx_L0; | |
12636 __pyx_L1_error:; | |
12637 __Pyx_XDECREF(__pyx_t_1); | |
12638 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
12639 __pyx_r = NULL; | |
12640 __pyx_L0:; | |
12641 __Pyx_XGIVEREF(__pyx_r); | |
12642 __Pyx_RefNannyFinishContext(); | |
12643 return __pyx_r; | |
12644 } | |
12645 | |
12646 /* "pybedtools/cbedtools.pyx":806 | |
12647 * | |
12648 * """ | |
12649 * def __init__(self, intervalFile): # <<<<<<<<<<<<<< | |
12650 * self.intervalFile_ptr = new BedFile(_cppstr(intervalFile)) | |
12651 * self._loaded = 0 | |
12652 */ | |
12653 | |
12654 /* Python wrapper */ | |
12655 static int __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
12656 static int __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
12657 PyObject *__pyx_v_intervalFile = 0; | |
12658 int __pyx_lineno = 0; | |
12659 const char *__pyx_filename = NULL; | |
12660 int __pyx_clineno = 0; | |
12661 int __pyx_r; | |
12662 __Pyx_RefNannyDeclarations | |
12663 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); | |
12664 { | |
12665 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_intervalFile,0}; | |
12666 PyObject* values[1] = {0}; | |
12667 if (unlikely(__pyx_kwds)) { | |
12668 Py_ssize_t kw_args; | |
12669 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
12670 switch (pos_args) { | |
12671 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
12672 CYTHON_FALLTHROUGH; | |
12673 case 0: break; | |
12674 default: goto __pyx_L5_argtuple_error; | |
12675 } | |
12676 kw_args = PyDict_Size(__pyx_kwds); | |
12677 switch (pos_args) { | |
12678 case 0: | |
12679 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intervalFile)) != 0)) kw_args--; | |
12680 else goto __pyx_L5_argtuple_error; | |
12681 } | |
12682 if (unlikely(kw_args > 0)) { | |
12683 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 806, __pyx_L3_error) | |
12684 } | |
12685 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { | |
12686 goto __pyx_L5_argtuple_error; | |
12687 } else { | |
12688 values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
12689 } | |
12690 __pyx_v_intervalFile = values[0]; | |
12691 } | |
12692 goto __pyx_L4_argument_unpacking_done; | |
12693 __pyx_L5_argtuple_error:; | |
12694 __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 806, __pyx_L3_error) | |
12695 __pyx_L3_error:; | |
12696 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
12697 __Pyx_RefNannyFinishContext(); | |
12698 return -1; | |
12699 __pyx_L4_argument_unpacking_done:; | |
12700 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile___init__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self), __pyx_v_intervalFile); | |
12701 | |
12702 /* function exit code */ | |
12703 __Pyx_RefNannyFinishContext(); | |
12704 return __pyx_r; | |
12705 } | |
12706 | |
12707 static int __pyx_pf_10pybedtools_9cbedtools_12IntervalFile___init__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, PyObject *__pyx_v_intervalFile) { | |
12708 int __pyx_r; | |
12709 __Pyx_RefNannyDeclarations | |
12710 PyObject *__pyx_t_1 = NULL; | |
12711 std::string __pyx_t_2; | |
12712 int __pyx_lineno = 0; | |
12713 const char *__pyx_filename = NULL; | |
12714 int __pyx_clineno = 0; | |
12715 __Pyx_RefNannySetupContext("__init__", 0); | |
12716 | |
12717 /* "pybedtools/cbedtools.pyx":807 | |
12718 * """ | |
12719 * def __init__(self, intervalFile): | |
12720 * self.intervalFile_ptr = new BedFile(_cppstr(intervalFile)) # <<<<<<<<<<<<<< | |
12721 * self._loaded = 0 | |
12722 * self._open = 0 | |
12723 */ | |
12724 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_intervalFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error) | |
12725 __Pyx_GOTREF(__pyx_t_1); | |
12726 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L1_error) | |
12727 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12728 __pyx_v_self->intervalFile_ptr = new BedFile(__pyx_t_2); | |
12729 | |
12730 /* "pybedtools/cbedtools.pyx":808 | |
12731 * def __init__(self, intervalFile): | |
12732 * self.intervalFile_ptr = new BedFile(_cppstr(intervalFile)) | |
12733 * self._loaded = 0 # <<<<<<<<<<<<<< | |
12734 * self._open = 0 | |
12735 * self._fn = _cppstr(intervalFile) | |
12736 */ | |
12737 __pyx_v_self->_loaded = 0; | |
12738 | |
12739 /* "pybedtools/cbedtools.pyx":809 | |
12740 * self.intervalFile_ptr = new BedFile(_cppstr(intervalFile)) | |
12741 * self._loaded = 0 | |
12742 * self._open = 0 # <<<<<<<<<<<<<< | |
12743 * self._fn = _cppstr(intervalFile) | |
12744 * | |
12745 */ | |
12746 __pyx_v_self->_open = 0; | |
12747 | |
12748 /* "pybedtools/cbedtools.pyx":810 | |
12749 * self._loaded = 0 | |
12750 * self._open = 0 | |
12751 * self._fn = _cppstr(intervalFile) # <<<<<<<<<<<<<< | |
12752 * | |
12753 * def __dealloc__(self): | |
12754 */ | |
12755 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__cppstr(__pyx_v_intervalFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error) | |
12756 __Pyx_GOTREF(__pyx_t_1); | |
12757 __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 810, __pyx_L1_error) | |
12758 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
12759 __pyx_v_self->_fn = __pyx_t_2; | |
12760 | |
12761 /* "pybedtools/cbedtools.pyx":806 | |
12762 * | |
12763 * """ | |
12764 * def __init__(self, intervalFile): # <<<<<<<<<<<<<< | |
12765 * self.intervalFile_ptr = new BedFile(_cppstr(intervalFile)) | |
12766 * self._loaded = 0 | |
12767 */ | |
12768 | |
12769 /* function exit code */ | |
12770 __pyx_r = 0; | |
12771 goto __pyx_L0; | |
12772 __pyx_L1_error:; | |
12773 __Pyx_XDECREF(__pyx_t_1); | |
12774 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
12775 __pyx_r = -1; | |
12776 __pyx_L0:; | |
12777 __Pyx_RefNannyFinishContext(); | |
12778 return __pyx_r; | |
12779 } | |
12780 | |
12781 /* "pybedtools/cbedtools.pyx":812 | |
12782 * self._fn = _cppstr(intervalFile) | |
12783 * | |
12784 * def __dealloc__(self): # <<<<<<<<<<<<<< | |
12785 * del self.intervalFile_ptr | |
12786 * | |
12787 */ | |
12788 | |
12789 /* Python wrapper */ | |
12790 static void __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ | |
12791 static void __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_3__dealloc__(PyObject *__pyx_v_self) { | |
12792 __Pyx_RefNannyDeclarations | |
12793 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); | |
12794 __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_2__dealloc__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
12795 | |
12796 /* function exit code */ | |
12797 __Pyx_RefNannyFinishContext(); | |
12798 } | |
12799 | |
12800 static void __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_2__dealloc__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
12801 __Pyx_RefNannyDeclarations | |
12802 __Pyx_RefNannySetupContext("__dealloc__", 0); | |
12803 | |
12804 /* "pybedtools/cbedtools.pyx":813 | |
12805 * | |
12806 * def __dealloc__(self): | |
12807 * del self.intervalFile_ptr # <<<<<<<<<<<<<< | |
12808 * | |
12809 * def __iter__(self): | |
12810 */ | |
12811 delete __pyx_v_self->intervalFile_ptr; | |
12812 | |
12813 /* "pybedtools/cbedtools.pyx":812 | |
12814 * self._fn = _cppstr(intervalFile) | |
12815 * | |
12816 * def __dealloc__(self): # <<<<<<<<<<<<<< | |
12817 * del self.intervalFile_ptr | |
12818 * | |
12819 */ | |
12820 | |
12821 /* function exit code */ | |
12822 __Pyx_RefNannyFinishContext(); | |
12823 } | |
12824 | |
12825 /* "pybedtools/cbedtools.pyx":815 | |
12826 * del self.intervalFile_ptr | |
12827 * | |
12828 * def __iter__(self): # <<<<<<<<<<<<<< | |
12829 * return self | |
12830 * | |
12831 */ | |
12832 | |
12833 /* Python wrapper */ | |
12834 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_5__iter__(PyObject *__pyx_v_self); /*proto*/ | |
12835 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_5__iter__(PyObject *__pyx_v_self) { | |
12836 PyObject *__pyx_r = 0; | |
12837 __Pyx_RefNannyDeclarations | |
12838 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); | |
12839 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_4__iter__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
12840 | |
12841 /* function exit code */ | |
12842 __Pyx_RefNannyFinishContext(); | |
12843 return __pyx_r; | |
12844 } | |
12845 | |
12846 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_4__iter__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
12847 PyObject *__pyx_r = NULL; | |
12848 __Pyx_RefNannyDeclarations | |
12849 __Pyx_RefNannySetupContext("__iter__", 0); | |
12850 | |
12851 /* "pybedtools/cbedtools.pyx":816 | |
12852 * | |
12853 * def __iter__(self): | |
12854 * return self # <<<<<<<<<<<<<< | |
12855 * | |
12856 * def __next__(self): | |
12857 */ | |
12858 __Pyx_XDECREF(__pyx_r); | |
12859 __Pyx_INCREF(((PyObject *)__pyx_v_self)); | |
12860 __pyx_r = ((PyObject *)__pyx_v_self); | |
12861 goto __pyx_L0; | |
12862 | |
12863 /* "pybedtools/cbedtools.pyx":815 | |
12864 * del self.intervalFile_ptr | |
12865 * | |
12866 * def __iter__(self): # <<<<<<<<<<<<<< | |
12867 * return self | |
12868 * | |
12869 */ | |
12870 | |
12871 /* function exit code */ | |
12872 __pyx_L0:; | |
12873 __Pyx_XGIVEREF(__pyx_r); | |
12874 __Pyx_RefNannyFinishContext(); | |
12875 return __pyx_r; | |
12876 } | |
12877 | |
12878 /* "pybedtools/cbedtools.pyx":818 | |
12879 * return self | |
12880 * | |
12881 * def __next__(self): # <<<<<<<<<<<<<< | |
12882 * if not self._open: | |
12883 * result = self.intervalFile_ptr.Open() | |
12884 */ | |
12885 | |
12886 /* Python wrapper */ | |
12887 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_7__next__(PyObject *__pyx_v_self); /*proto*/ | |
12888 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_7__next__(PyObject *__pyx_v_self) { | |
12889 PyObject *__pyx_r = 0; | |
12890 __Pyx_RefNannyDeclarations | |
12891 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); | |
12892 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_6__next__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
12893 | |
12894 /* function exit code */ | |
12895 __Pyx_RefNannyFinishContext(); | |
12896 return __pyx_r; | |
12897 } | |
12898 | |
12899 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_6__next__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
12900 int __pyx_v_result; | |
12901 BED __pyx_v_b; | |
12902 PyObject *__pyx_r = NULL; | |
12903 __Pyx_RefNannyDeclarations | |
12904 int __pyx_t_1; | |
12905 PyObject *__pyx_t_2 = NULL; | |
12906 PyObject *__pyx_t_3 = NULL; | |
12907 PyObject *__pyx_t_4 = NULL; | |
12908 PyObject *__pyx_t_5 = NULL; | |
12909 int __pyx_lineno = 0; | |
12910 const char *__pyx_filename = NULL; | |
12911 int __pyx_clineno = 0; | |
12912 __Pyx_RefNannySetupContext("__next__", 0); | |
12913 | |
12914 /* "pybedtools/cbedtools.pyx":819 | |
12915 * | |
12916 * def __next__(self): | |
12917 * if not self._open: # <<<<<<<<<<<<<< | |
12918 * result = self.intervalFile_ptr.Open() | |
12919 * if result == -1: | |
12920 */ | |
12921 __pyx_t_1 = ((!(__pyx_v_self->_open != 0)) != 0); | |
12922 if (__pyx_t_1) { | |
12923 | |
12924 /* "pybedtools/cbedtools.pyx":820 | |
12925 * def __next__(self): | |
12926 * if not self._open: | |
12927 * result = self.intervalFile_ptr.Open() # <<<<<<<<<<<<<< | |
12928 * if result == -1: | |
12929 * raise BedToolsFileError("Error opening file") | |
12930 */ | |
12931 __pyx_v_result = __pyx_v_self->intervalFile_ptr->Open(); | |
12932 | |
12933 /* "pybedtools/cbedtools.pyx":821 | |
12934 * if not self._open: | |
12935 * result = self.intervalFile_ptr.Open() | |
12936 * if result == -1: # <<<<<<<<<<<<<< | |
12937 * raise BedToolsFileError("Error opening file") | |
12938 * self._open = 1 | |
12939 */ | |
12940 __pyx_t_1 = ((__pyx_v_result == -1L) != 0); | |
12941 if (unlikely(__pyx_t_1)) { | |
12942 | |
12943 /* "pybedtools/cbedtools.pyx":822 | |
12944 * result = self.intervalFile_ptr.Open() | |
12945 * if result == -1: | |
12946 * raise BedToolsFileError("Error opening file") # <<<<<<<<<<<<<< | |
12947 * self._open = 1 | |
12948 * cdef BED b = self.intervalFile_ptr.GetNextBed() | |
12949 */ | |
12950 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BedToolsFileError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 822, __pyx_L1_error) | |
12951 __Pyx_GOTREF(__pyx_t_3); | |
12952 __pyx_t_4 = NULL; | |
12953 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { | |
12954 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); | |
12955 if (likely(__pyx_t_4)) { | |
12956 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); | |
12957 __Pyx_INCREF(__pyx_t_4); | |
12958 __Pyx_INCREF(function); | |
12959 __Pyx_DECREF_SET(__pyx_t_3, function); | |
12960 } | |
12961 } | |
12962 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_Error_opening_file) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Error_opening_file); | |
12963 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
12964 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) | |
12965 __Pyx_GOTREF(__pyx_t_2); | |
12966 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
12967 __Pyx_Raise(__pyx_t_2, 0, 0, 0); | |
12968 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
12969 __PYX_ERR(0, 822, __pyx_L1_error) | |
12970 | |
12971 /* "pybedtools/cbedtools.pyx":821 | |
12972 * if not self._open: | |
12973 * result = self.intervalFile_ptr.Open() | |
12974 * if result == -1: # <<<<<<<<<<<<<< | |
12975 * raise BedToolsFileError("Error opening file") | |
12976 * self._open = 1 | |
12977 */ | |
12978 } | |
12979 | |
12980 /* "pybedtools/cbedtools.pyx":823 | |
12981 * if result == -1: | |
12982 * raise BedToolsFileError("Error opening file") | |
12983 * self._open = 1 # <<<<<<<<<<<<<< | |
12984 * cdef BED b = self.intervalFile_ptr.GetNextBed() | |
12985 * if b.status == BED_VALID: | |
12986 */ | |
12987 __pyx_v_self->_open = 1; | |
12988 | |
12989 /* "pybedtools/cbedtools.pyx":819 | |
12990 * | |
12991 * def __next__(self): | |
12992 * if not self._open: # <<<<<<<<<<<<<< | |
12993 * result = self.intervalFile_ptr.Open() | |
12994 * if result == -1: | |
12995 */ | |
12996 } | |
12997 | |
12998 /* "pybedtools/cbedtools.pyx":824 | |
12999 * raise BedToolsFileError("Error opening file") | |
13000 * self._open = 1 | |
13001 * cdef BED b = self.intervalFile_ptr.GetNextBed() # <<<<<<<<<<<<<< | |
13002 * if b.status == BED_VALID: | |
13003 * return create_interval(b) | |
13004 */ | |
13005 __pyx_v_b = __pyx_v_self->intervalFile_ptr->GetNextBed(); | |
13006 | |
13007 /* "pybedtools/cbedtools.pyx":825 | |
13008 * self._open = 1 | |
13009 * cdef BED b = self.intervalFile_ptr.GetNextBed() | |
13010 * if b.status == BED_VALID: # <<<<<<<<<<<<<< | |
13011 * return create_interval(b) | |
13012 * elif b.status == BED_INVALID: | |
13013 */ | |
13014 switch (__pyx_v_b.status) { | |
13015 case BED_VALID: | |
13016 | |
13017 /* "pybedtools/cbedtools.pyx":826 | |
13018 * cdef BED b = self.intervalFile_ptr.GetNextBed() | |
13019 * if b.status == BED_VALID: | |
13020 * return create_interval(b) # <<<<<<<<<<<<<< | |
13021 * elif b.status == BED_INVALID: | |
13022 * self.intervalFile_ptr.Close() | |
13023 */ | |
13024 __Pyx_XDECREF(__pyx_r); | |
13025 __pyx_t_2 = ((PyObject *)__pyx_f_10pybedtools_9cbedtools_create_interval(__pyx_v_b)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error) | |
13026 __Pyx_GOTREF(__pyx_t_2); | |
13027 __pyx_r = __pyx_t_2; | |
13028 __pyx_t_2 = 0; | |
13029 goto __pyx_L0; | |
13030 | |
13031 /* "pybedtools/cbedtools.pyx":825 | |
13032 * self._open = 1 | |
13033 * cdef BED b = self.intervalFile_ptr.GetNextBed() | |
13034 * if b.status == BED_VALID: # <<<<<<<<<<<<<< | |
13035 * return create_interval(b) | |
13036 * elif b.status == BED_INVALID: | |
13037 */ | |
13038 break; | |
13039 case BED_INVALID: | |
13040 | |
13041 /* "pybedtools/cbedtools.pyx":828 | |
13042 * return create_interval(b) | |
13043 * elif b.status == BED_INVALID: | |
13044 * self.intervalFile_ptr.Close() # <<<<<<<<<<<<<< | |
13045 * raise StopIteration | |
13046 * elif b.status == BED_MALFORMED: | |
13047 */ | |
13048 __pyx_v_self->intervalFile_ptr->Close(); | |
13049 | |
13050 /* "pybedtools/cbedtools.pyx":829 | |
13051 * elif b.status == BED_INVALID: | |
13052 * self.intervalFile_ptr.Close() | |
13053 * raise StopIteration # <<<<<<<<<<<<<< | |
13054 * elif b.status == BED_MALFORMED: | |
13055 * self.intervalFile_ptr.Close() | |
13056 */ | |
13057 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); | |
13058 __PYX_ERR(0, 829, __pyx_L1_error) | |
13059 | |
13060 /* "pybedtools/cbedtools.pyx":827 | |
13061 * if b.status == BED_VALID: | |
13062 * return create_interval(b) | |
13063 * elif b.status == BED_INVALID: # <<<<<<<<<<<<<< | |
13064 * self.intervalFile_ptr.Close() | |
13065 * raise StopIteration | |
13066 */ | |
13067 break; | |
13068 case BED_MALFORMED: | |
13069 | |
13070 /* "pybedtools/cbedtools.pyx":831 | |
13071 * raise StopIteration | |
13072 * elif b.status == BED_MALFORMED: | |
13073 * self.intervalFile_ptr.Close() # <<<<<<<<<<<<<< | |
13074 * raise MalformedBedLineError("malformed line: %s" % string_vec2list(b.fields)) | |
13075 * else: | |
13076 */ | |
13077 __pyx_v_self->intervalFile_ptr->Close(); | |
13078 | |
13079 /* "pybedtools/cbedtools.pyx":832 | |
13080 * elif b.status == BED_MALFORMED: | |
13081 * self.intervalFile_ptr.Close() | |
13082 * raise MalformedBedLineError("malformed line: %s" % string_vec2list(b.fields)) # <<<<<<<<<<<<<< | |
13083 * else: | |
13084 * return next(self) | |
13085 */ | |
13086 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MalformedBedLineError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error) | |
13087 __Pyx_GOTREF(__pyx_t_3); | |
13088 __pyx_t_4 = __pyx_f_10pybedtools_9cbedtools_string_vec2list(__pyx_v_b.fields); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 832, __pyx_L1_error) | |
13089 __Pyx_GOTREF(__pyx_t_4); | |
13090 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_malformed_line_s, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error) | |
13091 __Pyx_GOTREF(__pyx_t_5); | |
13092 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
13093 __pyx_t_4 = NULL; | |
13094 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { | |
13095 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); | |
13096 if (likely(__pyx_t_4)) { | |
13097 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); | |
13098 __Pyx_INCREF(__pyx_t_4); | |
13099 __Pyx_INCREF(function); | |
13100 __Pyx_DECREF_SET(__pyx_t_3, function); | |
13101 } | |
13102 } | |
13103 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); | |
13104 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; | |
13105 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
13106 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error) | |
13107 __Pyx_GOTREF(__pyx_t_2); | |
13108 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | |
13109 __Pyx_Raise(__pyx_t_2, 0, 0, 0); | |
13110 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
13111 __PYX_ERR(0, 832, __pyx_L1_error) | |
13112 | |
13113 /* "pybedtools/cbedtools.pyx":830 | |
13114 * self.intervalFile_ptr.Close() | |
13115 * raise StopIteration | |
13116 * elif b.status == BED_MALFORMED: # <<<<<<<<<<<<<< | |
13117 * self.intervalFile_ptr.Close() | |
13118 * raise MalformedBedLineError("malformed line: %s" % string_vec2list(b.fields)) | |
13119 */ | |
13120 break; | |
13121 default: | |
13122 | |
13123 /* "pybedtools/cbedtools.pyx":834 | |
13124 * raise MalformedBedLineError("malformed line: %s" % string_vec2list(b.fields)) | |
13125 * else: | |
13126 * return next(self) # <<<<<<<<<<<<<< | |
13127 * | |
13128 * @property | |
13129 */ | |
13130 __Pyx_XDECREF(__pyx_r); | |
13131 __pyx_t_2 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) | |
13132 __Pyx_GOTREF(__pyx_t_2); | |
13133 __pyx_r = __pyx_t_2; | |
13134 __pyx_t_2 = 0; | |
13135 goto __pyx_L0; | |
13136 break; | |
13137 } | |
13138 | |
13139 /* "pybedtools/cbedtools.pyx":818 | |
13140 * return self | |
13141 * | |
13142 * def __next__(self): # <<<<<<<<<<<<<< | |
13143 * if not self._open: | |
13144 * result = self.intervalFile_ptr.Open() | |
13145 */ | |
13146 | |
13147 /* function exit code */ | |
13148 __pyx_L1_error:; | |
13149 __Pyx_XDECREF(__pyx_t_2); | |
13150 __Pyx_XDECREF(__pyx_t_3); | |
13151 __Pyx_XDECREF(__pyx_t_4); | |
13152 __Pyx_XDECREF(__pyx_t_5); | |
13153 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
13154 __pyx_r = NULL; | |
13155 __pyx_L0:; | |
13156 __Pyx_XGIVEREF(__pyx_r); | |
13157 __Pyx_RefNannyFinishContext(); | |
13158 return __pyx_r; | |
13159 } | |
13160 | |
13161 /* "pybedtools/cbedtools.pyx":837 | |
13162 * | |
13163 * @property | |
13164 * def fn(self): # <<<<<<<<<<<<<< | |
13165 * return _pystr(self._fn) | |
13166 * | |
13167 */ | |
13168 | |
13169 /* Python wrapper */ | |
13170 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_2fn_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
13171 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_2fn_1__get__(PyObject *__pyx_v_self) { | |
13172 PyObject *__pyx_r = 0; | |
13173 __Pyx_RefNannyDeclarations | |
13174 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
13175 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_2fn___get__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
13176 | |
13177 /* function exit code */ | |
13178 __Pyx_RefNannyFinishContext(); | |
13179 return __pyx_r; | |
13180 } | |
13181 | |
13182 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_2fn___get__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
13183 PyObject *__pyx_r = NULL; | |
13184 __Pyx_RefNannyDeclarations | |
13185 PyObject *__pyx_t_1 = NULL; | |
13186 int __pyx_lineno = 0; | |
13187 const char *__pyx_filename = NULL; | |
13188 int __pyx_clineno = 0; | |
13189 __Pyx_RefNannySetupContext("__get__", 0); | |
13190 | |
13191 /* "pybedtools/cbedtools.pyx":838 | |
13192 * @property | |
13193 * def fn(self): | |
13194 * return _pystr(self._fn) # <<<<<<<<<<<<<< | |
13195 * | |
13196 * @property | |
13197 */ | |
13198 __Pyx_XDECREF(__pyx_r); | |
13199 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->_fn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) | |
13200 __Pyx_GOTREF(__pyx_t_1); | |
13201 __pyx_r = __pyx_t_1; | |
13202 __pyx_t_1 = 0; | |
13203 goto __pyx_L0; | |
13204 | |
13205 /* "pybedtools/cbedtools.pyx":837 | |
13206 * | |
13207 * @property | |
13208 * def fn(self): # <<<<<<<<<<<<<< | |
13209 * return _pystr(self._fn) | |
13210 * | |
13211 */ | |
13212 | |
13213 /* function exit code */ | |
13214 __pyx_L1_error:; | |
13215 __Pyx_XDECREF(__pyx_t_1); | |
13216 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.fn.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
13217 __pyx_r = NULL; | |
13218 __pyx_L0:; | |
13219 __Pyx_XGIVEREF(__pyx_r); | |
13220 __Pyx_RefNannyFinishContext(); | |
13221 return __pyx_r; | |
13222 } | |
13223 | |
13224 /* "pybedtools/cbedtools.pyx":841 | |
13225 * | |
13226 * @property | |
13227 * def file_type(self): # <<<<<<<<<<<<<< | |
13228 * if not self.intervalFile_ptr._typeIsKnown: | |
13229 * try: | |
13230 */ | |
13231 | |
13232 /* Python wrapper */ | |
13233 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_9file_type_1__get__(PyObject *__pyx_v_self); /*proto*/ | |
13234 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_9file_type_1__get__(PyObject *__pyx_v_self) { | |
13235 PyObject *__pyx_r = 0; | |
13236 __Pyx_RefNannyDeclarations | |
13237 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); | |
13238 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_9file_type___get__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
13239 | |
13240 /* function exit code */ | |
13241 __Pyx_RefNannyFinishContext(); | |
13242 return __pyx_r; | |
13243 } | |
13244 | |
13245 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_9file_type___get__(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
13246 CYTHON_UNUSED PyObject *__pyx_v_a = NULL; | |
13247 PyObject *__pyx_v_file_type = NULL; | |
13248 PyObject *__pyx_v_fn = NULL; | |
13249 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval = NULL; | |
13250 PyObject *__pyx_r = NULL; | |
13251 __Pyx_RefNannyDeclarations | |
13252 int __pyx_t_1; | |
13253 PyObject *__pyx_t_2 = NULL; | |
13254 PyObject *__pyx_t_3 = NULL; | |
13255 PyObject *__pyx_t_4 = NULL; | |
13256 PyObject *__pyx_t_5 = NULL; | |
13257 PyObject *__pyx_t_6 = NULL; | |
13258 PyObject *__pyx_t_7 = NULL; | |
13259 PyObject *__pyx_t_8 = NULL; | |
13260 int __pyx_t_9; | |
13261 PyObject *__pyx_t_10 = NULL; | |
13262 PyObject *__pyx_t_11 = NULL; | |
13263 PyObject *__pyx_t_12 = NULL; | |
13264 PyObject *__pyx_t_13 = NULL; | |
13265 PyObject *__pyx_t_14 = NULL; | |
13266 PyObject *__pyx_t_15 = NULL; | |
13267 PyObject *__pyx_t_16 = NULL; | |
13268 PyObject *__pyx_t_17 = NULL; | |
13269 PyObject *__pyx_t_18 = NULL; | |
13270 int __pyx_t_19; | |
13271 int __pyx_lineno = 0; | |
13272 const char *__pyx_filename = NULL; | |
13273 int __pyx_clineno = 0; | |
13274 __Pyx_RefNannySetupContext("__get__", 0); | |
13275 | |
13276 /* "pybedtools/cbedtools.pyx":842 | |
13277 * @property | |
13278 * def file_type(self): | |
13279 * if not self.intervalFile_ptr._typeIsKnown: # <<<<<<<<<<<<<< | |
13280 * try: | |
13281 * a = next(iter(self)) | |
13282 */ | |
13283 __pyx_t_1 = ((!(__pyx_v_self->intervalFile_ptr->_typeIsKnown != 0)) != 0); | |
13284 if (__pyx_t_1) { | |
13285 | |
13286 /* "pybedtools/cbedtools.pyx":843 | |
13287 * def file_type(self): | |
13288 * if not self.intervalFile_ptr._typeIsKnown: | |
13289 * try: # <<<<<<<<<<<<<< | |
13290 * a = next(iter(self)) | |
13291 * file_type = _pystr(self.intervalFile_ptr.file_type) | |
13292 */ | |
13293 { | |
13294 __Pyx_PyThreadState_declare | |
13295 __Pyx_PyThreadState_assign | |
13296 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); | |
13297 __Pyx_XGOTREF(__pyx_t_2); | |
13298 __Pyx_XGOTREF(__pyx_t_3); | |
13299 __Pyx_XGOTREF(__pyx_t_4); | |
13300 /*try:*/ { | |
13301 | |
13302 /* "pybedtools/cbedtools.pyx":844 | |
13303 * if not self.intervalFile_ptr._typeIsKnown: | |
13304 * try: | |
13305 * a = next(iter(self)) # <<<<<<<<<<<<<< | |
13306 * file_type = _pystr(self.intervalFile_ptr.file_type) | |
13307 * self.intervalFile_ptr.Close() | |
13308 */ | |
13309 __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 844, __pyx_L4_error) | |
13310 __Pyx_GOTREF(__pyx_t_5); | |
13311 __pyx_t_6 = __Pyx_PyIter_Next(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L4_error) | |
13312 __Pyx_GOTREF(__pyx_t_6); | |
13313 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
13314 __pyx_v_a = __pyx_t_6; | |
13315 __pyx_t_6 = 0; | |
13316 | |
13317 /* "pybedtools/cbedtools.pyx":845 | |
13318 * try: | |
13319 * a = next(iter(self)) | |
13320 * file_type = _pystr(self.intervalFile_ptr.file_type) # <<<<<<<<<<<<<< | |
13321 * self.intervalFile_ptr.Close() | |
13322 * return file_type | |
13323 */ | |
13324 __pyx_t_6 = __pyx_f_10pybedtools_9cbedtools__pystr(__pyx_v_self->intervalFile_ptr->file_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L4_error) | |
13325 __Pyx_GOTREF(__pyx_t_6); | |
13326 __pyx_v_file_type = __pyx_t_6; | |
13327 __pyx_t_6 = 0; | |
13328 | |
13329 /* "pybedtools/cbedtools.pyx":846 | |
13330 * a = next(iter(self)) | |
13331 * file_type = _pystr(self.intervalFile_ptr.file_type) | |
13332 * self.intervalFile_ptr.Close() # <<<<<<<<<<<<<< | |
13333 * return file_type | |
13334 * except MalformedBedLineError: | |
13335 */ | |
13336 __pyx_v_self->intervalFile_ptr->Close(); | |
13337 | |
13338 /* "pybedtools/cbedtools.pyx":847 | |
13339 * file_type = _pystr(self.intervalFile_ptr.file_type) | |
13340 * self.intervalFile_ptr.Close() | |
13341 * return file_type # <<<<<<<<<<<<<< | |
13342 * except MalformedBedLineError: | |
13343 * # If it's a SAM, raise a meaningful exception. If not, fail. | |
13344 */ | |
13345 __Pyx_XDECREF(__pyx_r); | |
13346 __Pyx_INCREF(__pyx_v_file_type); | |
13347 __pyx_r = __pyx_v_file_type; | |
13348 goto __pyx_L8_try_return; | |
13349 | |
13350 /* "pybedtools/cbedtools.pyx":843 | |
13351 * def file_type(self): | |
13352 * if not self.intervalFile_ptr._typeIsKnown: | |
13353 * try: # <<<<<<<<<<<<<< | |
13354 * a = next(iter(self)) | |
13355 * file_type = _pystr(self.intervalFile_ptr.file_type) | |
13356 */ | |
13357 } | |
13358 __pyx_L4_error:; | |
13359 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
13360 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
13361 | |
13362 /* "pybedtools/cbedtools.pyx":848 | |
13363 * self.intervalFile_ptr.Close() | |
13364 * return file_type | |
13365 * except MalformedBedLineError: # <<<<<<<<<<<<<< | |
13366 * # If it's a SAM, raise a meaningful exception. If not, fail. | |
13367 * with open(self.fn) as fn: | |
13368 */ | |
13369 __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7); | |
13370 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_MalformedBedLineError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 848, __pyx_L6_except_error) | |
13371 __Pyx_GOTREF(__pyx_t_8); | |
13372 __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_8); | |
13373 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
13374 __Pyx_ErrRestore(__pyx_t_6, __pyx_t_5, __pyx_t_7); | |
13375 __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; | |
13376 if (__pyx_t_9) { | |
13377 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.file_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
13378 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 848, __pyx_L6_except_error) | |
13379 __Pyx_GOTREF(__pyx_t_7); | |
13380 __Pyx_GOTREF(__pyx_t_5); | |
13381 __Pyx_GOTREF(__pyx_t_6); | |
13382 | |
13383 /* "pybedtools/cbedtools.pyx":850 | |
13384 * except MalformedBedLineError: | |
13385 * # If it's a SAM, raise a meaningful exception. If not, fail. | |
13386 * with open(self.fn) as fn: # <<<<<<<<<<<<<< | |
13387 * interval = create_interval_from_list(fn.readline().strip().split()) | |
13388 * if interval.file_type == 'sam': | |
13389 */ | |
13390 /*with:*/ { | |
13391 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fn); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 850, __pyx_L6_except_error) | |
13392 __Pyx_GOTREF(__pyx_t_8); | |
13393 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 850, __pyx_L6_except_error) | |
13394 __Pyx_GOTREF(__pyx_t_10); | |
13395 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
13396 __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 850, __pyx_L6_except_error) | |
13397 __Pyx_GOTREF(__pyx_t_11); | |
13398 __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_enter); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 850, __pyx_L12_error) | |
13399 __Pyx_GOTREF(__pyx_t_12); | |
13400 __pyx_t_13 = NULL; | |
13401 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) { | |
13402 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); | |
13403 if (likely(__pyx_t_13)) { | |
13404 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); | |
13405 __Pyx_INCREF(__pyx_t_13); | |
13406 __Pyx_INCREF(function); | |
13407 __Pyx_DECREF_SET(__pyx_t_12, function); | |
13408 } | |
13409 } | |
13410 __pyx_t_8 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_12); | |
13411 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; | |
13412 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 850, __pyx_L12_error) | |
13413 __Pyx_GOTREF(__pyx_t_8); | |
13414 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; | |
13415 __pyx_t_12 = __pyx_t_8; | |
13416 __pyx_t_8 = 0; | |
13417 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13418 /*try:*/ { | |
13419 { | |
13420 __Pyx_PyThreadState_declare | |
13421 __Pyx_PyThreadState_assign | |
13422 __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); | |
13423 __Pyx_XGOTREF(__pyx_t_14); | |
13424 __Pyx_XGOTREF(__pyx_t_15); | |
13425 __Pyx_XGOTREF(__pyx_t_16); | |
13426 /*try:*/ { | |
13427 __pyx_v_fn = __pyx_t_12; | |
13428 __pyx_t_12 = 0; | |
13429 | |
13430 /* "pybedtools/cbedtools.pyx":851 | |
13431 * # If it's a SAM, raise a meaningful exception. If not, fail. | |
13432 * with open(self.fn) as fn: | |
13433 * interval = create_interval_from_list(fn.readline().strip().split()) # <<<<<<<<<<<<<< | |
13434 * if interval.file_type == 'sam': | |
13435 * raise ValueError('IntervalFile objects do not yet natively support SAM. ' | |
13436 */ | |
13437 __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_fn, __pyx_n_s_readline); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13438 __Pyx_GOTREF(__pyx_t_13); | |
13439 __pyx_t_17 = NULL; | |
13440 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { | |
13441 __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_13); | |
13442 if (likely(__pyx_t_17)) { | |
13443 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); | |
13444 __Pyx_INCREF(__pyx_t_17); | |
13445 __Pyx_INCREF(function); | |
13446 __Pyx_DECREF_SET(__pyx_t_13, function); | |
13447 } | |
13448 } | |
13449 __pyx_t_8 = (__pyx_t_17) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_17) : __Pyx_PyObject_CallNoArg(__pyx_t_13); | |
13450 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; | |
13451 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13452 __Pyx_GOTREF(__pyx_t_8); | |
13453 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; | |
13454 __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13455 __Pyx_GOTREF(__pyx_t_13); | |
13456 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
13457 __pyx_t_8 = NULL; | |
13458 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { | |
13459 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13); | |
13460 if (likely(__pyx_t_8)) { | |
13461 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); | |
13462 __Pyx_INCREF(__pyx_t_8); | |
13463 __Pyx_INCREF(function); | |
13464 __Pyx_DECREF_SET(__pyx_t_13, function); | |
13465 } | |
13466 } | |
13467 __pyx_t_10 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_13); | |
13468 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; | |
13469 if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13470 __Pyx_GOTREF(__pyx_t_10); | |
13471 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; | |
13472 __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13473 __Pyx_GOTREF(__pyx_t_13); | |
13474 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13475 __pyx_t_10 = NULL; | |
13476 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { | |
13477 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13); | |
13478 if (likely(__pyx_t_10)) { | |
13479 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); | |
13480 __Pyx_INCREF(__pyx_t_10); | |
13481 __Pyx_INCREF(function); | |
13482 __Pyx_DECREF_SET(__pyx_t_13, function); | |
13483 } | |
13484 } | |
13485 __pyx_t_12 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_13); | |
13486 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13487 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13488 __Pyx_GOTREF(__pyx_t_12); | |
13489 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; | |
13490 if (!(likely(PyList_CheckExact(__pyx_t_12))||((__pyx_t_12) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_12)->tp_name), 0))) __PYX_ERR(0, 851, __pyx_L18_error) | |
13491 __pyx_t_13 = ((PyObject *)__pyx_f_10pybedtools_9cbedtools_create_interval_from_list(((PyObject*)__pyx_t_12), 0)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 851, __pyx_L18_error) | |
13492 __Pyx_GOTREF(__pyx_t_13); | |
13493 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; | |
13494 __pyx_v_interval = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)__pyx_t_13); | |
13495 __pyx_t_13 = 0; | |
13496 | |
13497 /* "pybedtools/cbedtools.pyx":850 | |
13498 * except MalformedBedLineError: | |
13499 * # If it's a SAM, raise a meaningful exception. If not, fail. | |
13500 * with open(self.fn) as fn: # <<<<<<<<<<<<<< | |
13501 * interval = create_interval_from_list(fn.readline().strip().split()) | |
13502 * if interval.file_type == 'sam': | |
13503 */ | |
13504 } | |
13505 __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; | |
13506 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; | |
13507 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; | |
13508 goto __pyx_L25_try_end; | |
13509 __pyx_L18_error:; | |
13510 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13511 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; | |
13512 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; | |
13513 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; | |
13514 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; | |
13515 /*except:*/ { | |
13516 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.file_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
13517 if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_10) < 0) __PYX_ERR(0, 850, __pyx_L20_except_error) | |
13518 __Pyx_GOTREF(__pyx_t_13); | |
13519 __Pyx_GOTREF(__pyx_t_12); | |
13520 __Pyx_GOTREF(__pyx_t_10); | |
13521 __pyx_t_8 = PyTuple_Pack(3, __pyx_t_13, __pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 850, __pyx_L20_except_error) | |
13522 __Pyx_GOTREF(__pyx_t_8); | |
13523 __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, NULL); | |
13524 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
13525 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
13526 if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 850, __pyx_L20_except_error) | |
13527 __Pyx_GOTREF(__pyx_t_18); | |
13528 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_18); | |
13529 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; | |
13530 if (__pyx_t_1 < 0) __PYX_ERR(0, 850, __pyx_L20_except_error) | |
13531 __pyx_t_19 = ((!(__pyx_t_1 != 0)) != 0); | |
13532 if (__pyx_t_19) { | |
13533 __Pyx_GIVEREF(__pyx_t_13); | |
13534 __Pyx_GIVEREF(__pyx_t_12); | |
13535 __Pyx_XGIVEREF(__pyx_t_10); | |
13536 __Pyx_ErrRestoreWithState(__pyx_t_13, __pyx_t_12, __pyx_t_10); | |
13537 __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_10 = 0; | |
13538 __PYX_ERR(0, 850, __pyx_L20_except_error) | |
13539 } | |
13540 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; | |
13541 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; | |
13542 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13543 goto __pyx_L19_exception_handled; | |
13544 } | |
13545 __pyx_L20_except_error:; | |
13546 __Pyx_XGIVEREF(__pyx_t_14); | |
13547 __Pyx_XGIVEREF(__pyx_t_15); | |
13548 __Pyx_XGIVEREF(__pyx_t_16); | |
13549 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); | |
13550 goto __pyx_L6_except_error; | |
13551 __pyx_L19_exception_handled:; | |
13552 __Pyx_XGIVEREF(__pyx_t_14); | |
13553 __Pyx_XGIVEREF(__pyx_t_15); | |
13554 __Pyx_XGIVEREF(__pyx_t_16); | |
13555 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); | |
13556 __pyx_L25_try_end:; | |
13557 } | |
13558 } | |
13559 /*finally:*/ { | |
13560 /*normal exit:*/{ | |
13561 if (__pyx_t_11) { | |
13562 __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__26, NULL); | |
13563 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
13564 if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 850, __pyx_L6_except_error) | |
13565 __Pyx_GOTREF(__pyx_t_16); | |
13566 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; | |
13567 } | |
13568 goto __pyx_L17; | |
13569 } | |
13570 __pyx_L17:; | |
13571 } | |
13572 goto __pyx_L29; | |
13573 __pyx_L12_error:; | |
13574 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; | |
13575 goto __pyx_L6_except_error; | |
13576 __pyx_L29:; | |
13577 } | |
13578 | |
13579 /* "pybedtools/cbedtools.pyx":852 | |
13580 * with open(self.fn) as fn: | |
13581 * interval = create_interval_from_list(fn.readline().strip().split()) | |
13582 * if interval.file_type == 'sam': # <<<<<<<<<<<<<< | |
13583 * raise ValueError('IntervalFile objects do not yet natively support SAM. ' | |
13584 * 'Please convert to BED/GFF/VCF first if you want to ' | |
13585 */ | |
13586 if (unlikely(!__pyx_v_interval)) { __Pyx_RaiseUnboundLocalError("interval"); __PYX_ERR(0, 852, __pyx_L6_except_error) } | |
13587 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_interval), __pyx_n_s_file_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 852, __pyx_L6_except_error) | |
13588 __Pyx_GOTREF(__pyx_t_10); | |
13589 __pyx_t_19 = (__Pyx_PyString_Equals(__pyx_t_10, __pyx_n_s_sam, Py_EQ)); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 852, __pyx_L6_except_error) | |
13590 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13591 if (unlikely(__pyx_t_19)) { | |
13592 | |
13593 /* "pybedtools/cbedtools.pyx":853 | |
13594 * interval = create_interval_from_list(fn.readline().strip().split()) | |
13595 * if interval.file_type == 'sam': | |
13596 * raise ValueError('IntervalFile objects do not yet natively support SAM. ' # <<<<<<<<<<<<<< | |
13597 * 'Please convert to BED/GFF/VCF first if you want to ' | |
13598 * 'use the low-level API of IntervalFile') | |
13599 */ | |
13600 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 853, __pyx_L6_except_error) | |
13601 __Pyx_GOTREF(__pyx_t_10); | |
13602 __Pyx_Raise(__pyx_t_10, 0, 0, 0); | |
13603 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; | |
13604 __PYX_ERR(0, 853, __pyx_L6_except_error) | |
13605 | |
13606 /* "pybedtools/cbedtools.pyx":852 | |
13607 * with open(self.fn) as fn: | |
13608 * interval = create_interval_from_list(fn.readline().strip().split()) | |
13609 * if interval.file_type == 'sam': # <<<<<<<<<<<<<< | |
13610 * raise ValueError('IntervalFile objects do not yet natively support SAM. ' | |
13611 * 'Please convert to BED/GFF/VCF first if you want to ' | |
13612 */ | |
13613 } | |
13614 | |
13615 /* "pybedtools/cbedtools.pyx":857 | |
13616 * 'use the low-level API of IntervalFile') | |
13617 * else: | |
13618 * raise # <<<<<<<<<<<<<< | |
13619 * | |
13620 * | |
13621 */ | |
13622 /*else*/ { | |
13623 __Pyx_GIVEREF(__pyx_t_7); | |
13624 __Pyx_GIVEREF(__pyx_t_5); | |
13625 __Pyx_XGIVEREF(__pyx_t_6); | |
13626 __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_6); | |
13627 __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; | |
13628 __PYX_ERR(0, 857, __pyx_L6_except_error) | |
13629 } | |
13630 } | |
13631 goto __pyx_L6_except_error; | |
13632 __pyx_L6_except_error:; | |
13633 | |
13634 /* "pybedtools/cbedtools.pyx":843 | |
13635 * def file_type(self): | |
13636 * if not self.intervalFile_ptr._typeIsKnown: | |
13637 * try: # <<<<<<<<<<<<<< | |
13638 * a = next(iter(self)) | |
13639 * file_type = _pystr(self.intervalFile_ptr.file_type) | |
13640 */ | |
13641 __Pyx_XGIVEREF(__pyx_t_2); | |
13642 __Pyx_XGIVEREF(__pyx_t_3); | |
13643 __Pyx_XGIVEREF(__pyx_t_4); | |
13644 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); | |
13645 goto __pyx_L1_error; | |
13646 __pyx_L8_try_return:; | |
13647 __Pyx_XGIVEREF(__pyx_t_2); | |
13648 __Pyx_XGIVEREF(__pyx_t_3); | |
13649 __Pyx_XGIVEREF(__pyx_t_4); | |
13650 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); | |
13651 goto __pyx_L0; | |
13652 } | |
13653 | |
13654 /* "pybedtools/cbedtools.pyx":842 | |
13655 * @property | |
13656 * def file_type(self): | |
13657 * if not self.intervalFile_ptr._typeIsKnown: # <<<<<<<<<<<<<< | |
13658 * try: | |
13659 * a = next(iter(self)) | |
13660 */ | |
13661 } | |
13662 | |
13663 /* "pybedtools/cbedtools.pyx":841 | |
13664 * | |
13665 * @property | |
13666 * def file_type(self): # <<<<<<<<<<<<<< | |
13667 * if not self.intervalFile_ptr._typeIsKnown: | |
13668 * try: | |
13669 */ | |
13670 | |
13671 /* function exit code */ | |
13672 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
13673 goto __pyx_L0; | |
13674 __pyx_L1_error:; | |
13675 __Pyx_XDECREF(__pyx_t_5); | |
13676 __Pyx_XDECREF(__pyx_t_6); | |
13677 __Pyx_XDECREF(__pyx_t_7); | |
13678 __Pyx_XDECREF(__pyx_t_8); | |
13679 __Pyx_XDECREF(__pyx_t_10); | |
13680 __Pyx_XDECREF(__pyx_t_12); | |
13681 __Pyx_XDECREF(__pyx_t_13); | |
13682 __Pyx_XDECREF(__pyx_t_17); | |
13683 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.file_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
13684 __pyx_r = NULL; | |
13685 __pyx_L0:; | |
13686 __Pyx_XDECREF(__pyx_v_a); | |
13687 __Pyx_XDECREF(__pyx_v_file_type); | |
13688 __Pyx_XDECREF(__pyx_v_fn); | |
13689 __Pyx_XDECREF((PyObject *)__pyx_v_interval); | |
13690 __Pyx_XGIVEREF(__pyx_r); | |
13691 __Pyx_RefNannyFinishContext(); | |
13692 return __pyx_r; | |
13693 } | |
13694 | |
13695 /* "pybedtools/cbedtools.pyx":860 | |
13696 * | |
13697 * | |
13698 * def loadIntoMap(self): # <<<<<<<<<<<<<< | |
13699 * """ | |
13700 * Prepares file for checking intersections. Used by other methods like all_hits() | |
13701 */ | |
13702 | |
13703 /* Python wrapper */ | |
13704 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_9loadIntoMap(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
13705 static char __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_8loadIntoMap[] = "\n Prepares file for checking intersections. Used by other methods like all_hits()\n "; | |
13706 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_9loadIntoMap(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
13707 PyObject *__pyx_r = 0; | |
13708 __Pyx_RefNannyDeclarations | |
13709 __Pyx_RefNannySetupContext("loadIntoMap (wrapper)", 0); | |
13710 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_8loadIntoMap(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
13711 | |
13712 /* function exit code */ | |
13713 __Pyx_RefNannyFinishContext(); | |
13714 return __pyx_r; | |
13715 } | |
13716 | |
13717 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_8loadIntoMap(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
13718 PyObject *__pyx_r = NULL; | |
13719 __Pyx_RefNannyDeclarations | |
13720 int __pyx_t_1; | |
13721 __Pyx_RefNannySetupContext("loadIntoMap", 0); | |
13722 | |
13723 /* "pybedtools/cbedtools.pyx":864 | |
13724 * Prepares file for checking intersections. Used by other methods like all_hits() | |
13725 * """ | |
13726 * if self._loaded: # <<<<<<<<<<<<<< | |
13727 * return | |
13728 * self.intervalFile_ptr.loadBedFileIntoMap() | |
13729 */ | |
13730 __pyx_t_1 = (__pyx_v_self->_loaded != 0); | |
13731 if (__pyx_t_1) { | |
13732 | |
13733 /* "pybedtools/cbedtools.pyx":865 | |
13734 * """ | |
13735 * if self._loaded: | |
13736 * return # <<<<<<<<<<<<<< | |
13737 * self.intervalFile_ptr.loadBedFileIntoMap() | |
13738 * self._loaded = 1 | |
13739 */ | |
13740 __Pyx_XDECREF(__pyx_r); | |
13741 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
13742 goto __pyx_L0; | |
13743 | |
13744 /* "pybedtools/cbedtools.pyx":864 | |
13745 * Prepares file for checking intersections. Used by other methods like all_hits() | |
13746 * """ | |
13747 * if self._loaded: # <<<<<<<<<<<<<< | |
13748 * return | |
13749 * self.intervalFile_ptr.loadBedFileIntoMap() | |
13750 */ | |
13751 } | |
13752 | |
13753 /* "pybedtools/cbedtools.pyx":866 | |
13754 * if self._loaded: | |
13755 * return | |
13756 * self.intervalFile_ptr.loadBedFileIntoMap() # <<<<<<<<<<<<<< | |
13757 * self._loaded = 1 | |
13758 * | |
13759 */ | |
13760 __pyx_v_self->intervalFile_ptr->loadBedFileIntoMap(); | |
13761 | |
13762 /* "pybedtools/cbedtools.pyx":867 | |
13763 * return | |
13764 * self.intervalFile_ptr.loadBedFileIntoMap() | |
13765 * self._loaded = 1 # <<<<<<<<<<<<<< | |
13766 * | |
13767 * def rewind(self): | |
13768 */ | |
13769 __pyx_v_self->_loaded = 1; | |
13770 | |
13771 /* "pybedtools/cbedtools.pyx":860 | |
13772 * | |
13773 * | |
13774 * def loadIntoMap(self): # <<<<<<<<<<<<<< | |
13775 * """ | |
13776 * Prepares file for checking intersections. Used by other methods like all_hits() | |
13777 */ | |
13778 | |
13779 /* function exit code */ | |
13780 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
13781 __pyx_L0:; | |
13782 __Pyx_XGIVEREF(__pyx_r); | |
13783 __Pyx_RefNannyFinishContext(); | |
13784 return __pyx_r; | |
13785 } | |
13786 | |
13787 /* "pybedtools/cbedtools.pyx":869 | |
13788 * self._loaded = 1 | |
13789 * | |
13790 * def rewind(self): # <<<<<<<<<<<<<< | |
13791 * """ | |
13792 * Jump to the beginning of the file. | |
13793 */ | |
13794 | |
13795 /* Python wrapper */ | |
13796 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_11rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
13797 static char __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_10rewind[] = "\n Jump to the beginning of the file.\n "; | |
13798 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_11rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
13799 PyObject *__pyx_r = 0; | |
13800 __Pyx_RefNannyDeclarations | |
13801 __Pyx_RefNannySetupContext("rewind (wrapper)", 0); | |
13802 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_10rewind(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
13803 | |
13804 /* function exit code */ | |
13805 __Pyx_RefNannyFinishContext(); | |
13806 return __pyx_r; | |
13807 } | |
13808 | |
13809 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_10rewind(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
13810 PyObject *__pyx_r = NULL; | |
13811 __Pyx_RefNannyDeclarations | |
13812 int __pyx_t_1; | |
13813 __Pyx_RefNannySetupContext("rewind", 0); | |
13814 | |
13815 /* "pybedtools/cbedtools.pyx":873 | |
13816 * Jump to the beginning of the file. | |
13817 * """ | |
13818 * if not self._open: # <<<<<<<<<<<<<< | |
13819 * self.intervalFile_ptr.Open() | |
13820 * self._open = 1 | |
13821 */ | |
13822 __pyx_t_1 = ((!(__pyx_v_self->_open != 0)) != 0); | |
13823 if (__pyx_t_1) { | |
13824 | |
13825 /* "pybedtools/cbedtools.pyx":874 | |
13826 * """ | |
13827 * if not self._open: | |
13828 * self.intervalFile_ptr.Open() # <<<<<<<<<<<<<< | |
13829 * self._open = 1 | |
13830 * self.intervalFile_ptr.Rewind() | |
13831 */ | |
13832 (void)(__pyx_v_self->intervalFile_ptr->Open()); | |
13833 | |
13834 /* "pybedtools/cbedtools.pyx":875 | |
13835 * if not self._open: | |
13836 * self.intervalFile_ptr.Open() | |
13837 * self._open = 1 # <<<<<<<<<<<<<< | |
13838 * self.intervalFile_ptr.Rewind() | |
13839 * | |
13840 */ | |
13841 __pyx_v_self->_open = 1; | |
13842 | |
13843 /* "pybedtools/cbedtools.pyx":873 | |
13844 * Jump to the beginning of the file. | |
13845 * """ | |
13846 * if not self._open: # <<<<<<<<<<<<<< | |
13847 * self.intervalFile_ptr.Open() | |
13848 * self._open = 1 | |
13849 */ | |
13850 } | |
13851 | |
13852 /* "pybedtools/cbedtools.pyx":876 | |
13853 * self.intervalFile_ptr.Open() | |
13854 * self._open = 1 | |
13855 * self.intervalFile_ptr.Rewind() # <<<<<<<<<<<<<< | |
13856 * | |
13857 * def seek(self, offset): | |
13858 */ | |
13859 __pyx_v_self->intervalFile_ptr->Rewind(); | |
13860 | |
13861 /* "pybedtools/cbedtools.pyx":869 | |
13862 * self._loaded = 1 | |
13863 * | |
13864 * def rewind(self): # <<<<<<<<<<<<<< | |
13865 * """ | |
13866 * Jump to the beginning of the file. | |
13867 */ | |
13868 | |
13869 /* function exit code */ | |
13870 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
13871 __Pyx_XGIVEREF(__pyx_r); | |
13872 __Pyx_RefNannyFinishContext(); | |
13873 return __pyx_r; | |
13874 } | |
13875 | |
13876 /* "pybedtools/cbedtools.pyx":878 | |
13877 * self.intervalFile_ptr.Rewind() | |
13878 * | |
13879 * def seek(self, offset): # <<<<<<<<<<<<<< | |
13880 * """ | |
13881 * Jump to a specific byte offset in the file | |
13882 */ | |
13883 | |
13884 /* Python wrapper */ | |
13885 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_13seek(PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /*proto*/ | |
13886 static char __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_12seek[] = "\n Jump to a specific byte offset in the file\n "; | |
13887 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_13seek(PyObject *__pyx_v_self, PyObject *__pyx_v_offset) { | |
13888 PyObject *__pyx_r = 0; | |
13889 __Pyx_RefNannyDeclarations | |
13890 __Pyx_RefNannySetupContext("seek (wrapper)", 0); | |
13891 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_12seek(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self), ((PyObject *)__pyx_v_offset)); | |
13892 | |
13893 /* function exit code */ | |
13894 __Pyx_RefNannyFinishContext(); | |
13895 return __pyx_r; | |
13896 } | |
13897 | |
13898 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_12seek(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, PyObject *__pyx_v_offset) { | |
13899 PyObject *__pyx_r = NULL; | |
13900 __Pyx_RefNannyDeclarations | |
13901 int __pyx_t_1; | |
13902 unsigned long __pyx_t_2; | |
13903 int __pyx_lineno = 0; | |
13904 const char *__pyx_filename = NULL; | |
13905 int __pyx_clineno = 0; | |
13906 __Pyx_RefNannySetupContext("seek", 0); | |
13907 | |
13908 /* "pybedtools/cbedtools.pyx":882 | |
13909 * Jump to a specific byte offset in the file | |
13910 * """ | |
13911 * if not self._open: # <<<<<<<<<<<<<< | |
13912 * self.intervalFile_ptr.Open() | |
13913 * self._open = 1 | |
13914 */ | |
13915 __pyx_t_1 = ((!(__pyx_v_self->_open != 0)) != 0); | |
13916 if (__pyx_t_1) { | |
13917 | |
13918 /* "pybedtools/cbedtools.pyx":883 | |
13919 * """ | |
13920 * if not self._open: | |
13921 * self.intervalFile_ptr.Open() # <<<<<<<<<<<<<< | |
13922 * self._open = 1 | |
13923 * self.intervalFile_ptr.Seek(offset) | |
13924 */ | |
13925 (void)(__pyx_v_self->intervalFile_ptr->Open()); | |
13926 | |
13927 /* "pybedtools/cbedtools.pyx":884 | |
13928 * if not self._open: | |
13929 * self.intervalFile_ptr.Open() | |
13930 * self._open = 1 # <<<<<<<<<<<<<< | |
13931 * self.intervalFile_ptr.Seek(offset) | |
13932 * | |
13933 */ | |
13934 __pyx_v_self->_open = 1; | |
13935 | |
13936 /* "pybedtools/cbedtools.pyx":882 | |
13937 * Jump to a specific byte offset in the file | |
13938 * """ | |
13939 * if not self._open: # <<<<<<<<<<<<<< | |
13940 * self.intervalFile_ptr.Open() | |
13941 * self._open = 1 | |
13942 */ | |
13943 } | |
13944 | |
13945 /* "pybedtools/cbedtools.pyx":885 | |
13946 * self.intervalFile_ptr.Open() | |
13947 * self._open = 1 | |
13948 * self.intervalFile_ptr.Seek(offset) # <<<<<<<<<<<<<< | |
13949 * | |
13950 * | |
13951 */ | |
13952 __pyx_t_2 = __Pyx_PyInt_As_unsigned_long(__pyx_v_offset); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L1_error) | |
13953 __pyx_v_self->intervalFile_ptr->Seek(__pyx_t_2); | |
13954 | |
13955 /* "pybedtools/cbedtools.pyx":878 | |
13956 * self.intervalFile_ptr.Rewind() | |
13957 * | |
13958 * def seek(self, offset): # <<<<<<<<<<<<<< | |
13959 * """ | |
13960 * Jump to a specific byte offset in the file | |
13961 */ | |
13962 | |
13963 /* function exit code */ | |
13964 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
13965 goto __pyx_L0; | |
13966 __pyx_L1_error:; | |
13967 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
13968 __pyx_r = NULL; | |
13969 __pyx_L0:; | |
13970 __Pyx_XGIVEREF(__pyx_r); | |
13971 __Pyx_RefNannyFinishContext(); | |
13972 return __pyx_r; | |
13973 } | |
13974 | |
13975 /* "pybedtools/cbedtools.pyx":888 | |
13976 * | |
13977 * | |
13978 * def all_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): # <<<<<<<<<<<<<< | |
13979 * """ | |
13980 * :Signature: `IntervalFile.all_hits(interval, same_strand=False, overlap=0.0)` | |
13981 */ | |
13982 | |
13983 /* Python wrapper */ | |
13984 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_15all_hits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
13985 static char __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_14all_hits[] = "\n :Signature: `IntervalFile.all_hits(interval, same_strand=False, overlap=0.0)`\n\n Search for the Interval `interval` this file and return **all**\n overlaps as a list.\n\n `same_strand`, if True, will only consider hits on the same strand as `interval`.\n\n `overlap` can be used to specify the fraction of overlap between\n `interval` and each feature in the IntervalFile.\n\n Example usage:\n\n >>> fn = pybedtools.example_filename('a.bed')\n\n >>> # create an Interval to query with\n >>> i = pybedtools.Interval('chr1', 1, 10000, strand='+')\n\n >>> # Create an IntervalFile out of a.bed\n >>> intervalfile = pybedtools.IntervalFile(fn)\n\n >>> # get stranded hits\n >>> intervalfile.all_hits(i, same_strand=True)\n [Interval(chr1:1-100), Interval(chr1:100-200), Interval(chr1:900-950)]\n\n "; | |
13986 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_15all_hits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
13987 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval = 0; | |
13988 PyBoolObject *__pyx_v_same_strand = 0; | |
13989 float __pyx_v_overlap; | |
13990 int __pyx_lineno = 0; | |
13991 const char *__pyx_filename = NULL; | |
13992 int __pyx_clineno = 0; | |
13993 PyObject *__pyx_r = 0; | |
13994 __Pyx_RefNannyDeclarations | |
13995 __Pyx_RefNannySetupContext("all_hits (wrapper)", 0); | |
13996 { | |
13997 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interval,&__pyx_n_s_same_strand,&__pyx_n_s_overlap,0}; | |
13998 PyObject* values[3] = {0,0,0}; | |
13999 values[1] = (PyObject *)((PyBoolObject *)Py_False); | |
14000 if (unlikely(__pyx_kwds)) { | |
14001 Py_ssize_t kw_args; | |
14002 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
14003 switch (pos_args) { | |
14004 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14005 CYTHON_FALLTHROUGH; | |
14006 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14007 CYTHON_FALLTHROUGH; | |
14008 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14009 CYTHON_FALLTHROUGH; | |
14010 case 0: break; | |
14011 default: goto __pyx_L5_argtuple_error; | |
14012 } | |
14013 kw_args = PyDict_Size(__pyx_kwds); | |
14014 switch (pos_args) { | |
14015 case 0: | |
14016 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interval)) != 0)) kw_args--; | |
14017 else goto __pyx_L5_argtuple_error; | |
14018 CYTHON_FALLTHROUGH; | |
14019 case 1: | |
14020 if (kw_args > 0) { | |
14021 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_same_strand); | |
14022 if (value) { values[1] = value; kw_args--; } | |
14023 } | |
14024 CYTHON_FALLTHROUGH; | |
14025 case 2: | |
14026 if (kw_args > 0) { | |
14027 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_overlap); | |
14028 if (value) { values[2] = value; kw_args--; } | |
14029 } | |
14030 } | |
14031 if (unlikely(kw_args > 0)) { | |
14032 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "all_hits") < 0)) __PYX_ERR(0, 888, __pyx_L3_error) | |
14033 } | |
14034 } else { | |
14035 switch (PyTuple_GET_SIZE(__pyx_args)) { | |
14036 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14037 CYTHON_FALLTHROUGH; | |
14038 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14039 CYTHON_FALLTHROUGH; | |
14040 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14041 break; | |
14042 default: goto __pyx_L5_argtuple_error; | |
14043 } | |
14044 } | |
14045 __pyx_v_interval = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)values[0]); | |
14046 __pyx_v_same_strand = ((PyBoolObject *)values[1]); | |
14047 if (values[2]) { | |
14048 __pyx_v_overlap = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_overlap == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error) | |
14049 } else { | |
14050 __pyx_v_overlap = ((float)0.0); | |
14051 } | |
14052 } | |
14053 goto __pyx_L4_argument_unpacking_done; | |
14054 __pyx_L5_argtuple_error:; | |
14055 __Pyx_RaiseArgtupleInvalid("all_hits", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 888, __pyx_L3_error) | |
14056 __pyx_L3_error:; | |
14057 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.all_hits", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14058 __Pyx_RefNannyFinishContext(); | |
14059 return NULL; | |
14060 __pyx_L4_argument_unpacking_done:; | |
14061 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interval), __pyx_ptype_10pybedtools_9cbedtools_Interval, 1, "interval", 0))) __PYX_ERR(0, 888, __pyx_L1_error) | |
14062 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_same_strand), __pyx_ptype_7cpython_4bool_bool, 1, "same_strand", 0))) __PYX_ERR(0, 888, __pyx_L1_error) | |
14063 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_14all_hits(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self), __pyx_v_interval, __pyx_v_same_strand, __pyx_v_overlap); | |
14064 | |
14065 /* function exit code */ | |
14066 goto __pyx_L0; | |
14067 __pyx_L1_error:; | |
14068 __pyx_r = NULL; | |
14069 __pyx_L0:; | |
14070 __Pyx_RefNannyFinishContext(); | |
14071 return __pyx_r; | |
14072 } | |
14073 | |
14074 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_14all_hits(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval, PyBoolObject *__pyx_v_same_strand, float __pyx_v_overlap) { | |
14075 std::vector<BED> __pyx_v_vec_b; | |
14076 PyObject *__pyx_r = NULL; | |
14077 __Pyx_RefNannyDeclarations | |
14078 PyObject *__pyx_t_1 = NULL; | |
14079 PyObject *__pyx_t_2 = NULL; | |
14080 PyObject *__pyx_t_3 = NULL; | |
14081 int __pyx_t_4; | |
14082 int __pyx_t_5; | |
14083 int __pyx_t_6; | |
14084 char const *__pyx_t_7; | |
14085 PyObject *__pyx_t_8 = NULL; | |
14086 PyObject *__pyx_t_9 = NULL; | |
14087 PyObject *__pyx_t_10 = NULL; | |
14088 PyObject *__pyx_t_11 = NULL; | |
14089 PyObject *__pyx_t_12 = NULL; | |
14090 PyObject *__pyx_t_13 = NULL; | |
14091 char const *__pyx_t_14; | |
14092 int __pyx_lineno = 0; | |
14093 const char *__pyx_filename = NULL; | |
14094 int __pyx_clineno = 0; | |
14095 __Pyx_RefNannySetupContext("all_hits", 0); | |
14096 | |
14097 /* "pybedtools/cbedtools.pyx":916 | |
14098 * """ | |
14099 * cdef vector[BED] vec_b | |
14100 * self.loadIntoMap() # <<<<<<<<<<<<<< | |
14101 * | |
14102 * if same_strand == False: | |
14103 */ | |
14104 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadIntoMap); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error) | |
14105 __Pyx_GOTREF(__pyx_t_2); | |
14106 __pyx_t_3 = NULL; | |
14107 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
14108 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
14109 if (likely(__pyx_t_3)) { | |
14110 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
14111 __Pyx_INCREF(__pyx_t_3); | |
14112 __Pyx_INCREF(function); | |
14113 __Pyx_DECREF_SET(__pyx_t_2, function); | |
14114 } | |
14115 } | |
14116 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); | |
14117 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
14118 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) | |
14119 __Pyx_GOTREF(__pyx_t_1); | |
14120 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
14121 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14122 | |
14123 /* "pybedtools/cbedtools.pyx":918 | |
14124 * self.loadIntoMap() | |
14125 * | |
14126 * if same_strand == False: # <<<<<<<<<<<<<< | |
14127 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), overlap) | |
14128 * try: | |
14129 */ | |
14130 __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_same_strand), Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) | |
14131 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 918, __pyx_L1_error) | |
14132 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14133 if (__pyx_t_4) { | |
14134 | |
14135 /* "pybedtools/cbedtools.pyx":919 | |
14136 * | |
14137 * if same_strand == False: | |
14138 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), overlap) # <<<<<<<<<<<<<< | |
14139 * try: | |
14140 * return bed_vec2list(vec_b) | |
14141 */ | |
14142 __pyx_v_vec_b = __pyx_v_self->intervalFile_ptr->FindOverlapsPerBin((*__pyx_v_interval->_bed), __pyx_v_overlap); | |
14143 | |
14144 /* "pybedtools/cbedtools.pyx":920 | |
14145 * if same_strand == False: | |
14146 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), overlap) | |
14147 * try: # <<<<<<<<<<<<<< | |
14148 * return bed_vec2list(vec_b) | |
14149 * finally: | |
14150 */ | |
14151 /*try:*/ { | |
14152 | |
14153 /* "pybedtools/cbedtools.pyx":921 | |
14154 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), overlap) | |
14155 * try: | |
14156 * return bed_vec2list(vec_b) # <<<<<<<<<<<<<< | |
14157 * finally: | |
14158 * pass | |
14159 */ | |
14160 __Pyx_XDECREF(__pyx_r); | |
14161 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_bed_vec2list(__pyx_v_vec_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L5_error) | |
14162 __Pyx_GOTREF(__pyx_t_1); | |
14163 __pyx_r = __pyx_t_1; | |
14164 __pyx_t_1 = 0; | |
14165 goto __pyx_L4_return; | |
14166 } | |
14167 | |
14168 /* "pybedtools/cbedtools.pyx":923 | |
14169 * return bed_vec2list(vec_b) | |
14170 * finally: | |
14171 * pass # <<<<<<<<<<<<<< | |
14172 * else: | |
14173 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), same_strand, overlap) | |
14174 */ | |
14175 /*finally:*/ { | |
14176 __pyx_L5_error:; | |
14177 /*exception exit:*/{ | |
14178 __Pyx_PyThreadState_declare | |
14179 __Pyx_PyThreadState_assign | |
14180 __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; | |
14181 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14182 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; | |
14183 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
14184 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); | |
14185 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); | |
14186 __Pyx_XGOTREF(__pyx_t_8); | |
14187 __Pyx_XGOTREF(__pyx_t_9); | |
14188 __Pyx_XGOTREF(__pyx_t_10); | |
14189 __Pyx_XGOTREF(__pyx_t_11); | |
14190 __Pyx_XGOTREF(__pyx_t_12); | |
14191 __Pyx_XGOTREF(__pyx_t_13); | |
14192 __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename; | |
14193 { | |
14194 } | |
14195 if (PY_MAJOR_VERSION >= 3) { | |
14196 __Pyx_XGIVEREF(__pyx_t_11); | |
14197 __Pyx_XGIVEREF(__pyx_t_12); | |
14198 __Pyx_XGIVEREF(__pyx_t_13); | |
14199 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); | |
14200 } | |
14201 __Pyx_XGIVEREF(__pyx_t_8); | |
14202 __Pyx_XGIVEREF(__pyx_t_9); | |
14203 __Pyx_XGIVEREF(__pyx_t_10); | |
14204 __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10); | |
14205 __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; | |
14206 __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7; | |
14207 goto __pyx_L1_error; | |
14208 } | |
14209 __pyx_L4_return: { | |
14210 __pyx_t_13 = __pyx_r; | |
14211 __pyx_r = 0; | |
14212 __pyx_r = __pyx_t_13; | |
14213 __pyx_t_13 = 0; | |
14214 goto __pyx_L0; | |
14215 } | |
14216 } | |
14217 | |
14218 /* "pybedtools/cbedtools.pyx":918 | |
14219 * self.loadIntoMap() | |
14220 * | |
14221 * if same_strand == False: # <<<<<<<<<<<<<< | |
14222 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), overlap) | |
14223 * try: | |
14224 */ | |
14225 } | |
14226 | |
14227 /* "pybedtools/cbedtools.pyx":925 | |
14228 * pass | |
14229 * else: | |
14230 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), same_strand, overlap) # <<<<<<<<<<<<<< | |
14231 * try: | |
14232 * return bed_vec2list(vec_b) | |
14233 */ | |
14234 /*else*/ { | |
14235 __pyx_v_vec_b = __pyx_v_self->intervalFile_ptr->FindOverlapsPerBin((*__pyx_v_interval->_bed), __pyx_v_same_strand, __pyx_v_overlap); | |
14236 | |
14237 /* "pybedtools/cbedtools.pyx":926 | |
14238 * else: | |
14239 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), same_strand, overlap) | |
14240 * try: # <<<<<<<<<<<<<< | |
14241 * return bed_vec2list(vec_b) | |
14242 * finally: | |
14243 */ | |
14244 /*try:*/ { | |
14245 | |
14246 /* "pybedtools/cbedtools.pyx":927 | |
14247 * vec_b = self.intervalFile_ptr.FindOverlapsPerBin(deref(interval._bed), same_strand, overlap) | |
14248 * try: | |
14249 * return bed_vec2list(vec_b) # <<<<<<<<<<<<<< | |
14250 * finally: | |
14251 * pass | |
14252 */ | |
14253 __Pyx_XDECREF(__pyx_r); | |
14254 __pyx_t_1 = __pyx_f_10pybedtools_9cbedtools_bed_vec2list(__pyx_v_vec_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L10_error) | |
14255 __Pyx_GOTREF(__pyx_t_1); | |
14256 __pyx_r = __pyx_t_1; | |
14257 __pyx_t_1 = 0; | |
14258 goto __pyx_L9_return; | |
14259 } | |
14260 | |
14261 /* "pybedtools/cbedtools.pyx":929 | |
14262 * return bed_vec2list(vec_b) | |
14263 * finally: | |
14264 * pass # <<<<<<<<<<<<<< | |
14265 * | |
14266 * # search() is an alias for all_hits | |
14267 */ | |
14268 /*finally:*/ { | |
14269 __pyx_L10_error:; | |
14270 /*exception exit:*/{ | |
14271 __Pyx_PyThreadState_declare | |
14272 __Pyx_PyThreadState_assign | |
14273 __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; | |
14274 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14275 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; | |
14276 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
14277 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); | |
14278 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); | |
14279 __Pyx_XGOTREF(__pyx_t_13); | |
14280 __Pyx_XGOTREF(__pyx_t_12); | |
14281 __Pyx_XGOTREF(__pyx_t_11); | |
14282 __Pyx_XGOTREF(__pyx_t_10); | |
14283 __Pyx_XGOTREF(__pyx_t_9); | |
14284 __Pyx_XGOTREF(__pyx_t_8); | |
14285 __pyx_t_6 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_14 = __pyx_filename; | |
14286 { | |
14287 } | |
14288 if (PY_MAJOR_VERSION >= 3) { | |
14289 __Pyx_XGIVEREF(__pyx_t_10); | |
14290 __Pyx_XGIVEREF(__pyx_t_9); | |
14291 __Pyx_XGIVEREF(__pyx_t_8); | |
14292 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8); | |
14293 } | |
14294 __Pyx_XGIVEREF(__pyx_t_13); | |
14295 __Pyx_XGIVEREF(__pyx_t_12); | |
14296 __Pyx_XGIVEREF(__pyx_t_11); | |
14297 __Pyx_ErrRestore(__pyx_t_13, __pyx_t_12, __pyx_t_11); | |
14298 __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; | |
14299 __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_14; | |
14300 goto __pyx_L1_error; | |
14301 } | |
14302 __pyx_L9_return: { | |
14303 __pyx_t_8 = __pyx_r; | |
14304 __pyx_r = 0; | |
14305 __pyx_r = __pyx_t_8; | |
14306 __pyx_t_8 = 0; | |
14307 goto __pyx_L0; | |
14308 } | |
14309 } | |
14310 } | |
14311 | |
14312 /* "pybedtools/cbedtools.pyx":888 | |
14313 * | |
14314 * | |
14315 * def all_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): # <<<<<<<<<<<<<< | |
14316 * """ | |
14317 * :Signature: `IntervalFile.all_hits(interval, same_strand=False, overlap=0.0)` | |
14318 */ | |
14319 | |
14320 /* function exit code */ | |
14321 __pyx_L1_error:; | |
14322 __Pyx_XDECREF(__pyx_t_1); | |
14323 __Pyx_XDECREF(__pyx_t_2); | |
14324 __Pyx_XDECREF(__pyx_t_3); | |
14325 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.all_hits", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14326 __pyx_r = NULL; | |
14327 __pyx_L0:; | |
14328 __Pyx_XGIVEREF(__pyx_r); | |
14329 __Pyx_RefNannyFinishContext(); | |
14330 return __pyx_r; | |
14331 } | |
14332 | |
14333 /* "pybedtools/cbedtools.pyx":934 | |
14334 * search = all_hits | |
14335 * | |
14336 * def any_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): # <<<<<<<<<<<<<< | |
14337 * """ | |
14338 * :Signature: `IntervalFile.any_hits(interval, same_strand=False, overlap=0.0)` | |
14339 */ | |
14340 | |
14341 /* Python wrapper */ | |
14342 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_17any_hits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
14343 static char __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_16any_hits[] = "\n :Signature: `IntervalFile.any_hits(interval, same_strand=False, overlap=0.0)`\n\n Return 1 if the Interval `interval` had >=1 hit in this IntervalFile, 0 otherwise.\n\n `same_strand`, if True, will only consider hits on the same strand as `interval`.\n\n `overlap` can be used to specify the fraction of overlap between\n `interval` and each feature in the IntervalFile.\n\n Example usage:\n\n >>> fn = pybedtools.example_filename('a.bed')\n\n >>> # create an Interval to query with\n >>> i = pybedtools.Interval('chr1', 1, 10000, strand='+')\n\n >>> # Create an IntervalFile out of a.bed\n >>> intervalfile = pybedtools.IntervalFile(fn)\n\n >>> # any stranded hits?\n >>> intervalfile.any_hits(i, same_strand=True)\n 1\n\n "; | |
14344 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_17any_hits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
14345 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval = 0; | |
14346 PyBoolObject *__pyx_v_same_strand = 0; | |
14347 float __pyx_v_overlap; | |
14348 int __pyx_lineno = 0; | |
14349 const char *__pyx_filename = NULL; | |
14350 int __pyx_clineno = 0; | |
14351 PyObject *__pyx_r = 0; | |
14352 __Pyx_RefNannyDeclarations | |
14353 __Pyx_RefNannySetupContext("any_hits (wrapper)", 0); | |
14354 { | |
14355 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interval,&__pyx_n_s_same_strand,&__pyx_n_s_overlap,0}; | |
14356 PyObject* values[3] = {0,0,0}; | |
14357 values[1] = (PyObject *)((PyBoolObject *)Py_False); | |
14358 if (unlikely(__pyx_kwds)) { | |
14359 Py_ssize_t kw_args; | |
14360 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
14361 switch (pos_args) { | |
14362 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14363 CYTHON_FALLTHROUGH; | |
14364 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14365 CYTHON_FALLTHROUGH; | |
14366 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14367 CYTHON_FALLTHROUGH; | |
14368 case 0: break; | |
14369 default: goto __pyx_L5_argtuple_error; | |
14370 } | |
14371 kw_args = PyDict_Size(__pyx_kwds); | |
14372 switch (pos_args) { | |
14373 case 0: | |
14374 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interval)) != 0)) kw_args--; | |
14375 else goto __pyx_L5_argtuple_error; | |
14376 CYTHON_FALLTHROUGH; | |
14377 case 1: | |
14378 if (kw_args > 0) { | |
14379 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_same_strand); | |
14380 if (value) { values[1] = value; kw_args--; } | |
14381 } | |
14382 CYTHON_FALLTHROUGH; | |
14383 case 2: | |
14384 if (kw_args > 0) { | |
14385 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_overlap); | |
14386 if (value) { values[2] = value; kw_args--; } | |
14387 } | |
14388 } | |
14389 if (unlikely(kw_args > 0)) { | |
14390 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "any_hits") < 0)) __PYX_ERR(0, 934, __pyx_L3_error) | |
14391 } | |
14392 } else { | |
14393 switch (PyTuple_GET_SIZE(__pyx_args)) { | |
14394 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14395 CYTHON_FALLTHROUGH; | |
14396 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14397 CYTHON_FALLTHROUGH; | |
14398 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14399 break; | |
14400 default: goto __pyx_L5_argtuple_error; | |
14401 } | |
14402 } | |
14403 __pyx_v_interval = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)values[0]); | |
14404 __pyx_v_same_strand = ((PyBoolObject *)values[1]); | |
14405 if (values[2]) { | |
14406 __pyx_v_overlap = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_overlap == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L3_error) | |
14407 } else { | |
14408 __pyx_v_overlap = ((float)0.0); | |
14409 } | |
14410 } | |
14411 goto __pyx_L4_argument_unpacking_done; | |
14412 __pyx_L5_argtuple_error:; | |
14413 __Pyx_RaiseArgtupleInvalid("any_hits", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 934, __pyx_L3_error) | |
14414 __pyx_L3_error:; | |
14415 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.any_hits", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14416 __Pyx_RefNannyFinishContext(); | |
14417 return NULL; | |
14418 __pyx_L4_argument_unpacking_done:; | |
14419 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interval), __pyx_ptype_10pybedtools_9cbedtools_Interval, 1, "interval", 0))) __PYX_ERR(0, 934, __pyx_L1_error) | |
14420 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_same_strand), __pyx_ptype_7cpython_4bool_bool, 1, "same_strand", 0))) __PYX_ERR(0, 934, __pyx_L1_error) | |
14421 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_16any_hits(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self), __pyx_v_interval, __pyx_v_same_strand, __pyx_v_overlap); | |
14422 | |
14423 /* function exit code */ | |
14424 goto __pyx_L0; | |
14425 __pyx_L1_error:; | |
14426 __pyx_r = NULL; | |
14427 __pyx_L0:; | |
14428 __Pyx_RefNannyFinishContext(); | |
14429 return __pyx_r; | |
14430 } | |
14431 | |
14432 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_16any_hits(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval, PyBoolObject *__pyx_v_same_strand, float __pyx_v_overlap) { | |
14433 long __pyx_v_found; | |
14434 PyObject *__pyx_r = NULL; | |
14435 __Pyx_RefNannyDeclarations | |
14436 PyObject *__pyx_t_1 = NULL; | |
14437 PyObject *__pyx_t_2 = NULL; | |
14438 PyObject *__pyx_t_3 = NULL; | |
14439 int __pyx_t_4; | |
14440 int __pyx_lineno = 0; | |
14441 const char *__pyx_filename = NULL; | |
14442 int __pyx_clineno = 0; | |
14443 __Pyx_RefNannySetupContext("any_hits", 0); | |
14444 | |
14445 /* "pybedtools/cbedtools.pyx":960 | |
14446 * | |
14447 * """ | |
14448 * found = 0 # <<<<<<<<<<<<<< | |
14449 * self.loadIntoMap() | |
14450 * | |
14451 */ | |
14452 __pyx_v_found = 0; | |
14453 | |
14454 /* "pybedtools/cbedtools.pyx":961 | |
14455 * """ | |
14456 * found = 0 | |
14457 * self.loadIntoMap() # <<<<<<<<<<<<<< | |
14458 * | |
14459 * if same_strand == False: | |
14460 */ | |
14461 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadIntoMap); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error) | |
14462 __Pyx_GOTREF(__pyx_t_2); | |
14463 __pyx_t_3 = NULL; | |
14464 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
14465 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
14466 if (likely(__pyx_t_3)) { | |
14467 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
14468 __Pyx_INCREF(__pyx_t_3); | |
14469 __Pyx_INCREF(function); | |
14470 __Pyx_DECREF_SET(__pyx_t_2, function); | |
14471 } | |
14472 } | |
14473 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); | |
14474 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
14475 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error) | |
14476 __Pyx_GOTREF(__pyx_t_1); | |
14477 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
14478 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14479 | |
14480 /* "pybedtools/cbedtools.pyx":963 | |
14481 * self.loadIntoMap() | |
14482 * | |
14483 * if same_strand == False: # <<<<<<<<<<<<<< | |
14484 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), overlap) | |
14485 * else: | |
14486 */ | |
14487 __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_same_strand), Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error) | |
14488 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 963, __pyx_L1_error) | |
14489 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14490 if (__pyx_t_4) { | |
14491 | |
14492 /* "pybedtools/cbedtools.pyx":964 | |
14493 * | |
14494 * if same_strand == False: | |
14495 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), overlap) # <<<<<<<<<<<<<< | |
14496 * else: | |
14497 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), same_strand, overlap) | |
14498 */ | |
14499 __pyx_v_found = __pyx_v_self->intervalFile_ptr->FindAnyOverlapsPerBin((*__pyx_v_interval->_bed), __pyx_v_overlap); | |
14500 | |
14501 /* "pybedtools/cbedtools.pyx":963 | |
14502 * self.loadIntoMap() | |
14503 * | |
14504 * if same_strand == False: # <<<<<<<<<<<<<< | |
14505 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), overlap) | |
14506 * else: | |
14507 */ | |
14508 goto __pyx_L3; | |
14509 } | |
14510 | |
14511 /* "pybedtools/cbedtools.pyx":966 | |
14512 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), overlap) | |
14513 * else: | |
14514 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), same_strand, overlap) # <<<<<<<<<<<<<< | |
14515 * | |
14516 * return found | |
14517 */ | |
14518 /*else*/ { | |
14519 __pyx_v_found = __pyx_v_self->intervalFile_ptr->FindAnyOverlapsPerBin((*__pyx_v_interval->_bed), __pyx_v_same_strand, __pyx_v_overlap); | |
14520 } | |
14521 __pyx_L3:; | |
14522 | |
14523 /* "pybedtools/cbedtools.pyx":968 | |
14524 * found = self.intervalFile_ptr.FindAnyOverlapsPerBin(deref(interval._bed), same_strand, overlap) | |
14525 * | |
14526 * return found # <<<<<<<<<<<<<< | |
14527 * | |
14528 * def count_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): | |
14529 */ | |
14530 __Pyx_XDECREF(__pyx_r); | |
14531 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_found); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error) | |
14532 __Pyx_GOTREF(__pyx_t_1); | |
14533 __pyx_r = __pyx_t_1; | |
14534 __pyx_t_1 = 0; | |
14535 goto __pyx_L0; | |
14536 | |
14537 /* "pybedtools/cbedtools.pyx":934 | |
14538 * search = all_hits | |
14539 * | |
14540 * def any_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): # <<<<<<<<<<<<<< | |
14541 * """ | |
14542 * :Signature: `IntervalFile.any_hits(interval, same_strand=False, overlap=0.0)` | |
14543 */ | |
14544 | |
14545 /* function exit code */ | |
14546 __pyx_L1_error:; | |
14547 __Pyx_XDECREF(__pyx_t_1); | |
14548 __Pyx_XDECREF(__pyx_t_2); | |
14549 __Pyx_XDECREF(__pyx_t_3); | |
14550 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.any_hits", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14551 __pyx_r = NULL; | |
14552 __pyx_L0:; | |
14553 __Pyx_XGIVEREF(__pyx_r); | |
14554 __Pyx_RefNannyFinishContext(); | |
14555 return __pyx_r; | |
14556 } | |
14557 | |
14558 /* "pybedtools/cbedtools.pyx":970 | |
14559 * return found | |
14560 * | |
14561 * def count_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): # <<<<<<<<<<<<<< | |
14562 * """ | |
14563 * :Signature: `IntervalFile.count_hits(interval, same_strand=False, overlap=0.0)` | |
14564 */ | |
14565 | |
14566 /* Python wrapper */ | |
14567 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_19count_hits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
14568 static char __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_18count_hits[] = "\n :Signature: `IntervalFile.count_hits(interval, same_strand=False, overlap=0.0)`\n\n Return the number of overlaps of the Interval `interval` had with this\n IntervalFile.\n\n `same_strand`, if True, will only consider hits on the same strand as\n `interval`.\n\n `overlap` can be used to specify the fraction of overlap between\n `interval` and each feature in the IntervalFile.\n\n Example usage:\n\n >>> fn = pybedtools.example_filename('a.bed')\n\n >>> # create an Interval to query with\n >>> i = pybedtools.Interval('chr1', 1, 10000, strand='+')\n\n >>> # Create an IntervalFile out of a.bed\n >>> intervalfile = pybedtools.IntervalFile(fn)\n\n >>> # get number of stranded hits\n >>> intervalfile.count_hits(i, same_strand=True)\n 3\n\n "; | |
14569 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_19count_hits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
14570 struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval = 0; | |
14571 PyBoolObject *__pyx_v_same_strand = 0; | |
14572 float __pyx_v_overlap; | |
14573 int __pyx_lineno = 0; | |
14574 const char *__pyx_filename = NULL; | |
14575 int __pyx_clineno = 0; | |
14576 PyObject *__pyx_r = 0; | |
14577 __Pyx_RefNannyDeclarations | |
14578 __Pyx_RefNannySetupContext("count_hits (wrapper)", 0); | |
14579 { | |
14580 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interval,&__pyx_n_s_same_strand,&__pyx_n_s_overlap,0}; | |
14581 PyObject* values[3] = {0,0,0}; | |
14582 values[1] = (PyObject *)((PyBoolObject *)Py_False); | |
14583 if (unlikely(__pyx_kwds)) { | |
14584 Py_ssize_t kw_args; | |
14585 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
14586 switch (pos_args) { | |
14587 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14588 CYTHON_FALLTHROUGH; | |
14589 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14590 CYTHON_FALLTHROUGH; | |
14591 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14592 CYTHON_FALLTHROUGH; | |
14593 case 0: break; | |
14594 default: goto __pyx_L5_argtuple_error; | |
14595 } | |
14596 kw_args = PyDict_Size(__pyx_kwds); | |
14597 switch (pos_args) { | |
14598 case 0: | |
14599 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interval)) != 0)) kw_args--; | |
14600 else goto __pyx_L5_argtuple_error; | |
14601 CYTHON_FALLTHROUGH; | |
14602 case 1: | |
14603 if (kw_args > 0) { | |
14604 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_same_strand); | |
14605 if (value) { values[1] = value; kw_args--; } | |
14606 } | |
14607 CYTHON_FALLTHROUGH; | |
14608 case 2: | |
14609 if (kw_args > 0) { | |
14610 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_overlap); | |
14611 if (value) { values[2] = value; kw_args--; } | |
14612 } | |
14613 } | |
14614 if (unlikely(kw_args > 0)) { | |
14615 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_hits") < 0)) __PYX_ERR(0, 970, __pyx_L3_error) | |
14616 } | |
14617 } else { | |
14618 switch (PyTuple_GET_SIZE(__pyx_args)) { | |
14619 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14620 CYTHON_FALLTHROUGH; | |
14621 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14622 CYTHON_FALLTHROUGH; | |
14623 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14624 break; | |
14625 default: goto __pyx_L5_argtuple_error; | |
14626 } | |
14627 } | |
14628 __pyx_v_interval = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)values[0]); | |
14629 __pyx_v_same_strand = ((PyBoolObject *)values[1]); | |
14630 if (values[2]) { | |
14631 __pyx_v_overlap = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_overlap == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 970, __pyx_L3_error) | |
14632 } else { | |
14633 __pyx_v_overlap = ((float)0.0); | |
14634 } | |
14635 } | |
14636 goto __pyx_L4_argument_unpacking_done; | |
14637 __pyx_L5_argtuple_error:; | |
14638 __Pyx_RaiseArgtupleInvalid("count_hits", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 970, __pyx_L3_error) | |
14639 __pyx_L3_error:; | |
14640 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.count_hits", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14641 __Pyx_RefNannyFinishContext(); | |
14642 return NULL; | |
14643 __pyx_L4_argument_unpacking_done:; | |
14644 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interval), __pyx_ptype_10pybedtools_9cbedtools_Interval, 1, "interval", 0))) __PYX_ERR(0, 970, __pyx_L1_error) | |
14645 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_same_strand), __pyx_ptype_7cpython_4bool_bool, 1, "same_strand", 0))) __PYX_ERR(0, 970, __pyx_L1_error) | |
14646 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_18count_hits(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self), __pyx_v_interval, __pyx_v_same_strand, __pyx_v_overlap); | |
14647 | |
14648 /* function exit code */ | |
14649 goto __pyx_L0; | |
14650 __pyx_L1_error:; | |
14651 __pyx_r = NULL; | |
14652 __pyx_L0:; | |
14653 __Pyx_RefNannyFinishContext(); | |
14654 return __pyx_r; | |
14655 } | |
14656 | |
14657 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_18count_hits(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, struct __pyx_obj_10pybedtools_9cbedtools_Interval *__pyx_v_interval, PyBoolObject *__pyx_v_same_strand, float __pyx_v_overlap) { | |
14658 PyObject *__pyx_r = NULL; | |
14659 __Pyx_RefNannyDeclarations | |
14660 PyObject *__pyx_t_1 = NULL; | |
14661 PyObject *__pyx_t_2 = NULL; | |
14662 PyObject *__pyx_t_3 = NULL; | |
14663 int __pyx_t_4; | |
14664 int __pyx_lineno = 0; | |
14665 const char *__pyx_filename = NULL; | |
14666 int __pyx_clineno = 0; | |
14667 __Pyx_RefNannySetupContext("count_hits", 0); | |
14668 | |
14669 /* "pybedtools/cbedtools.pyx":998 | |
14670 * | |
14671 * """ | |
14672 * self.loadIntoMap() # <<<<<<<<<<<<<< | |
14673 * | |
14674 * if same_strand == False: | |
14675 */ | |
14676 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_loadIntoMap); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 998, __pyx_L1_error) | |
14677 __Pyx_GOTREF(__pyx_t_2); | |
14678 __pyx_t_3 = NULL; | |
14679 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { | |
14680 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); | |
14681 if (likely(__pyx_t_3)) { | |
14682 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); | |
14683 __Pyx_INCREF(__pyx_t_3); | |
14684 __Pyx_INCREF(function); | |
14685 __Pyx_DECREF_SET(__pyx_t_2, function); | |
14686 } | |
14687 } | |
14688 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); | |
14689 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; | |
14690 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error) | |
14691 __Pyx_GOTREF(__pyx_t_1); | |
14692 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
14693 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14694 | |
14695 /* "pybedtools/cbedtools.pyx":1000 | |
14696 * self.loadIntoMap() | |
14697 * | |
14698 * if same_strand == False: # <<<<<<<<<<<<<< | |
14699 * return self.intervalFile_ptr.CountOverlapsPerBin(deref(interval._bed), overlap) | |
14700 * else: | |
14701 */ | |
14702 __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_same_strand), Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1000, __pyx_L1_error) | |
14703 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1000, __pyx_L1_error) | |
14704 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14705 if (__pyx_t_4) { | |
14706 | |
14707 /* "pybedtools/cbedtools.pyx":1001 | |
14708 * | |
14709 * if same_strand == False: | |
14710 * return self.intervalFile_ptr.CountOverlapsPerBin(deref(interval._bed), overlap) # <<<<<<<<<<<<<< | |
14711 * else: | |
14712 * return self.intervalFile_ptr.CountOverlapsPerBin(deref(interval._bed), same_strand, overlap) | |
14713 */ | |
14714 __Pyx_XDECREF(__pyx_r); | |
14715 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->intervalFile_ptr->CountOverlapsPerBin((*__pyx_v_interval->_bed), __pyx_v_overlap)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1001, __pyx_L1_error) | |
14716 __Pyx_GOTREF(__pyx_t_1); | |
14717 __pyx_r = __pyx_t_1; | |
14718 __pyx_t_1 = 0; | |
14719 goto __pyx_L0; | |
14720 | |
14721 /* "pybedtools/cbedtools.pyx":1000 | |
14722 * self.loadIntoMap() | |
14723 * | |
14724 * if same_strand == False: # <<<<<<<<<<<<<< | |
14725 * return self.intervalFile_ptr.CountOverlapsPerBin(deref(interval._bed), overlap) | |
14726 * else: | |
14727 */ | |
14728 } | |
14729 | |
14730 /* "pybedtools/cbedtools.pyx":1003 | |
14731 * return self.intervalFile_ptr.CountOverlapsPerBin(deref(interval._bed), overlap) | |
14732 * else: | |
14733 * return self.intervalFile_ptr.CountOverlapsPerBin(deref(interval._bed), same_strand, overlap) # <<<<<<<<<<<<<< | |
14734 */ | |
14735 /*else*/ { | |
14736 __Pyx_XDECREF(__pyx_r); | |
14737 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->intervalFile_ptr->CountOverlapsPerBin((*__pyx_v_interval->_bed), __pyx_v_same_strand, __pyx_v_overlap)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error) | |
14738 __Pyx_GOTREF(__pyx_t_1); | |
14739 __pyx_r = __pyx_t_1; | |
14740 __pyx_t_1 = 0; | |
14741 goto __pyx_L0; | |
14742 } | |
14743 | |
14744 /* "pybedtools/cbedtools.pyx":970 | |
14745 * return found | |
14746 * | |
14747 * def count_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): # <<<<<<<<<<<<<< | |
14748 * """ | |
14749 * :Signature: `IntervalFile.count_hits(interval, same_strand=False, overlap=0.0)` | |
14750 */ | |
14751 | |
14752 /* function exit code */ | |
14753 __pyx_L1_error:; | |
14754 __Pyx_XDECREF(__pyx_t_1); | |
14755 __Pyx_XDECREF(__pyx_t_2); | |
14756 __Pyx_XDECREF(__pyx_t_3); | |
14757 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.count_hits", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14758 __pyx_r = NULL; | |
14759 __pyx_L0:; | |
14760 __Pyx_XGIVEREF(__pyx_r); | |
14761 __Pyx_RefNannyFinishContext(); | |
14762 return __pyx_r; | |
14763 } | |
14764 | |
14765 /* "(tree fragment)":1 | |
14766 * def __reduce_cython__(self): # <<<<<<<<<<<<<< | |
14767 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14768 * def __setstate_cython__(self, __pyx_state): | |
14769 */ | |
14770 | |
14771 /* Python wrapper */ | |
14772 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
14773 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { | |
14774 PyObject *__pyx_r = 0; | |
14775 __Pyx_RefNannyDeclarations | |
14776 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); | |
14777 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_20__reduce_cython__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self)); | |
14778 | |
14779 /* function exit code */ | |
14780 __Pyx_RefNannyFinishContext(); | |
14781 return __pyx_r; | |
14782 } | |
14783 | |
14784 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self) { | |
14785 PyObject *__pyx_r = NULL; | |
14786 __Pyx_RefNannyDeclarations | |
14787 PyObject *__pyx_t_1 = NULL; | |
14788 int __pyx_lineno = 0; | |
14789 const char *__pyx_filename = NULL; | |
14790 int __pyx_clineno = 0; | |
14791 __Pyx_RefNannySetupContext("__reduce_cython__", 0); | |
14792 | |
14793 /* "(tree fragment)":2 | |
14794 * def __reduce_cython__(self): | |
14795 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
14796 * def __setstate_cython__(self, __pyx_state): | |
14797 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14798 */ | |
14799 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) | |
14800 __Pyx_GOTREF(__pyx_t_1); | |
14801 __Pyx_Raise(__pyx_t_1, 0, 0, 0); | |
14802 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14803 __PYX_ERR(1, 2, __pyx_L1_error) | |
14804 | |
14805 /* "(tree fragment)":1 | |
14806 * def __reduce_cython__(self): # <<<<<<<<<<<<<< | |
14807 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14808 * def __setstate_cython__(self, __pyx_state): | |
14809 */ | |
14810 | |
14811 /* function exit code */ | |
14812 __pyx_L1_error:; | |
14813 __Pyx_XDECREF(__pyx_t_1); | |
14814 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14815 __pyx_r = NULL; | |
14816 __Pyx_XGIVEREF(__pyx_r); | |
14817 __Pyx_RefNannyFinishContext(); | |
14818 return __pyx_r; | |
14819 } | |
14820 | |
14821 /* "(tree fragment)":3 | |
14822 * def __reduce_cython__(self): | |
14823 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14824 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< | |
14825 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14826 */ | |
14827 | |
14828 /* Python wrapper */ | |
14829 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ | |
14830 static PyObject *__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { | |
14831 PyObject *__pyx_r = 0; | |
14832 __Pyx_RefNannyDeclarations | |
14833 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); | |
14834 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_12IntervalFile_22__setstate_cython__(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); | |
14835 | |
14836 /* function exit code */ | |
14837 __Pyx_RefNannyFinishContext(); | |
14838 return __pyx_r; | |
14839 } | |
14840 | |
14841 static PyObject *__pyx_pf_10pybedtools_9cbedtools_12IntervalFile_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { | |
14842 PyObject *__pyx_r = NULL; | |
14843 __Pyx_RefNannyDeclarations | |
14844 PyObject *__pyx_t_1 = NULL; | |
14845 int __pyx_lineno = 0; | |
14846 const char *__pyx_filename = NULL; | |
14847 int __pyx_clineno = 0; | |
14848 __Pyx_RefNannySetupContext("__setstate_cython__", 0); | |
14849 | |
14850 /* "(tree fragment)":4 | |
14851 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14852 * def __setstate_cython__(self, __pyx_state): | |
14853 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
14854 */ | |
14855 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) | |
14856 __Pyx_GOTREF(__pyx_t_1); | |
14857 __Pyx_Raise(__pyx_t_1, 0, 0, 0); | |
14858 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14859 __PYX_ERR(1, 4, __pyx_L1_error) | |
14860 | |
14861 /* "(tree fragment)":3 | |
14862 * def __reduce_cython__(self): | |
14863 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14864 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< | |
14865 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
14866 */ | |
14867 | |
14868 /* function exit code */ | |
14869 __pyx_L1_error:; | |
14870 __Pyx_XDECREF(__pyx_t_1); | |
14871 __Pyx_AddTraceback("pybedtools.cbedtools.IntervalFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14872 __pyx_r = NULL; | |
14873 __Pyx_XGIVEREF(__pyx_r); | |
14874 __Pyx_RefNannyFinishContext(); | |
14875 return __pyx_r; | |
14876 } | |
14877 | |
14878 /* "(tree fragment)":1 | |
14879 * def __pyx_unpickle_IntervalIterator(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< | |
14880 * cdef object __pyx_PickleError | |
14881 * cdef object __pyx_result | |
14882 */ | |
14883 | |
14884 /* Python wrapper */ | |
14885 static PyObject *__pyx_pw_10pybedtools_9cbedtools_5__pyx_unpickle_IntervalIterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
14886 static PyMethodDef __pyx_mdef_10pybedtools_9cbedtools_5__pyx_unpickle_IntervalIterator = {"__pyx_unpickle_IntervalIterator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_5__pyx_unpickle_IntervalIterator, METH_VARARGS|METH_KEYWORDS, 0}; | |
14887 static PyObject *__pyx_pw_10pybedtools_9cbedtools_5__pyx_unpickle_IntervalIterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
14888 PyObject *__pyx_v___pyx_type = 0; | |
14889 long __pyx_v___pyx_checksum; | |
14890 PyObject *__pyx_v___pyx_state = 0; | |
14891 int __pyx_lineno = 0; | |
14892 const char *__pyx_filename = NULL; | |
14893 int __pyx_clineno = 0; | |
14894 PyObject *__pyx_r = 0; | |
14895 __Pyx_RefNannyDeclarations | |
14896 __Pyx_RefNannySetupContext("__pyx_unpickle_IntervalIterator (wrapper)", 0); | |
14897 { | |
14898 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; | |
14899 PyObject* values[3] = {0,0,0}; | |
14900 if (unlikely(__pyx_kwds)) { | |
14901 Py_ssize_t kw_args; | |
14902 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); | |
14903 switch (pos_args) { | |
14904 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14905 CYTHON_FALLTHROUGH; | |
14906 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14907 CYTHON_FALLTHROUGH; | |
14908 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14909 CYTHON_FALLTHROUGH; | |
14910 case 0: break; | |
14911 default: goto __pyx_L5_argtuple_error; | |
14912 } | |
14913 kw_args = PyDict_Size(__pyx_kwds); | |
14914 switch (pos_args) { | |
14915 case 0: | |
14916 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; | |
14917 else goto __pyx_L5_argtuple_error; | |
14918 CYTHON_FALLTHROUGH; | |
14919 case 1: | |
14920 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; | |
14921 else { | |
14922 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_IntervalIterator", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) | |
14923 } | |
14924 CYTHON_FALLTHROUGH; | |
14925 case 2: | |
14926 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; | |
14927 else { | |
14928 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_IntervalIterator", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) | |
14929 } | |
14930 } | |
14931 if (unlikely(kw_args > 0)) { | |
14932 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_IntervalIterator") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) | |
14933 } | |
14934 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { | |
14935 goto __pyx_L5_argtuple_error; | |
14936 } else { | |
14937 values[0] = PyTuple_GET_ITEM(__pyx_args, 0); | |
14938 values[1] = PyTuple_GET_ITEM(__pyx_args, 1); | |
14939 values[2] = PyTuple_GET_ITEM(__pyx_args, 2); | |
14940 } | |
14941 __pyx_v___pyx_type = values[0]; | |
14942 __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) | |
14943 __pyx_v___pyx_state = values[2]; | |
14944 } | |
14945 goto __pyx_L4_argument_unpacking_done; | |
14946 __pyx_L5_argtuple_error:; | |
14947 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_IntervalIterator", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error) | |
14948 __pyx_L3_error:; | |
14949 __Pyx_AddTraceback("pybedtools.cbedtools.__pyx_unpickle_IntervalIterator", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
14950 __Pyx_RefNannyFinishContext(); | |
14951 return NULL; | |
14952 __pyx_L4_argument_unpacking_done:; | |
14953 __pyx_r = __pyx_pf_10pybedtools_9cbedtools_4__pyx_unpickle_IntervalIterator(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); | |
14954 | |
14955 /* function exit code */ | |
14956 __Pyx_RefNannyFinishContext(); | |
14957 return __pyx_r; | |
14958 } | |
14959 | |
14960 static PyObject *__pyx_pf_10pybedtools_9cbedtools_4__pyx_unpickle_IntervalIterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { | |
14961 PyObject *__pyx_v___pyx_PickleError = 0; | |
14962 PyObject *__pyx_v___pyx_result = 0; | |
14963 PyObject *__pyx_r = NULL; | |
14964 __Pyx_RefNannyDeclarations | |
14965 PyObject *__pyx_t_1 = NULL; | |
14966 int __pyx_t_2; | |
14967 int __pyx_t_3; | |
14968 PyObject *__pyx_t_4 = NULL; | |
14969 PyObject *__pyx_t_5 = NULL; | |
14970 PyObject *__pyx_t_6 = NULL; | |
14971 int __pyx_lineno = 0; | |
14972 const char *__pyx_filename = NULL; | |
14973 int __pyx_clineno = 0; | |
14974 __Pyx_RefNannySetupContext("__pyx_unpickle_IntervalIterator", 0); | |
14975 | |
14976 /* "(tree fragment)":4 | |
14977 * cdef object __pyx_PickleError | |
14978 * cdef object __pyx_result | |
14979 * if __pyx_checksum not in (0x15da9d6, 0xa415738, 0x19b863f): # <<<<<<<<<<<<<< | |
14980 * from pickle import PickleError as __pyx_PickleError | |
14981 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) | |
14982 */ | |
14983 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) | |
14984 __Pyx_GOTREF(__pyx_t_1); | |
14985 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__30, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 4, __pyx_L1_error) | |
14986 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
14987 __pyx_t_3 = (__pyx_t_2 != 0); | |
14988 if (__pyx_t_3) { | |
14989 | |
14990 /* "(tree fragment)":5 | |
14991 * cdef object __pyx_result | |
14992 * if __pyx_checksum not in (0x15da9d6, 0xa415738, 0x19b863f): | |
14993 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< | |
14994 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) | |
14995 * __pyx_result = IntervalIterator.__new__(__pyx_type) | |
14996 */ | |
14997 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) | |
14998 __Pyx_GOTREF(__pyx_t_1); | |
14999 __Pyx_INCREF(__pyx_n_s_PickleError); | |
15000 __Pyx_GIVEREF(__pyx_n_s_PickleError); | |
15001 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); | |
15002 __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) | |
15003 __Pyx_GOTREF(__pyx_t_4); | |
15004 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15005 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) | |
15006 __Pyx_GOTREF(__pyx_t_1); | |
15007 __Pyx_INCREF(__pyx_t_1); | |
15008 __pyx_v___pyx_PickleError = __pyx_t_1; | |
15009 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15010 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
15011 | |
15012 /* "(tree fragment)":6 | |
15013 * if __pyx_checksum not in (0x15da9d6, 0xa415738, 0x19b863f): | |
15014 * from pickle import PickleError as __pyx_PickleError | |
15015 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) # <<<<<<<<<<<<<< | |
15016 * __pyx_result = IntervalIterator.__new__(__pyx_type) | |
15017 * if __pyx_state is not None: | |
15018 */ | |
15019 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) | |
15020 __Pyx_GOTREF(__pyx_t_1); | |
15021 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error) | |
15022 __Pyx_GOTREF(__pyx_t_5); | |
15023 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15024 __Pyx_INCREF(__pyx_v___pyx_PickleError); | |
15025 __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; | |
15026 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { | |
15027 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); | |
15028 if (likely(__pyx_t_6)) { | |
15029 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
15030 __Pyx_INCREF(__pyx_t_6); | |
15031 __Pyx_INCREF(function); | |
15032 __Pyx_DECREF_SET(__pyx_t_1, function); | |
15033 } | |
15034 } | |
15035 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); | |
15036 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; | |
15037 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
15038 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) | |
15039 __Pyx_GOTREF(__pyx_t_4); | |
15040 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15041 __Pyx_Raise(__pyx_t_4, 0, 0, 0); | |
15042 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
15043 __PYX_ERR(1, 6, __pyx_L1_error) | |
15044 | |
15045 /* "(tree fragment)":4 | |
15046 * cdef object __pyx_PickleError | |
15047 * cdef object __pyx_result | |
15048 * if __pyx_checksum not in (0x15da9d6, 0xa415738, 0x19b863f): # <<<<<<<<<<<<<< | |
15049 * from pickle import PickleError as __pyx_PickleError | |
15050 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) | |
15051 */ | |
15052 } | |
15053 | |
15054 /* "(tree fragment)":7 | |
15055 * from pickle import PickleError as __pyx_PickleError | |
15056 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) | |
15057 * __pyx_result = IntervalIterator.__new__(__pyx_type) # <<<<<<<<<<<<<< | |
15058 * if __pyx_state is not None: | |
15059 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) | |
15060 */ | |
15061 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10pybedtools_9cbedtools_IntervalIterator), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) | |
15062 __Pyx_GOTREF(__pyx_t_1); | |
15063 __pyx_t_5 = NULL; | |
15064 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { | |
15065 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); | |
15066 if (likely(__pyx_t_5)) { | |
15067 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); | |
15068 __Pyx_INCREF(__pyx_t_5); | |
15069 __Pyx_INCREF(function); | |
15070 __Pyx_DECREF_SET(__pyx_t_1, function); | |
15071 } | |
15072 } | |
15073 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); | |
15074 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
15075 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7, __pyx_L1_error) | |
15076 __Pyx_GOTREF(__pyx_t_4); | |
15077 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15078 __pyx_v___pyx_result = __pyx_t_4; | |
15079 __pyx_t_4 = 0; | |
15080 | |
15081 /* "(tree fragment)":8 | |
15082 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) | |
15083 * __pyx_result = IntervalIterator.__new__(__pyx_type) | |
15084 * if __pyx_state is not None: # <<<<<<<<<<<<<< | |
15085 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) | |
15086 * return __pyx_result | |
15087 */ | |
15088 __pyx_t_3 = (__pyx_v___pyx_state != Py_None); | |
15089 __pyx_t_2 = (__pyx_t_3 != 0); | |
15090 if (__pyx_t_2) { | |
15091 | |
15092 /* "(tree fragment)":9 | |
15093 * __pyx_result = IntervalIterator.__new__(__pyx_type) | |
15094 * if __pyx_state is not None: | |
15095 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) # <<<<<<<<<<<<<< | |
15096 * return __pyx_result | |
15097 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): | |
15098 */ | |
15099 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)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) | |
15100 __pyx_t_4 = __pyx_f_10pybedtools_9cbedtools___pyx_unpickle_IntervalIterator__set_state(((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 9, __pyx_L1_error) | |
15101 __Pyx_GOTREF(__pyx_t_4); | |
15102 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
15103 | |
15104 /* "(tree fragment)":8 | |
15105 * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0x15da9d6, 0xa415738, 0x19b863f) = (_itemtype, stream))" % __pyx_checksum) | |
15106 * __pyx_result = IntervalIterator.__new__(__pyx_type) | |
15107 * if __pyx_state is not None: # <<<<<<<<<<<<<< | |
15108 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) | |
15109 * return __pyx_result | |
15110 */ | |
15111 } | |
15112 | |
15113 /* "(tree fragment)":10 | |
15114 * if __pyx_state is not None: | |
15115 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) | |
15116 * return __pyx_result # <<<<<<<<<<<<<< | |
15117 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): | |
15118 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] | |
15119 */ | |
15120 __Pyx_XDECREF(__pyx_r); | |
15121 __Pyx_INCREF(__pyx_v___pyx_result); | |
15122 __pyx_r = __pyx_v___pyx_result; | |
15123 goto __pyx_L0; | |
15124 | |
15125 /* "(tree fragment)":1 | |
15126 * def __pyx_unpickle_IntervalIterator(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< | |
15127 * cdef object __pyx_PickleError | |
15128 * cdef object __pyx_result | |
15129 */ | |
15130 | |
15131 /* function exit code */ | |
15132 __pyx_L1_error:; | |
15133 __Pyx_XDECREF(__pyx_t_1); | |
15134 __Pyx_XDECREF(__pyx_t_4); | |
15135 __Pyx_XDECREF(__pyx_t_5); | |
15136 __Pyx_XDECREF(__pyx_t_6); | |
15137 __Pyx_AddTraceback("pybedtools.cbedtools.__pyx_unpickle_IntervalIterator", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15138 __pyx_r = NULL; | |
15139 __pyx_L0:; | |
15140 __Pyx_XDECREF(__pyx_v___pyx_PickleError); | |
15141 __Pyx_XDECREF(__pyx_v___pyx_result); | |
15142 __Pyx_XGIVEREF(__pyx_r); | |
15143 __Pyx_RefNannyFinishContext(); | |
15144 return __pyx_r; | |
15145 } | |
15146 | |
15147 /* "(tree fragment)":11 | |
15148 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) | |
15149 * return __pyx_result | |
15150 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< | |
15151 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] | |
15152 * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): | |
15153 */ | |
15154 | |
15155 static PyObject *__pyx_f_10pybedtools_9cbedtools___pyx_unpickle_IntervalIterator__set_state(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { | |
15156 PyObject *__pyx_r = NULL; | |
15157 __Pyx_RefNannyDeclarations | |
15158 PyObject *__pyx_t_1 = NULL; | |
15159 int __pyx_t_2; | |
15160 int __pyx_t_3; | |
15161 Py_ssize_t __pyx_t_4; | |
15162 int __pyx_t_5; | |
15163 int __pyx_t_6; | |
15164 PyObject *__pyx_t_7 = NULL; | |
15165 PyObject *__pyx_t_8 = NULL; | |
15166 PyObject *__pyx_t_9 = NULL; | |
15167 int __pyx_lineno = 0; | |
15168 const char *__pyx_filename = NULL; | |
15169 int __pyx_clineno = 0; | |
15170 __Pyx_RefNannySetupContext("__pyx_unpickle_IntervalIterator__set_state", 0); | |
15171 | |
15172 /* "(tree fragment)":12 | |
15173 * return __pyx_result | |
15174 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): | |
15175 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] # <<<<<<<<<<<<<< | |
15176 * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): | |
15177 * __pyx_result.__dict__.update(__pyx_state[2]) | |
15178 */ | |
15179 if (unlikely(__pyx_v___pyx_state == Py_None)) { | |
15180 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
15181 __PYX_ERR(1, 12, __pyx_L1_error) | |
15182 } | |
15183 __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) | |
15184 __Pyx_GOTREF(__pyx_t_1); | |
15185 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) | |
15186 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15187 __pyx_v___pyx_result->_itemtype = __pyx_t_2; | |
15188 if (unlikely(__pyx_v___pyx_state == Py_None)) { | |
15189 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
15190 __PYX_ERR(1, 12, __pyx_L1_error) | |
15191 } | |
15192 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) | |
15193 __Pyx_GOTREF(__pyx_t_1); | |
15194 __Pyx_GIVEREF(__pyx_t_1); | |
15195 __Pyx_GOTREF(__pyx_v___pyx_result->stream); | |
15196 __Pyx_DECREF(__pyx_v___pyx_result->stream); | |
15197 __pyx_v___pyx_result->stream = __pyx_t_1; | |
15198 __pyx_t_1 = 0; | |
15199 | |
15200 /* "(tree fragment)":13 | |
15201 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): | |
15202 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] | |
15203 * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< | |
15204 * __pyx_result.__dict__.update(__pyx_state[2]) | |
15205 */ | |
15206 if (unlikely(__pyx_v___pyx_state == Py_None)) { | |
15207 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); | |
15208 __PYX_ERR(1, 13, __pyx_L1_error) | |
15209 } | |
15210 __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) | |
15211 __pyx_t_5 = ((__pyx_t_4 > 2) != 0); | |
15212 if (__pyx_t_5) { | |
15213 } else { | |
15214 __pyx_t_3 = __pyx_t_5; | |
15215 goto __pyx_L4_bool_binop_done; | |
15216 } | |
15217 __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) | |
15218 __pyx_t_6 = (__pyx_t_5 != 0); | |
15219 __pyx_t_3 = __pyx_t_6; | |
15220 __pyx_L4_bool_binop_done:; | |
15221 if (__pyx_t_3) { | |
15222 | |
15223 /* "(tree fragment)":14 | |
15224 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] | |
15225 * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): | |
15226 * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<< | |
15227 */ | |
15228 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) | |
15229 __Pyx_GOTREF(__pyx_t_7); | |
15230 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error) | |
15231 __Pyx_GOTREF(__pyx_t_8); | |
15232 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
15233 if (unlikely(__pyx_v___pyx_state == Py_None)) { | |
15234 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); | |
15235 __PYX_ERR(1, 14, __pyx_L1_error) | |
15236 } | |
15237 __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) | |
15238 __Pyx_GOTREF(__pyx_t_7); | |
15239 __pyx_t_9 = NULL; | |
15240 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { | |
15241 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); | |
15242 if (likely(__pyx_t_9)) { | |
15243 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); | |
15244 __Pyx_INCREF(__pyx_t_9); | |
15245 __Pyx_INCREF(function); | |
15246 __Pyx_DECREF_SET(__pyx_t_8, function); | |
15247 } | |
15248 } | |
15249 __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); | |
15250 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; | |
15251 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; | |
15252 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) | |
15253 __Pyx_GOTREF(__pyx_t_1); | |
15254 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; | |
15255 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15256 | |
15257 /* "(tree fragment)":13 | |
15258 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): | |
15259 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] | |
15260 * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< | |
15261 * __pyx_result.__dict__.update(__pyx_state[2]) | |
15262 */ | |
15263 } | |
15264 | |
15265 /* "(tree fragment)":11 | |
15266 * __pyx_unpickle_IntervalIterator__set_state(<IntervalIterator> __pyx_result, __pyx_state) | |
15267 * return __pyx_result | |
15268 * cdef __pyx_unpickle_IntervalIterator__set_state(IntervalIterator __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< | |
15269 * __pyx_result._itemtype = __pyx_state[0]; __pyx_result.stream = __pyx_state[1] | |
15270 * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): | |
15271 */ | |
15272 | |
15273 /* function exit code */ | |
15274 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
15275 goto __pyx_L0; | |
15276 __pyx_L1_error:; | |
15277 __Pyx_XDECREF(__pyx_t_1); | |
15278 __Pyx_XDECREF(__pyx_t_7); | |
15279 __Pyx_XDECREF(__pyx_t_8); | |
15280 __Pyx_XDECREF(__pyx_t_9); | |
15281 __Pyx_AddTraceback("pybedtools.cbedtools.__pyx_unpickle_IntervalIterator__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15282 __pyx_r = 0; | |
15283 __pyx_L0:; | |
15284 __Pyx_XGIVEREF(__pyx_r); | |
15285 __Pyx_RefNannyFinishContext(); | |
15286 return __pyx_r; | |
15287 } | |
15288 | |
15289 /* "string.from_py":13 | |
15290 * | |
15291 * @cname("__pyx_convert_string_from_py_std__in_string") | |
15292 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< | |
15293 * cdef Py_ssize_t length = 0 | |
15294 * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) | |
15295 */ | |
15296 | |
15297 static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { | |
15298 Py_ssize_t __pyx_v_length; | |
15299 char const *__pyx_v_data; | |
15300 std::string __pyx_r; | |
15301 __Pyx_RefNannyDeclarations | |
15302 char const *__pyx_t_1; | |
15303 int __pyx_lineno = 0; | |
15304 const char *__pyx_filename = NULL; | |
15305 int __pyx_clineno = 0; | |
15306 __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); | |
15307 | |
15308 /* "string.from_py":14 | |
15309 * @cname("__pyx_convert_string_from_py_std__in_string") | |
15310 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: | |
15311 * cdef Py_ssize_t length = 0 # <<<<<<<<<<<<<< | |
15312 * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) | |
15313 * return string(data, length) | |
15314 */ | |
15315 __pyx_v_length = 0; | |
15316 | |
15317 /* "string.from_py":15 | |
15318 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: | |
15319 * cdef Py_ssize_t length = 0 | |
15320 * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< | |
15321 * return string(data, length) | |
15322 * | |
15323 */ | |
15324 __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) | |
15325 __pyx_v_data = __pyx_t_1; | |
15326 | |
15327 /* "string.from_py":16 | |
15328 * cdef Py_ssize_t length = 0 | |
15329 * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) | |
15330 * return string(data, length) # <<<<<<<<<<<<<< | |
15331 * | |
15332 * | |
15333 */ | |
15334 __pyx_r = std::string(__pyx_v_data, __pyx_v_length); | |
15335 goto __pyx_L0; | |
15336 | |
15337 /* "string.from_py":13 | |
15338 * | |
15339 * @cname("__pyx_convert_string_from_py_std__in_string") | |
15340 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< | |
15341 * cdef Py_ssize_t length = 0 | |
15342 * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) | |
15343 */ | |
15344 | |
15345 /* function exit code */ | |
15346 __pyx_L1_error:; | |
15347 __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15348 __Pyx_pretend_to_initialize(&__pyx_r); | |
15349 __pyx_L0:; | |
15350 __Pyx_RefNannyFinishContext(); | |
15351 return __pyx_r; | |
15352 } | |
15353 | |
15354 /* "string.to_py":31 | |
15355 * | |
15356 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") | |
15357 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15358 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) | |
15359 * cdef extern from *: | |
15360 */ | |
15361 | |
15362 static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { | |
15363 PyObject *__pyx_r = NULL; | |
15364 __Pyx_RefNannyDeclarations | |
15365 PyObject *__pyx_t_1 = NULL; | |
15366 int __pyx_lineno = 0; | |
15367 const char *__pyx_filename = NULL; | |
15368 int __pyx_clineno = 0; | |
15369 __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); | |
15370 | |
15371 /* "string.to_py":32 | |
15372 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") | |
15373 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): | |
15374 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< | |
15375 * cdef extern from *: | |
15376 * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) | |
15377 */ | |
15378 __Pyx_XDECREF(__pyx_r); | |
15379 __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) | |
15380 __Pyx_GOTREF(__pyx_t_1); | |
15381 __pyx_r = __pyx_t_1; | |
15382 __pyx_t_1 = 0; | |
15383 goto __pyx_L0; | |
15384 | |
15385 /* "string.to_py":31 | |
15386 * | |
15387 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") | |
15388 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15389 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) | |
15390 * cdef extern from *: | |
15391 */ | |
15392 | |
15393 /* function exit code */ | |
15394 __pyx_L1_error:; | |
15395 __Pyx_XDECREF(__pyx_t_1); | |
15396 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15397 __pyx_r = 0; | |
15398 __pyx_L0:; | |
15399 __Pyx_XGIVEREF(__pyx_r); | |
15400 __Pyx_RefNannyFinishContext(); | |
15401 return __pyx_r; | |
15402 } | |
15403 | |
15404 /* "string.to_py":37 | |
15405 * | |
15406 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") | |
15407 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15408 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) | |
15409 * cdef extern from *: | |
15410 */ | |
15411 | |
15412 static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { | |
15413 PyObject *__pyx_r = NULL; | |
15414 __Pyx_RefNannyDeclarations | |
15415 PyObject *__pyx_t_1 = NULL; | |
15416 int __pyx_lineno = 0; | |
15417 const char *__pyx_filename = NULL; | |
15418 int __pyx_clineno = 0; | |
15419 __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); | |
15420 | |
15421 /* "string.to_py":38 | |
15422 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") | |
15423 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): | |
15424 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< | |
15425 * cdef extern from *: | |
15426 * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) | |
15427 */ | |
15428 __Pyx_XDECREF(__pyx_r); | |
15429 __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) | |
15430 __Pyx_GOTREF(__pyx_t_1); | |
15431 __pyx_r = __pyx_t_1; | |
15432 __pyx_t_1 = 0; | |
15433 goto __pyx_L0; | |
15434 | |
15435 /* "string.to_py":37 | |
15436 * | |
15437 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") | |
15438 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15439 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) | |
15440 * cdef extern from *: | |
15441 */ | |
15442 | |
15443 /* function exit code */ | |
15444 __pyx_L1_error:; | |
15445 __Pyx_XDECREF(__pyx_t_1); | |
15446 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15447 __pyx_r = 0; | |
15448 __pyx_L0:; | |
15449 __Pyx_XGIVEREF(__pyx_r); | |
15450 __Pyx_RefNannyFinishContext(); | |
15451 return __pyx_r; | |
15452 } | |
15453 | |
15454 /* "string.to_py":43 | |
15455 * | |
15456 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") | |
15457 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15458 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) | |
15459 * cdef extern from *: | |
15460 */ | |
15461 | |
15462 static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { | |
15463 PyObject *__pyx_r = NULL; | |
15464 __Pyx_RefNannyDeclarations | |
15465 PyObject *__pyx_t_1 = NULL; | |
15466 int __pyx_lineno = 0; | |
15467 const char *__pyx_filename = NULL; | |
15468 int __pyx_clineno = 0; | |
15469 __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); | |
15470 | |
15471 /* "string.to_py":44 | |
15472 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") | |
15473 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): | |
15474 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< | |
15475 * cdef extern from *: | |
15476 * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) | |
15477 */ | |
15478 __Pyx_XDECREF(__pyx_r); | |
15479 __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) | |
15480 __Pyx_GOTREF(__pyx_t_1); | |
15481 __pyx_r = __pyx_t_1; | |
15482 __pyx_t_1 = 0; | |
15483 goto __pyx_L0; | |
15484 | |
15485 /* "string.to_py":43 | |
15486 * | |
15487 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") | |
15488 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15489 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) | |
15490 * cdef extern from *: | |
15491 */ | |
15492 | |
15493 /* function exit code */ | |
15494 __pyx_L1_error:; | |
15495 __Pyx_XDECREF(__pyx_t_1); | |
15496 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15497 __pyx_r = 0; | |
15498 __pyx_L0:; | |
15499 __Pyx_XGIVEREF(__pyx_r); | |
15500 __Pyx_RefNannyFinishContext(); | |
15501 return __pyx_r; | |
15502 } | |
15503 | |
15504 /* "string.to_py":49 | |
15505 * | |
15506 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") | |
15507 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15508 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) | |
15509 * cdef extern from *: | |
15510 */ | |
15511 | |
15512 static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { | |
15513 PyObject *__pyx_r = NULL; | |
15514 __Pyx_RefNannyDeclarations | |
15515 PyObject *__pyx_t_1 = NULL; | |
15516 int __pyx_lineno = 0; | |
15517 const char *__pyx_filename = NULL; | |
15518 int __pyx_clineno = 0; | |
15519 __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); | |
15520 | |
15521 /* "string.to_py":50 | |
15522 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") | |
15523 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): | |
15524 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< | |
15525 * cdef extern from *: | |
15526 * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) | |
15527 */ | |
15528 __Pyx_XDECREF(__pyx_r); | |
15529 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) | |
15530 __Pyx_GOTREF(__pyx_t_1); | |
15531 __pyx_r = __pyx_t_1; | |
15532 __pyx_t_1 = 0; | |
15533 goto __pyx_L0; | |
15534 | |
15535 /* "string.to_py":49 | |
15536 * | |
15537 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") | |
15538 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15539 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) | |
15540 * cdef extern from *: | |
15541 */ | |
15542 | |
15543 /* function exit code */ | |
15544 __pyx_L1_error:; | |
15545 __Pyx_XDECREF(__pyx_t_1); | |
15546 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15547 __pyx_r = 0; | |
15548 __pyx_L0:; | |
15549 __Pyx_XGIVEREF(__pyx_r); | |
15550 __Pyx_RefNannyFinishContext(); | |
15551 return __pyx_r; | |
15552 } | |
15553 | |
15554 /* "string.to_py":55 | |
15555 * | |
15556 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") | |
15557 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15558 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) | |
15559 * | |
15560 */ | |
15561 | |
15562 static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { | |
15563 PyObject *__pyx_r = NULL; | |
15564 __Pyx_RefNannyDeclarations | |
15565 PyObject *__pyx_t_1 = NULL; | |
15566 int __pyx_lineno = 0; | |
15567 const char *__pyx_filename = NULL; | |
15568 int __pyx_clineno = 0; | |
15569 __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); | |
15570 | |
15571 /* "string.to_py":56 | |
15572 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") | |
15573 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): | |
15574 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< | |
15575 * | |
15576 */ | |
15577 __Pyx_XDECREF(__pyx_r); | |
15578 __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) | |
15579 __Pyx_GOTREF(__pyx_t_1); | |
15580 __pyx_r = __pyx_t_1; | |
15581 __pyx_t_1 = 0; | |
15582 goto __pyx_L0; | |
15583 | |
15584 /* "string.to_py":55 | |
15585 * | |
15586 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") | |
15587 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< | |
15588 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) | |
15589 * | |
15590 */ | |
15591 | |
15592 /* function exit code */ | |
15593 __pyx_L1_error:; | |
15594 __Pyx_XDECREF(__pyx_t_1); | |
15595 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15596 __pyx_r = 0; | |
15597 __pyx_L0:; | |
15598 __Pyx_XGIVEREF(__pyx_r); | |
15599 __Pyx_RefNannyFinishContext(); | |
15600 return __pyx_r; | |
15601 } | |
15602 | |
15603 /* "vector.from_py":45 | |
15604 * | |
15605 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") | |
15606 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< | |
15607 * cdef vector[X] v | |
15608 * for item in o: | |
15609 */ | |
15610 | |
15611 static std::vector<std::string> __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) { | |
15612 std::vector<std::string> __pyx_v_v; | |
15613 PyObject *__pyx_v_item = NULL; | |
15614 std::vector<std::string> __pyx_r; | |
15615 __Pyx_RefNannyDeclarations | |
15616 PyObject *__pyx_t_1 = NULL; | |
15617 Py_ssize_t __pyx_t_2; | |
15618 PyObject *(*__pyx_t_3)(PyObject *); | |
15619 PyObject *__pyx_t_4 = NULL; | |
15620 std::string __pyx_t_5; | |
15621 int __pyx_lineno = 0; | |
15622 const char *__pyx_filename = NULL; | |
15623 int __pyx_clineno = 0; | |
15624 __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0); | |
15625 | |
15626 /* "vector.from_py":47 | |
15627 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: | |
15628 * cdef vector[X] v | |
15629 * for item in o: # <<<<<<<<<<<<<< | |
15630 * v.push_back(<X>item) | |
15631 * return v | |
15632 */ | |
15633 if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { | |
15634 __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; | |
15635 __pyx_t_3 = NULL; | |
15636 } else { | |
15637 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) | |
15638 __Pyx_GOTREF(__pyx_t_1); | |
15639 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) | |
15640 } | |
15641 for (;;) { | |
15642 if (likely(!__pyx_t_3)) { | |
15643 if (likely(PyList_CheckExact(__pyx_t_1))) { | |
15644 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; | |
15645 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
15646 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) | |
15647 #else | |
15648 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) | |
15649 __Pyx_GOTREF(__pyx_t_4); | |
15650 #endif | |
15651 } else { | |
15652 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; | |
15653 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
15654 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) | |
15655 #else | |
15656 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) | |
15657 __Pyx_GOTREF(__pyx_t_4); | |
15658 #endif | |
15659 } | |
15660 } else { | |
15661 __pyx_t_4 = __pyx_t_3(__pyx_t_1); | |
15662 if (unlikely(!__pyx_t_4)) { | |
15663 PyObject* exc_type = PyErr_Occurred(); | |
15664 if (exc_type) { | |
15665 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); | |
15666 else __PYX_ERR(1, 47, __pyx_L1_error) | |
15667 } | |
15668 break; | |
15669 } | |
15670 __Pyx_GOTREF(__pyx_t_4); | |
15671 } | |
15672 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); | |
15673 __pyx_t_4 = 0; | |
15674 | |
15675 /* "vector.from_py":48 | |
15676 * cdef vector[X] v | |
15677 * for item in o: | |
15678 * v.push_back(<X>item) # <<<<<<<<<<<<<< | |
15679 * return v | |
15680 * | |
15681 */ | |
15682 __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) | |
15683 __pyx_v_v.push_back(((std::string)__pyx_t_5)); | |
15684 | |
15685 /* "vector.from_py":47 | |
15686 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: | |
15687 * cdef vector[X] v | |
15688 * for item in o: # <<<<<<<<<<<<<< | |
15689 * v.push_back(<X>item) | |
15690 * return v | |
15691 */ | |
15692 } | |
15693 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
15694 | |
15695 /* "vector.from_py":49 | |
15696 * for item in o: | |
15697 * v.push_back(<X>item) | |
15698 * return v # <<<<<<<<<<<<<< | |
15699 * | |
15700 * | |
15701 */ | |
15702 __pyx_r = __pyx_v_v; | |
15703 goto __pyx_L0; | |
15704 | |
15705 /* "vector.from_py":45 | |
15706 * | |
15707 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") | |
15708 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< | |
15709 * cdef vector[X] v | |
15710 * for item in o: | |
15711 */ | |
15712 | |
15713 /* function exit code */ | |
15714 __pyx_L1_error:; | |
15715 __Pyx_XDECREF(__pyx_t_1); | |
15716 __Pyx_XDECREF(__pyx_t_4); | |
15717 __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
15718 __Pyx_pretend_to_initialize(&__pyx_r); | |
15719 __pyx_L0:; | |
15720 __Pyx_XDECREF(__pyx_v_item); | |
15721 __Pyx_RefNannyFinishContext(); | |
15722 return __pyx_r; | |
15723 } | |
15724 static struct __pyx_vtabstruct_10pybedtools_9cbedtools_Interval __pyx_vtable_10pybedtools_9cbedtools_Interval; | |
15725 | |
15726 static PyObject *__pyx_tp_new_10pybedtools_9cbedtools_Interval(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { | |
15727 struct __pyx_obj_10pybedtools_9cbedtools_Interval *p; | |
15728 PyObject *o; | |
15729 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { | |
15730 o = (*t->tp_alloc)(t, 0); | |
15731 } else { | |
15732 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); | |
15733 } | |
15734 if (unlikely(!o)) return 0; | |
15735 p = ((struct __pyx_obj_10pybedtools_9cbedtools_Interval *)o); | |
15736 p->__pyx_vtab = __pyx_vtabptr_10pybedtools_9cbedtools_Interval; | |
15737 p->_attrs = Py_None; Py_INCREF(Py_None); | |
15738 return o; | |
15739 } | |
15740 | |
15741 static void __pyx_tp_dealloc_10pybedtools_9cbedtools_Interval(PyObject *o) { | |
15742 struct __pyx_obj_10pybedtools_9cbedtools_Interval *p = (struct __pyx_obj_10pybedtools_9cbedtools_Interval *)o; | |
15743 #if CYTHON_USE_TP_FINALIZE | |
15744 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) { | |
15745 if (PyObject_CallFinalizerFromDealloc(o)) return; | |
15746 } | |
15747 #endif | |
15748 PyObject_GC_UnTrack(o); | |
15749 { | |
15750 PyObject *etype, *eval, *etb; | |
15751 PyErr_Fetch(&etype, &eval, &etb); | |
15752 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); | |
15753 __pyx_pw_10pybedtools_9cbedtools_8Interval_15__dealloc__(o); | |
15754 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); | |
15755 PyErr_Restore(etype, eval, etb); | |
15756 } | |
15757 Py_CLEAR(p->_attrs); | |
15758 (*Py_TYPE(o)->tp_free)(o); | |
15759 } | |
15760 | |
15761 static int __pyx_tp_traverse_10pybedtools_9cbedtools_Interval(PyObject *o, visitproc v, void *a) { | |
15762 int e; | |
15763 struct __pyx_obj_10pybedtools_9cbedtools_Interval *p = (struct __pyx_obj_10pybedtools_9cbedtools_Interval *)o; | |
15764 if (p->_attrs) { | |
15765 e = (*v)(p->_attrs, a); if (e) return e; | |
15766 } | |
15767 return 0; | |
15768 } | |
15769 | |
15770 static int __pyx_tp_clear_10pybedtools_9cbedtools_Interval(PyObject *o) { | |
15771 PyObject* tmp; | |
15772 struct __pyx_obj_10pybedtools_9cbedtools_Interval *p = (struct __pyx_obj_10pybedtools_9cbedtools_Interval *)o; | |
15773 tmp = ((PyObject*)p->_attrs); | |
15774 p->_attrs = Py_None; Py_INCREF(Py_None); | |
15775 Py_XDECREF(tmp); | |
15776 return 0; | |
15777 } | |
15778 static PyObject *__pyx_sq_item_10pybedtools_9cbedtools_Interval(PyObject *o, Py_ssize_t i) { | |
15779 PyObject *r; | |
15780 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; | |
15781 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); | |
15782 Py_DECREF(x); | |
15783 return r; | |
15784 } | |
15785 | |
15786 static int __pyx_mp_ass_subscript_10pybedtools_9cbedtools_Interval(PyObject *o, PyObject *i, PyObject *v) { | |
15787 if (v) { | |
15788 return __pyx_pw_10pybedtools_9cbedtools_8Interval_21__setitem__(o, i, v); | |
15789 } | |
15790 else { | |
15791 PyErr_Format(PyExc_NotImplementedError, | |
15792 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); | |
15793 return -1; | |
15794 } | |
15795 } | |
15796 | |
15797 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_chrom(PyObject *o, CYTHON_UNUSED void *x) { | |
15798 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5chrom_1__get__(o); | |
15799 } | |
15800 | |
15801 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_chrom(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15802 if (v) { | |
15803 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5chrom_3__set__(o, v); | |
15804 } | |
15805 else { | |
15806 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15807 return -1; | |
15808 } | |
15809 } | |
15810 | |
15811 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_start(PyObject *o, CYTHON_UNUSED void *x) { | |
15812 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5start_1__get__(o); | |
15813 } | |
15814 | |
15815 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_start(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15816 if (v) { | |
15817 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5start_3__set__(o, v); | |
15818 } | |
15819 else { | |
15820 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15821 return -1; | |
15822 } | |
15823 } | |
15824 | |
15825 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_end(PyObject *o, CYTHON_UNUSED void *x) { | |
15826 return __pyx_pw_10pybedtools_9cbedtools_8Interval_3end_1__get__(o); | |
15827 } | |
15828 | |
15829 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_end(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15830 if (v) { | |
15831 return __pyx_pw_10pybedtools_9cbedtools_8Interval_3end_3__set__(o, v); | |
15832 } | |
15833 else { | |
15834 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15835 return -1; | |
15836 } | |
15837 } | |
15838 | |
15839 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_stop(PyObject *o, CYTHON_UNUSED void *x) { | |
15840 return __pyx_pw_10pybedtools_9cbedtools_8Interval_4stop_1__get__(o); | |
15841 } | |
15842 | |
15843 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_stop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15844 if (v) { | |
15845 return __pyx_pw_10pybedtools_9cbedtools_8Interval_4stop_3__set__(o, v); | |
15846 } | |
15847 else { | |
15848 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15849 return -1; | |
15850 } | |
15851 } | |
15852 | |
15853 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_strand(PyObject *o, CYTHON_UNUSED void *x) { | |
15854 return __pyx_pw_10pybedtools_9cbedtools_8Interval_6strand_1__get__(o); | |
15855 } | |
15856 | |
15857 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_strand(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15858 if (v) { | |
15859 return __pyx_pw_10pybedtools_9cbedtools_8Interval_6strand_3__set__(o, v); | |
15860 } | |
15861 else { | |
15862 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15863 return -1; | |
15864 } | |
15865 } | |
15866 | |
15867 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_length(PyObject *o, CYTHON_UNUSED void *x) { | |
15868 return __pyx_pw_10pybedtools_9cbedtools_8Interval_6length_1__get__(o); | |
15869 } | |
15870 | |
15871 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_fields(PyObject *o, CYTHON_UNUSED void *x) { | |
15872 return __pyx_pw_10pybedtools_9cbedtools_8Interval_6fields_1__get__(o); | |
15873 } | |
15874 | |
15875 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_attrs(PyObject *o, CYTHON_UNUSED void *x) { | |
15876 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5attrs_1__get__(o); | |
15877 } | |
15878 | |
15879 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_attrs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15880 if (v) { | |
15881 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5attrs_3__set__(o, v); | |
15882 } | |
15883 else { | |
15884 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15885 return -1; | |
15886 } | |
15887 } | |
15888 | |
15889 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_count(PyObject *o, CYTHON_UNUSED void *x) { | |
15890 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5count_1__get__(o); | |
15891 } | |
15892 | |
15893 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_name(PyObject *o, CYTHON_UNUSED void *x) { | |
15894 return __pyx_pw_10pybedtools_9cbedtools_8Interval_4name_1__get__(o); | |
15895 } | |
15896 | |
15897 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15898 if (v) { | |
15899 return __pyx_pw_10pybedtools_9cbedtools_8Interval_4name_3__set__(o, v); | |
15900 } | |
15901 else { | |
15902 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15903 return -1; | |
15904 } | |
15905 } | |
15906 | |
15907 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_score(PyObject *o, CYTHON_UNUSED void *x) { | |
15908 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5score_1__get__(o); | |
15909 } | |
15910 | |
15911 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_score(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15912 if (v) { | |
15913 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5score_3__set__(o, v); | |
15914 } | |
15915 else { | |
15916 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15917 return -1; | |
15918 } | |
15919 } | |
15920 | |
15921 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_file_type(PyObject *o, CYTHON_UNUSED void *x) { | |
15922 return __pyx_pw_10pybedtools_9cbedtools_8Interval_9file_type_1__get__(o); | |
15923 } | |
15924 | |
15925 static int __pyx_setprop_10pybedtools_9cbedtools_8Interval_file_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { | |
15926 if (v) { | |
15927 return __pyx_pw_10pybedtools_9cbedtools_8Interval_9file_type_3__set__(o, v); | |
15928 } | |
15929 else { | |
15930 PyErr_SetString(PyExc_NotImplementedError, "__del__"); | |
15931 return -1; | |
15932 } | |
15933 } | |
15934 | |
15935 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_o_start(PyObject *o, CYTHON_UNUSED void *x) { | |
15936 return __pyx_pw_10pybedtools_9cbedtools_8Interval_7o_start_1__get__(o); | |
15937 } | |
15938 | |
15939 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_o_end(PyObject *o, CYTHON_UNUSED void *x) { | |
15940 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5o_end_1__get__(o); | |
15941 } | |
15942 | |
15943 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_8Interval_o_amt(PyObject *o, CYTHON_UNUSED void *x) { | |
15944 return __pyx_pw_10pybedtools_9cbedtools_8Interval_5o_amt_1__get__(o); | |
15945 } | |
15946 | |
15947 static PyMethodDef __pyx_methods_10pybedtools_9cbedtools_Interval[] = { | |
15948 {"__copy__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_8Interval_3__copy__, METH_NOARGS, 0}, | |
15949 {"deparse_attrs", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_8Interval_9deparse_attrs, METH_NOARGS, 0}, | |
15950 {"append", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_8Interval_23append, METH_O, 0}, | |
15951 {"__reduce_cython__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_8Interval_27__reduce_cython__, METH_NOARGS, 0}, | |
15952 {"__setstate_cython__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_8Interval_29__setstate_cython__, METH_O, 0}, | |
15953 {0, 0, 0, 0} | |
15954 }; | |
15955 | |
15956 static struct PyGetSetDef __pyx_getsets_10pybedtools_9cbedtools_Interval[] = { | |
15957 {(char *)"chrom", __pyx_getprop_10pybedtools_9cbedtools_8Interval_chrom, __pyx_setprop_10pybedtools_9cbedtools_8Interval_chrom, (char *)" the chromosome of the feature", 0}, | |
15958 {(char *)"start", __pyx_getprop_10pybedtools_9cbedtools_8Interval_start, __pyx_setprop_10pybedtools_9cbedtools_8Interval_start, (char *)"The 0-based start of the feature.", 0}, | |
15959 {(char *)"end", __pyx_getprop_10pybedtools_9cbedtools_8Interval_end, __pyx_setprop_10pybedtools_9cbedtools_8Interval_end, (char *)"The end of the feature", 0}, | |
15960 {(char *)"stop", __pyx_getprop_10pybedtools_9cbedtools_8Interval_stop, __pyx_setprop_10pybedtools_9cbedtools_8Interval_stop, (char *)" the end of the feature", 0}, | |
15961 {(char *)"strand", __pyx_getprop_10pybedtools_9cbedtools_8Interval_strand, __pyx_setprop_10pybedtools_9cbedtools_8Interval_strand, (char *)" the strand of the feature", 0}, | |
15962 {(char *)"length", __pyx_getprop_10pybedtools_9cbedtools_8Interval_length, 0, (char *)" the length of the feature", 0}, | |
15963 {(char *)"fields", __pyx_getprop_10pybedtools_9cbedtools_8Interval_fields, 0, (char *)0, 0}, | |
15964 {(char *)"attrs", __pyx_getprop_10pybedtools_9cbedtools_8Interval_attrs, __pyx_setprop_10pybedtools_9cbedtools_8Interval_attrs, (char *)0, 0}, | |
15965 {(char *)"count", __pyx_getprop_10pybedtools_9cbedtools_8Interval_count, 0, (char *)0, 0}, | |
15966 {(char *)"name", __pyx_getprop_10pybedtools_9cbedtools_8Interval_name, __pyx_setprop_10pybedtools_9cbedtools_8Interval_name, (char *)"\n >>> import pybedtools\n >>> vcf = pybedtools.example_bedtool('v.vcf')\n >>> [v.name for v in vcf]\n ['rs6054257', 'chr1:16', 'rs6040355', 'chr1:222', 'microsat1']\n\n ", 0}, | |
15967 {(char *)"score", __pyx_getprop_10pybedtools_9cbedtools_8Interval_score, __pyx_setprop_10pybedtools_9cbedtools_8Interval_score, (char *)0, 0}, | |
15968 {(char *)"file_type", __pyx_getprop_10pybedtools_9cbedtools_8Interval_file_type, __pyx_setprop_10pybedtools_9cbedtools_8Interval_file_type, (char *)"bed/vcf/gff", 0}, | |
15969 {(char *)"o_start", __pyx_getprop_10pybedtools_9cbedtools_8Interval_o_start, 0, (char *)0, 0}, | |
15970 {(char *)"o_end", __pyx_getprop_10pybedtools_9cbedtools_8Interval_o_end, 0, (char *)0, 0}, | |
15971 {(char *)"o_amt", __pyx_getprop_10pybedtools_9cbedtools_8Interval_o_amt, 0, (char *)0, 0}, | |
15972 {0, 0, 0, 0, 0} | |
15973 }; | |
15974 | |
15975 static PyNumberMethods __pyx_tp_as_number_Interval = { | |
15976 0, /*nb_add*/ | |
15977 0, /*nb_subtract*/ | |
15978 0, /*nb_multiply*/ | |
15979 #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) | |
15980 0, /*nb_divide*/ | |
15981 #endif | |
15982 0, /*nb_remainder*/ | |
15983 0, /*nb_divmod*/ | |
15984 0, /*nb_power*/ | |
15985 0, /*nb_negative*/ | |
15986 0, /*nb_positive*/ | |
15987 0, /*nb_absolute*/ | |
15988 __pyx_pw_10pybedtools_9cbedtools_8Interval_25__nonzero__, /*nb_nonzero*/ | |
15989 0, /*nb_invert*/ | |
15990 0, /*nb_lshift*/ | |
15991 0, /*nb_rshift*/ | |
15992 0, /*nb_and*/ | |
15993 0, /*nb_xor*/ | |
15994 0, /*nb_or*/ | |
15995 #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) | |
15996 0, /*nb_coerce*/ | |
15997 #endif | |
15998 0, /*nb_int*/ | |
15999 #if PY_MAJOR_VERSION < 3 | |
16000 0, /*nb_long*/ | |
16001 #else | |
16002 0, /*reserved*/ | |
16003 #endif | |
16004 0, /*nb_float*/ | |
16005 #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) | |
16006 0, /*nb_oct*/ | |
16007 #endif | |
16008 #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) | |
16009 0, /*nb_hex*/ | |
16010 #endif | |
16011 0, /*nb_inplace_add*/ | |
16012 0, /*nb_inplace_subtract*/ | |
16013 0, /*nb_inplace_multiply*/ | |
16014 #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000) | |
16015 0, /*nb_inplace_divide*/ | |
16016 #endif | |
16017 0, /*nb_inplace_remainder*/ | |
16018 0, /*nb_inplace_power*/ | |
16019 0, /*nb_inplace_lshift*/ | |
16020 0, /*nb_inplace_rshift*/ | |
16021 0, /*nb_inplace_and*/ | |
16022 0, /*nb_inplace_xor*/ | |
16023 0, /*nb_inplace_or*/ | |
16024 0, /*nb_floor_divide*/ | |
16025 0, /*nb_true_divide*/ | |
16026 0, /*nb_inplace_floor_divide*/ | |
16027 0, /*nb_inplace_true_divide*/ | |
16028 0, /*nb_index*/ | |
16029 #if PY_VERSION_HEX >= 0x03050000 | |
16030 0, /*nb_matrix_multiply*/ | |
16031 #endif | |
16032 #if PY_VERSION_HEX >= 0x03050000 | |
16033 0, /*nb_inplace_matrix_multiply*/ | |
16034 #endif | |
16035 }; | |
16036 | |
16037 static PySequenceMethods __pyx_tp_as_sequence_Interval = { | |
16038 __pyx_pw_10pybedtools_9cbedtools_8Interval_17__len__, /*sq_length*/ | |
16039 0, /*sq_concat*/ | |
16040 0, /*sq_repeat*/ | |
16041 __pyx_sq_item_10pybedtools_9cbedtools_Interval, /*sq_item*/ | |
16042 0, /*sq_slice*/ | |
16043 0, /*sq_ass_item*/ | |
16044 0, /*sq_ass_slice*/ | |
16045 0, /*sq_contains*/ | |
16046 0, /*sq_inplace_concat*/ | |
16047 0, /*sq_inplace_repeat*/ | |
16048 }; | |
16049 | |
16050 static PyMappingMethods __pyx_tp_as_mapping_Interval = { | |
16051 __pyx_pw_10pybedtools_9cbedtools_8Interval_17__len__, /*mp_length*/ | |
16052 __pyx_pw_10pybedtools_9cbedtools_8Interval_19__getitem__, /*mp_subscript*/ | |
16053 __pyx_mp_ass_subscript_10pybedtools_9cbedtools_Interval, /*mp_ass_subscript*/ | |
16054 }; | |
16055 | |
16056 static PyTypeObject __pyx_type_10pybedtools_9cbedtools_Interval = { | |
16057 PyVarObject_HEAD_INIT(0, 0) | |
16058 "pybedtools.cbedtools.Interval", /*tp_name*/ | |
16059 sizeof(struct __pyx_obj_10pybedtools_9cbedtools_Interval), /*tp_basicsize*/ | |
16060 0, /*tp_itemsize*/ | |
16061 __pyx_tp_dealloc_10pybedtools_9cbedtools_Interval, /*tp_dealloc*/ | |
16062 #if PY_VERSION_HEX < 0x030800b4 | |
16063 0, /*tp_print*/ | |
16064 #endif | |
16065 #if PY_VERSION_HEX >= 0x030800b4 | |
16066 0, /*tp_vectorcall_offset*/ | |
16067 #endif | |
16068 0, /*tp_getattr*/ | |
16069 0, /*tp_setattr*/ | |
16070 #if PY_MAJOR_VERSION < 3 | |
16071 0, /*tp_compare*/ | |
16072 #endif | |
16073 #if PY_MAJOR_VERSION >= 3 | |
16074 0, /*tp_as_async*/ | |
16075 #endif | |
16076 __pyx_pw_10pybedtools_9cbedtools_8Interval_13__repr__, /*tp_repr*/ | |
16077 &__pyx_tp_as_number_Interval, /*tp_as_number*/ | |
16078 &__pyx_tp_as_sequence_Interval, /*tp_as_sequence*/ | |
16079 &__pyx_tp_as_mapping_Interval, /*tp_as_mapping*/ | |
16080 __pyx_pw_10pybedtools_9cbedtools_8Interval_5__hash__, /*tp_hash*/ | |
16081 0, /*tp_call*/ | |
16082 __pyx_pw_10pybedtools_9cbedtools_8Interval_11__str__, /*tp_str*/ | |
16083 0, /*tp_getattro*/ | |
16084 0, /*tp_setattro*/ | |
16085 0, /*tp_as_buffer*/ | |
16086 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ | |
16087 "\n Class to represent a genomic interval.\n\n Constructor::\n\n Interval(chrom, start, end, name=\".\", score=\".\", strand=\".\", otherfields=None)\n\n Class to represent a genomic interval of any format. Requires at least 3\n args: chrom (string), start (int), end (int).\n\n `start` is *always* the 0-based start coordinate. If this Interval is to\n represent a GFF object (which uses a 1-based coordinate system), then\n subtract 1 from the 4th item in the line to get the start position in\n 0-based coords for this Interval. The 1-based GFF coord will still be\n available, albeit as a string, in fields[3].\n\n `otherfields` is a list of fields that don't fit into the other kwargs, and\n will be stored in the `fields` attribute of the Interval.\n\n All the items in `otherfields` must be strings for proper conversion to\n C++.\n\n By convention, for BED files, `otherfields` is everything past the first 6\n items in the line. This allows an Interval to represent composite features\n (e.g., a GFF line concatenated to the end of a BED line)\n\n But for other formats (VCF, GFF, SAM), the entire line should be passed in\n as a list for `otherfields` so that we can always check the\n Interval.file_type and extract the fields we want, knowing that they'll be\n in the right order as passed in with `otherfields`.\n\n Example usage:\n\n >>> from pybedtools import Interval\n >>> i = Interval(\"chr1\", 22, 44, strand='-')\n >>> i\n Interval(chr1:22-44)\n\n\n ", /*tp_doc*/ | |
16088 __pyx_tp_traverse_10pybedtools_9cbedtools_Interval, /*tp_traverse*/ | |
16089 __pyx_tp_clear_10pybedtools_9cbedtools_Interval, /*tp_clear*/ | |
16090 __pyx_pw_10pybedtools_9cbedtools_8Interval_7__richcmp__, /*tp_richcompare*/ | |
16091 0, /*tp_weaklistoffset*/ | |
16092 0, /*tp_iter*/ | |
16093 0, /*tp_iternext*/ | |
16094 __pyx_methods_10pybedtools_9cbedtools_Interval, /*tp_methods*/ | |
16095 0, /*tp_members*/ | |
16096 __pyx_getsets_10pybedtools_9cbedtools_Interval, /*tp_getset*/ | |
16097 0, /*tp_base*/ | |
16098 0, /*tp_dict*/ | |
16099 0, /*tp_descr_get*/ | |
16100 0, /*tp_descr_set*/ | |
16101 0, /*tp_dictoffset*/ | |
16102 __pyx_pw_10pybedtools_9cbedtools_8Interval_1__init__, /*tp_init*/ | |
16103 0, /*tp_alloc*/ | |
16104 __pyx_tp_new_10pybedtools_9cbedtools_Interval, /*tp_new*/ | |
16105 0, /*tp_free*/ | |
16106 0, /*tp_is_gc*/ | |
16107 0, /*tp_bases*/ | |
16108 0, /*tp_mro*/ | |
16109 0, /*tp_cache*/ | |
16110 0, /*tp_subclasses*/ | |
16111 0, /*tp_weaklist*/ | |
16112 0, /*tp_del*/ | |
16113 0, /*tp_version_tag*/ | |
16114 #if PY_VERSION_HEX >= 0x030400a1 | |
16115 0, /*tp_finalize*/ | |
16116 #endif | |
16117 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) | |
16118 0, /*tp_vectorcall*/ | |
16119 #endif | |
16120 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 | |
16121 0, /*tp_print*/ | |
16122 #endif | |
16123 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 | |
16124 0, /*tp_pypy_flags*/ | |
16125 #endif | |
16126 }; | |
16127 | |
16128 static PyObject *__pyx_tp_new_10pybedtools_9cbedtools_IntervalIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { | |
16129 struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *p; | |
16130 PyObject *o; | |
16131 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { | |
16132 o = (*t->tp_alloc)(t, 0); | |
16133 } else { | |
16134 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); | |
16135 } | |
16136 if (unlikely(!o)) return 0; | |
16137 p = ((struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)o); | |
16138 p->stream = Py_None; Py_INCREF(Py_None); | |
16139 return o; | |
16140 } | |
16141 | |
16142 static void __pyx_tp_dealloc_10pybedtools_9cbedtools_IntervalIterator(PyObject *o) { | |
16143 struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *p = (struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)o; | |
16144 #if CYTHON_USE_TP_FINALIZE | |
16145 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) { | |
16146 if (PyObject_CallFinalizerFromDealloc(o)) return; | |
16147 } | |
16148 #endif | |
16149 PyObject_GC_UnTrack(o); | |
16150 { | |
16151 PyObject *etype, *eval, *etb; | |
16152 PyErr_Fetch(&etype, &eval, &etb); | |
16153 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); | |
16154 __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_3__dealloc__(o); | |
16155 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); | |
16156 PyErr_Restore(etype, eval, etb); | |
16157 } | |
16158 Py_CLEAR(p->stream); | |
16159 (*Py_TYPE(o)->tp_free)(o); | |
16160 } | |
16161 | |
16162 static int __pyx_tp_traverse_10pybedtools_9cbedtools_IntervalIterator(PyObject *o, visitproc v, void *a) { | |
16163 int e; | |
16164 struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *p = (struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)o; | |
16165 if (p->stream) { | |
16166 e = (*v)(p->stream, a); if (e) return e; | |
16167 } | |
16168 return 0; | |
16169 } | |
16170 | |
16171 static int __pyx_tp_clear_10pybedtools_9cbedtools_IntervalIterator(PyObject *o) { | |
16172 PyObject* tmp; | |
16173 struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *p = (struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator *)o; | |
16174 tmp = ((PyObject*)p->stream); | |
16175 p->stream = Py_None; Py_INCREF(Py_None); | |
16176 Py_XDECREF(tmp); | |
16177 return 0; | |
16178 } | |
16179 | |
16180 static PyObject *__pyx_specialmethod___pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_7__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_7__next__(self);} | |
16181 | |
16182 static PyMethodDef __pyx_methods_10pybedtools_9cbedtools_IntervalIterator[] = { | |
16183 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_7__next__, METH_NOARGS|METH_COEXIST, 0}, | |
16184 {"__reduce_cython__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_9__reduce_cython__, METH_NOARGS, 0}, | |
16185 {"__setstate_cython__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_11__setstate_cython__, METH_O, 0}, | |
16186 {0, 0, 0, 0} | |
16187 }; | |
16188 | |
16189 static PyTypeObject __pyx_type_10pybedtools_9cbedtools_IntervalIterator = { | |
16190 PyVarObject_HEAD_INIT(0, 0) | |
16191 "pybedtools.cbedtools.IntervalIterator", /*tp_name*/ | |
16192 sizeof(struct __pyx_obj_10pybedtools_9cbedtools_IntervalIterator), /*tp_basicsize*/ | |
16193 0, /*tp_itemsize*/ | |
16194 __pyx_tp_dealloc_10pybedtools_9cbedtools_IntervalIterator, /*tp_dealloc*/ | |
16195 #if PY_VERSION_HEX < 0x030800b4 | |
16196 0, /*tp_print*/ | |
16197 #endif | |
16198 #if PY_VERSION_HEX >= 0x030800b4 | |
16199 0, /*tp_vectorcall_offset*/ | |
16200 #endif | |
16201 0, /*tp_getattr*/ | |
16202 0, /*tp_setattr*/ | |
16203 #if PY_MAJOR_VERSION < 3 | |
16204 0, /*tp_compare*/ | |
16205 #endif | |
16206 #if PY_MAJOR_VERSION >= 3 | |
16207 0, /*tp_as_async*/ | |
16208 #endif | |
16209 0, /*tp_repr*/ | |
16210 0, /*tp_as_number*/ | |
16211 0, /*tp_as_sequence*/ | |
16212 0, /*tp_as_mapping*/ | |
16213 0, /*tp_hash*/ | |
16214 0, /*tp_call*/ | |
16215 0, /*tp_str*/ | |
16216 0, /*tp_getattro*/ | |
16217 0, /*tp_setattro*/ | |
16218 0, /*tp_as_buffer*/ | |
16219 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ | |
16220 0, /*tp_doc*/ | |
16221 __pyx_tp_traverse_10pybedtools_9cbedtools_IntervalIterator, /*tp_traverse*/ | |
16222 __pyx_tp_clear_10pybedtools_9cbedtools_IntervalIterator, /*tp_clear*/ | |
16223 0, /*tp_richcompare*/ | |
16224 0, /*tp_weaklistoffset*/ | |
16225 __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_5__iter__, /*tp_iter*/ | |
16226 __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_7__next__, /*tp_iternext*/ | |
16227 __pyx_methods_10pybedtools_9cbedtools_IntervalIterator, /*tp_methods*/ | |
16228 0, /*tp_members*/ | |
16229 0, /*tp_getset*/ | |
16230 0, /*tp_base*/ | |
16231 0, /*tp_dict*/ | |
16232 0, /*tp_descr_get*/ | |
16233 0, /*tp_descr_set*/ | |
16234 0, /*tp_dictoffset*/ | |
16235 __pyx_pw_10pybedtools_9cbedtools_16IntervalIterator_1__init__, /*tp_init*/ | |
16236 0, /*tp_alloc*/ | |
16237 __pyx_tp_new_10pybedtools_9cbedtools_IntervalIterator, /*tp_new*/ | |
16238 0, /*tp_free*/ | |
16239 0, /*tp_is_gc*/ | |
16240 0, /*tp_bases*/ | |
16241 0, /*tp_mro*/ | |
16242 0, /*tp_cache*/ | |
16243 0, /*tp_subclasses*/ | |
16244 0, /*tp_weaklist*/ | |
16245 0, /*tp_del*/ | |
16246 0, /*tp_version_tag*/ | |
16247 #if PY_VERSION_HEX >= 0x030400a1 | |
16248 0, /*tp_finalize*/ | |
16249 #endif | |
16250 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) | |
16251 0, /*tp_vectorcall*/ | |
16252 #endif | |
16253 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 | |
16254 0, /*tp_print*/ | |
16255 #endif | |
16256 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 | |
16257 0, /*tp_pypy_flags*/ | |
16258 #endif | |
16259 }; | |
16260 | |
16261 static PyObject *__pyx_tp_new_10pybedtools_9cbedtools_IntervalFile(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { | |
16262 struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *p; | |
16263 PyObject *o; | |
16264 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { | |
16265 o = (*t->tp_alloc)(t, 0); | |
16266 } else { | |
16267 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); | |
16268 } | |
16269 if (unlikely(!o)) return 0; | |
16270 p = ((struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)o); | |
16271 new((void*)&(p->_fn)) std::string(); | |
16272 return o; | |
16273 } | |
16274 | |
16275 static void __pyx_tp_dealloc_10pybedtools_9cbedtools_IntervalFile(PyObject *o) { | |
16276 struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *p = (struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile *)o; | |
16277 #if CYTHON_USE_TP_FINALIZE | |
16278 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { | |
16279 if (PyObject_CallFinalizerFromDealloc(o)) return; | |
16280 } | |
16281 #endif | |
16282 { | |
16283 PyObject *etype, *eval, *etb; | |
16284 PyErr_Fetch(&etype, &eval, &etb); | |
16285 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); | |
16286 __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_3__dealloc__(o); | |
16287 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); | |
16288 PyErr_Restore(etype, eval, etb); | |
16289 } | |
16290 __Pyx_call_destructor(p->_fn); | |
16291 (*Py_TYPE(o)->tp_free)(o); | |
16292 } | |
16293 | |
16294 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_12IntervalFile_fn(PyObject *o, CYTHON_UNUSED void *x) { | |
16295 return __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_2fn_1__get__(o); | |
16296 } | |
16297 | |
16298 static PyObject *__pyx_getprop_10pybedtools_9cbedtools_12IntervalFile_file_type(PyObject *o, CYTHON_UNUSED void *x) { | |
16299 return __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_9file_type_1__get__(o); | |
16300 } | |
16301 | |
16302 static PyObject *__pyx_specialmethod___pyx_pw_10pybedtools_9cbedtools_12IntervalFile_7__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_7__next__(self);} | |
16303 | |
16304 static PyMethodDef __pyx_methods_10pybedtools_9cbedtools_IntervalFile[] = { | |
16305 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_10pybedtools_9cbedtools_12IntervalFile_7__next__, METH_NOARGS|METH_COEXIST, 0}, | |
16306 {"loadIntoMap", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_9loadIntoMap, METH_NOARGS, __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_8loadIntoMap}, | |
16307 {"rewind", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_11rewind, METH_NOARGS, __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_10rewind}, | |
16308 {"seek", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_13seek, METH_O, __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_12seek}, | |
16309 {"all_hits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_15all_hits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_14all_hits}, | |
16310 {"any_hits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_17any_hits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_16any_hits}, | |
16311 {"count_hits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_19count_hits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pybedtools_9cbedtools_12IntervalFile_18count_hits}, | |
16312 {"__reduce_cython__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_21__reduce_cython__, METH_NOARGS, 0}, | |
16313 {"__setstate_cython__", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_12IntervalFile_23__setstate_cython__, METH_O, 0}, | |
16314 {0, 0, 0, 0} | |
16315 }; | |
16316 | |
16317 static struct PyGetSetDef __pyx_getsets_10pybedtools_9cbedtools_IntervalFile[] = { | |
16318 {(char *)"fn", __pyx_getprop_10pybedtools_9cbedtools_12IntervalFile_fn, 0, (char *)0, 0}, | |
16319 {(char *)"file_type", __pyx_getprop_10pybedtools_9cbedtools_12IntervalFile_file_type, 0, (char *)0, 0}, | |
16320 {0, 0, 0, 0, 0} | |
16321 }; | |
16322 | |
16323 static PyTypeObject __pyx_type_10pybedtools_9cbedtools_IntervalFile = { | |
16324 PyVarObject_HEAD_INIT(0, 0) | |
16325 "pybedtools.cbedtools.IntervalFile", /*tp_name*/ | |
16326 sizeof(struct __pyx_obj_10pybedtools_9cbedtools_IntervalFile), /*tp_basicsize*/ | |
16327 0, /*tp_itemsize*/ | |
16328 __pyx_tp_dealloc_10pybedtools_9cbedtools_IntervalFile, /*tp_dealloc*/ | |
16329 #if PY_VERSION_HEX < 0x030800b4 | |
16330 0, /*tp_print*/ | |
16331 #endif | |
16332 #if PY_VERSION_HEX >= 0x030800b4 | |
16333 0, /*tp_vectorcall_offset*/ | |
16334 #endif | |
16335 0, /*tp_getattr*/ | |
16336 0, /*tp_setattr*/ | |
16337 #if PY_MAJOR_VERSION < 3 | |
16338 0, /*tp_compare*/ | |
16339 #endif | |
16340 #if PY_MAJOR_VERSION >= 3 | |
16341 0, /*tp_as_async*/ | |
16342 #endif | |
16343 0, /*tp_repr*/ | |
16344 0, /*tp_as_number*/ | |
16345 0, /*tp_as_sequence*/ | |
16346 0, /*tp_as_mapping*/ | |
16347 0, /*tp_hash*/ | |
16348 0, /*tp_call*/ | |
16349 0, /*tp_str*/ | |
16350 0, /*tp_getattro*/ | |
16351 0, /*tp_setattro*/ | |
16352 0, /*tp_as_buffer*/ | |
16353 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ | |
16354 0, /*tp_doc*/ | |
16355 0, /*tp_traverse*/ | |
16356 0, /*tp_clear*/ | |
16357 0, /*tp_richcompare*/ | |
16358 0, /*tp_weaklistoffset*/ | |
16359 __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_5__iter__, /*tp_iter*/ | |
16360 __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_7__next__, /*tp_iternext*/ | |
16361 __pyx_methods_10pybedtools_9cbedtools_IntervalFile, /*tp_methods*/ | |
16362 0, /*tp_members*/ | |
16363 __pyx_getsets_10pybedtools_9cbedtools_IntervalFile, /*tp_getset*/ | |
16364 0, /*tp_base*/ | |
16365 0, /*tp_dict*/ | |
16366 0, /*tp_descr_get*/ | |
16367 0, /*tp_descr_set*/ | |
16368 0, /*tp_dictoffset*/ | |
16369 __pyx_pw_10pybedtools_9cbedtools_12IntervalFile_1__init__, /*tp_init*/ | |
16370 0, /*tp_alloc*/ | |
16371 __pyx_tp_new_10pybedtools_9cbedtools_IntervalFile, /*tp_new*/ | |
16372 0, /*tp_free*/ | |
16373 0, /*tp_is_gc*/ | |
16374 0, /*tp_bases*/ | |
16375 0, /*tp_mro*/ | |
16376 0, /*tp_cache*/ | |
16377 0, /*tp_subclasses*/ | |
16378 0, /*tp_weaklist*/ | |
16379 0, /*tp_del*/ | |
16380 0, /*tp_version_tag*/ | |
16381 #if PY_VERSION_HEX >= 0x030400a1 | |
16382 0, /*tp_finalize*/ | |
16383 #endif | |
16384 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) | |
16385 0, /*tp_vectorcall*/ | |
16386 #endif | |
16387 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 | |
16388 0, /*tp_print*/ | |
16389 #endif | |
16390 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 | |
16391 0, /*tp_pypy_flags*/ | |
16392 #endif | |
16393 }; | |
16394 | |
16395 static PyMethodDef __pyx_methods[] = { | |
16396 {"create_interval_from_list", (PyCFunction)__pyx_pw_10pybedtools_9cbedtools_1create_interval_from_list, METH_O, __pyx_doc_10pybedtools_9cbedtools_create_interval_from_list}, | |
16397 {0, 0, 0, 0} | |
16398 }; | |
16399 | |
16400 #if PY_MAJOR_VERSION >= 3 | |
16401 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
16402 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ | |
16403 static int __pyx_pymod_exec_cbedtools(PyObject* module); /*proto*/ | |
16404 static PyModuleDef_Slot __pyx_moduledef_slots[] = { | |
16405 {Py_mod_create, (void*)__pyx_pymod_create}, | |
16406 {Py_mod_exec, (void*)__pyx_pymod_exec_cbedtools}, | |
16407 {0, NULL} | |
16408 }; | |
16409 #endif | |
16410 | |
16411 static struct PyModuleDef __pyx_moduledef = { | |
16412 PyModuleDef_HEAD_INIT, | |
16413 "cbedtools", | |
16414 0, /* m_doc */ | |
16415 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
16416 0, /* m_size */ | |
16417 #else | |
16418 -1, /* m_size */ | |
16419 #endif | |
16420 __pyx_methods /* m_methods */, | |
16421 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
16422 __pyx_moduledef_slots, /* m_slots */ | |
16423 #else | |
16424 NULL, /* m_reload */ | |
16425 #endif | |
16426 NULL, /* m_traverse */ | |
16427 NULL, /* m_clear */ | |
16428 NULL /* m_free */ | |
16429 }; | |
16430 #endif | |
16431 #ifndef CYTHON_SMALL_CODE | |
16432 #if defined(__clang__) | |
16433 #define CYTHON_SMALL_CODE | |
16434 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) | |
16435 #define CYTHON_SMALL_CODE __attribute__((cold)) | |
16436 #else | |
16437 #define CYTHON_SMALL_CODE | |
16438 #endif | |
16439 #endif | |
16440 | |
16441 static __Pyx_StringTabEntry __pyx_string_tab[] = { | |
16442 {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, | |
16443 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1}, | |
16444 {&__pyx_n_s_Attributes, __pyx_k_Attributes, sizeof(__pyx_k_Attributes), 0, 0, 1, 1}, | |
16445 {&__pyx_n_s_Attributes___init, __pyx_k_Attributes___init, sizeof(__pyx_k_Attributes___init), 0, 0, 1, 1}, | |
16446 {&__pyx_n_s_Attributes___str, __pyx_k_Attributes___str, sizeof(__pyx_k_Attributes___str), 0, 0, 1, 1}, | |
16447 {&__pyx_n_s_BedToolsFileError, __pyx_k_BedToolsFileError, sizeof(__pyx_k_BedToolsFileError), 0, 0, 1, 1}, | |
16448 {&__pyx_kp_s_Class_to_map_between_a_dict_of, __pyx_k_Class_to_map_between_a_dict_of, sizeof(__pyx_k_Class_to_map_between_a_dict_of), 0, 0, 1, 0}, | |
16449 {&__pyx_kp_u_Create_an_Interval_object_from, __pyx_k_Create_an_Interval_object_from, sizeof(__pyx_k_Create_an_Interval_object_from), 0, 1, 0, 0}, | |
16450 {&__pyx_kp_s_Currently_unsupported_comparison, __pyx_k_Currently_unsupported_comparison, sizeof(__pyx_k_Currently_unsupported_comparison), 0, 0, 1, 0}, | |
16451 {&__pyx_kp_s_Error_opening_file, __pyx_k_Error_opening_file, sizeof(__pyx_k_Error_opening_file), 0, 0, 1, 0}, | |
16452 {&__pyx_kp_s_Features_are_nested_comparison_u, __pyx_k_Features_are_nested_comparison_u, sizeof(__pyx_k_Features_are_nested_comparison_u), 0, 0, 1, 0}, | |
16453 {&__pyx_n_s_ID, __pyx_k_ID, sizeof(__pyx_k_ID), 0, 0, 1, 1}, | |
16454 {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, | |
16455 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, | |
16456 {&__pyx_n_s_Interval, __pyx_k_Interval, sizeof(__pyx_k_Interval), 0, 0, 1, 1}, | |
16457 {&__pyx_n_s_IntervalFile, __pyx_k_IntervalFile, sizeof(__pyx_k_IntervalFile), 0, 0, 1, 1}, | |
16458 {&__pyx_kp_u_IntervalFile_all_hits_line_888, __pyx_k_IntervalFile_all_hits_line_888, sizeof(__pyx_k_IntervalFile_all_hits_line_888), 0, 1, 0, 0}, | |
16459 {&__pyx_kp_u_IntervalFile_any_hits_line_934, __pyx_k_IntervalFile_any_hits_line_934, sizeof(__pyx_k_IntervalFile_any_hits_line_934), 0, 1, 0, 0}, | |
16460 {&__pyx_kp_u_IntervalFile_count_hits_line_970, __pyx_k_IntervalFile_count_hits_line_970, sizeof(__pyx_k_IntervalFile_count_hits_line_970), 0, 1, 0, 0}, | |
16461 {&__pyx_kp_s_IntervalFile_objects_do_not_yet, __pyx_k_IntervalFile_objects_do_not_yet, sizeof(__pyx_k_IntervalFile_objects_do_not_yet), 0, 0, 1, 0}, | |
16462 {&__pyx_n_s_IntervalIterator, __pyx_k_IntervalIterator, sizeof(__pyx_k_IntervalIterator), 0, 0, 1, 1}, | |
16463 {&__pyx_kp_s_Interval_attrs_was_not_None_but, __pyx_k_Interval_attrs_was_not_None_but, sizeof(__pyx_k_Interval_attrs_was_not_None_but), 0, 0, 1, 0}, | |
16464 {&__pyx_kp_s_Interval_s_i_i, __pyx_k_Interval_s_i_i, sizeof(__pyx_k_Interval_s_i_i), 0, 0, 1, 0}, | |
16465 {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, | |
16466 {&__pyx_n_s_MalformedBedLineError, __pyx_k_MalformedBedLineError, sizeof(__pyx_k_MalformedBedLineError), 0, 0, 1, 1}, | |
16467 {&__pyx_n_s_Name, __pyx_k_Name, sizeof(__pyx_k_Name), 0, 0, 1, 1}, | |
16468 {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, | |
16469 {&__pyx_n_s_PROFILES_TRUE, __pyx_k_PROFILES_TRUE, sizeof(__pyx_k_PROFILES_TRUE), 0, 0, 1, 1}, | |
16470 {&__pyx_n_s_Parent, __pyx_k_Parent, sizeof(__pyx_k_Parent), 0, 0, 1, 1}, | |
16471 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, | |
16472 {&__pyx_kp_u_Signature_IntervalFile_all_hits, __pyx_k_Signature_IntervalFile_all_hits, sizeof(__pyx_k_Signature_IntervalFile_all_hits), 0, 1, 0, 0}, | |
16473 {&__pyx_kp_u_Signature_IntervalFile_any_hits, __pyx_k_Signature_IntervalFile_any_hits, sizeof(__pyx_k_Signature_IntervalFile_any_hits), 0, 1, 0, 0}, | |
16474 {&__pyx_kp_u_Signature_IntervalFile_count_hi, __pyx_k_Signature_IntervalFile_count_hi, sizeof(__pyx_k_Signature_IntervalFile_count_hi), 0, 1, 0, 0}, | |
16475 {&__pyx_kp_s_Start_is_greater_than_stop, __pyx_k_Start_is_greater_than_stop, sizeof(__pyx_k_Start_is_greater_than_stop), 0, 0, 1, 0}, | |
16476 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, | |
16477 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, | |
16478 {&__pyx_kp_s_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 0, 1, 0}, | |
16479 {&__pyx_kp_s_Unable_to_detect_format_from_s, __pyx_k_Unable_to_detect_format_from_s, sizeof(__pyx_k_Unable_to_detect_format_from_s), 0, 0, 1, 0}, | |
16480 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, | |
16481 {&__pyx_kp_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 0}, | |
16482 {&__pyx_kp_s__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 0, 1, 0}, | |
16483 {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, | |
16484 {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0}, | |
16485 {&__pyx_kp_s__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 0, 1, 0}, | |
16486 {&__pyx_kp_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 0}, | |
16487 {&__pyx_kp_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 0}, | |
16488 {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0}, | |
16489 {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, | |
16490 {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0}, | |
16491 {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0}, | |
16492 {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0}, | |
16493 {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0}, | |
16494 {&__pyx_n_s_all_hits, __pyx_k_all_hits, sizeof(__pyx_k_all_hits), 0, 0, 1, 1}, | |
16495 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, | |
16496 {&__pyx_n_s_attr_str, __pyx_k_attr_str, sizeof(__pyx_k_attr_str), 0, 0, 1, 1}, | |
16497 {&__pyx_n_s_attr_str_2, __pyx_k_attr_str_2, sizeof(__pyx_k_attr_str_2), 0, 0, 1, 1}, | |
16498 {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1}, | |
16499 {&__pyx_n_b_bed, __pyx_k_bed, sizeof(__pyx_k_bed), 0, 0, 0, 1}, | |
16500 {&__pyx_n_s_bed, __pyx_k_bed, sizeof(__pyx_k_bed), 0, 0, 1, 1}, | |
16501 {&__pyx_n_s_browser, __pyx_k_browser, sizeof(__pyx_k_browser), 0, 0, 1, 1}, | |
16502 {&__pyx_n_s_chrom, __pyx_k_chrom, sizeof(__pyx_k_chrom), 0, 0, 1, 1}, | |
16503 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, | |
16504 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, | |
16505 {&__pyx_n_s_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 0, 1, 1}, | |
16506 {&__pyx_n_s_cmp, __pyx_k_cmp, sizeof(__pyx_k_cmp), 0, 0, 1, 1}, | |
16507 {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, | |
16508 {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, | |
16509 {&__pyx_kp_u_create_interval_from_list_line_5, __pyx_k_create_interval_from_list_line_5, sizeof(__pyx_k_create_interval_from_list_line_5), 0, 1, 0, 0}, | |
16510 {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1}, | |
16511 {&__pyx_n_s_deparse_attrs, __pyx_k_deparse_attrs, sizeof(__pyx_k_deparse_attrs), 0, 0, 1, 1}, | |
16512 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, | |
16513 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, | |
16514 {&__pyx_n_s_e1, __pyx_k_e1, sizeof(__pyx_k_e1), 0, 0, 1, 1}, | |
16515 {&__pyx_n_s_e2, __pyx_k_e2, sizeof(__pyx_k_e2), 0, 0, 1, 1}, | |
16516 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, | |
16517 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, | |
16518 {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, | |
16519 {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, | |
16520 {&__pyx_n_s_field, __pyx_k_field, sizeof(__pyx_k_field), 0, 0, 1, 1}, | |
16521 {&__pyx_kp_s_field_index_out_of_range, __pyx_k_field_index_out_of_range, sizeof(__pyx_k_field_index_out_of_range), 0, 0, 1, 0}, | |
16522 {&__pyx_n_s_field_sep, __pyx_k_field_sep, sizeof(__pyx_k_field_sep), 0, 0, 1, 1}, | |
16523 {&__pyx_n_s_fields, __pyx_k_fields, sizeof(__pyx_k_fields), 0, 0, 1, 1}, | |
16524 {&__pyx_n_s_file_type, __pyx_k_file_type, sizeof(__pyx_k_file_type), 0, 0, 1, 1}, | |
16525 {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1}, | |
16526 {&__pyx_n_s_gene_id, __pyx_k_gene_id, sizeof(__pyx_k_gene_id), 0, 0, 1, 1}, | |
16527 {&__pyx_n_s_gene_name, __pyx_k_gene_name, sizeof(__pyx_k_gene_name), 0, 0, 1, 1}, | |
16528 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, | |
16529 {&__pyx_n_b_gff, __pyx_k_gff, sizeof(__pyx_k_gff), 0, 0, 0, 1}, | |
16530 {&__pyx_n_s_gff, __pyx_k_gff, sizeof(__pyx_k_gff), 0, 0, 1, 1}, | |
16531 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, | |
16532 {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1}, | |
16533 {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, | |
16534 {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1}, | |
16535 {&__pyx_n_s_integer_types, __pyx_k_integer_types, sizeof(__pyx_k_integer_types), 0, 0, 1, 1}, | |
16536 {&__pyx_n_s_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 0, 1, 1}, | |
16537 {&__pyx_n_s_intervalFile, __pyx_k_intervalFile, sizeof(__pyx_k_intervalFile), 0, 0, 1, 1}, | |
16538 {&__pyx_n_s_isdigit, __pyx_k_isdigit, sizeof(__pyx_k_isdigit), 0, 0, 1, 1}, | |
16539 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, | |
16540 {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1}, | |
16541 {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, | |
16542 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, | |
16543 {&__pyx_n_s_kdict, __pyx_k_kdict, sizeof(__pyx_k_kdict), 0, 0, 1, 1}, | |
16544 {&__pyx_n_s_ktype, __pyx_k_ktype, sizeof(__pyx_k_ktype), 0, 0, 1, 1}, | |
16545 {&__pyx_n_s_kv, __pyx_k_kv, sizeof(__pyx_k_kv), 0, 0, 1, 1}, | |
16546 {&__pyx_n_s_kvs, __pyx_k_kvs, sizeof(__pyx_k_kvs), 0, 0, 1, 1}, | |
16547 {&__pyx_n_s_loadIntoMap, __pyx_k_loadIntoMap, sizeof(__pyx_k_loadIntoMap), 0, 0, 1, 1}, | |
16548 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, | |
16549 {&__pyx_kp_s_malformed_line_s, __pyx_k_malformed_line_s, sizeof(__pyx_k_malformed_line_s), 0, 0, 1, 0}, | |
16550 {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1}, | |
16551 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, | |
16552 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, | |
16553 {&__pyx_n_s_n_eq, __pyx_k_n_eq, sizeof(__pyx_k_n_eq), 0, 0, 1, 1}, | |
16554 {&__pyx_n_s_n_quotes, __pyx_k_n_quotes, sizeof(__pyx_k_n_quotes), 0, 0, 1, 1}, | |
16555 {&__pyx_n_s_n_semi, __pyx_k_n_semi, sizeof(__pyx_k_n_semi), 0, 0, 1, 1}, | |
16556 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, | |
16557 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, | |
16558 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, | |
16559 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, | |
16560 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, | |
16561 {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, | |
16562 {&__pyx_n_s_otherfields, __pyx_k_otherfields, sizeof(__pyx_k_otherfields), 0, 0, 1, 1}, | |
16563 {&__pyx_n_s_overlap, __pyx_k_overlap, sizeof(__pyx_k_overlap), 0, 0, 1, 1}, | |
16564 {&__pyx_n_s_pairs, __pyx_k_pairs, sizeof(__pyx_k_pairs), 0, 0, 1, 1}, | |
16565 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, | |
16566 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, | |
16567 {&__pyx_n_s_pybedtools_cbedtools, __pyx_k_pybedtools_cbedtools, sizeof(__pyx_k_pybedtools_cbedtools), 0, 0, 1, 1}, | |
16568 {&__pyx_kp_s_pybedtools_cbedtools_pyx, __pyx_k_pybedtools_cbedtools_pyx, sizeof(__pyx_k_pybedtools_cbedtools_pyx), 0, 0, 1, 0}, | |
16569 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, | |
16570 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, | |
16571 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, | |
16572 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, | |
16573 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, | |
16574 {&__pyx_n_s_pyx_unpickle_IntervalIterator, __pyx_k_pyx_unpickle_IntervalIterator, sizeof(__pyx_k_pyx_unpickle_IntervalIterator), 0, 0, 1, 1}, | |
16575 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, | |
16576 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, | |
16577 {&__pyx_n_s_quoted, __pyx_k_quoted, sizeof(__pyx_k_quoted), 0, 0, 1, 1}, | |
16578 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, | |
16579 {&__pyx_n_s_readline, __pyx_k_readline, sizeof(__pyx_k_readline), 0, 0, 1, 1}, | |
16580 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, | |
16581 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, | |
16582 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, | |
16583 {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1}, | |
16584 {&__pyx_n_s_richcmp___locals_cmp, __pyx_k_richcmp___locals_cmp, sizeof(__pyx_k_richcmp___locals_cmp), 0, 0, 1, 1}, | |
16585 {&__pyx_n_s_rstrip, __pyx_k_rstrip, sizeof(__pyx_k_rstrip), 0, 0, 1, 1}, | |
16586 {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1}, | |
16587 {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, | |
16588 {&__pyx_kp_s_s_i, __pyx_k_s_i, sizeof(__pyx_k_s_i), 0, 0, 1, 0}, | |
16589 {&__pyx_n_s_sam, __pyx_k_sam, sizeof(__pyx_k_sam), 0, 0, 1, 1}, | |
16590 {&__pyx_n_s_same_strand, __pyx_k_same_strand, sizeof(__pyx_k_same_strand), 0, 0, 1, 1}, | |
16591 {&__pyx_n_s_score, __pyx_k_score, sizeof(__pyx_k_score), 0, 0, 1, 1}, | |
16592 {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1}, | |
16593 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, | |
16594 {&__pyx_kp_s_self__bed_cannot_be_converted_to, __pyx_k_self__bed_cannot_be_converted_to, sizeof(__pyx_k_self__bed_cannot_be_converted_to), 0, 0, 1, 0}, | |
16595 {&__pyx_kp_s_self_intervalFile_ptr_cannot_be, __pyx_k_self_intervalFile_ptr_cannot_be, sizeof(__pyx_k_self_intervalFile_ptr_cannot_be), 0, 0, 1, 0}, | |
16596 {&__pyx_n_s_sep, __pyx_k_sep, sizeof(__pyx_k_sep), 0, 0, 1, 1}, | |
16597 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, | |
16598 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, | |
16599 {&__pyx_n_s_sort_keys, __pyx_k_sort_keys, sizeof(__pyx_k_sort_keys), 0, 0, 1, 1}, | |
16600 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, | |
16601 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, | |
16602 {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1}, | |
16603 {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, | |
16604 {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, | |
16605 {&__pyx_n_s_strand, __pyx_k_strand, sizeof(__pyx_k_strand), 0, 0, 1, 1}, | |
16606 {&__pyx_n_s_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 0, 0, 1, 1}, | |
16607 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, | |
16608 {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1}, | |
16609 {&__pyx_n_s_subprocess, __pyx_k_subprocess, sizeof(__pyx_k_subprocess), 0, 0, 1, 1}, | |
16610 {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, | |
16611 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, | |
16612 {&__pyx_n_s_track, __pyx_k_track, sizeof(__pyx_k_track), 0, 0, 1, 1}, | |
16613 {&__pyx_n_s_transcript_id, __pyx_k_transcript_id, sizeof(__pyx_k_transcript_id), 0, 0, 1, 1}, | |
16614 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, | |
16615 {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, | |
16616 {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1}, | |
16617 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, | |
16618 {&__pyx_n_b_vcf, __pyx_k_vcf, sizeof(__pyx_k_vcf), 0, 0, 0, 1}, | |
16619 {&__pyx_n_s_vcf, __pyx_k_vcf, sizeof(__pyx_k_vcf), 0, 0, 1, 1}, | |
16620 {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, | |
16621 {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, | |
16622 {0, 0, 0, 0, 0, 0, 0} | |
16623 }; | |
16624 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { | |
16625 __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) __PYX_ERR(0, 176, __pyx_L1_error) | |
16626 __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 189, __pyx_L1_error) | |
16627 __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 301, __pyx_L1_error) | |
16628 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 312, __pyx_L1_error) | |
16629 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 521, __pyx_L1_error) | |
16630 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 527, __pyx_L1_error) | |
16631 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) | |
16632 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 745, __pyx_L1_error) | |
16633 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 755, __pyx_L1_error) | |
16634 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 850, __pyx_L1_error) | |
16635 return 0; | |
16636 __pyx_L1_error:; | |
16637 return -1; | |
16638 } | |
16639 | |
16640 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { | |
16641 __Pyx_RefNannyDeclarations | |
16642 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); | |
16643 | |
16644 /* "pybedtools/cbedtools.pyx":180 | |
16645 * if value.count('"') == 2: | |
16646 * self._quoted[field] = True | |
16647 * self[field] = value.replace('"', '') # <<<<<<<<<<<<<< | |
16648 * | |
16649 * def __str__(self): | |
16650 */ | |
16651 __pyx_tuple__6 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_kp_s_); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 180, __pyx_L1_error) | |
16652 __Pyx_GOTREF(__pyx_tuple__6); | |
16653 __Pyx_GIVEREF(__pyx_tuple__6); | |
16654 | |
16655 /* "pybedtools/cbedtools.pyx":284 | |
16656 * return False | |
16657 * | |
16658 * def cmp(x, y): # <<<<<<<<<<<<<< | |
16659 * if x < y: | |
16660 * return -1 | |
16661 */ | |
16662 __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 284, __pyx_L1_error) | |
16663 __Pyx_GOTREF(__pyx_tuple__9); | |
16664 __Pyx_GIVEREF(__pyx_tuple__9); | |
16665 __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pybedtools_cbedtools_pyx, __pyx_n_s_cmp, 284, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 284, __pyx_L1_error) | |
16666 | |
16667 /* "pybedtools/cbedtools.pyx":301 | |
16668 * try: | |
16669 * if PROFILES_TRUE[profile] == tuple(): | |
16670 * raise NotImplementedError('Features are nested -- comparison undefined') # <<<<<<<<<<<<<< | |
16671 * | |
16672 * if op != 3: | |
16673 */ | |
16674 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Features_are_nested_comparison_u); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 301, __pyx_L1_error) | |
16675 __Pyx_GOTREF(__pyx_tuple__11); | |
16676 __Pyx_GIVEREF(__pyx_tuple__11); | |
16677 | |
16678 /* "pybedtools/cbedtools.pyx":312 | |
16679 * return True | |
16680 * except KeyError: | |
16681 * raise ValueError('Currently unsupported comparison -- please ' # <<<<<<<<<<<<<< | |
16682 * 'submit a bug report') | |
16683 * | |
16684 */ | |
16685 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Currently_unsupported_comparison); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 312, __pyx_L1_error) | |
16686 __Pyx_GOTREF(__pyx_tuple__12); | |
16687 __Pyx_GIVEREF(__pyx_tuple__12); | |
16688 | |
16689 /* "pybedtools/cbedtools.pyx":369 | |
16690 * | |
16691 * if self.file_type != "gff": | |
16692 * raise ValueError('Interval.attrs was not None, but this was a non-GFF Interval') # <<<<<<<<<<<<<< | |
16693 * | |
16694 * s = self._attrs.__str__() | |
16695 */ | |
16696 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Interval_attrs_was_not_None_but); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 369, __pyx_L1_error) | |
16697 __Pyx_GOTREF(__pyx_tuple__13); | |
16698 __Pyx_GIVEREF(__pyx_tuple__13); | |
16699 | |
16700 /* "pybedtools/cbedtools.pyx":420 | |
16701 * return attrs[self.name_key] | |
16702 * """ | |
16703 * for key in ("ID", "Name", "gene_name", "transcript_id", \ # <<<<<<<<<<<<<< | |
16704 * "gene_id", "Parent"): | |
16705 * if key in self.attrs: | |
16706 */ | |
16707 __pyx_tuple__14 = PyTuple_Pack(6, __pyx_n_s_ID, __pyx_n_s_Name, __pyx_n_s_gene_name, __pyx_n_s_transcript_id, __pyx_n_s_gene_id, __pyx_n_s_Parent); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 420, __pyx_L1_error) | |
16708 __Pyx_GOTREF(__pyx_tuple__14); | |
16709 __Pyx_GIVEREF(__pyx_tuple__14); | |
16710 | |
16711 /* "pybedtools/cbedtools.pyx":521 | |
16712 * nfields = self._bed.fields.size() | |
16713 * if key >= nfields: | |
16714 * raise IndexError('field index out of range') # <<<<<<<<<<<<<< | |
16715 * elif key < 0: | |
16716 * key = nfields + key | |
16717 */ | |
16718 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_field_index_out_of_range); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 521, __pyx_L1_error) | |
16719 __Pyx_GOTREF(__pyx_tuple__16); | |
16720 __Pyx_GIVEREF(__pyx_tuple__16); | |
16721 | |
16722 /* "(tree fragment)":2 | |
16723 * def __reduce_cython__(self): | |
16724 * raise TypeError("self._bed cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
16725 * def __setstate_cython__(self, __pyx_state): | |
16726 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
16727 */ | |
16728 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_self__bed_cannot_be_converted_to); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 2, __pyx_L1_error) | |
16729 __Pyx_GOTREF(__pyx_tuple__17); | |
16730 __Pyx_GIVEREF(__pyx_tuple__17); | |
16731 | |
16732 /* "(tree fragment)":4 | |
16733 * raise TypeError("self._bed cannot be converted to a Python object for pickling") | |
16734 * def __setstate_cython__(self, __pyx_state): | |
16735 * raise TypeError("self._bed cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
16736 */ | |
16737 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_self__bed_cannot_be_converted_to); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error) | |
16738 __Pyx_GOTREF(__pyx_tuple__18); | |
16739 __Pyx_GIVEREF(__pyx_tuple__18); | |
16740 | |
16741 /* "pybedtools/cbedtools.pyx":772 | |
16742 * | |
16743 * if self._itemtype == 1: | |
16744 * if line.startswith(('@', '#', 'track', 'browser')) or len(line.strip()) == 0: # <<<<<<<<<<<<<< | |
16745 * continue | |
16746 * break | |
16747 */ | |
16748 __pyx_tuple__24 = PyTuple_Pack(4, __pyx_kp_s__22, __pyx_kp_s__23, __pyx_n_s_track, __pyx_n_s_browser); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 772, __pyx_L1_error) | |
16749 __Pyx_GOTREF(__pyx_tuple__24); | |
16750 __Pyx_GIVEREF(__pyx_tuple__24); | |
16751 | |
16752 /* "pybedtools/cbedtools.pyx":850 | |
16753 * except MalformedBedLineError: | |
16754 * # If it's a SAM, raise a meaningful exception. If not, fail. | |
16755 * with open(self.fn) as fn: # <<<<<<<<<<<<<< | |
16756 * interval = create_interval_from_list(fn.readline().strip().split()) | |
16757 * if interval.file_type == 'sam': | |
16758 */ | |
16759 __pyx_tuple__26 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 850, __pyx_L1_error) | |
16760 __Pyx_GOTREF(__pyx_tuple__26); | |
16761 __Pyx_GIVEREF(__pyx_tuple__26); | |
16762 | |
16763 /* "pybedtools/cbedtools.pyx":853 | |
16764 * interval = create_interval_from_list(fn.readline().strip().split()) | |
16765 * if interval.file_type == 'sam': | |
16766 * raise ValueError('IntervalFile objects do not yet natively support SAM. ' # <<<<<<<<<<<<<< | |
16767 * 'Please convert to BED/GFF/VCF first if you want to ' | |
16768 * 'use the low-level API of IntervalFile') | |
16769 */ | |
16770 __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_IntervalFile_objects_do_not_yet); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 853, __pyx_L1_error) | |
16771 __Pyx_GOTREF(__pyx_tuple__27); | |
16772 __Pyx_GIVEREF(__pyx_tuple__27); | |
16773 | |
16774 /* "(tree fragment)":2 | |
16775 * def __reduce_cython__(self): | |
16776 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
16777 * def __setstate_cython__(self, __pyx_state): | |
16778 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
16779 */ | |
16780 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_self_intervalFile_ptr_cannot_be); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 2, __pyx_L1_error) | |
16781 __Pyx_GOTREF(__pyx_tuple__28); | |
16782 __Pyx_GIVEREF(__pyx_tuple__28); | |
16783 | |
16784 /* "(tree fragment)":4 | |
16785 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") | |
16786 * def __setstate_cython__(self, __pyx_state): | |
16787 * raise TypeError("self.intervalFile_ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< | |
16788 */ | |
16789 __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_self_intervalFile_ptr_cannot_be); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 4, __pyx_L1_error) | |
16790 __Pyx_GOTREF(__pyx_tuple__29); | |
16791 __Pyx_GIVEREF(__pyx_tuple__29); | |
16792 __pyx_tuple__30 = PyTuple_Pack(3, __pyx_int_22915542, __pyx_int_172054328, __pyx_int_26969663); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 4, __pyx_L1_error) | |
16793 __Pyx_GOTREF(__pyx_tuple__30); | |
16794 __Pyx_GIVEREF(__pyx_tuple__30); | |
16795 | |
16796 /* "pybedtools/cbedtools.pyx":67 | |
16797 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
16798 * PROFILES_TRUE = { | |
16799 * (0, 0, -1, 1): (2, 1, 5), # a == b, a >= b, a <= b # <<<<<<<<<<<<<< | |
16800 * # a --------- | |
16801 * # b --------- | |
16802 */ | |
16803 __pyx_tuple__31 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 67, __pyx_L1_error) | |
16804 __Pyx_GOTREF(__pyx_tuple__31); | |
16805 __Pyx_GIVEREF(__pyx_tuple__31); | |
16806 __pyx_tuple__32 = PyTuple_Pack(3, __pyx_int_2, __pyx_int_1, __pyx_int_5); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 67, __pyx_L1_error) | |
16807 __Pyx_GOTREF(__pyx_tuple__32); | |
16808 __Pyx_GIVEREF(__pyx_tuple__32); | |
16809 | |
16810 /* "pybedtools/cbedtools.pyx":71 | |
16811 * # b --------- | |
16812 * | |
16813 * (-1, -1, -1, -1): (0, 1), # a < b, a <= b # <<<<<<<<<<<<<< | |
16814 * # a ---- | |
16815 * # b ----- | |
16816 */ | |
16817 __pyx_tuple__33 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 71, __pyx_L1_error) | |
16818 __Pyx_GOTREF(__pyx_tuple__33); | |
16819 __Pyx_GIVEREF(__pyx_tuple__33); | |
16820 __pyx_tuple__34 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 71, __pyx_L1_error) | |
16821 __Pyx_GOTREF(__pyx_tuple__34); | |
16822 __Pyx_GIVEREF(__pyx_tuple__34); | |
16823 | |
16824 /* "pybedtools/cbedtools.pyx":75 | |
16825 * # b ----- | |
16826 * | |
16827 * (-1, -1, -1, 0): (1,), # a <= b # <<<<<<<<<<<<<< | |
16828 * # a ---- | |
16829 * # b ----- (book-ended) | |
16830 */ | |
16831 __pyx_tuple__35 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 75, __pyx_L1_error) | |
16832 __Pyx_GOTREF(__pyx_tuple__35); | |
16833 __Pyx_GIVEREF(__pyx_tuple__35); | |
16834 __pyx_tuple__36 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 75, __pyx_L1_error) | |
16835 __Pyx_GOTREF(__pyx_tuple__36); | |
16836 __Pyx_GIVEREF(__pyx_tuple__36); | |
16837 | |
16838 /* "pybedtools/cbedtools.pyx":79 | |
16839 * # b ----- (book-ended) | |
16840 * | |
16841 * (1, 1, 0, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
16842 * # a ----- | |
16843 * # b ---- (book-ended) | |
16844 */ | |
16845 __pyx_tuple__37 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 79, __pyx_L1_error) | |
16846 __Pyx_GOTREF(__pyx_tuple__37); | |
16847 __Pyx_GIVEREF(__pyx_tuple__37); | |
16848 __pyx_tuple__38 = PyTuple_Pack(1, __pyx_int_5); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 79, __pyx_L1_error) | |
16849 __Pyx_GOTREF(__pyx_tuple__38); | |
16850 __Pyx_GIVEREF(__pyx_tuple__38); | |
16851 | |
16852 /* "pybedtools/cbedtools.pyx":83 | |
16853 * # b ---- (book-ended) | |
16854 * | |
16855 * (1, 1, 1, 1): (4, 5), # a > b, a >= b # <<<<<<<<<<<<<< | |
16856 * # a ------ | |
16857 * # b ---- | |
16858 */ | |
16859 __pyx_tuple__39 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 83, __pyx_L1_error) | |
16860 __Pyx_GOTREF(__pyx_tuple__39); | |
16861 __Pyx_GIVEREF(__pyx_tuple__39); | |
16862 __pyx_tuple__40 = PyTuple_Pack(2, __pyx_int_4, __pyx_int_5); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 83, __pyx_L1_error) | |
16863 __Pyx_GOTREF(__pyx_tuple__40); | |
16864 __Pyx_GIVEREF(__pyx_tuple__40); | |
16865 | |
16866 /* "pybedtools/cbedtools.pyx":87 | |
16867 * # b ---- | |
16868 * | |
16869 * (0, 1, -1, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
16870 * # a ------------ | |
16871 * # b --------- | |
16872 */ | |
16873 __pyx_tuple__41 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_1, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 87, __pyx_L1_error) | |
16874 __Pyx_GOTREF(__pyx_tuple__41); | |
16875 __Pyx_GIVEREF(__pyx_tuple__41); | |
16876 | |
16877 /* "pybedtools/cbedtools.pyx":91 | |
16878 * # b --------- | |
16879 * | |
16880 * (1, 0, -1, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
16881 * # a ----------- | |
16882 * # b ------------- | |
16883 */ | |
16884 __pyx_tuple__42 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 91, __pyx_L1_error) | |
16885 __Pyx_GOTREF(__pyx_tuple__42); | |
16886 __Pyx_GIVEREF(__pyx_tuple__42); | |
16887 | |
16888 /* "pybedtools/cbedtools.pyx":95 | |
16889 * # b ------------- | |
16890 * | |
16891 * (-1, 0, -1, 1): (1,), # a <= b # <<<<<<<<<<<<<< | |
16892 * # a ------------- | |
16893 * # b ----------- | |
16894 */ | |
16895 __pyx_tuple__43 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_0, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 95, __pyx_L1_error) | |
16896 __Pyx_GOTREF(__pyx_tuple__43); | |
16897 __Pyx_GIVEREF(__pyx_tuple__43); | |
16898 | |
16899 /* "pybedtools/cbedtools.pyx":99 | |
16900 * # b ----------- | |
16901 * | |
16902 * (0, -1, -1, 1): (1,), # a <= b # <<<<<<<<<<<<<< | |
16903 * # a --------- | |
16904 * # b ------------ | |
16905 */ | |
16906 __pyx_tuple__44 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 99, __pyx_L1_error) | |
16907 __Pyx_GOTREF(__pyx_tuple__44); | |
16908 __Pyx_GIVEREF(__pyx_tuple__44); | |
16909 | |
16910 /* "pybedtools/cbedtools.pyx":103 | |
16911 * # b ------------ | |
16912 * | |
16913 * (-1, -1, -1, 1): (1,), # a <= b # <<<<<<<<<<<<<< | |
16914 * # a ----------- | |
16915 * # b ----------- | |
16916 */ | |
16917 __pyx_tuple__45 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 103, __pyx_L1_error) | |
16918 __Pyx_GOTREF(__pyx_tuple__45); | |
16919 __Pyx_GIVEREF(__pyx_tuple__45); | |
16920 | |
16921 /* "pybedtools/cbedtools.pyx":107 | |
16922 * # b ----------- | |
16923 * | |
16924 * (1, 1, -1, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
16925 * # a ----------- | |
16926 * # b ----------- | |
16927 */ | |
16928 __pyx_tuple__46 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_1, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 107, __pyx_L1_error) | |
16929 __Pyx_GOTREF(__pyx_tuple__46); | |
16930 __Pyx_GIVEREF(__pyx_tuple__46); | |
16931 | |
16932 /* "pybedtools/cbedtools.pyx":111 | |
16933 * # b ----------- | |
16934 * | |
16935 * (1, -1, -1, 1): tuple(), # undef # <<<<<<<<<<<<<< | |
16936 * # a ---- | |
16937 * # b ----------- | |
16938 */ | |
16939 __pyx_tuple__47 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 111, __pyx_L1_error) | |
16940 __Pyx_GOTREF(__pyx_tuple__47); | |
16941 __Pyx_GIVEREF(__pyx_tuple__47); | |
16942 | |
16943 /* "pybedtools/cbedtools.pyx":115 | |
16944 * # b ----------- | |
16945 * | |
16946 * (-1, 1, -1, 1): tuple(), # undef # <<<<<<<<<<<<<< | |
16947 * # a ----------- | |
16948 * # b ---- | |
16949 */ | |
16950 __pyx_tuple__48 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_1, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 115, __pyx_L1_error) | |
16951 __Pyx_GOTREF(__pyx_tuple__48); | |
16952 __Pyx_GIVEREF(__pyx_tuple__48); | |
16953 | |
16954 /* "pybedtools/cbedtools.pyx":119 | |
16955 * # b ---- | |
16956 * | |
16957 * (-1, 0, -1, 0): (1,), # a <= b # <<<<<<<<<<<<<< | |
16958 * # a ----------- | |
16959 * # b - | |
16960 */ | |
16961 __pyx_tuple__49 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_0, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 119, __pyx_L1_error) | |
16962 __Pyx_GOTREF(__pyx_tuple__49); | |
16963 __Pyx_GIVEREF(__pyx_tuple__49); | |
16964 | |
16965 /* "pybedtools/cbedtools.pyx":123 | |
16966 * # b - | |
16967 * | |
16968 * (1, 0, 0, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
16969 * # a - | |
16970 * # b ----------- | |
16971 */ | |
16972 __pyx_tuple__50 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 123, __pyx_L1_error) | |
16973 __Pyx_GOTREF(__pyx_tuple__50); | |
16974 __Pyx_GIVEREF(__pyx_tuple__50); | |
16975 | |
16976 /* "pybedtools/cbedtools.pyx":127 | |
16977 * # b ----------- | |
16978 * | |
16979 * (0, 0, 0, 0): (1, 2, 5), # a == b, a <= b, a >= b # <<<<<<<<<<<<<< | |
16980 * # a - | |
16981 * # b - (starts and stops are identical for all features) | |
16982 */ | |
16983 __pyx_tuple__51 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 127, __pyx_L1_error) | |
16984 __Pyx_GOTREF(__pyx_tuple__51); | |
16985 __Pyx_GIVEREF(__pyx_tuple__51); | |
16986 __pyx_tuple__52 = PyTuple_Pack(3, __pyx_int_1, __pyx_int_2, __pyx_int_5); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 127, __pyx_L1_error) | |
16987 __Pyx_GOTREF(__pyx_tuple__52); | |
16988 __Pyx_GIVEREF(__pyx_tuple__52); | |
16989 | |
16990 /* "pybedtools/cbedtools.pyx":146 | |
16991 * """ | |
16992 * | |
16993 * def __init__(self, attr_str=""): # <<<<<<<<<<<<<< | |
16994 * attr_str = str(attr_str) | |
16995 * self._attr_str = attr_str | |
16996 */ | |
16997 __pyx_tuple__53 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_attr_str, __pyx_n_s_n_semi, __pyx_n_s_n_eq, __pyx_n_s_n_quotes, __pyx_n_s_kvs, __pyx_n_s_field, __pyx_n_s_value, __pyx_n_s_kv); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 146, __pyx_L1_error) | |
16998 __Pyx_GOTREF(__pyx_tuple__53); | |
16999 __Pyx_GIVEREF(__pyx_tuple__53); | |
17000 __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pybedtools_cbedtools_pyx, __pyx_n_s_init, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 146, __pyx_L1_error) | |
17001 __pyx_tuple__55 = PyTuple_Pack(1, ((PyObject*)__pyx_kp_s_)); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 146, __pyx_L1_error) | |
17002 __Pyx_GOTREF(__pyx_tuple__55); | |
17003 __Pyx_GIVEREF(__pyx_tuple__55); | |
17004 | |
17005 /* "pybedtools/cbedtools.pyx":182 | |
17006 * self[field] = value.replace('"', '') | |
17007 * | |
17008 * def __str__(self): # <<<<<<<<<<<<<< | |
17009 * # stringify all items first | |
17010 * items = [] | |
17011 */ | |
17012 __pyx_tuple__56 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_items, __pyx_n_s_field, __pyx_n_s_val, __pyx_n_s_pairs, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 182, __pyx_L1_error) | |
17013 __Pyx_GOTREF(__pyx_tuple__56); | |
17014 __Pyx_GIVEREF(__pyx_tuple__56); | |
17015 __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pybedtools_cbedtools_pyx, __pyx_n_s_str, 182, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 182, __pyx_L1_error) | |
17016 | |
17017 /* "pybedtools/cbedtools.pyx":725 | |
17018 * | |
17019 * | |
17020 * def overlap(int s1, int s2, int e1, int e2): # <<<<<<<<<<<<<< | |
17021 * return min(e1, e2) - max(s1, s2) | |
17022 * | |
17023 */ | |
17024 __pyx_tuple__58 = PyTuple_Pack(4, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_e1, __pyx_n_s_e2); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 725, __pyx_L1_error) | |
17025 __Pyx_GOTREF(__pyx_tuple__58); | |
17026 __Pyx_GIVEREF(__pyx_tuple__58); | |
17027 __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pybedtools_cbedtools_pyx, __pyx_n_s_overlap, 725, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 725, __pyx_L1_error) | |
17028 | |
17029 /* "(tree fragment)":1 | |
17030 * def __pyx_unpickle_IntervalIterator(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< | |
17031 * cdef object __pyx_PickleError | |
17032 * cdef object __pyx_result | |
17033 */ | |
17034 __pyx_tuple__60 = 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__60)) __PYX_ERR(1, 1, __pyx_L1_error) | |
17035 __Pyx_GOTREF(__pyx_tuple__60); | |
17036 __Pyx_GIVEREF(__pyx_tuple__60); | |
17037 __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_IntervalIterator, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(1, 1, __pyx_L1_error) | |
17038 __Pyx_RefNannyFinishContext(); | |
17039 return 0; | |
17040 __pyx_L1_error:; | |
17041 __Pyx_RefNannyFinishContext(); | |
17042 return -1; | |
17043 } | |
17044 | |
17045 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { | |
17046 __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; | |
17047 __pyx_umethod_PyDict_Type_iteritems.type = (PyObject*)&PyDict_Type; | |
17048 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17049 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17050 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17051 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17052 __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17053 __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17054 __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17055 __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17056 __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17057 __pyx_int_22915542 = PyInt_FromLong(22915542L); if (unlikely(!__pyx_int_22915542)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17058 __pyx_int_26969663 = PyInt_FromLong(26969663L); if (unlikely(!__pyx_int_26969663)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17059 __pyx_int_172054328 = PyInt_FromLong(172054328L); if (unlikely(!__pyx_int_172054328)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17060 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17061 return 0; | |
17062 __pyx_L1_error:; | |
17063 return -1; | |
17064 } | |
17065 | |
17066 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ | |
17067 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ | |
17068 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ | |
17069 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ | |
17070 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ | |
17071 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ | |
17072 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ | |
17073 | |
17074 static int __Pyx_modinit_global_init_code(void) { | |
17075 __Pyx_RefNannyDeclarations | |
17076 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); | |
17077 /*--- Global init code ---*/ | |
17078 __pyx_v_10pybedtools_9cbedtools_LOOKUPS = ((PyObject*)Py_None); Py_INCREF(Py_None); | |
17079 __Pyx_RefNannyFinishContext(); | |
17080 return 0; | |
17081 } | |
17082 | |
17083 static int __Pyx_modinit_variable_export_code(void) { | |
17084 __Pyx_RefNannyDeclarations | |
17085 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); | |
17086 /*--- Variable export code ---*/ | |
17087 __Pyx_RefNannyFinishContext(); | |
17088 return 0; | |
17089 } | |
17090 | |
17091 static int __Pyx_modinit_function_export_code(void) { | |
17092 __Pyx_RefNannyDeclarations | |
17093 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); | |
17094 /*--- Function export code ---*/ | |
17095 __Pyx_RefNannyFinishContext(); | |
17096 return 0; | |
17097 } | |
17098 | |
17099 static int __Pyx_modinit_type_init_code(void) { | |
17100 __Pyx_RefNannyDeclarations | |
17101 int __pyx_lineno = 0; | |
17102 const char *__pyx_filename = NULL; | |
17103 int __pyx_clineno = 0; | |
17104 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); | |
17105 /*--- Type init code ---*/ | |
17106 __pyx_vtabptr_10pybedtools_9cbedtools_Interval = &__pyx_vtable_10pybedtools_9cbedtools_Interval; | |
17107 __pyx_vtable_10pybedtools_9cbedtools_Interval.append = (PyObject *(*)(struct __pyx_obj_10pybedtools_9cbedtools_Interval *, PyObject *, int __pyx_skip_dispatch))__pyx_f_10pybedtools_9cbedtools_8Interval_append; | |
17108 __pyx_vtable_10pybedtools_9cbedtools_Interval.deparse_attrs = (PyObject *(*)(struct __pyx_obj_10pybedtools_9cbedtools_Interval *, int __pyx_skip_dispatch))__pyx_f_10pybedtools_9cbedtools_8Interval_deparse_attrs; | |
17109 if (PyType_Ready(&__pyx_type_10pybedtools_9cbedtools_Interval) < 0) __PYX_ERR(0, 201, __pyx_L1_error) | |
17110 #if PY_VERSION_HEX < 0x030800B1 | |
17111 __pyx_type_10pybedtools_9cbedtools_Interval.tp_print = 0; | |
17112 #endif | |
17113 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pybedtools_9cbedtools_Interval.tp_dictoffset && __pyx_type_10pybedtools_9cbedtools_Interval.tp_getattro == PyObject_GenericGetAttr)) { | |
17114 __pyx_type_10pybedtools_9cbedtools_Interval.tp_getattro = __Pyx_PyObject_GenericGetAttr; | |
17115 } | |
17116 #if CYTHON_UPDATE_DESCRIPTOR_DOC | |
17117 { | |
17118 PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pybedtools_9cbedtools_Interval, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 201, __pyx_L1_error) | |
17119 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { | |
17120 __pyx_wrapperbase_10pybedtools_9cbedtools_8Interval_10__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; | |
17121 __pyx_wrapperbase_10pybedtools_9cbedtools_8Interval_10__str__.doc = __pyx_doc_10pybedtools_9cbedtools_8Interval_10__str__; | |
17122 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pybedtools_9cbedtools_8Interval_10__str__; | |
17123 } | |
17124 } | |
17125 #endif | |
17126 if (__Pyx_SetVtable(__pyx_type_10pybedtools_9cbedtools_Interval.tp_dict, __pyx_vtabptr_10pybedtools_9cbedtools_Interval) < 0) __PYX_ERR(0, 201, __pyx_L1_error) | |
17127 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Interval, (PyObject *)&__pyx_type_10pybedtools_9cbedtools_Interval) < 0) __PYX_ERR(0, 201, __pyx_L1_error) | |
17128 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pybedtools_9cbedtools_Interval) < 0) __PYX_ERR(0, 201, __pyx_L1_error) | |
17129 __pyx_ptype_10pybedtools_9cbedtools_Interval = &__pyx_type_10pybedtools_9cbedtools_Interval; | |
17130 if (PyType_Ready(&__pyx_type_10pybedtools_9cbedtools_IntervalIterator) < 0) __PYX_ERR(0, 729, __pyx_L1_error) | |
17131 #if PY_VERSION_HEX < 0x030800B1 | |
17132 __pyx_type_10pybedtools_9cbedtools_IntervalIterator.tp_print = 0; | |
17133 #endif | |
17134 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pybedtools_9cbedtools_IntervalIterator.tp_dictoffset && __pyx_type_10pybedtools_9cbedtools_IntervalIterator.tp_getattro == PyObject_GenericGetAttr)) { | |
17135 __pyx_type_10pybedtools_9cbedtools_IntervalIterator.tp_getattro = __Pyx_PyObject_GenericGetAttr; | |
17136 } | |
17137 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IntervalIterator, (PyObject *)&__pyx_type_10pybedtools_9cbedtools_IntervalIterator) < 0) __PYX_ERR(0, 729, __pyx_L1_error) | |
17138 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pybedtools_9cbedtools_IntervalIterator) < 0) __PYX_ERR(0, 729, __pyx_L1_error) | |
17139 __pyx_ptype_10pybedtools_9cbedtools_IntervalIterator = &__pyx_type_10pybedtools_9cbedtools_IntervalIterator; | |
17140 if (PyType_Ready(&__pyx_type_10pybedtools_9cbedtools_IntervalFile) < 0) __PYX_ERR(0, 794, __pyx_L1_error) | |
17141 #if PY_VERSION_HEX < 0x030800B1 | |
17142 __pyx_type_10pybedtools_9cbedtools_IntervalFile.tp_print = 0; | |
17143 #endif | |
17144 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pybedtools_9cbedtools_IntervalFile.tp_dictoffset && __pyx_type_10pybedtools_9cbedtools_IntervalFile.tp_getattro == PyObject_GenericGetAttr)) { | |
17145 __pyx_type_10pybedtools_9cbedtools_IntervalFile.tp_getattro = __Pyx_PyObject_GenericGetAttr; | |
17146 } | |
17147 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_IntervalFile, (PyObject *)&__pyx_type_10pybedtools_9cbedtools_IntervalFile) < 0) __PYX_ERR(0, 794, __pyx_L1_error) | |
17148 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pybedtools_9cbedtools_IntervalFile) < 0) __PYX_ERR(0, 794, __pyx_L1_error) | |
17149 __pyx_ptype_10pybedtools_9cbedtools_IntervalFile = &__pyx_type_10pybedtools_9cbedtools_IntervalFile; | |
17150 __Pyx_RefNannyFinishContext(); | |
17151 return 0; | |
17152 __pyx_L1_error:; | |
17153 __Pyx_RefNannyFinishContext(); | |
17154 return -1; | |
17155 } | |
17156 | |
17157 static int __Pyx_modinit_type_import_code(void) { | |
17158 __Pyx_RefNannyDeclarations | |
17159 PyObject *__pyx_t_1 = NULL; | |
17160 int __pyx_lineno = 0; | |
17161 const char *__pyx_filename = NULL; | |
17162 int __pyx_clineno = 0; | |
17163 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); | |
17164 /*--- Type import code ---*/ | |
17165 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) | |
17166 __Pyx_GOTREF(__pyx_t_1); | |
17167 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_0_29_37(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", | |
17168 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 | |
17169 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_0_29_37(PyTypeObject), | |
17170 #else | |
17171 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_0_29_37(PyHeapTypeObject), | |
17172 #endif | |
17173 __Pyx_ImportType_CheckSize_Warn_0_29_37); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) | |
17174 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17175 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) | |
17176 __Pyx_GOTREF(__pyx_t_1); | |
17177 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_0_29_37(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_0_29_37(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_0_29_37); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error) | |
17178 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17179 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error) | |
17180 __Pyx_GOTREF(__pyx_t_1); | |
17181 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_0_29_37(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_0_29_37(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_0_29_37); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error) | |
17182 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17183 __Pyx_RefNannyFinishContext(); | |
17184 return 0; | |
17185 __pyx_L1_error:; | |
17186 __Pyx_XDECREF(__pyx_t_1); | |
17187 __Pyx_RefNannyFinishContext(); | |
17188 return -1; | |
17189 } | |
17190 | |
17191 static int __Pyx_modinit_variable_import_code(void) { | |
17192 __Pyx_RefNannyDeclarations | |
17193 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); | |
17194 /*--- Variable import code ---*/ | |
17195 __Pyx_RefNannyFinishContext(); | |
17196 return 0; | |
17197 } | |
17198 | |
17199 static int __Pyx_modinit_function_import_code(void) { | |
17200 __Pyx_RefNannyDeclarations | |
17201 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); | |
17202 /*--- Function import code ---*/ | |
17203 __Pyx_RefNannyFinishContext(); | |
17204 return 0; | |
17205 } | |
17206 | |
17207 | |
17208 #ifndef CYTHON_NO_PYINIT_EXPORT | |
17209 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC | |
17210 #elif PY_MAJOR_VERSION < 3 | |
17211 #ifdef __cplusplus | |
17212 #define __Pyx_PyMODINIT_FUNC extern "C" void | |
17213 #else | |
17214 #define __Pyx_PyMODINIT_FUNC void | |
17215 #endif | |
17216 #else | |
17217 #ifdef __cplusplus | |
17218 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * | |
17219 #else | |
17220 #define __Pyx_PyMODINIT_FUNC PyObject * | |
17221 #endif | |
17222 #endif | |
17223 | |
17224 | |
17225 #if PY_MAJOR_VERSION < 3 | |
17226 __Pyx_PyMODINIT_FUNC initcbedtools(void) CYTHON_SMALL_CODE; /*proto*/ | |
17227 __Pyx_PyMODINIT_FUNC initcbedtools(void) | |
17228 #else | |
17229 __Pyx_PyMODINIT_FUNC PyInit_cbedtools(void) CYTHON_SMALL_CODE; /*proto*/ | |
17230 __Pyx_PyMODINIT_FUNC PyInit_cbedtools(void) | |
17231 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
17232 { | |
17233 return PyModuleDef_Init(&__pyx_moduledef); | |
17234 } | |
17235 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { | |
17236 #if PY_VERSION_HEX >= 0x030700A1 | |
17237 static PY_INT64_T main_interpreter_id = -1; | |
17238 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); | |
17239 if (main_interpreter_id == -1) { | |
17240 main_interpreter_id = current_id; | |
17241 return (unlikely(current_id == -1)) ? -1 : 0; | |
17242 } else if (unlikely(main_interpreter_id != current_id)) | |
17243 #else | |
17244 static PyInterpreterState *main_interpreter = NULL; | |
17245 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; | |
17246 if (!main_interpreter) { | |
17247 main_interpreter = current_interpreter; | |
17248 } else if (unlikely(main_interpreter != current_interpreter)) | |
17249 #endif | |
17250 { | |
17251 PyErr_SetString( | |
17252 PyExc_ImportError, | |
17253 "Interpreter change detected - this module can only be loaded into one interpreter per process."); | |
17254 return -1; | |
17255 } | |
17256 return 0; | |
17257 } | |
17258 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) { | |
17259 PyObject *value = PyObject_GetAttrString(spec, from_name); | |
17260 int result = 0; | |
17261 if (likely(value)) { | |
17262 if (allow_none || value != Py_None) { | |
17263 result = PyDict_SetItemString(moddict, to_name, value); | |
17264 } | |
17265 Py_DECREF(value); | |
17266 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { | |
17267 PyErr_Clear(); | |
17268 } else { | |
17269 result = -1; | |
17270 } | |
17271 return result; | |
17272 } | |
17273 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { | |
17274 PyObject *module = NULL, *moddict, *modname; | |
17275 if (__Pyx_check_single_interpreter()) | |
17276 return NULL; | |
17277 if (__pyx_m) | |
17278 return __Pyx_NewRef(__pyx_m); | |
17279 modname = PyObject_GetAttrString(spec, "name"); | |
17280 if (unlikely(!modname)) goto bad; | |
17281 module = PyModule_NewObject(modname); | |
17282 Py_DECREF(modname); | |
17283 if (unlikely(!module)) goto bad; | |
17284 moddict = PyModule_GetDict(module); | |
17285 if (unlikely(!moddict)) goto bad; | |
17286 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; | |
17287 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; | |
17288 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; | |
17289 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; | |
17290 return module; | |
17291 bad: | |
17292 Py_XDECREF(module); | |
17293 return NULL; | |
17294 } | |
17295 | |
17296 | |
17297 static CYTHON_SMALL_CODE int __pyx_pymod_exec_cbedtools(PyObject *__pyx_pyinit_module) | |
17298 #endif | |
17299 #endif | |
17300 { | |
17301 PyObject *__pyx_t_1 = NULL; | |
17302 PyObject *__pyx_t_2 = NULL; | |
17303 Py_ssize_t __pyx_t_3; | |
17304 PyObject *__pyx_t_4 = NULL; | |
17305 PyObject *__pyx_t_5 = NULL; | |
17306 PyObject *__pyx_t_6 = NULL; | |
17307 PyObject *(*__pyx_t_7)(PyObject *); | |
17308 Py_ssize_t __pyx_t_8; | |
17309 PyObject *__pyx_t_9 = NULL; | |
17310 int __pyx_lineno = 0; | |
17311 const char *__pyx_filename = NULL; | |
17312 int __pyx_clineno = 0; | |
17313 __Pyx_RefNannyDeclarations | |
17314 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
17315 if (__pyx_m) { | |
17316 if (__pyx_m == __pyx_pyinit_module) return 0; | |
17317 PyErr_SetString(PyExc_RuntimeError, "Module 'cbedtools' has already been imported. Re-initialisation is not supported."); | |
17318 return -1; | |
17319 } | |
17320 #elif PY_MAJOR_VERSION >= 3 | |
17321 if (__pyx_m) return __Pyx_NewRef(__pyx_m); | |
17322 #endif | |
17323 #if CYTHON_REFNANNY | |
17324 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); | |
17325 if (!__Pyx_RefNanny) { | |
17326 PyErr_Clear(); | |
17327 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); | |
17328 if (!__Pyx_RefNanny) | |
17329 Py_FatalError("failed to import 'refnanny' module"); | |
17330 } | |
17331 #endif | |
17332 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cbedtools(void)", 0); | |
17333 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17334 #ifdef __Pxy_PyFrame_Initialize_Offsets | |
17335 __Pxy_PyFrame_Initialize_Offsets(); | |
17336 #endif | |
17337 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17338 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17339 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17340 #ifdef __Pyx_CyFunction_USED | |
17341 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17342 #endif | |
17343 #ifdef __Pyx_FusedFunction_USED | |
17344 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17345 #endif | |
17346 #ifdef __Pyx_Coroutine_USED | |
17347 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17348 #endif | |
17349 #ifdef __Pyx_Generator_USED | |
17350 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17351 #endif | |
17352 #ifdef __Pyx_AsyncGen_USED | |
17353 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17354 #endif | |
17355 #ifdef __Pyx_StopAsyncIteration_USED | |
17356 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17357 #endif | |
17358 /*--- Library function declarations ---*/ | |
17359 /*--- Threads initialization code ---*/ | |
17360 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS | |
17361 PyEval_InitThreads(); | |
17362 #endif | |
17363 /*--- Module creation code ---*/ | |
17364 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
17365 __pyx_m = __pyx_pyinit_module; | |
17366 Py_INCREF(__pyx_m); | |
17367 #else | |
17368 #if PY_MAJOR_VERSION < 3 | |
17369 __pyx_m = Py_InitModule4("cbedtools", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); | |
17370 #else | |
17371 __pyx_m = PyModule_Create(&__pyx_moduledef); | |
17372 #endif | |
17373 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17374 #endif | |
17375 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17376 Py_INCREF(__pyx_d); | |
17377 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17378 Py_INCREF(__pyx_b); | |
17379 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17380 Py_INCREF(__pyx_cython_runtime); | |
17381 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17382 /*--- Initialize various global constants etc. ---*/ | |
17383 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17384 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) | |
17385 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17386 #endif | |
17387 if (__pyx_module_is_main_pybedtools__cbedtools) { | |
17388 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17389 } | |
17390 #if PY_MAJOR_VERSION >= 3 | |
17391 { | |
17392 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17393 if (!PyDict_GetItemString(modules, "pybedtools.cbedtools")) { | |
17394 if (unlikely(PyDict_SetItemString(modules, "pybedtools.cbedtools", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17395 } | |
17396 } | |
17397 #endif | |
17398 /*--- Builtin init code ---*/ | |
17399 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17400 /*--- Constants init code ---*/ | |
17401 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17402 /*--- Global type/function init code ---*/ | |
17403 (void)__Pyx_modinit_global_init_code(); | |
17404 (void)__Pyx_modinit_variable_export_code(); | |
17405 (void)__Pyx_modinit_function_export_code(); | |
17406 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17407 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) | |
17408 (void)__Pyx_modinit_variable_import_code(); | |
17409 (void)__Pyx_modinit_function_import_code(); | |
17410 /*--- Execution code ---*/ | |
17411 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) | |
17412 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
17413 #endif | |
17414 | |
17415 /* "pybedtools/cbedtools.pyx":17 | |
17416 * | |
17417 * from libcpp.string cimport string | |
17418 * import numpy as np # <<<<<<<<<<<<<< | |
17419 * | |
17420 * # Python byte strings automatically coerce to/from C++ strings. | |
17421 */ | |
17422 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) | |
17423 __Pyx_GOTREF(__pyx_t_1); | |
17424 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error) | |
17425 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17426 | |
17427 /* "pybedtools/cbedtools.pyx":38 | |
17428 * return s.decode('UTF-8', 'strict') | |
17429 * | |
17430 * integer_types = (int, long, np.int64) # <<<<<<<<<<<<<< | |
17431 * | |
17432 * | |
17433 */ | |
17434 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) | |
17435 __Pyx_GOTREF(__pyx_t_1); | |
17436 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) | |
17437 __Pyx_GOTREF(__pyx_t_2); | |
17438 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17439 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) | |
17440 __Pyx_GOTREF(__pyx_t_1); | |
17441 __Pyx_INCREF(((PyObject *)(&PyInt_Type))); | |
17442 __Pyx_GIVEREF(((PyObject *)(&PyInt_Type))); | |
17443 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyInt_Type))); | |
17444 __Pyx_INCREF(((PyObject *)(&PyLong_Type))); | |
17445 __Pyx_GIVEREF(((PyObject *)(&PyLong_Type))); | |
17446 PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)(&PyLong_Type))); | |
17447 __Pyx_GIVEREF(__pyx_t_2); | |
17448 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); | |
17449 __pyx_t_2 = 0; | |
17450 if (PyDict_SetItem(__pyx_d, __pyx_n_s_integer_types, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) | |
17451 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17452 | |
17453 /* "pybedtools/cbedtools.pyx":50 | |
17454 * """ | |
17455 * from cython.operator cimport dereference as deref | |
17456 * import sys # <<<<<<<<<<<<<< | |
17457 * import subprocess | |
17458 * from collections import defaultdict | |
17459 */ | |
17460 __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) | |
17461 __Pyx_GOTREF(__pyx_t_1); | |
17462 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 50, __pyx_L1_error) | |
17463 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17464 | |
17465 /* "pybedtools/cbedtools.pyx":51 | |
17466 * from cython.operator cimport dereference as deref | |
17467 * import sys | |
17468 * import subprocess # <<<<<<<<<<<<<< | |
17469 * from collections import defaultdict | |
17470 * | |
17471 */ | |
17472 __pyx_t_1 = __Pyx_Import(__pyx_n_s_subprocess, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) | |
17473 __Pyx_GOTREF(__pyx_t_1); | |
17474 if (PyDict_SetItem(__pyx_d, __pyx_n_s_subprocess, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) | |
17475 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17476 | |
17477 /* "pybedtools/cbedtools.pyx":52 | |
17478 * import sys | |
17479 * import subprocess | |
17480 * from collections import defaultdict # <<<<<<<<<<<<<< | |
17481 * | |
17482 * cdef dict LOOKUPS = { | |
17483 */ | |
17484 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) | |
17485 __Pyx_GOTREF(__pyx_t_1); | |
17486 __Pyx_INCREF(__pyx_n_s_defaultdict); | |
17487 __Pyx_GIVEREF(__pyx_n_s_defaultdict); | |
17488 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_defaultdict); | |
17489 __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) | |
17490 __Pyx_GOTREF(__pyx_t_2); | |
17491 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17492 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) | |
17493 __Pyx_GOTREF(__pyx_t_1); | |
17494 if (PyDict_SetItem(__pyx_d, __pyx_n_s_defaultdict, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error) | |
17495 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17496 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
17497 | |
17498 /* "pybedtools/cbedtools.pyx":55 | |
17499 * | |
17500 * cdef dict LOOKUPS = { | |
17501 * "gff": {"chrom": 0, "start": 3, "end": 4, "stop": 4, "strand": 6}, # <<<<<<<<<<<<<< | |
17502 * "vcf": {"chrom": 0, "start": 1}, | |
17503 * "bed": {"chrom": 0, "start": 1, "end": 2, "stop": 2, "score": 4, "strand": 5} | |
17504 */ | |
17505 __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) | |
17506 __Pyx_GOTREF(__pyx_t_2); | |
17507 __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) | |
17508 __Pyx_GOTREF(__pyx_t_1); | |
17509 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_chrom, __pyx_int_0) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17510 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_start, __pyx_int_3) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17511 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_end, __pyx_int_4) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17512 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_stop, __pyx_int_4) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17513 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_strand, __pyx_int_6) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17514 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_gff, __pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17515 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17516 | |
17517 /* "pybedtools/cbedtools.pyx":56 | |
17518 * cdef dict LOOKUPS = { | |
17519 * "gff": {"chrom": 0, "start": 3, "end": 4, "stop": 4, "strand": 6}, | |
17520 * "vcf": {"chrom": 0, "start": 1}, # <<<<<<<<<<<<<< | |
17521 * "bed": {"chrom": 0, "start": 1, "end": 2, "stop": 2, "score": 4, "strand": 5} | |
17522 * } | |
17523 */ | |
17524 __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) | |
17525 __Pyx_GOTREF(__pyx_t_1); | |
17526 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_chrom, __pyx_int_0) < 0) __PYX_ERR(0, 56, __pyx_L1_error) | |
17527 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_start, __pyx_int_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error) | |
17528 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_vcf, __pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17529 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17530 | |
17531 /* "pybedtools/cbedtools.pyx":57 | |
17532 * "gff": {"chrom": 0, "start": 3, "end": 4, "stop": 4, "strand": 6}, | |
17533 * "vcf": {"chrom": 0, "start": 1}, | |
17534 * "bed": {"chrom": 0, "start": 1, "end": 2, "stop": 2, "score": 4, "strand": 5} # <<<<<<<<<<<<<< | |
17535 * } | |
17536 * for ktype, kdict in list(LOOKUPS.items()): | |
17537 */ | |
17538 __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) | |
17539 __Pyx_GOTREF(__pyx_t_1); | |
17540 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_chrom, __pyx_int_0) < 0) __PYX_ERR(0, 57, __pyx_L1_error) | |
17541 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_start, __pyx_int_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) | |
17542 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_end, __pyx_int_2) < 0) __PYX_ERR(0, 57, __pyx_L1_error) | |
17543 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_stop, __pyx_int_2) < 0) __PYX_ERR(0, 57, __pyx_L1_error) | |
17544 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_score, __pyx_int_4) < 0) __PYX_ERR(0, 57, __pyx_L1_error) | |
17545 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_strand, __pyx_int_5) < 0) __PYX_ERR(0, 57, __pyx_L1_error) | |
17546 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bed, __pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error) | |
17547 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17548 __Pyx_XGOTREF(__pyx_v_10pybedtools_9cbedtools_LOOKUPS); | |
17549 __Pyx_DECREF_SET(__pyx_v_10pybedtools_9cbedtools_LOOKUPS, ((PyObject*)__pyx_t_2)); | |
17550 __Pyx_GIVEREF(__pyx_t_2); | |
17551 __pyx_t_2 = 0; | |
17552 | |
17553 /* "pybedtools/cbedtools.pyx":59 | |
17554 * "bed": {"chrom": 0, "start": 1, "end": 2, "stop": 2, "score": 4, "strand": 5} | |
17555 * } | |
17556 * for ktype, kdict in list(LOOKUPS.items()): # <<<<<<<<<<<<<< | |
17557 * for k, v in list(kdict.items()): | |
17558 * kdict[v] = k | |
17559 */ | |
17560 if (unlikely(__pyx_v_10pybedtools_9cbedtools_LOOKUPS == Py_None)) { | |
17561 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); | |
17562 __PYX_ERR(0, 59, __pyx_L1_error) | |
17563 } | |
17564 __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_10pybedtools_9cbedtools_LOOKUPS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17565 __Pyx_GOTREF(__pyx_t_2); | |
17566 __pyx_t_1 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17567 __Pyx_GOTREF(__pyx_t_1); | |
17568 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
17569 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; | |
17570 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17571 for (;;) { | |
17572 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; | |
17573 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
17574 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17575 #else | |
17576 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17577 __Pyx_GOTREF(__pyx_t_1); | |
17578 #endif | |
17579 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { | |
17580 PyObject* sequence = __pyx_t_1; | |
17581 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); | |
17582 if (unlikely(size != 2)) { | |
17583 if (size > 2) __Pyx_RaiseTooManyValuesError(2); | |
17584 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); | |
17585 __PYX_ERR(0, 59, __pyx_L1_error) | |
17586 } | |
17587 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
17588 if (likely(PyTuple_CheckExact(sequence))) { | |
17589 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); | |
17590 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); | |
17591 } else { | |
17592 __pyx_t_4 = PyList_GET_ITEM(sequence, 0); | |
17593 __pyx_t_5 = PyList_GET_ITEM(sequence, 1); | |
17594 } | |
17595 __Pyx_INCREF(__pyx_t_4); | |
17596 __Pyx_INCREF(__pyx_t_5); | |
17597 #else | |
17598 __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17599 __Pyx_GOTREF(__pyx_t_4); | |
17600 __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17601 __Pyx_GOTREF(__pyx_t_5); | |
17602 #endif | |
17603 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17604 } else { | |
17605 Py_ssize_t index = -1; | |
17606 __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error) | |
17607 __Pyx_GOTREF(__pyx_t_6); | |
17608 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17609 __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; | |
17610 index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; | |
17611 __Pyx_GOTREF(__pyx_t_4); | |
17612 index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; | |
17613 __Pyx_GOTREF(__pyx_t_5); | |
17614 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 59, __pyx_L1_error) | |
17615 __pyx_t_7 = NULL; | |
17616 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
17617 goto __pyx_L5_unpacking_done; | |
17618 __pyx_L4_unpacking_failed:; | |
17619 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
17620 __pyx_t_7 = NULL; | |
17621 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); | |
17622 __PYX_ERR(0, 59, __pyx_L1_error) | |
17623 __pyx_L5_unpacking_done:; | |
17624 } | |
17625 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ktype, __pyx_t_4) < 0) __PYX_ERR(0, 59, __pyx_L1_error) | |
17626 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17627 if (PyDict_SetItem(__pyx_d, __pyx_n_s_kdict, __pyx_t_5) < 0) __PYX_ERR(0, 59, __pyx_L1_error) | |
17628 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17629 | |
17630 /* "pybedtools/cbedtools.pyx":60 | |
17631 * } | |
17632 * for ktype, kdict in list(LOOKUPS.items()): | |
17633 * for k, v in list(kdict.items()): # <<<<<<<<<<<<<< | |
17634 * kdict[v] = k | |
17635 * | |
17636 */ | |
17637 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_kdict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17638 __Pyx_GOTREF(__pyx_t_5); | |
17639 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17640 __Pyx_GOTREF(__pyx_t_4); | |
17641 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17642 __pyx_t_5 = NULL; | |
17643 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { | |
17644 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); | |
17645 if (likely(__pyx_t_5)) { | |
17646 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); | |
17647 __Pyx_INCREF(__pyx_t_5); | |
17648 __Pyx_INCREF(function); | |
17649 __Pyx_DECREF_SET(__pyx_t_4, function); | |
17650 } | |
17651 } | |
17652 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); | |
17653 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17654 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17655 __Pyx_GOTREF(__pyx_t_1); | |
17656 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17657 __pyx_t_4 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17658 __Pyx_GOTREF(__pyx_t_4); | |
17659 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17660 __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; | |
17661 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17662 for (;;) { | |
17663 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; | |
17664 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
17665 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17666 #else | |
17667 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17668 __Pyx_GOTREF(__pyx_t_4); | |
17669 #endif | |
17670 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { | |
17671 PyObject* sequence = __pyx_t_4; | |
17672 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); | |
17673 if (unlikely(size != 2)) { | |
17674 if (size > 2) __Pyx_RaiseTooManyValuesError(2); | |
17675 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); | |
17676 __PYX_ERR(0, 60, __pyx_L1_error) | |
17677 } | |
17678 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
17679 if (likely(PyTuple_CheckExact(sequence))) { | |
17680 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); | |
17681 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); | |
17682 } else { | |
17683 __pyx_t_5 = PyList_GET_ITEM(sequence, 0); | |
17684 __pyx_t_6 = PyList_GET_ITEM(sequence, 1); | |
17685 } | |
17686 __Pyx_INCREF(__pyx_t_5); | |
17687 __Pyx_INCREF(__pyx_t_6); | |
17688 #else | |
17689 __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17690 __Pyx_GOTREF(__pyx_t_5); | |
17691 __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17692 __Pyx_GOTREF(__pyx_t_6); | |
17693 #endif | |
17694 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17695 } else { | |
17696 Py_ssize_t index = -1; | |
17697 __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) | |
17698 __Pyx_GOTREF(__pyx_t_9); | |
17699 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17700 __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext; | |
17701 index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed; | |
17702 __Pyx_GOTREF(__pyx_t_5); | |
17703 index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; | |
17704 __Pyx_GOTREF(__pyx_t_6); | |
17705 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < 0) __PYX_ERR(0, 60, __pyx_L1_error) | |
17706 __pyx_t_7 = NULL; | |
17707 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; | |
17708 goto __pyx_L9_unpacking_done; | |
17709 __pyx_L8_unpacking_failed:; | |
17710 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; | |
17711 __pyx_t_7 = NULL; | |
17712 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); | |
17713 __PYX_ERR(0, 60, __pyx_L1_error) | |
17714 __pyx_L9_unpacking_done:; | |
17715 } | |
17716 if (PyDict_SetItem(__pyx_d, __pyx_n_s_k, __pyx_t_5) < 0) __PYX_ERR(0, 60, __pyx_L1_error) | |
17717 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17718 if (PyDict_SetItem(__pyx_d, __pyx_n_s_v, __pyx_t_6) < 0) __PYX_ERR(0, 60, __pyx_L1_error) | |
17719 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
17720 | |
17721 /* "pybedtools/cbedtools.pyx":61 | |
17722 * for ktype, kdict in list(LOOKUPS.items()): | |
17723 * for k, v in list(kdict.items()): | |
17724 * kdict[v] = k # <<<<<<<<<<<<<< | |
17725 * | |
17726 * # Keys are tuples of start/start, stop/stop, start/stop, stop/start. | |
17727 */ | |
17728 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) | |
17729 __Pyx_GOTREF(__pyx_t_4); | |
17730 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_kdict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L1_error) | |
17731 __Pyx_GOTREF(__pyx_t_6); | |
17732 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_v); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) | |
17733 __Pyx_GOTREF(__pyx_t_5); | |
17734 if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_4) < 0)) __PYX_ERR(0, 61, __pyx_L1_error) | |
17735 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; | |
17736 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17737 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17738 | |
17739 /* "pybedtools/cbedtools.pyx":60 | |
17740 * } | |
17741 * for ktype, kdict in list(LOOKUPS.items()): | |
17742 * for k, v in list(kdict.items()): # <<<<<<<<<<<<<< | |
17743 * kdict[v] = k | |
17744 * | |
17745 */ | |
17746 } | |
17747 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17748 | |
17749 /* "pybedtools/cbedtools.pyx":59 | |
17750 * "bed": {"chrom": 0, "start": 1, "end": 2, "stop": 2, "score": 4, "strand": 5} | |
17751 * } | |
17752 * for ktype, kdict in list(LOOKUPS.items()): # <<<<<<<<<<<<<< | |
17753 * for k, v in list(kdict.items()): | |
17754 * kdict[v] = k | |
17755 */ | |
17756 } | |
17757 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
17758 | |
17759 /* "pybedtools/cbedtools.pyx":67 | |
17760 * # < 0 | <= 1 | == 2 | != 3 | > 4 | >= 5 | |
17761 * PROFILES_TRUE = { | |
17762 * (0, 0, -1, 1): (2, 1, 5), # a == b, a >= b, a <= b # <<<<<<<<<<<<<< | |
17763 * # a --------- | |
17764 * # b --------- | |
17765 */ | |
17766 __pyx_t_2 = __Pyx_PyDict_NewPresized(16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) | |
17767 __Pyx_GOTREF(__pyx_t_2); | |
17768 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__31, __pyx_tuple__32) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17769 | |
17770 /* "pybedtools/cbedtools.pyx":71 | |
17771 * # b --------- | |
17772 * | |
17773 * (-1, -1, -1, -1): (0, 1), # a < b, a <= b # <<<<<<<<<<<<<< | |
17774 * # a ---- | |
17775 * # b ----- | |
17776 */ | |
17777 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__33, __pyx_tuple__34) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17778 | |
17779 /* "pybedtools/cbedtools.pyx":75 | |
17780 * # b ----- | |
17781 * | |
17782 * (-1, -1, -1, 0): (1,), # a <= b # <<<<<<<<<<<<<< | |
17783 * # a ---- | |
17784 * # b ----- (book-ended) | |
17785 */ | |
17786 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__35, __pyx_tuple__36) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17787 | |
17788 /* "pybedtools/cbedtools.pyx":79 | |
17789 * # b ----- (book-ended) | |
17790 * | |
17791 * (1, 1, 0, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
17792 * # a ----- | |
17793 * # b ---- (book-ended) | |
17794 */ | |
17795 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__37, __pyx_tuple__38) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17796 | |
17797 /* "pybedtools/cbedtools.pyx":83 | |
17798 * # b ---- (book-ended) | |
17799 * | |
17800 * (1, 1, 1, 1): (4, 5), # a > b, a >= b # <<<<<<<<<<<<<< | |
17801 * # a ------ | |
17802 * # b ---- | |
17803 */ | |
17804 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__39, __pyx_tuple__40) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17805 | |
17806 /* "pybedtools/cbedtools.pyx":87 | |
17807 * # b ---- | |
17808 * | |
17809 * (0, 1, -1, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
17810 * # a ------------ | |
17811 * # b --------- | |
17812 */ | |
17813 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__41, __pyx_tuple__38) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17814 | |
17815 /* "pybedtools/cbedtools.pyx":91 | |
17816 * # b --------- | |
17817 * | |
17818 * (1, 0, -1, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
17819 * # a ----------- | |
17820 * # b ------------- | |
17821 */ | |
17822 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__42, __pyx_tuple__38) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17823 | |
17824 /* "pybedtools/cbedtools.pyx":95 | |
17825 * # b ------------- | |
17826 * | |
17827 * (-1, 0, -1, 1): (1,), # a <= b # <<<<<<<<<<<<<< | |
17828 * # a ------------- | |
17829 * # b ----------- | |
17830 */ | |
17831 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__43, __pyx_tuple__36) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17832 | |
17833 /* "pybedtools/cbedtools.pyx":99 | |
17834 * # b ----------- | |
17835 * | |
17836 * (0, -1, -1, 1): (1,), # a <= b # <<<<<<<<<<<<<< | |
17837 * # a --------- | |
17838 * # b ------------ | |
17839 */ | |
17840 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__44, __pyx_tuple__36) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17841 | |
17842 /* "pybedtools/cbedtools.pyx":103 | |
17843 * # b ------------ | |
17844 * | |
17845 * (-1, -1, -1, 1): (1,), # a <= b # <<<<<<<<<<<<<< | |
17846 * # a ----------- | |
17847 * # b ----------- | |
17848 */ | |
17849 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__45, __pyx_tuple__36) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17850 | |
17851 /* "pybedtools/cbedtools.pyx":107 | |
17852 * # b ----------- | |
17853 * | |
17854 * (1, 1, -1, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
17855 * # a ----------- | |
17856 * # b ----------- | |
17857 */ | |
17858 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__46, __pyx_tuple__38) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17859 | |
17860 /* "pybedtools/cbedtools.pyx":111 | |
17861 * # b ----------- | |
17862 * | |
17863 * (1, -1, -1, 1): tuple(), # undef # <<<<<<<<<<<<<< | |
17864 * # a ---- | |
17865 * # b ----------- | |
17866 */ | |
17867 __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) | |
17868 __Pyx_GOTREF(__pyx_t_1); | |
17869 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__47, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17870 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17871 | |
17872 /* "pybedtools/cbedtools.pyx":115 | |
17873 * # b ----------- | |
17874 * | |
17875 * (-1, 1, -1, 1): tuple(), # undef # <<<<<<<<<<<<<< | |
17876 * # a ----------- | |
17877 * # b ---- | |
17878 */ | |
17879 __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) | |
17880 __Pyx_GOTREF(__pyx_t_1); | |
17881 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__48, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17882 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17883 | |
17884 /* "pybedtools/cbedtools.pyx":119 | |
17885 * # b ---- | |
17886 * | |
17887 * (-1, 0, -1, 0): (1,), # a <= b # <<<<<<<<<<<<<< | |
17888 * # a ----------- | |
17889 * # b - | |
17890 */ | |
17891 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__49, __pyx_tuple__36) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17892 | |
17893 /* "pybedtools/cbedtools.pyx":123 | |
17894 * # b - | |
17895 * | |
17896 * (1, 0, 0, 1): (5,), # a >= b # <<<<<<<<<<<<<< | |
17897 * # a - | |
17898 * # b ----------- | |
17899 */ | |
17900 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__50, __pyx_tuple__38) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17901 | |
17902 /* "pybedtools/cbedtools.pyx":127 | |
17903 * # b ----------- | |
17904 * | |
17905 * (0, 0, 0, 0): (1, 2, 5), # a == b, a <= b, a >= b # <<<<<<<<<<<<<< | |
17906 * # a - | |
17907 * # b - (starts and stops are identical for all features) | |
17908 */ | |
17909 if (PyDict_SetItem(__pyx_t_2, __pyx_tuple__51, __pyx_tuple__52) < 0) __PYX_ERR(0, 67, __pyx_L1_error) | |
17910 if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROFILES_TRUE, __pyx_t_2) < 0) __PYX_ERR(0, 66, __pyx_L1_error) | |
17911 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
17912 | |
17913 /* "pybedtools/cbedtools.pyx":133 | |
17914 * | |
17915 * | |
17916 * class MalformedBedLineError(Exception): # <<<<<<<<<<<<<< | |
17917 * pass | |
17918 * | |
17919 */ | |
17920 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) | |
17921 __Pyx_GOTREF(__pyx_t_2); | |
17922 __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); | |
17923 __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); | |
17924 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); | |
17925 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) | |
17926 __Pyx_GOTREF(__pyx_t_1); | |
17927 __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_MalformedBedLineError, __pyx_n_s_MalformedBedLineError, (PyObject *) NULL, __pyx_n_s_pybedtools_cbedtools, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) | |
17928 __Pyx_GOTREF(__pyx_t_4); | |
17929 __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MalformedBedLineError, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error) | |
17930 __Pyx_GOTREF(__pyx_t_5); | |
17931 if (PyDict_SetItem(__pyx_d, __pyx_n_s_MalformedBedLineError, __pyx_t_5) < 0) __PYX_ERR(0, 133, __pyx_L1_error) | |
17932 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17933 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17934 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17935 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
17936 | |
17937 /* "pybedtools/cbedtools.pyx":137 | |
17938 * | |
17939 * | |
17940 * class BedToolsFileError(Exception): # <<<<<<<<<<<<<< | |
17941 * pass | |
17942 * | |
17943 */ | |
17944 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) | |
17945 __Pyx_GOTREF(__pyx_t_2); | |
17946 __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); | |
17947 __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); | |
17948 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); | |
17949 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) | |
17950 __Pyx_GOTREF(__pyx_t_1); | |
17951 __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_BedToolsFileError, __pyx_n_s_BedToolsFileError, (PyObject *) NULL, __pyx_n_s_pybedtools_cbedtools, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) | |
17952 __Pyx_GOTREF(__pyx_t_4); | |
17953 __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_BedToolsFileError, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L1_error) | |
17954 __Pyx_GOTREF(__pyx_t_5); | |
17955 if (PyDict_SetItem(__pyx_d, __pyx_n_s_BedToolsFileError, __pyx_t_5) < 0) __PYX_ERR(0, 137, __pyx_L1_error) | |
17956 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17957 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
17958 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
17959 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
17960 | |
17961 /* "pybedtools/cbedtools.pyx":141 | |
17962 * | |
17963 * | |
17964 * class Attributes(dict): # <<<<<<<<<<<<<< | |
17965 * """ | |
17966 * Class to map between a dict of attrs and fields[8] of a GFF Interval obj. | |
17967 */ | |
17968 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) | |
17969 __Pyx_GOTREF(__pyx_t_2); | |
17970 __Pyx_INCREF(((PyObject *)(&PyDict_Type))); | |
17971 __Pyx_GIVEREF(((PyObject *)(&PyDict_Type))); | |
17972 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&PyDict_Type))); | |
17973 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) | |
17974 __Pyx_GOTREF(__pyx_t_1); | |
17975 __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Attributes, __pyx_n_s_Attributes, (PyObject *) NULL, __pyx_n_s_pybedtools_cbedtools, __pyx_kp_s_Class_to_map_between_a_dict_of); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error) | |
17976 __Pyx_GOTREF(__pyx_t_4); | |
17977 | |
17978 /* "pybedtools/cbedtools.pyx":146 | |
17979 * """ | |
17980 * | |
17981 * def __init__(self, attr_str=""): # <<<<<<<<<<<<<< | |
17982 * attr_str = str(attr_str) | |
17983 * self._attr_str = attr_str | |
17984 */ | |
17985 __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_10pybedtools_9cbedtools_10Attributes_1__init__, 0, __pyx_n_s_Attributes___init, NULL, __pyx_n_s_pybedtools_cbedtools, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) | |
17986 __Pyx_GOTREF(__pyx_t_5); | |
17987 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__55); | |
17988 if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 146, __pyx_L1_error) | |
17989 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
17990 | |
17991 /* "pybedtools/cbedtools.pyx":182 | |
17992 * self[field] = value.replace('"', '') | |
17993 * | |
17994 * def __str__(self): # <<<<<<<<<<<<<< | |
17995 * # stringify all items first | |
17996 * items = [] | |
17997 */ | |
17998 __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_10pybedtools_9cbedtools_10Attributes_3__str__, 0, __pyx_n_s_Attributes___str, NULL, __pyx_n_s_pybedtools_cbedtools, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error) | |
17999 __Pyx_GOTREF(__pyx_t_5); | |
18000 if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_str, __pyx_t_5) < 0) __PYX_ERR(0, 182, __pyx_L1_error) | |
18001 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
18002 | |
18003 /* "pybedtools/cbedtools.pyx":141 | |
18004 * | |
18005 * | |
18006 * class Attributes(dict): # <<<<<<<<<<<<<< | |
18007 * """ | |
18008 * Class to map between a dict of attrs and fields[8] of a GFF Interval obj. | |
18009 */ | |
18010 __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Attributes, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error) | |
18011 __Pyx_GOTREF(__pyx_t_5); | |
18012 if (PyDict_SetItem(__pyx_d, __pyx_n_s_Attributes, __pyx_t_5) < 0) __PYX_ERR(0, 141, __pyx_L1_error) | |
18013 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; | |
18014 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | |
18015 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
18016 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
18017 | |
18018 /* "pybedtools/cbedtools.pyx":725 | |
18019 * | |
18020 * | |
18021 * def overlap(int s1, int s2, int e1, int e2): # <<<<<<<<<<<<<< | |
18022 * return min(e1, e2) - max(s1, s2) | |
18023 * | |
18024 */ | |
18025 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pybedtools_9cbedtools_3overlap, NULL, __pyx_n_s_pybedtools_cbedtools); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error) | |
18026 __Pyx_GOTREF(__pyx_t_2); | |
18027 if (PyDict_SetItem(__pyx_d, __pyx_n_s_overlap, __pyx_t_2) < 0) __PYX_ERR(0, 725, __pyx_L1_error) | |
18028 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
18029 | |
18030 /* "pybedtools/cbedtools.pyx":932 | |
18031 * | |
18032 * # search() is an alias for all_hits | |
18033 * search = all_hits # <<<<<<<<<<<<<< | |
18034 * | |
18035 * def any_hits(self, Interval interval, bool same_strand=False, float overlap=0.0): | |
18036 */ | |
18037 __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_10pybedtools_9cbedtools_IntervalFile, __pyx_n_s_all_hits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error) | |
18038 __Pyx_GOTREF(__pyx_t_2); | |
18039 if (PyDict_SetItem((PyObject *)__pyx_ptype_10pybedtools_9cbedtools_IntervalFile->tp_dict, __pyx_n_s_search, __pyx_t_2) < 0) __PYX_ERR(0, 932, __pyx_L1_error) | |
18040 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
18041 PyType_Modified(__pyx_ptype_10pybedtools_9cbedtools_IntervalFile); | |
18042 | |
18043 /* "(tree fragment)":1 | |
18044 * def __pyx_unpickle_IntervalIterator(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< | |
18045 * cdef object __pyx_PickleError | |
18046 * cdef object __pyx_result | |
18047 */ | |
18048 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pybedtools_9cbedtools_5__pyx_unpickle_IntervalIterator, NULL, __pyx_n_s_pybedtools_cbedtools); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) | |
18049 __Pyx_GOTREF(__pyx_t_2); | |
18050 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_IntervalIterator, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) | |
18051 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
18052 | |
18053 /* "pybedtools/cbedtools.pyx":1 | |
18054 * # distutils: language = c++ # <<<<<<<<<<<<<< | |
18055 * # cython: language_level=2 | |
18056 * | |
18057 */ | |
18058 __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) | |
18059 __Pyx_GOTREF(__pyx_t_2); | |
18060 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_create_interval_from_list_line_5, __pyx_kp_u_Create_an_Interval_object_from) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
18061 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_IntervalFile_all_hits_line_888, __pyx_kp_u_Signature_IntervalFile_all_hits) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
18062 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_IntervalFile_any_hits_line_934, __pyx_kp_u_Signature_IntervalFile_any_hits) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
18063 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_IntervalFile_count_hits_line_970, __pyx_kp_u_Signature_IntervalFile_count_hi) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
18064 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
18065 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
18066 | |
18067 /* "vector.from_py":45 | |
18068 * | |
18069 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") | |
18070 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< | |
18071 * cdef vector[X] v | |
18072 * for item in o: | |
18073 */ | |
18074 | |
18075 /*--- Wrapped vars code ---*/ | |
18076 | |
18077 goto __pyx_L0; | |
18078 __pyx_L1_error:; | |
18079 __Pyx_XDECREF(__pyx_t_1); | |
18080 __Pyx_XDECREF(__pyx_t_2); | |
18081 __Pyx_XDECREF(__pyx_t_4); | |
18082 __Pyx_XDECREF(__pyx_t_5); | |
18083 __Pyx_XDECREF(__pyx_t_6); | |
18084 __Pyx_XDECREF(__pyx_t_9); | |
18085 if (__pyx_m) { | |
18086 if (__pyx_d) { | |
18087 __Pyx_AddTraceback("init pybedtools.cbedtools", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
18088 } | |
18089 Py_CLEAR(__pyx_m); | |
18090 } else if (!PyErr_Occurred()) { | |
18091 PyErr_SetString(PyExc_ImportError, "init pybedtools.cbedtools"); | |
18092 } | |
18093 __pyx_L0:; | |
18094 __Pyx_RefNannyFinishContext(); | |
18095 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
18096 return (__pyx_m != NULL) ? 0 : -1; | |
18097 #elif PY_MAJOR_VERSION >= 3 | |
18098 return __pyx_m; | |
18099 #else | |
18100 return; | |
18101 #endif | |
18102 } | |
18103 | |
18104 /* --- Runtime support code --- */ | |
18105 /* Refnanny */ | |
18106 #if CYTHON_REFNANNY | |
18107 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { | |
18108 PyObject *m = NULL, *p = NULL; | |
18109 void *r = NULL; | |
18110 m = PyImport_ImportModule(modname); | |
18111 if (!m) goto end; | |
18112 p = PyObject_GetAttrString(m, "RefNannyAPI"); | |
18113 if (!p) goto end; | |
18114 r = PyLong_AsVoidPtr(p); | |
18115 end: | |
18116 Py_XDECREF(p); | |
18117 Py_XDECREF(m); | |
18118 return (__Pyx_RefNannyAPIStruct *)r; | |
18119 } | |
18120 #endif | |
18121 | |
18122 /* PyObjectGetAttrStr */ | |
18123 #if CYTHON_USE_TYPE_SLOTS | |
18124 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { | |
18125 PyTypeObject* tp = Py_TYPE(obj); | |
18126 if (likely(tp->tp_getattro)) | |
18127 return tp->tp_getattro(obj, attr_name); | |
18128 #if PY_MAJOR_VERSION < 3 | |
18129 if (likely(tp->tp_getattr)) | |
18130 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); | |
18131 #endif | |
18132 return PyObject_GetAttr(obj, attr_name); | |
18133 } | |
18134 #endif | |
18135 | |
18136 /* GetBuiltinName */ | |
18137 static PyObject *__Pyx_GetBuiltinName(PyObject *name) { | |
18138 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); | |
18139 if (unlikely(!result)) { | |
18140 PyErr_Format(PyExc_NameError, | |
18141 #if PY_MAJOR_VERSION >= 3 | |
18142 "name '%U' is not defined", name); | |
18143 #else | |
18144 "name '%.200s' is not defined", PyString_AS_STRING(name)); | |
18145 #endif | |
18146 } | |
18147 return result; | |
18148 } | |
18149 | |
18150 /* PyDictVersioning */ | |
18151 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS | |
18152 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { | |
18153 PyObject *dict = Py_TYPE(obj)->tp_dict; | |
18154 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; | |
18155 } | |
18156 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { | |
18157 PyObject **dictptr = NULL; | |
18158 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; | |
18159 if (offset) { | |
18160 #if CYTHON_COMPILING_IN_CPYTHON | |
18161 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); | |
18162 #else | |
18163 dictptr = _PyObject_GetDictPtr(obj); | |
18164 #endif | |
18165 } | |
18166 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; | |
18167 } | |
18168 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { | |
18169 PyObject *dict = Py_TYPE(obj)->tp_dict; | |
18170 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) | |
18171 return 0; | |
18172 return obj_dict_version == __Pyx_get_object_dict_version(obj); | |
18173 } | |
18174 #endif | |
18175 | |
18176 /* GetModuleGlobalName */ | |
18177 #if CYTHON_USE_DICT_VERSIONS | |
18178 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) | |
18179 #else | |
18180 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) | |
18181 #endif | |
18182 { | |
18183 PyObject *result; | |
18184 #if !CYTHON_AVOID_BORROWED_REFS | |
18185 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 | |
18186 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); | |
18187 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) | |
18188 if (likely(result)) { | |
18189 return __Pyx_NewRef(result); | |
18190 } else if (unlikely(PyErr_Occurred())) { | |
18191 return NULL; | |
18192 } | |
18193 #else | |
18194 result = PyDict_GetItem(__pyx_d, name); | |
18195 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) | |
18196 if (likely(result)) { | |
18197 return __Pyx_NewRef(result); | |
18198 } | |
18199 #endif | |
18200 #else | |
18201 result = PyObject_GetItem(__pyx_d, name); | |
18202 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) | |
18203 if (likely(result)) { | |
18204 return __Pyx_NewRef(result); | |
18205 } | |
18206 PyErr_Clear(); | |
18207 #endif | |
18208 return __Pyx_GetBuiltinName(name); | |
18209 } | |
18210 | |
18211 /* PyCFunctionFastCall */ | |
18212 #if CYTHON_FAST_PYCCALL | |
18213 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { | |
18214 PyCFunctionObject *func = (PyCFunctionObject*)func_obj; | |
18215 PyCFunction meth = PyCFunction_GET_FUNCTION(func); | |
18216 PyObject *self = PyCFunction_GET_SELF(func); | |
18217 int flags = PyCFunction_GET_FLAGS(func); | |
18218 assert(PyCFunction_Check(func)); | |
18219 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); | |
18220 assert(nargs >= 0); | |
18221 assert(nargs == 0 || args != NULL); | |
18222 /* _PyCFunction_FastCallDict() must not be called with an exception set, | |
18223 because it may clear it (directly or indirectly) and so the | |
18224 caller loses its exception */ | |
18225 assert(!PyErr_Occurred()); | |
18226 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { | |
18227 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); | |
18228 } else { | |
18229 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); | |
18230 } | |
18231 } | |
18232 #endif | |
18233 | |
18234 /* PyFunctionFastCall */ | |
18235 #if CYTHON_FAST_PYCALL | |
18236 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, | |
18237 PyObject *globals) { | |
18238 PyFrameObject *f; | |
18239 PyThreadState *tstate = __Pyx_PyThreadState_Current; | |
18240 PyObject **fastlocals; | |
18241 Py_ssize_t i; | |
18242 PyObject *result; | |
18243 assert(globals != NULL); | |
18244 /* XXX Perhaps we should create a specialized | |
18245 PyFrame_New() that doesn't take locals, but does | |
18246 take builtins without sanity checking them. | |
18247 */ | |
18248 assert(tstate != NULL); | |
18249 f = PyFrame_New(tstate, co, globals, NULL); | |
18250 if (f == NULL) { | |
18251 return NULL; | |
18252 } | |
18253 fastlocals = __Pyx_PyFrame_GetLocalsplus(f); | |
18254 for (i = 0; i < na; i++) { | |
18255 Py_INCREF(*args); | |
18256 fastlocals[i] = *args++; | |
18257 } | |
18258 result = PyEval_EvalFrameEx(f,0); | |
18259 ++tstate->recursion_depth; | |
18260 Py_DECREF(f); | |
18261 --tstate->recursion_depth; | |
18262 return result; | |
18263 } | |
18264 #if 1 || PY_VERSION_HEX < 0x030600B1 | |
18265 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { | |
18266 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); | |
18267 PyObject *globals = PyFunction_GET_GLOBALS(func); | |
18268 PyObject *argdefs = PyFunction_GET_DEFAULTS(func); | |
18269 PyObject *closure; | |
18270 #if PY_MAJOR_VERSION >= 3 | |
18271 PyObject *kwdefs; | |
18272 #endif | |
18273 PyObject *kwtuple, **k; | |
18274 PyObject **d; | |
18275 Py_ssize_t nd; | |
18276 Py_ssize_t nk; | |
18277 PyObject *result; | |
18278 assert(kwargs == NULL || PyDict_Check(kwargs)); | |
18279 nk = kwargs ? PyDict_Size(kwargs) : 0; | |
18280 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { | |
18281 return NULL; | |
18282 } | |
18283 if ( | |
18284 #if PY_MAJOR_VERSION >= 3 | |
18285 co->co_kwonlyargcount == 0 && | |
18286 #endif | |
18287 likely(kwargs == NULL || nk == 0) && | |
18288 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { | |
18289 if (argdefs == NULL && co->co_argcount == nargs) { | |
18290 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); | |
18291 goto done; | |
18292 } | |
18293 else if (nargs == 0 && argdefs != NULL | |
18294 && co->co_argcount == Py_SIZE(argdefs)) { | |
18295 /* function called with no arguments, but all parameters have | |
18296 a default value: use default values as arguments .*/ | |
18297 args = &PyTuple_GET_ITEM(argdefs, 0); | |
18298 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); | |
18299 goto done; | |
18300 } | |
18301 } | |
18302 if (kwargs != NULL) { | |
18303 Py_ssize_t pos, i; | |
18304 kwtuple = PyTuple_New(2 * nk); | |
18305 if (kwtuple == NULL) { | |
18306 result = NULL; | |
18307 goto done; | |
18308 } | |
18309 k = &PyTuple_GET_ITEM(kwtuple, 0); | |
18310 pos = i = 0; | |
18311 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { | |
18312 Py_INCREF(k[i]); | |
18313 Py_INCREF(k[i+1]); | |
18314 i += 2; | |
18315 } | |
18316 nk = i / 2; | |
18317 } | |
18318 else { | |
18319 kwtuple = NULL; | |
18320 k = NULL; | |
18321 } | |
18322 closure = PyFunction_GET_CLOSURE(func); | |
18323 #if PY_MAJOR_VERSION >= 3 | |
18324 kwdefs = PyFunction_GET_KW_DEFAULTS(func); | |
18325 #endif | |
18326 if (argdefs != NULL) { | |
18327 d = &PyTuple_GET_ITEM(argdefs, 0); | |
18328 nd = Py_SIZE(argdefs); | |
18329 } | |
18330 else { | |
18331 d = NULL; | |
18332 nd = 0; | |
18333 } | |
18334 #if PY_MAJOR_VERSION >= 3 | |
18335 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, | |
18336 args, (int)nargs, | |
18337 k, (int)nk, | |
18338 d, (int)nd, kwdefs, closure); | |
18339 #else | |
18340 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, | |
18341 args, (int)nargs, | |
18342 k, (int)nk, | |
18343 d, (int)nd, closure); | |
18344 #endif | |
18345 Py_XDECREF(kwtuple); | |
18346 done: | |
18347 Py_LeaveRecursiveCall(); | |
18348 return result; | |
18349 } | |
18350 #endif | |
18351 #endif | |
18352 | |
18353 /* PyObjectCall */ | |
18354 #if CYTHON_COMPILING_IN_CPYTHON | |
18355 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { | |
18356 PyObject *result; | |
18357 ternaryfunc call = Py_TYPE(func)->tp_call; | |
18358 if (unlikely(!call)) | |
18359 return PyObject_Call(func, arg, kw); | |
18360 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) | |
18361 return NULL; | |
18362 result = (*call)(func, arg, kw); | |
18363 Py_LeaveRecursiveCall(); | |
18364 if (unlikely(!result) && unlikely(!PyErr_Occurred())) { | |
18365 PyErr_SetString( | |
18366 PyExc_SystemError, | |
18367 "NULL result without error in PyObject_Call"); | |
18368 } | |
18369 return result; | |
18370 } | |
18371 #endif | |
18372 | |
18373 /* PyObjectCallMethO */ | |
18374 #if CYTHON_COMPILING_IN_CPYTHON | |
18375 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { | |
18376 PyObject *self, *result; | |
18377 PyCFunction cfunc; | |
18378 cfunc = PyCFunction_GET_FUNCTION(func); | |
18379 self = PyCFunction_GET_SELF(func); | |
18380 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) | |
18381 return NULL; | |
18382 result = cfunc(self, arg); | |
18383 Py_LeaveRecursiveCall(); | |
18384 if (unlikely(!result) && unlikely(!PyErr_Occurred())) { | |
18385 PyErr_SetString( | |
18386 PyExc_SystemError, | |
18387 "NULL result without error in PyObject_Call"); | |
18388 } | |
18389 return result; | |
18390 } | |
18391 #endif | |
18392 | |
18393 /* PyObjectCallOneArg */ | |
18394 #if CYTHON_COMPILING_IN_CPYTHON | |
18395 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { | |
18396 PyObject *result; | |
18397 PyObject *args = PyTuple_New(1); | |
18398 if (unlikely(!args)) return NULL; | |
18399 Py_INCREF(arg); | |
18400 PyTuple_SET_ITEM(args, 0, arg); | |
18401 result = __Pyx_PyObject_Call(func, args, NULL); | |
18402 Py_DECREF(args); | |
18403 return result; | |
18404 } | |
18405 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { | |
18406 #if CYTHON_FAST_PYCALL | |
18407 if (PyFunction_Check(func)) { | |
18408 return __Pyx_PyFunction_FastCall(func, &arg, 1); | |
18409 } | |
18410 #endif | |
18411 if (likely(PyCFunction_Check(func))) { | |
18412 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { | |
18413 return __Pyx_PyObject_CallMethO(func, arg); | |
18414 #if CYTHON_FAST_PYCCALL | |
18415 } else if (__Pyx_PyFastCFunction_Check(func)) { | |
18416 return __Pyx_PyCFunction_FastCall(func, &arg, 1); | |
18417 #endif | |
18418 } | |
18419 } | |
18420 return __Pyx__PyObject_CallOneArg(func, arg); | |
18421 } | |
18422 #else | |
18423 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { | |
18424 PyObject *result; | |
18425 PyObject *args = PyTuple_Pack(1, arg); | |
18426 if (unlikely(!args)) return NULL; | |
18427 result = __Pyx_PyObject_Call(func, args, NULL); | |
18428 Py_DECREF(args); | |
18429 return result; | |
18430 } | |
18431 #endif | |
18432 | |
18433 /* PyObjectCall2Args */ | |
18434 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { | |
18435 PyObject *args, *result = NULL; | |
18436 #if CYTHON_FAST_PYCALL | |
18437 if (PyFunction_Check(function)) { | |
18438 PyObject *args[2] = {arg1, arg2}; | |
18439 return __Pyx_PyFunction_FastCall(function, args, 2); | |
18440 } | |
18441 #endif | |
18442 #if CYTHON_FAST_PYCCALL | |
18443 if (__Pyx_PyFastCFunction_Check(function)) { | |
18444 PyObject *args[2] = {arg1, arg2}; | |
18445 return __Pyx_PyCFunction_FastCall(function, args, 2); | |
18446 } | |
18447 #endif | |
18448 args = PyTuple_New(2); | |
18449 if (unlikely(!args)) goto done; | |
18450 Py_INCREF(arg1); | |
18451 PyTuple_SET_ITEM(args, 0, arg1); | |
18452 Py_INCREF(arg2); | |
18453 PyTuple_SET_ITEM(args, 1, arg2); | |
18454 Py_INCREF(function); | |
18455 result = __Pyx_PyObject_Call(function, args, NULL); | |
18456 Py_DECREF(args); | |
18457 Py_DECREF(function); | |
18458 done: | |
18459 return result; | |
18460 } | |
18461 | |
18462 /* decode_c_bytes */ | |
18463 static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( | |
18464 const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, | |
18465 const char* encoding, const char* errors, | |
18466 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { | |
18467 if (unlikely((start < 0) | (stop < 0))) { | |
18468 if (start < 0) { | |
18469 start += length; | |
18470 if (start < 0) | |
18471 start = 0; | |
18472 } | |
18473 if (stop < 0) | |
18474 stop += length; | |
18475 } | |
18476 if (stop > length) | |
18477 stop = length; | |
18478 if (unlikely(stop <= start)) | |
18479 return __Pyx_NewRef(__pyx_empty_unicode); | |
18480 length = stop - start; | |
18481 cstring += start; | |
18482 if (decode_func) { | |
18483 return decode_func(cstring, length, errors); | |
18484 } else { | |
18485 return PyUnicode_Decode(cstring, length, encoding, errors); | |
18486 } | |
18487 } | |
18488 | |
18489 /* RaiseDoubleKeywords */ | |
18490 static void __Pyx_RaiseDoubleKeywordsError( | |
18491 const char* func_name, | |
18492 PyObject* kw_name) | |
18493 { | |
18494 PyErr_Format(PyExc_TypeError, | |
18495 #if PY_MAJOR_VERSION >= 3 | |
18496 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); | |
18497 #else | |
18498 "%s() got multiple values for keyword argument '%s'", func_name, | |
18499 PyString_AsString(kw_name)); | |
18500 #endif | |
18501 } | |
18502 | |
18503 /* ParseKeywords */ | |
18504 static int __Pyx_ParseOptionalKeywords( | |
18505 PyObject *kwds, | |
18506 PyObject **argnames[], | |
18507 PyObject *kwds2, | |
18508 PyObject *values[], | |
18509 Py_ssize_t num_pos_args, | |
18510 const char* function_name) | |
18511 { | |
18512 PyObject *key = 0, *value = 0; | |
18513 Py_ssize_t pos = 0; | |
18514 PyObject*** name; | |
18515 PyObject*** first_kw_arg = argnames + num_pos_args; | |
18516 while (PyDict_Next(kwds, &pos, &key, &value)) { | |
18517 name = first_kw_arg; | |
18518 while (*name && (**name != key)) name++; | |
18519 if (*name) { | |
18520 values[name-argnames] = value; | |
18521 continue; | |
18522 } | |
18523 name = first_kw_arg; | |
18524 #if PY_MAJOR_VERSION < 3 | |
18525 if (likely(PyString_Check(key))) { | |
18526 while (*name) { | |
18527 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) | |
18528 && _PyString_Eq(**name, key)) { | |
18529 values[name-argnames] = value; | |
18530 break; | |
18531 } | |
18532 name++; | |
18533 } | |
18534 if (*name) continue; | |
18535 else { | |
18536 PyObject*** argname = argnames; | |
18537 while (argname != first_kw_arg) { | |
18538 if ((**argname == key) || ( | |
18539 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) | |
18540 && _PyString_Eq(**argname, key))) { | |
18541 goto arg_passed_twice; | |
18542 } | |
18543 argname++; | |
18544 } | |
18545 } | |
18546 } else | |
18547 #endif | |
18548 if (likely(PyUnicode_Check(key))) { | |
18549 while (*name) { | |
18550 int cmp = (**name == key) ? 0 : | |
18551 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 | |
18552 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : | |
18553 #endif | |
18554 PyUnicode_Compare(**name, key); | |
18555 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; | |
18556 if (cmp == 0) { | |
18557 values[name-argnames] = value; | |
18558 break; | |
18559 } | |
18560 name++; | |
18561 } | |
18562 if (*name) continue; | |
18563 else { | |
18564 PyObject*** argname = argnames; | |
18565 while (argname != first_kw_arg) { | |
18566 int cmp = (**argname == key) ? 0 : | |
18567 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 | |
18568 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : | |
18569 #endif | |
18570 PyUnicode_Compare(**argname, key); | |
18571 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; | |
18572 if (cmp == 0) goto arg_passed_twice; | |
18573 argname++; | |
18574 } | |
18575 } | |
18576 } else | |
18577 goto invalid_keyword_type; | |
18578 if (kwds2) { | |
18579 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; | |
18580 } else { | |
18581 goto invalid_keyword; | |
18582 } | |
18583 } | |
18584 return 0; | |
18585 arg_passed_twice: | |
18586 __Pyx_RaiseDoubleKeywordsError(function_name, key); | |
18587 goto bad; | |
18588 invalid_keyword_type: | |
18589 PyErr_Format(PyExc_TypeError, | |
18590 "%.200s() keywords must be strings", function_name); | |
18591 goto bad; | |
18592 invalid_keyword: | |
18593 PyErr_Format(PyExc_TypeError, | |
18594 #if PY_MAJOR_VERSION < 3 | |
18595 "%.200s() got an unexpected keyword argument '%.200s'", | |
18596 function_name, PyString_AsString(key)); | |
18597 #else | |
18598 "%s() got an unexpected keyword argument '%U'", | |
18599 function_name, key); | |
18600 #endif | |
18601 bad: | |
18602 return -1; | |
18603 } | |
18604 | |
18605 /* RaiseArgTupleInvalid */ | |
18606 static void __Pyx_RaiseArgtupleInvalid( | |
18607 const char* func_name, | |
18608 int exact, | |
18609 Py_ssize_t num_min, | |
18610 Py_ssize_t num_max, | |
18611 Py_ssize_t num_found) | |
18612 { | |
18613 Py_ssize_t num_expected; | |
18614 const char *more_or_less; | |
18615 if (num_found < num_min) { | |
18616 num_expected = num_min; | |
18617 more_or_less = "at least"; | |
18618 } else { | |
18619 num_expected = num_max; | |
18620 more_or_less = "at most"; | |
18621 } | |
18622 if (exact) { | |
18623 more_or_less = "exactly"; | |
18624 } | |
18625 PyErr_Format(PyExc_TypeError, | |
18626 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
18627 func_name, more_or_less, num_expected, | |
18628 (num_expected == 1) ? "" : "s", num_found); | |
18629 } | |
18630 | |
18631 /* PyObjectSetAttrStr */ | |
18632 #if CYTHON_USE_TYPE_SLOTS | |
18633 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { | |
18634 PyTypeObject* tp = Py_TYPE(obj); | |
18635 if (likely(tp->tp_setattro)) | |
18636 return tp->tp_setattro(obj, attr_name, value); | |
18637 #if PY_MAJOR_VERSION < 3 | |
18638 if (likely(tp->tp_setattr)) | |
18639 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); | |
18640 #endif | |
18641 return PyObject_SetAttr(obj, attr_name, value); | |
18642 } | |
18643 #endif | |
18644 | |
18645 /* PyIntBinop */ | |
18646 #if !CYTHON_COMPILING_IN_PYPY | |
18647 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { | |
18648 (void)inplace; | |
18649 (void)zerodivision_check; | |
18650 #if PY_MAJOR_VERSION < 3 | |
18651 if (likely(PyInt_CheckExact(op1))) { | |
18652 const long b = intval; | |
18653 long x; | |
18654 long a = PyInt_AS_LONG(op1); | |
18655 x = (long)((unsigned long)a - b); | |
18656 if (likely((x^a) >= 0 || (x^~b) >= 0)) | |
18657 return PyInt_FromLong(x); | |
18658 return PyLong_Type.tp_as_number->nb_subtract(op1, op2); | |
18659 } | |
18660 #endif | |
18661 #if CYTHON_USE_PYLONG_INTERNALS | |
18662 if (likely(PyLong_CheckExact(op1))) { | |
18663 const long b = intval; | |
18664 long a, x; | |
18665 #ifdef HAVE_LONG_LONG | |
18666 const PY_LONG_LONG llb = intval; | |
18667 PY_LONG_LONG lla, llx; | |
18668 #endif | |
18669 const digit* digits = ((PyLongObject*)op1)->ob_digit; | |
18670 const Py_ssize_t size = Py_SIZE(op1); | |
18671 if (likely(__Pyx_sst_abs(size) <= 1)) { | |
18672 a = likely(size) ? digits[0] : 0; | |
18673 if (size == -1) a = -a; | |
18674 } else { | |
18675 switch (size) { | |
18676 case -2: | |
18677 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
18678 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
18679 break; | |
18680 #ifdef HAVE_LONG_LONG | |
18681 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { | |
18682 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
18683 goto long_long; | |
18684 #endif | |
18685 } | |
18686 CYTHON_FALLTHROUGH; | |
18687 case 2: | |
18688 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
18689 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
18690 break; | |
18691 #ifdef HAVE_LONG_LONG | |
18692 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { | |
18693 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
18694 goto long_long; | |
18695 #endif | |
18696 } | |
18697 CYTHON_FALLTHROUGH; | |
18698 case -3: | |
18699 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
18700 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
18701 break; | |
18702 #ifdef HAVE_LONG_LONG | |
18703 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { | |
18704 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
18705 goto long_long; | |
18706 #endif | |
18707 } | |
18708 CYTHON_FALLTHROUGH; | |
18709 case 3: | |
18710 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
18711 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
18712 break; | |
18713 #ifdef HAVE_LONG_LONG | |
18714 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { | |
18715 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
18716 goto long_long; | |
18717 #endif | |
18718 } | |
18719 CYTHON_FALLTHROUGH; | |
18720 case -4: | |
18721 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
18722 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
18723 break; | |
18724 #ifdef HAVE_LONG_LONG | |
18725 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { | |
18726 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
18727 goto long_long; | |
18728 #endif | |
18729 } | |
18730 CYTHON_FALLTHROUGH; | |
18731 case 4: | |
18732 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
18733 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
18734 break; | |
18735 #ifdef HAVE_LONG_LONG | |
18736 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { | |
18737 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
18738 goto long_long; | |
18739 #endif | |
18740 } | |
18741 CYTHON_FALLTHROUGH; | |
18742 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); | |
18743 } | |
18744 } | |
18745 x = a - b; | |
18746 return PyLong_FromLong(x); | |
18747 #ifdef HAVE_LONG_LONG | |
18748 long_long: | |
18749 llx = lla - llb; | |
18750 return PyLong_FromLongLong(llx); | |
18751 #endif | |
18752 | |
18753 | |
18754 } | |
18755 #endif | |
18756 if (PyFloat_CheckExact(op1)) { | |
18757 const long b = intval; | |
18758 double a = PyFloat_AS_DOUBLE(op1); | |
18759 double result; | |
18760 PyFPE_START_PROTECT("subtract", return NULL) | |
18761 result = ((double)a) - (double)b; | |
18762 PyFPE_END_PROTECT(result) | |
18763 return PyFloat_FromDouble(result); | |
18764 } | |
18765 return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); | |
18766 } | |
18767 #endif | |
18768 | |
18769 /* BytesEquals */ | |
18770 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { | |
18771 #if CYTHON_COMPILING_IN_PYPY | |
18772 return PyObject_RichCompareBool(s1, s2, equals); | |
18773 #else | |
18774 if (s1 == s2) { | |
18775 return (equals == Py_EQ); | |
18776 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { | |
18777 const char *ps1, *ps2; | |
18778 Py_ssize_t length = PyBytes_GET_SIZE(s1); | |
18779 if (length != PyBytes_GET_SIZE(s2)) | |
18780 return (equals == Py_NE); | |
18781 ps1 = PyBytes_AS_STRING(s1); | |
18782 ps2 = PyBytes_AS_STRING(s2); | |
18783 if (ps1[0] != ps2[0]) { | |
18784 return (equals == Py_NE); | |
18785 } else if (length == 1) { | |
18786 return (equals == Py_EQ); | |
18787 } else { | |
18788 int result; | |
18789 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) | |
18790 Py_hash_t hash1, hash2; | |
18791 hash1 = ((PyBytesObject*)s1)->ob_shash; | |
18792 hash2 = ((PyBytesObject*)s2)->ob_shash; | |
18793 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { | |
18794 return (equals == Py_NE); | |
18795 } | |
18796 #endif | |
18797 result = memcmp(ps1, ps2, (size_t)length); | |
18798 return (equals == Py_EQ) ? (result == 0) : (result != 0); | |
18799 } | |
18800 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { | |
18801 return (equals == Py_NE); | |
18802 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { | |
18803 return (equals == Py_NE); | |
18804 } else { | |
18805 int result; | |
18806 PyObject* py_result = PyObject_RichCompare(s1, s2, equals); | |
18807 if (!py_result) | |
18808 return -1; | |
18809 result = __Pyx_PyObject_IsTrue(py_result); | |
18810 Py_DECREF(py_result); | |
18811 return result; | |
18812 } | |
18813 #endif | |
18814 } | |
18815 | |
18816 /* UnicodeEquals */ | |
18817 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { | |
18818 #if CYTHON_COMPILING_IN_PYPY | |
18819 return PyObject_RichCompareBool(s1, s2, equals); | |
18820 #else | |
18821 #if PY_MAJOR_VERSION < 3 | |
18822 PyObject* owned_ref = NULL; | |
18823 #endif | |
18824 int s1_is_unicode, s2_is_unicode; | |
18825 if (s1 == s2) { | |
18826 goto return_eq; | |
18827 } | |
18828 s1_is_unicode = PyUnicode_CheckExact(s1); | |
18829 s2_is_unicode = PyUnicode_CheckExact(s2); | |
18830 #if PY_MAJOR_VERSION < 3 | |
18831 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { | |
18832 owned_ref = PyUnicode_FromObject(s2); | |
18833 if (unlikely(!owned_ref)) | |
18834 return -1; | |
18835 s2 = owned_ref; | |
18836 s2_is_unicode = 1; | |
18837 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { | |
18838 owned_ref = PyUnicode_FromObject(s1); | |
18839 if (unlikely(!owned_ref)) | |
18840 return -1; | |
18841 s1 = owned_ref; | |
18842 s1_is_unicode = 1; | |
18843 } else if (((!s2_is_unicode) & (!s1_is_unicode))) { | |
18844 return __Pyx_PyBytes_Equals(s1, s2, equals); | |
18845 } | |
18846 #endif | |
18847 if (s1_is_unicode & s2_is_unicode) { | |
18848 Py_ssize_t length; | |
18849 int kind; | |
18850 void *data1, *data2; | |
18851 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) | |
18852 return -1; | |
18853 length = __Pyx_PyUnicode_GET_LENGTH(s1); | |
18854 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { | |
18855 goto return_ne; | |
18856 } | |
18857 #if CYTHON_USE_UNICODE_INTERNALS | |
18858 { | |
18859 Py_hash_t hash1, hash2; | |
18860 #if CYTHON_PEP393_ENABLED | |
18861 hash1 = ((PyASCIIObject*)s1)->hash; | |
18862 hash2 = ((PyASCIIObject*)s2)->hash; | |
18863 #else | |
18864 hash1 = ((PyUnicodeObject*)s1)->hash; | |
18865 hash2 = ((PyUnicodeObject*)s2)->hash; | |
18866 #endif | |
18867 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { | |
18868 goto return_ne; | |
18869 } | |
18870 } | |
18871 #endif | |
18872 kind = __Pyx_PyUnicode_KIND(s1); | |
18873 if (kind != __Pyx_PyUnicode_KIND(s2)) { | |
18874 goto return_ne; | |
18875 } | |
18876 data1 = __Pyx_PyUnicode_DATA(s1); | |
18877 data2 = __Pyx_PyUnicode_DATA(s2); | |
18878 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { | |
18879 goto return_ne; | |
18880 } else if (length == 1) { | |
18881 goto return_eq; | |
18882 } else { | |
18883 int result = memcmp(data1, data2, (size_t)(length * kind)); | |
18884 #if PY_MAJOR_VERSION < 3 | |
18885 Py_XDECREF(owned_ref); | |
18886 #endif | |
18887 return (equals == Py_EQ) ? (result == 0) : (result != 0); | |
18888 } | |
18889 } else if ((s1 == Py_None) & s2_is_unicode) { | |
18890 goto return_ne; | |
18891 } else if ((s2 == Py_None) & s1_is_unicode) { | |
18892 goto return_ne; | |
18893 } else { | |
18894 int result; | |
18895 PyObject* py_result = PyObject_RichCompare(s1, s2, equals); | |
18896 #if PY_MAJOR_VERSION < 3 | |
18897 Py_XDECREF(owned_ref); | |
18898 #endif | |
18899 if (!py_result) | |
18900 return -1; | |
18901 result = __Pyx_PyObject_IsTrue(py_result); | |
18902 Py_DECREF(py_result); | |
18903 return result; | |
18904 } | |
18905 return_eq: | |
18906 #if PY_MAJOR_VERSION < 3 | |
18907 Py_XDECREF(owned_ref); | |
18908 #endif | |
18909 return (equals == Py_EQ); | |
18910 return_ne: | |
18911 #if PY_MAJOR_VERSION < 3 | |
18912 Py_XDECREF(owned_ref); | |
18913 #endif | |
18914 return (equals == Py_NE); | |
18915 #endif | |
18916 } | |
18917 | |
18918 /* PyObjectCallNoArg */ | |
18919 #if CYTHON_COMPILING_IN_CPYTHON | |
18920 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { | |
18921 #if CYTHON_FAST_PYCALL | |
18922 if (PyFunction_Check(func)) { | |
18923 return __Pyx_PyFunction_FastCall(func, NULL, 0); | |
18924 } | |
18925 #endif | |
18926 #if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) | |
18927 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) | |
18928 #else | |
18929 if (likely(PyCFunction_Check(func))) | |
18930 #endif | |
18931 { | |
18932 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { | |
18933 return __Pyx_PyObject_CallMethO(func, NULL); | |
18934 } | |
18935 } | |
18936 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); | |
18937 } | |
18938 #endif | |
18939 | |
18940 /* RaiseTooManyValuesToUnpack */ | |
18941 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { | |
18942 PyErr_Format(PyExc_ValueError, | |
18943 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); | |
18944 } | |
18945 | |
18946 /* RaiseNeedMoreValuesToUnpack */ | |
18947 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { | |
18948 PyErr_Format(PyExc_ValueError, | |
18949 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", | |
18950 index, (index == 1) ? "" : "s"); | |
18951 } | |
18952 | |
18953 /* IterFinish */ | |
18954 static CYTHON_INLINE int __Pyx_IterFinish(void) { | |
18955 #if CYTHON_FAST_THREAD_STATE | |
18956 PyThreadState *tstate = __Pyx_PyThreadState_Current; | |
18957 PyObject* exc_type = tstate->curexc_type; | |
18958 if (unlikely(exc_type)) { | |
18959 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { | |
18960 PyObject *exc_value, *exc_tb; | |
18961 exc_value = tstate->curexc_value; | |
18962 exc_tb = tstate->curexc_traceback; | |
18963 tstate->curexc_type = 0; | |
18964 tstate->curexc_value = 0; | |
18965 tstate->curexc_traceback = 0; | |
18966 Py_DECREF(exc_type); | |
18967 Py_XDECREF(exc_value); | |
18968 Py_XDECREF(exc_tb); | |
18969 return 0; | |
18970 } else { | |
18971 return -1; | |
18972 } | |
18973 } | |
18974 return 0; | |
18975 #else | |
18976 if (unlikely(PyErr_Occurred())) { | |
18977 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { | |
18978 PyErr_Clear(); | |
18979 return 0; | |
18980 } else { | |
18981 return -1; | |
18982 } | |
18983 } | |
18984 return 0; | |
18985 #endif | |
18986 } | |
18987 | |
18988 /* UnpackItemEndCheck */ | |
18989 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { | |
18990 if (unlikely(retval)) { | |
18991 Py_DECREF(retval); | |
18992 __Pyx_RaiseTooManyValuesError(expected); | |
18993 return -1; | |
18994 } | |
18995 return __Pyx_IterFinish(); | |
18996 } | |
18997 | |
18998 /* PyIntCompare */ | |
18999 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { | |
19000 if (op1 == op2) { | |
19001 Py_RETURN_TRUE; | |
19002 } | |
19003 #if PY_MAJOR_VERSION < 3 | |
19004 if (likely(PyInt_CheckExact(op1))) { | |
19005 const long b = intval; | |
19006 long a = PyInt_AS_LONG(op1); | |
19007 if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE; | |
19008 } | |
19009 #endif | |
19010 #if CYTHON_USE_PYLONG_INTERNALS | |
19011 if (likely(PyLong_CheckExact(op1))) { | |
19012 int unequal; | |
19013 unsigned long uintval; | |
19014 Py_ssize_t size = Py_SIZE(op1); | |
19015 const digit* digits = ((PyLongObject*)op1)->ob_digit; | |
19016 if (intval == 0) { | |
19017 if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; | |
19018 } else if (intval < 0) { | |
19019 if (size >= 0) | |
19020 Py_RETURN_FALSE; | |
19021 intval = -intval; | |
19022 size = -size; | |
19023 } else { | |
19024 if (size <= 0) | |
19025 Py_RETURN_FALSE; | |
19026 } | |
19027 uintval = (unsigned long) intval; | |
19028 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8 | |
19029 if (uintval >> (PyLong_SHIFT * 4)) { | |
19030 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | |
19031 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); | |
19032 } else | |
19033 #endif | |
19034 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8 | |
19035 if (uintval >> (PyLong_SHIFT * 3)) { | |
19036 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | |
19037 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); | |
19038 } else | |
19039 #endif | |
19040 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8 | |
19041 if (uintval >> (PyLong_SHIFT * 2)) { | |
19042 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | |
19043 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); | |
19044 } else | |
19045 #endif | |
19046 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8 | |
19047 if (uintval >> (PyLong_SHIFT * 1)) { | |
19048 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | |
19049 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); | |
19050 } else | |
19051 #endif | |
19052 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); | |
19053 if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; | |
19054 } | |
19055 #endif | |
19056 if (PyFloat_CheckExact(op1)) { | |
19057 const long b = intval; | |
19058 double a = PyFloat_AS_DOUBLE(op1); | |
19059 if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; | |
19060 } | |
19061 return ( | |
19062 PyObject_RichCompare(op1, op2, Py_EQ)); | |
19063 } | |
19064 | |
19065 /* UnpackUnboundCMethod */ | |
19066 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { | |
19067 PyObject *method; | |
19068 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); | |
19069 if (unlikely(!method)) | |
19070 return -1; | |
19071 target->method = method; | |
19072 #if CYTHON_COMPILING_IN_CPYTHON | |
19073 #if PY_MAJOR_VERSION >= 3 | |
19074 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) | |
19075 #endif | |
19076 { | |
19077 PyMethodDescrObject *descr = (PyMethodDescrObject*) method; | |
19078 target->func = descr->d_method->ml_meth; | |
19079 target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); | |
19080 } | |
19081 #endif | |
19082 return 0; | |
19083 } | |
19084 | |
19085 /* CallUnboundCMethod0 */ | |
19086 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { | |
19087 PyObject *args, *result = NULL; | |
19088 if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; | |
19089 #if CYTHON_ASSUME_SAFE_MACROS | |
19090 args = PyTuple_New(1); | |
19091 if (unlikely(!args)) goto bad; | |
19092 Py_INCREF(self); | |
19093 PyTuple_SET_ITEM(args, 0, self); | |
19094 #else | |
19095 args = PyTuple_Pack(1, self); | |
19096 if (unlikely(!args)) goto bad; | |
19097 #endif | |
19098 result = __Pyx_PyObject_Call(cfunc->method, args, NULL); | |
19099 Py_DECREF(args); | |
19100 bad: | |
19101 return result; | |
19102 } | |
19103 | |
19104 /* py_dict_iteritems */ | |
19105 static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d) { | |
19106 if (PY_MAJOR_VERSION >= 3) | |
19107 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d); | |
19108 else | |
19109 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_iteritems, d); | |
19110 } | |
19111 | |
19112 /* GetItemInt */ | |
19113 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { | |
19114 PyObject *r; | |
19115 if (!j) return NULL; | |
19116 r = PyObject_GetItem(o, j); | |
19117 Py_DECREF(j); | |
19118 return r; | |
19119 } | |
19120 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, | |
19121 CYTHON_NCP_UNUSED int wraparound, | |
19122 CYTHON_NCP_UNUSED int boundscheck) { | |
19123 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
19124 Py_ssize_t wrapped_i = i; | |
19125 if (wraparound & unlikely(i < 0)) { | |
19126 wrapped_i += PyList_GET_SIZE(o); | |
19127 } | |
19128 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { | |
19129 PyObject *r = PyList_GET_ITEM(o, wrapped_i); | |
19130 Py_INCREF(r); | |
19131 return r; | |
19132 } | |
19133 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); | |
19134 #else | |
19135 return PySequence_GetItem(o, i); | |
19136 #endif | |
19137 } | |
19138 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, | |
19139 CYTHON_NCP_UNUSED int wraparound, | |
19140 CYTHON_NCP_UNUSED int boundscheck) { | |
19141 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
19142 Py_ssize_t wrapped_i = i; | |
19143 if (wraparound & unlikely(i < 0)) { | |
19144 wrapped_i += PyTuple_GET_SIZE(o); | |
19145 } | |
19146 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { | |
19147 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); | |
19148 Py_INCREF(r); | |
19149 return r; | |
19150 } | |
19151 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); | |
19152 #else | |
19153 return PySequence_GetItem(o, i); | |
19154 #endif | |
19155 } | |
19156 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, | |
19157 CYTHON_NCP_UNUSED int wraparound, | |
19158 CYTHON_NCP_UNUSED int boundscheck) { | |
19159 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS | |
19160 if (is_list || PyList_CheckExact(o)) { | |
19161 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); | |
19162 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { | |
19163 PyObject *r = PyList_GET_ITEM(o, n); | |
19164 Py_INCREF(r); | |
19165 return r; | |
19166 } | |
19167 } | |
19168 else if (PyTuple_CheckExact(o)) { | |
19169 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); | |
19170 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { | |
19171 PyObject *r = PyTuple_GET_ITEM(o, n); | |
19172 Py_INCREF(r); | |
19173 return r; | |
19174 } | |
19175 } else { | |
19176 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; | |
19177 if (likely(m && m->sq_item)) { | |
19178 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { | |
19179 Py_ssize_t l = m->sq_length(o); | |
19180 if (likely(l >= 0)) { | |
19181 i += l; | |
19182 } else { | |
19183 if (!PyErr_ExceptionMatches(PyExc_OverflowError)) | |
19184 return NULL; | |
19185 PyErr_Clear(); | |
19186 } | |
19187 } | |
19188 return m->sq_item(o, i); | |
19189 } | |
19190 } | |
19191 #else | |
19192 if (is_list || PySequence_Check(o)) { | |
19193 return PySequence_GetItem(o, i); | |
19194 } | |
19195 #endif | |
19196 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); | |
19197 } | |
19198 | |
19199 /* ObjectGetItem */ | |
19200 #if CYTHON_USE_TYPE_SLOTS | |
19201 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { | |
19202 PyObject *runerr = NULL; | |
19203 Py_ssize_t key_value; | |
19204 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; | |
19205 if (unlikely(!(m && m->sq_item))) { | |
19206 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); | |
19207 return NULL; | |
19208 } | |
19209 key_value = __Pyx_PyIndex_AsSsize_t(index); | |
19210 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { | |
19211 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); | |
19212 } | |
19213 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { | |
19214 PyErr_Clear(); | |
19215 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); | |
19216 } | |
19217 return NULL; | |
19218 } | |
19219 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { | |
19220 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; | |
19221 if (likely(m && m->mp_subscript)) { | |
19222 return m->mp_subscript(obj, key); | |
19223 } | |
19224 return __Pyx_PyObject_GetIndex(obj, key); | |
19225 } | |
19226 #endif | |
19227 | |
19228 /* GetTopmostException */ | |
19229 #if CYTHON_USE_EXC_INFO_STACK | |
19230 static _PyErr_StackItem * | |
19231 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) | |
19232 { | |
19233 _PyErr_StackItem *exc_info = tstate->exc_info; | |
19234 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && | |
19235 exc_info->previous_item != NULL) | |
19236 { | |
19237 exc_info = exc_info->previous_item; | |
19238 } | |
19239 return exc_info; | |
19240 } | |
19241 #endif | |
19242 | |
19243 /* SaveResetException */ | |
19244 #if CYTHON_FAST_THREAD_STATE | |
19245 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { | |
19246 #if CYTHON_USE_EXC_INFO_STACK | |
19247 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); | |
19248 *type = exc_info->exc_type; | |
19249 *value = exc_info->exc_value; | |
19250 *tb = exc_info->exc_traceback; | |
19251 #else | |
19252 *type = tstate->exc_type; | |
19253 *value = tstate->exc_value; | |
19254 *tb = tstate->exc_traceback; | |
19255 #endif | |
19256 Py_XINCREF(*type); | |
19257 Py_XINCREF(*value); | |
19258 Py_XINCREF(*tb); | |
19259 } | |
19260 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { | |
19261 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
19262 #if CYTHON_USE_EXC_INFO_STACK | |
19263 _PyErr_StackItem *exc_info = tstate->exc_info; | |
19264 tmp_type = exc_info->exc_type; | |
19265 tmp_value = exc_info->exc_value; | |
19266 tmp_tb = exc_info->exc_traceback; | |
19267 exc_info->exc_type = type; | |
19268 exc_info->exc_value = value; | |
19269 exc_info->exc_traceback = tb; | |
19270 #else | |
19271 tmp_type = tstate->exc_type; | |
19272 tmp_value = tstate->exc_value; | |
19273 tmp_tb = tstate->exc_traceback; | |
19274 tstate->exc_type = type; | |
19275 tstate->exc_value = value; | |
19276 tstate->exc_traceback = tb; | |
19277 #endif | |
19278 Py_XDECREF(tmp_type); | |
19279 Py_XDECREF(tmp_value); | |
19280 Py_XDECREF(tmp_tb); | |
19281 } | |
19282 #endif | |
19283 | |
19284 /* PyErrExceptionMatches */ | |
19285 #if CYTHON_FAST_THREAD_STATE | |
19286 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { | |
19287 Py_ssize_t i, n; | |
19288 n = PyTuple_GET_SIZE(tuple); | |
19289 #if PY_MAJOR_VERSION >= 3 | |
19290 for (i=0; i<n; i++) { | |
19291 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; | |
19292 } | |
19293 #endif | |
19294 for (i=0; i<n; i++) { | |
19295 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; | |
19296 } | |
19297 return 0; | |
19298 } | |
19299 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { | |
19300 PyObject *exc_type = tstate->curexc_type; | |
19301 if (exc_type == err) return 1; | |
19302 if (unlikely(!exc_type)) return 0; | |
19303 if (unlikely(PyTuple_Check(err))) | |
19304 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); | |
19305 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); | |
19306 } | |
19307 #endif | |
19308 | |
19309 /* PyErrFetchRestore */ | |
19310 #if CYTHON_FAST_THREAD_STATE | |
19311 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { | |
19312 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
19313 tmp_type = tstate->curexc_type; | |
19314 tmp_value = tstate->curexc_value; | |
19315 tmp_tb = tstate->curexc_traceback; | |
19316 tstate->curexc_type = type; | |
19317 tstate->curexc_value = value; | |
19318 tstate->curexc_traceback = tb; | |
19319 Py_XDECREF(tmp_type); | |
19320 Py_XDECREF(tmp_value); | |
19321 Py_XDECREF(tmp_tb); | |
19322 } | |
19323 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { | |
19324 *type = tstate->curexc_type; | |
19325 *value = tstate->curexc_value; | |
19326 *tb = tstate->curexc_traceback; | |
19327 tstate->curexc_type = 0; | |
19328 tstate->curexc_value = 0; | |
19329 tstate->curexc_traceback = 0; | |
19330 } | |
19331 #endif | |
19332 | |
19333 /* StringJoin */ | |
19334 #if !CYTHON_COMPILING_IN_CPYTHON | |
19335 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { | |
19336 return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); | |
19337 } | |
19338 #endif | |
19339 | |
19340 /* DictGetItem */ | |
19341 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY | |
19342 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { | |
19343 PyObject *value; | |
19344 value = PyDict_GetItemWithError(d, key); | |
19345 if (unlikely(!value)) { | |
19346 if (!PyErr_Occurred()) { | |
19347 if (unlikely(PyTuple_Check(key))) { | |
19348 PyObject* args = PyTuple_Pack(1, key); | |
19349 if (likely(args)) { | |
19350 PyErr_SetObject(PyExc_KeyError, args); | |
19351 Py_DECREF(args); | |
19352 } | |
19353 } else { | |
19354 PyErr_SetObject(PyExc_KeyError, key); | |
19355 } | |
19356 } | |
19357 return NULL; | |
19358 } | |
19359 Py_INCREF(value); | |
19360 return value; | |
19361 } | |
19362 #endif | |
19363 | |
19364 /* FetchCommonType */ | |
19365 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { | |
19366 PyObject* fake_module; | |
19367 PyTypeObject* cached_type = NULL; | |
19368 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); | |
19369 if (!fake_module) return NULL; | |
19370 Py_INCREF(fake_module); | |
19371 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); | |
19372 if (cached_type) { | |
19373 if (!PyType_Check((PyObject*)cached_type)) { | |
19374 PyErr_Format(PyExc_TypeError, | |
19375 "Shared Cython type %.200s is not a type object", | |
19376 type->tp_name); | |
19377 goto bad; | |
19378 } | |
19379 if (cached_type->tp_basicsize != type->tp_basicsize) { | |
19380 PyErr_Format(PyExc_TypeError, | |
19381 "Shared Cython type %.200s has the wrong size, try recompiling", | |
19382 type->tp_name); | |
19383 goto bad; | |
19384 } | |
19385 } else { | |
19386 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; | |
19387 PyErr_Clear(); | |
19388 if (PyType_Ready(type) < 0) goto bad; | |
19389 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) | |
19390 goto bad; | |
19391 Py_INCREF(type); | |
19392 cached_type = type; | |
19393 } | |
19394 done: | |
19395 Py_DECREF(fake_module); | |
19396 return cached_type; | |
19397 bad: | |
19398 Py_XDECREF(cached_type); | |
19399 cached_type = NULL; | |
19400 goto done; | |
19401 } | |
19402 | |
19403 /* CythonFunctionShared */ | |
19404 #include <structmember.h> | |
19405 static PyObject * | |
19406 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) | |
19407 { | |
19408 if (unlikely(op->func_doc == NULL)) { | |
19409 if (op->func.m_ml->ml_doc) { | |
19410 #if PY_MAJOR_VERSION >= 3 | |
19411 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); | |
19412 #else | |
19413 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); | |
19414 #endif | |
19415 if (unlikely(op->func_doc == NULL)) | |
19416 return NULL; | |
19417 } else { | |
19418 Py_INCREF(Py_None); | |
19419 return Py_None; | |
19420 } | |
19421 } | |
19422 Py_INCREF(op->func_doc); | |
19423 return op->func_doc; | |
19424 } | |
19425 static int | |
19426 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) | |
19427 { | |
19428 PyObject *tmp = op->func_doc; | |
19429 if (value == NULL) { | |
19430 value = Py_None; | |
19431 } | |
19432 Py_INCREF(value); | |
19433 op->func_doc = value; | |
19434 Py_XDECREF(tmp); | |
19435 return 0; | |
19436 } | |
19437 static PyObject * | |
19438 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) | |
19439 { | |
19440 if (unlikely(op->func_name == NULL)) { | |
19441 #if PY_MAJOR_VERSION >= 3 | |
19442 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); | |
19443 #else | |
19444 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); | |
19445 #endif | |
19446 if (unlikely(op->func_name == NULL)) | |
19447 return NULL; | |
19448 } | |
19449 Py_INCREF(op->func_name); | |
19450 return op->func_name; | |
19451 } | |
19452 static int | |
19453 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) | |
19454 { | |
19455 PyObject *tmp; | |
19456 #if PY_MAJOR_VERSION >= 3 | |
19457 if (unlikely(value == NULL || !PyUnicode_Check(value))) | |
19458 #else | |
19459 if (unlikely(value == NULL || !PyString_Check(value))) | |
19460 #endif | |
19461 { | |
19462 PyErr_SetString(PyExc_TypeError, | |
19463 "__name__ must be set to a string object"); | |
19464 return -1; | |
19465 } | |
19466 tmp = op->func_name; | |
19467 Py_INCREF(value); | |
19468 op->func_name = value; | |
19469 Py_XDECREF(tmp); | |
19470 return 0; | |
19471 } | |
19472 static PyObject * | |
19473 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) | |
19474 { | |
19475 Py_INCREF(op->func_qualname); | |
19476 return op->func_qualname; | |
19477 } | |
19478 static int | |
19479 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) | |
19480 { | |
19481 PyObject *tmp; | |
19482 #if PY_MAJOR_VERSION >= 3 | |
19483 if (unlikely(value == NULL || !PyUnicode_Check(value))) | |
19484 #else | |
19485 if (unlikely(value == NULL || !PyString_Check(value))) | |
19486 #endif | |
19487 { | |
19488 PyErr_SetString(PyExc_TypeError, | |
19489 "__qualname__ must be set to a string object"); | |
19490 return -1; | |
19491 } | |
19492 tmp = op->func_qualname; | |
19493 Py_INCREF(value); | |
19494 op->func_qualname = value; | |
19495 Py_XDECREF(tmp); | |
19496 return 0; | |
19497 } | |
19498 static PyObject * | |
19499 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) | |
19500 { | |
19501 PyObject *self; | |
19502 self = m->func_closure; | |
19503 if (self == NULL) | |
19504 self = Py_None; | |
19505 Py_INCREF(self); | |
19506 return self; | |
19507 } | |
19508 static PyObject * | |
19509 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) | |
19510 { | |
19511 if (unlikely(op->func_dict == NULL)) { | |
19512 op->func_dict = PyDict_New(); | |
19513 if (unlikely(op->func_dict == NULL)) | |
19514 return NULL; | |
19515 } | |
19516 Py_INCREF(op->func_dict); | |
19517 return op->func_dict; | |
19518 } | |
19519 static int | |
19520 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) | |
19521 { | |
19522 PyObject *tmp; | |
19523 if (unlikely(value == NULL)) { | |
19524 PyErr_SetString(PyExc_TypeError, | |
19525 "function's dictionary may not be deleted"); | |
19526 return -1; | |
19527 } | |
19528 if (unlikely(!PyDict_Check(value))) { | |
19529 PyErr_SetString(PyExc_TypeError, | |
19530 "setting function's dictionary to a non-dict"); | |
19531 return -1; | |
19532 } | |
19533 tmp = op->func_dict; | |
19534 Py_INCREF(value); | |
19535 op->func_dict = value; | |
19536 Py_XDECREF(tmp); | |
19537 return 0; | |
19538 } | |
19539 static PyObject * | |
19540 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) | |
19541 { | |
19542 Py_INCREF(op->func_globals); | |
19543 return op->func_globals; | |
19544 } | |
19545 static PyObject * | |
19546 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) | |
19547 { | |
19548 Py_INCREF(Py_None); | |
19549 return Py_None; | |
19550 } | |
19551 static PyObject * | |
19552 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) | |
19553 { | |
19554 PyObject* result = (op->func_code) ? op->func_code : Py_None; | |
19555 Py_INCREF(result); | |
19556 return result; | |
19557 } | |
19558 static int | |
19559 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { | |
19560 int result = 0; | |
19561 PyObject *res = op->defaults_getter((PyObject *) op); | |
19562 if (unlikely(!res)) | |
19563 return -1; | |
19564 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
19565 op->defaults_tuple = PyTuple_GET_ITEM(res, 0); | |
19566 Py_INCREF(op->defaults_tuple); | |
19567 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); | |
19568 Py_INCREF(op->defaults_kwdict); | |
19569 #else | |
19570 op->defaults_tuple = PySequence_ITEM(res, 0); | |
19571 if (unlikely(!op->defaults_tuple)) result = -1; | |
19572 else { | |
19573 op->defaults_kwdict = PySequence_ITEM(res, 1); | |
19574 if (unlikely(!op->defaults_kwdict)) result = -1; | |
19575 } | |
19576 #endif | |
19577 Py_DECREF(res); | |
19578 return result; | |
19579 } | |
19580 static int | |
19581 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { | |
19582 PyObject* tmp; | |
19583 if (!value) { | |
19584 value = Py_None; | |
19585 } else if (value != Py_None && !PyTuple_Check(value)) { | |
19586 PyErr_SetString(PyExc_TypeError, | |
19587 "__defaults__ must be set to a tuple object"); | |
19588 return -1; | |
19589 } | |
19590 Py_INCREF(value); | |
19591 tmp = op->defaults_tuple; | |
19592 op->defaults_tuple = value; | |
19593 Py_XDECREF(tmp); | |
19594 return 0; | |
19595 } | |
19596 static PyObject * | |
19597 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { | |
19598 PyObject* result = op->defaults_tuple; | |
19599 if (unlikely(!result)) { | |
19600 if (op->defaults_getter) { | |
19601 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; | |
19602 result = op->defaults_tuple; | |
19603 } else { | |
19604 result = Py_None; | |
19605 } | |
19606 } | |
19607 Py_INCREF(result); | |
19608 return result; | |
19609 } | |
19610 static int | |
19611 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { | |
19612 PyObject* tmp; | |
19613 if (!value) { | |
19614 value = Py_None; | |
19615 } else if (value != Py_None && !PyDict_Check(value)) { | |
19616 PyErr_SetString(PyExc_TypeError, | |
19617 "__kwdefaults__ must be set to a dict object"); | |
19618 return -1; | |
19619 } | |
19620 Py_INCREF(value); | |
19621 tmp = op->defaults_kwdict; | |
19622 op->defaults_kwdict = value; | |
19623 Py_XDECREF(tmp); | |
19624 return 0; | |
19625 } | |
19626 static PyObject * | |
19627 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { | |
19628 PyObject* result = op->defaults_kwdict; | |
19629 if (unlikely(!result)) { | |
19630 if (op->defaults_getter) { | |
19631 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; | |
19632 result = op->defaults_kwdict; | |
19633 } else { | |
19634 result = Py_None; | |
19635 } | |
19636 } | |
19637 Py_INCREF(result); | |
19638 return result; | |
19639 } | |
19640 static int | |
19641 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { | |
19642 PyObject* tmp; | |
19643 if (!value || value == Py_None) { | |
19644 value = NULL; | |
19645 } else if (!PyDict_Check(value)) { | |
19646 PyErr_SetString(PyExc_TypeError, | |
19647 "__annotations__ must be set to a dict object"); | |
19648 return -1; | |
19649 } | |
19650 Py_XINCREF(value); | |
19651 tmp = op->func_annotations; | |
19652 op->func_annotations = value; | |
19653 Py_XDECREF(tmp); | |
19654 return 0; | |
19655 } | |
19656 static PyObject * | |
19657 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { | |
19658 PyObject* result = op->func_annotations; | |
19659 if (unlikely(!result)) { | |
19660 result = PyDict_New(); | |
19661 if (unlikely(!result)) return NULL; | |
19662 op->func_annotations = result; | |
19663 } | |
19664 Py_INCREF(result); | |
19665 return result; | |
19666 } | |
19667 static PyGetSetDef __pyx_CyFunction_getsets[] = { | |
19668 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, | |
19669 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, | |
19670 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, | |
19671 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, | |
19672 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, | |
19673 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, | |
19674 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, | |
19675 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, | |
19676 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, | |
19677 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, | |
19678 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, | |
19679 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, | |
19680 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, | |
19681 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, | |
19682 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, | |
19683 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, | |
19684 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, | |
19685 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, | |
19686 {0, 0, 0, 0, 0} | |
19687 }; | |
19688 static PyMemberDef __pyx_CyFunction_members[] = { | |
19689 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, | |
19690 {0, 0, 0, 0, 0} | |
19691 }; | |
19692 static PyObject * | |
19693 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) | |
19694 { | |
19695 #if PY_MAJOR_VERSION >= 3 | |
19696 Py_INCREF(m->func_qualname); | |
19697 return m->func_qualname; | |
19698 #else | |
19699 return PyString_FromString(m->func.m_ml->ml_name); | |
19700 #endif | |
19701 } | |
19702 static PyMethodDef __pyx_CyFunction_methods[] = { | |
19703 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, | |
19704 {0, 0, 0, 0} | |
19705 }; | |
19706 #if PY_VERSION_HEX < 0x030500A0 | |
19707 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) | |
19708 #else | |
19709 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) | |
19710 #endif | |
19711 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, | |
19712 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { | |
19713 if (unlikely(op == NULL)) | |
19714 return NULL; | |
19715 op->flags = flags; | |
19716 __Pyx_CyFunction_weakreflist(op) = NULL; | |
19717 op->func.m_ml = ml; | |
19718 op->func.m_self = (PyObject *) op; | |
19719 Py_XINCREF(closure); | |
19720 op->func_closure = closure; | |
19721 Py_XINCREF(module); | |
19722 op->func.m_module = module; | |
19723 op->func_dict = NULL; | |
19724 op->func_name = NULL; | |
19725 Py_INCREF(qualname); | |
19726 op->func_qualname = qualname; | |
19727 op->func_doc = NULL; | |
19728 op->func_classobj = NULL; | |
19729 op->func_globals = globals; | |
19730 Py_INCREF(op->func_globals); | |
19731 Py_XINCREF(code); | |
19732 op->func_code = code; | |
19733 op->defaults_pyobjects = 0; | |
19734 op->defaults_size = 0; | |
19735 op->defaults = NULL; | |
19736 op->defaults_tuple = NULL; | |
19737 op->defaults_kwdict = NULL; | |
19738 op->defaults_getter = NULL; | |
19739 op->func_annotations = NULL; | |
19740 return (PyObject *) op; | |
19741 } | |
19742 static int | |
19743 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) | |
19744 { | |
19745 Py_CLEAR(m->func_closure); | |
19746 Py_CLEAR(m->func.m_module); | |
19747 Py_CLEAR(m->func_dict); | |
19748 Py_CLEAR(m->func_name); | |
19749 Py_CLEAR(m->func_qualname); | |
19750 Py_CLEAR(m->func_doc); | |
19751 Py_CLEAR(m->func_globals); | |
19752 Py_CLEAR(m->func_code); | |
19753 Py_CLEAR(m->func_classobj); | |
19754 Py_CLEAR(m->defaults_tuple); | |
19755 Py_CLEAR(m->defaults_kwdict); | |
19756 Py_CLEAR(m->func_annotations); | |
19757 if (m->defaults) { | |
19758 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); | |
19759 int i; | |
19760 for (i = 0; i < m->defaults_pyobjects; i++) | |
19761 Py_XDECREF(pydefaults[i]); | |
19762 PyObject_Free(m->defaults); | |
19763 m->defaults = NULL; | |
19764 } | |
19765 return 0; | |
19766 } | |
19767 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) | |
19768 { | |
19769 if (__Pyx_CyFunction_weakreflist(m) != NULL) | |
19770 PyObject_ClearWeakRefs((PyObject *) m); | |
19771 __Pyx_CyFunction_clear(m); | |
19772 PyObject_GC_Del(m); | |
19773 } | |
19774 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) | |
19775 { | |
19776 PyObject_GC_UnTrack(m); | |
19777 __Pyx__CyFunction_dealloc(m); | |
19778 } | |
19779 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) | |
19780 { | |
19781 Py_VISIT(m->func_closure); | |
19782 Py_VISIT(m->func.m_module); | |
19783 Py_VISIT(m->func_dict); | |
19784 Py_VISIT(m->func_name); | |
19785 Py_VISIT(m->func_qualname); | |
19786 Py_VISIT(m->func_doc); | |
19787 Py_VISIT(m->func_globals); | |
19788 Py_VISIT(m->func_code); | |
19789 Py_VISIT(m->func_classobj); | |
19790 Py_VISIT(m->defaults_tuple); | |
19791 Py_VISIT(m->defaults_kwdict); | |
19792 if (m->defaults) { | |
19793 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); | |
19794 int i; | |
19795 for (i = 0; i < m->defaults_pyobjects; i++) | |
19796 Py_VISIT(pydefaults[i]); | |
19797 } | |
19798 return 0; | |
19799 } | |
19800 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) | |
19801 { | |
19802 #if PY_MAJOR_VERSION < 3 | |
19803 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
19804 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { | |
19805 Py_INCREF(func); | |
19806 return func; | |
19807 } | |
19808 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { | |
19809 if (type == NULL) | |
19810 type = (PyObject *)(Py_TYPE(obj)); | |
19811 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); | |
19812 } | |
19813 if (obj == Py_None) | |
19814 obj = NULL; | |
19815 #endif | |
19816 return __Pyx_PyMethod_New(func, obj, type); | |
19817 } | |
19818 static PyObject* | |
19819 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) | |
19820 { | |
19821 #if PY_MAJOR_VERSION >= 3 | |
19822 return PyUnicode_FromFormat("<cyfunction %U at %p>", | |
19823 op->func_qualname, (void *)op); | |
19824 #else | |
19825 return PyString_FromFormat("<cyfunction %s at %p>", | |
19826 PyString_AsString(op->func_qualname), (void *)op); | |
19827 #endif | |
19828 } | |
19829 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { | |
19830 PyCFunctionObject* f = (PyCFunctionObject*)func; | |
19831 PyCFunction meth = f->m_ml->ml_meth; | |
19832 Py_ssize_t size; | |
19833 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { | |
19834 case METH_VARARGS: | |
19835 if (likely(kw == NULL || PyDict_Size(kw) == 0)) | |
19836 return (*meth)(self, arg); | |
19837 break; | |
19838 case METH_VARARGS | METH_KEYWORDS: | |
19839 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); | |
19840 case METH_NOARGS: | |
19841 if (likely(kw == NULL || PyDict_Size(kw) == 0)) { | |
19842 size = PyTuple_GET_SIZE(arg); | |
19843 if (likely(size == 0)) | |
19844 return (*meth)(self, NULL); | |
19845 PyErr_Format(PyExc_TypeError, | |
19846 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
19847 f->m_ml->ml_name, size); | |
19848 return NULL; | |
19849 } | |
19850 break; | |
19851 case METH_O: | |
19852 if (likely(kw == NULL || PyDict_Size(kw) == 0)) { | |
19853 size = PyTuple_GET_SIZE(arg); | |
19854 if (likely(size == 1)) { | |
19855 PyObject *result, *arg0; | |
19856 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
19857 arg0 = PyTuple_GET_ITEM(arg, 0); | |
19858 #else | |
19859 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; | |
19860 #endif | |
19861 result = (*meth)(self, arg0); | |
19862 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) | |
19863 Py_DECREF(arg0); | |
19864 #endif | |
19865 return result; | |
19866 } | |
19867 PyErr_Format(PyExc_TypeError, | |
19868 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
19869 f->m_ml->ml_name, size); | |
19870 return NULL; | |
19871 } | |
19872 break; | |
19873 default: | |
19874 PyErr_SetString(PyExc_SystemError, "Bad call flags in " | |
19875 "__Pyx_CyFunction_Call. METH_OLDARGS is no " | |
19876 "longer supported!"); | |
19877 return NULL; | |
19878 } | |
19879 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", | |
19880 f->m_ml->ml_name); | |
19881 return NULL; | |
19882 } | |
19883 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { | |
19884 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); | |
19885 } | |
19886 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { | |
19887 PyObject *result; | |
19888 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; | |
19889 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { | |
19890 Py_ssize_t argc; | |
19891 PyObject *new_args; | |
19892 PyObject *self; | |
19893 argc = PyTuple_GET_SIZE(args); | |
19894 new_args = PyTuple_GetSlice(args, 1, argc); | |
19895 if (unlikely(!new_args)) | |
19896 return NULL; | |
19897 self = PyTuple_GetItem(args, 0); | |
19898 if (unlikely(!self)) { | |
19899 Py_DECREF(new_args); | |
19900 #if PY_MAJOR_VERSION > 2 | |
19901 PyErr_Format(PyExc_TypeError, | |
19902 "unbound method %.200S() needs an argument", | |
19903 cyfunc->func_qualname); | |
19904 #else | |
19905 PyErr_SetString(PyExc_TypeError, | |
19906 "unbound method needs an argument"); | |
19907 #endif | |
19908 return NULL; | |
19909 } | |
19910 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); | |
19911 Py_DECREF(new_args); | |
19912 } else { | |
19913 result = __Pyx_CyFunction_Call(func, args, kw); | |
19914 } | |
19915 return result; | |
19916 } | |
19917 static PyTypeObject __pyx_CyFunctionType_type = { | |
19918 PyVarObject_HEAD_INIT(0, 0) | |
19919 "cython_function_or_method", | |
19920 sizeof(__pyx_CyFunctionObject), | |
19921 0, | |
19922 (destructor) __Pyx_CyFunction_dealloc, | |
19923 0, | |
19924 0, | |
19925 0, | |
19926 #if PY_MAJOR_VERSION < 3 | |
19927 0, | |
19928 #else | |
19929 0, | |
19930 #endif | |
19931 (reprfunc) __Pyx_CyFunction_repr, | |
19932 0, | |
19933 0, | |
19934 0, | |
19935 0, | |
19936 __Pyx_CyFunction_CallAsMethod, | |
19937 0, | |
19938 0, | |
19939 0, | |
19940 0, | |
19941 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, | |
19942 0, | |
19943 (traverseproc) __Pyx_CyFunction_traverse, | |
19944 (inquiry) __Pyx_CyFunction_clear, | |
19945 0, | |
19946 #if PY_VERSION_HEX < 0x030500A0 | |
19947 offsetof(__pyx_CyFunctionObject, func_weakreflist), | |
19948 #else | |
19949 offsetof(PyCFunctionObject, m_weakreflist), | |
19950 #endif | |
19951 0, | |
19952 0, | |
19953 __pyx_CyFunction_methods, | |
19954 __pyx_CyFunction_members, | |
19955 __pyx_CyFunction_getsets, | |
19956 0, | |
19957 0, | |
19958 __Pyx_CyFunction_descr_get, | |
19959 0, | |
19960 offsetof(__pyx_CyFunctionObject, func_dict), | |
19961 0, | |
19962 0, | |
19963 0, | |
19964 0, | |
19965 0, | |
19966 0, | |
19967 0, | |
19968 0, | |
19969 0, | |
19970 0, | |
19971 0, | |
19972 0, | |
19973 #if PY_VERSION_HEX >= 0x030400a1 | |
19974 0, | |
19975 #endif | |
19976 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) | |
19977 0, | |
19978 #endif | |
19979 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 | |
19980 0, | |
19981 #endif | |
19982 #if PY_VERSION_HEX >= 0x030C0000 | |
19983 0, | |
19984 #endif | |
19985 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 | |
19986 0, | |
19987 #endif | |
19988 }; | |
19989 static int __pyx_CyFunction_init(void) { | |
19990 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); | |
19991 if (unlikely(__pyx_CyFunctionType == NULL)) { | |
19992 return -1; | |
19993 } | |
19994 return 0; | |
19995 } | |
19996 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { | |
19997 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
19998 m->defaults = PyObject_Malloc(size); | |
19999 if (unlikely(!m->defaults)) | |
20000 return PyErr_NoMemory(); | |
20001 memset(m->defaults, 0, size); | |
20002 m->defaults_pyobjects = pyobjects; | |
20003 m->defaults_size = size; | |
20004 return m->defaults; | |
20005 } | |
20006 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { | |
20007 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
20008 m->defaults_tuple = tuple; | |
20009 Py_INCREF(tuple); | |
20010 } | |
20011 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { | |
20012 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
20013 m->defaults_kwdict = dict; | |
20014 Py_INCREF(dict); | |
20015 } | |
20016 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { | |
20017 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
20018 m->func_annotations = dict; | |
20019 Py_INCREF(dict); | |
20020 } | |
20021 | |
20022 /* CythonFunction */ | |
20023 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, | |
20024 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { | |
20025 PyObject *op = __Pyx_CyFunction_Init( | |
20026 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), | |
20027 ml, flags, qualname, closure, module, globals, code | |
20028 ); | |
20029 if (likely(op)) { | |
20030 PyObject_GC_Track(op); | |
20031 } | |
20032 return op; | |
20033 } | |
20034 | |
20035 /* RaiseException */ | |
20036 #if PY_MAJOR_VERSION < 3 | |
20037 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, | |
20038 CYTHON_UNUSED PyObject *cause) { | |
20039 __Pyx_PyThreadState_declare | |
20040 Py_XINCREF(type); | |
20041 if (!value || value == Py_None) | |
20042 value = NULL; | |
20043 else | |
20044 Py_INCREF(value); | |
20045 if (!tb || tb == Py_None) | |
20046 tb = NULL; | |
20047 else { | |
20048 Py_INCREF(tb); | |
20049 if (!PyTraceBack_Check(tb)) { | |
20050 PyErr_SetString(PyExc_TypeError, | |
20051 "raise: arg 3 must be a traceback or None"); | |
20052 goto raise_error; | |
20053 } | |
20054 } | |
20055 if (PyType_Check(type)) { | |
20056 #if CYTHON_COMPILING_IN_PYPY | |
20057 if (!value) { | |
20058 Py_INCREF(Py_None); | |
20059 value = Py_None; | |
20060 } | |
20061 #endif | |
20062 PyErr_NormalizeException(&type, &value, &tb); | |
20063 } else { | |
20064 if (value) { | |
20065 PyErr_SetString(PyExc_TypeError, | |
20066 "instance exception may not have a separate value"); | |
20067 goto raise_error; | |
20068 } | |
20069 value = type; | |
20070 type = (PyObject*) Py_TYPE(type); | |
20071 Py_INCREF(type); | |
20072 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { | |
20073 PyErr_SetString(PyExc_TypeError, | |
20074 "raise: exception class must be a subclass of BaseException"); | |
20075 goto raise_error; | |
20076 } | |
20077 } | |
20078 __Pyx_PyThreadState_assign | |
20079 __Pyx_ErrRestore(type, value, tb); | |
20080 return; | |
20081 raise_error: | |
20082 Py_XDECREF(value); | |
20083 Py_XDECREF(type); | |
20084 Py_XDECREF(tb); | |
20085 return; | |
20086 } | |
20087 #else | |
20088 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { | |
20089 PyObject* owned_instance = NULL; | |
20090 if (tb == Py_None) { | |
20091 tb = 0; | |
20092 } else if (tb && !PyTraceBack_Check(tb)) { | |
20093 PyErr_SetString(PyExc_TypeError, | |
20094 "raise: arg 3 must be a traceback or None"); | |
20095 goto bad; | |
20096 } | |
20097 if (value == Py_None) | |
20098 value = 0; | |
20099 if (PyExceptionInstance_Check(type)) { | |
20100 if (value) { | |
20101 PyErr_SetString(PyExc_TypeError, | |
20102 "instance exception may not have a separate value"); | |
20103 goto bad; | |
20104 } | |
20105 value = type; | |
20106 type = (PyObject*) Py_TYPE(value); | |
20107 } else if (PyExceptionClass_Check(type)) { | |
20108 PyObject *instance_class = NULL; | |
20109 if (value && PyExceptionInstance_Check(value)) { | |
20110 instance_class = (PyObject*) Py_TYPE(value); | |
20111 if (instance_class != type) { | |
20112 int is_subclass = PyObject_IsSubclass(instance_class, type); | |
20113 if (!is_subclass) { | |
20114 instance_class = NULL; | |
20115 } else if (unlikely(is_subclass == -1)) { | |
20116 goto bad; | |
20117 } else { | |
20118 type = instance_class; | |
20119 } | |
20120 } | |
20121 } | |
20122 if (!instance_class) { | |
20123 PyObject *args; | |
20124 if (!value) | |
20125 args = PyTuple_New(0); | |
20126 else if (PyTuple_Check(value)) { | |
20127 Py_INCREF(value); | |
20128 args = value; | |
20129 } else | |
20130 args = PyTuple_Pack(1, value); | |
20131 if (!args) | |
20132 goto bad; | |
20133 owned_instance = PyObject_Call(type, args, NULL); | |
20134 Py_DECREF(args); | |
20135 if (!owned_instance) | |
20136 goto bad; | |
20137 value = owned_instance; | |
20138 if (!PyExceptionInstance_Check(value)) { | |
20139 PyErr_Format(PyExc_TypeError, | |
20140 "calling %R should have returned an instance of " | |
20141 "BaseException, not %R", | |
20142 type, Py_TYPE(value)); | |
20143 goto bad; | |
20144 } | |
20145 } | |
20146 } else { | |
20147 PyErr_SetString(PyExc_TypeError, | |
20148 "raise: exception class must be a subclass of BaseException"); | |
20149 goto bad; | |
20150 } | |
20151 if (cause) { | |
20152 PyObject *fixed_cause; | |
20153 if (cause == Py_None) { | |
20154 fixed_cause = NULL; | |
20155 } else if (PyExceptionClass_Check(cause)) { | |
20156 fixed_cause = PyObject_CallObject(cause, NULL); | |
20157 if (fixed_cause == NULL) | |
20158 goto bad; | |
20159 } else if (PyExceptionInstance_Check(cause)) { | |
20160 fixed_cause = cause; | |
20161 Py_INCREF(fixed_cause); | |
20162 } else { | |
20163 PyErr_SetString(PyExc_TypeError, | |
20164 "exception causes must derive from " | |
20165 "BaseException"); | |
20166 goto bad; | |
20167 } | |
20168 PyException_SetCause(value, fixed_cause); | |
20169 } | |
20170 PyErr_SetObject(type, value); | |
20171 if (tb) { | |
20172 #if CYTHON_FAST_THREAD_STATE | |
20173 PyThreadState *tstate = __Pyx_PyThreadState_Current; | |
20174 PyObject* tmp_tb = tstate->curexc_traceback; | |
20175 if (tb != tmp_tb) { | |
20176 Py_INCREF(tb); | |
20177 tstate->curexc_traceback = tb; | |
20178 Py_XDECREF(tmp_tb); | |
20179 } | |
20180 #else | |
20181 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
20182 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); | |
20183 Py_INCREF(tb); | |
20184 PyErr_Restore(tmp_type, tmp_value, tb); | |
20185 Py_XDECREF(tmp_tb); | |
20186 #endif | |
20187 } | |
20188 bad: | |
20189 Py_XDECREF(owned_instance); | |
20190 return; | |
20191 } | |
20192 #endif | |
20193 | |
20194 /* GetException */ | |
20195 #if CYTHON_FAST_THREAD_STATE | |
20196 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) | |
20197 #else | |
20198 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) | |
20199 #endif | |
20200 { | |
20201 PyObject *local_type, *local_value, *local_tb; | |
20202 #if CYTHON_FAST_THREAD_STATE | |
20203 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
20204 local_type = tstate->curexc_type; | |
20205 local_value = tstate->curexc_value; | |
20206 local_tb = tstate->curexc_traceback; | |
20207 tstate->curexc_type = 0; | |
20208 tstate->curexc_value = 0; | |
20209 tstate->curexc_traceback = 0; | |
20210 #else | |
20211 PyErr_Fetch(&local_type, &local_value, &local_tb); | |
20212 #endif | |
20213 PyErr_NormalizeException(&local_type, &local_value, &local_tb); | |
20214 #if CYTHON_FAST_THREAD_STATE | |
20215 if (unlikely(tstate->curexc_type)) | |
20216 #else | |
20217 if (unlikely(PyErr_Occurred())) | |
20218 #endif | |
20219 goto bad; | |
20220 #if PY_MAJOR_VERSION >= 3 | |
20221 if (local_tb) { | |
20222 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) | |
20223 goto bad; | |
20224 } | |
20225 #endif | |
20226 Py_XINCREF(local_tb); | |
20227 Py_XINCREF(local_type); | |
20228 Py_XINCREF(local_value); | |
20229 *type = local_type; | |
20230 *value = local_value; | |
20231 *tb = local_tb; | |
20232 #if CYTHON_FAST_THREAD_STATE | |
20233 #if CYTHON_USE_EXC_INFO_STACK | |
20234 { | |
20235 _PyErr_StackItem *exc_info = tstate->exc_info; | |
20236 tmp_type = exc_info->exc_type; | |
20237 tmp_value = exc_info->exc_value; | |
20238 tmp_tb = exc_info->exc_traceback; | |
20239 exc_info->exc_type = local_type; | |
20240 exc_info->exc_value = local_value; | |
20241 exc_info->exc_traceback = local_tb; | |
20242 } | |
20243 #else | |
20244 tmp_type = tstate->exc_type; | |
20245 tmp_value = tstate->exc_value; | |
20246 tmp_tb = tstate->exc_traceback; | |
20247 tstate->exc_type = local_type; | |
20248 tstate->exc_value = local_value; | |
20249 tstate->exc_traceback = local_tb; | |
20250 #endif | |
20251 Py_XDECREF(tmp_type); | |
20252 Py_XDECREF(tmp_value); | |
20253 Py_XDECREF(tmp_tb); | |
20254 #else | |
20255 PyErr_SetExcInfo(local_type, local_value, local_tb); | |
20256 #endif | |
20257 return 0; | |
20258 bad: | |
20259 *type = 0; | |
20260 *value = 0; | |
20261 *tb = 0; | |
20262 Py_XDECREF(local_type); | |
20263 Py_XDECREF(local_value); | |
20264 Py_XDECREF(local_tb); | |
20265 return -1; | |
20266 } | |
20267 | |
20268 /* GetAttr */ | |
20269 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { | |
20270 #if CYTHON_USE_TYPE_SLOTS | |
20271 #if PY_MAJOR_VERSION >= 3 | |
20272 if (likely(PyUnicode_Check(n))) | |
20273 #else | |
20274 if (likely(PyString_Check(n))) | |
20275 #endif | |
20276 return __Pyx_PyObject_GetAttrStr(o, n); | |
20277 #endif | |
20278 return PyObject_GetAttr(o, n); | |
20279 } | |
20280 | |
20281 /* SliceTupleAndList */ | |
20282 #if CYTHON_COMPILING_IN_CPYTHON | |
20283 static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { | |
20284 Py_ssize_t start = *_start, stop = *_stop, length = *_length; | |
20285 if (start < 0) { | |
20286 start += length; | |
20287 if (start < 0) | |
20288 start = 0; | |
20289 } | |
20290 if (stop < 0) | |
20291 stop += length; | |
20292 else if (stop > length) | |
20293 stop = length; | |
20294 *_length = stop - start; | |
20295 *_start = start; | |
20296 *_stop = stop; | |
20297 } | |
20298 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { | |
20299 PyObject *v; | |
20300 Py_ssize_t i; | |
20301 for (i = 0; i < length; i++) { | |
20302 v = dest[i] = src[i]; | |
20303 Py_INCREF(v); | |
20304 } | |
20305 } | |
20306 static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice( | |
20307 PyObject* src, Py_ssize_t start, Py_ssize_t stop) { | |
20308 PyObject* dest; | |
20309 Py_ssize_t length = PyList_GET_SIZE(src); | |
20310 __Pyx_crop_slice(&start, &stop, &length); | |
20311 if (unlikely(length <= 0)) | |
20312 return PyList_New(0); | |
20313 dest = PyList_New(length); | |
20314 if (unlikely(!dest)) | |
20315 return NULL; | |
20316 __Pyx_copy_object_array( | |
20317 ((PyListObject*)src)->ob_item + start, | |
20318 ((PyListObject*)dest)->ob_item, | |
20319 length); | |
20320 return dest; | |
20321 } | |
20322 static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice( | |
20323 PyObject* src, Py_ssize_t start, Py_ssize_t stop) { | |
20324 PyObject* dest; | |
20325 Py_ssize_t length = PyTuple_GET_SIZE(src); | |
20326 __Pyx_crop_slice(&start, &stop, &length); | |
20327 if (unlikely(length <= 0)) | |
20328 return PyTuple_New(0); | |
20329 dest = PyTuple_New(length); | |
20330 if (unlikely(!dest)) | |
20331 return NULL; | |
20332 __Pyx_copy_object_array( | |
20333 ((PyTupleObject*)src)->ob_item + start, | |
20334 ((PyTupleObject*)dest)->ob_item, | |
20335 length); | |
20336 return dest; | |
20337 } | |
20338 #endif | |
20339 | |
20340 /* PyIntBinop */ | |
20341 #if !CYTHON_COMPILING_IN_PYPY | |
20342 static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { | |
20343 (void)inplace; | |
20344 (void)zerodivision_check; | |
20345 #if PY_MAJOR_VERSION < 3 | |
20346 if (likely(PyInt_CheckExact(op1))) { | |
20347 const long b = intval; | |
20348 long a = PyInt_AS_LONG(op1); | |
20349 return PyInt_FromLong(a & b); | |
20350 } | |
20351 #endif | |
20352 #if CYTHON_USE_PYLONG_INTERNALS | |
20353 if (likely(PyLong_CheckExact(op1))) { | |
20354 const long b = intval; | |
20355 long a, x; | |
20356 #ifdef HAVE_LONG_LONG | |
20357 const PY_LONG_LONG llb = intval; | |
20358 PY_LONG_LONG lla, llx; | |
20359 #endif | |
20360 const digit* digits = ((PyLongObject*)op1)->ob_digit; | |
20361 const Py_ssize_t size = Py_SIZE(op1); | |
20362 if (likely(__Pyx_sst_abs(size) <= 1)) { | |
20363 a = likely(size) ? digits[0] : 0; | |
20364 if (size == -1) a = -a; | |
20365 } else { | |
20366 switch (size) { | |
20367 case -2: | |
20368 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
20369 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20370 break; | |
20371 #ifdef HAVE_LONG_LONG | |
20372 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { | |
20373 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20374 goto long_long; | |
20375 #endif | |
20376 } | |
20377 CYTHON_FALLTHROUGH; | |
20378 case 2: | |
20379 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
20380 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20381 break; | |
20382 #ifdef HAVE_LONG_LONG | |
20383 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { | |
20384 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20385 goto long_long; | |
20386 #endif | |
20387 } | |
20388 CYTHON_FALLTHROUGH; | |
20389 case -3: | |
20390 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
20391 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20392 break; | |
20393 #ifdef HAVE_LONG_LONG | |
20394 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { | |
20395 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20396 goto long_long; | |
20397 #endif | |
20398 } | |
20399 CYTHON_FALLTHROUGH; | |
20400 case 3: | |
20401 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
20402 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20403 break; | |
20404 #ifdef HAVE_LONG_LONG | |
20405 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { | |
20406 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20407 goto long_long; | |
20408 #endif | |
20409 } | |
20410 CYTHON_FALLTHROUGH; | |
20411 case -4: | |
20412 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
20413 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20414 break; | |
20415 #ifdef HAVE_LONG_LONG | |
20416 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { | |
20417 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20418 goto long_long; | |
20419 #endif | |
20420 } | |
20421 CYTHON_FALLTHROUGH; | |
20422 case 4: | |
20423 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
20424 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20425 break; | |
20426 #ifdef HAVE_LONG_LONG | |
20427 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { | |
20428 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20429 goto long_long; | |
20430 #endif | |
20431 } | |
20432 CYTHON_FALLTHROUGH; | |
20433 default: return PyLong_Type.tp_as_number->nb_and(op1, op2); | |
20434 } | |
20435 } | |
20436 x = a & b; | |
20437 return PyLong_FromLong(x); | |
20438 #ifdef HAVE_LONG_LONG | |
20439 long_long: | |
20440 llx = lla & llb; | |
20441 return PyLong_FromLongLong(llx); | |
20442 #endif | |
20443 | |
20444 | |
20445 } | |
20446 #endif | |
20447 return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2); | |
20448 } | |
20449 #endif | |
20450 | |
20451 /* PyIntBinop */ | |
20452 #if !CYTHON_COMPILING_IN_PYPY | |
20453 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { | |
20454 (void)inplace; | |
20455 (void)zerodivision_check; | |
20456 #if PY_MAJOR_VERSION < 3 | |
20457 if (likely(PyInt_CheckExact(op1))) { | |
20458 const long b = intval; | |
20459 long x; | |
20460 long a = PyInt_AS_LONG(op1); | |
20461 x = (long)((unsigned long)a + b); | |
20462 if (likely((x^a) >= 0 || (x^b) >= 0)) | |
20463 return PyInt_FromLong(x); | |
20464 return PyLong_Type.tp_as_number->nb_add(op1, op2); | |
20465 } | |
20466 #endif | |
20467 #if CYTHON_USE_PYLONG_INTERNALS | |
20468 if (likely(PyLong_CheckExact(op1))) { | |
20469 const long b = intval; | |
20470 long a, x; | |
20471 #ifdef HAVE_LONG_LONG | |
20472 const PY_LONG_LONG llb = intval; | |
20473 PY_LONG_LONG lla, llx; | |
20474 #endif | |
20475 const digit* digits = ((PyLongObject*)op1)->ob_digit; | |
20476 const Py_ssize_t size = Py_SIZE(op1); | |
20477 if (likely(__Pyx_sst_abs(size) <= 1)) { | |
20478 a = likely(size) ? digits[0] : 0; | |
20479 if (size == -1) a = -a; | |
20480 } else { | |
20481 switch (size) { | |
20482 case -2: | |
20483 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
20484 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20485 break; | |
20486 #ifdef HAVE_LONG_LONG | |
20487 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { | |
20488 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20489 goto long_long; | |
20490 #endif | |
20491 } | |
20492 CYTHON_FALLTHROUGH; | |
20493 case 2: | |
20494 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
20495 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20496 break; | |
20497 #ifdef HAVE_LONG_LONG | |
20498 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { | |
20499 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20500 goto long_long; | |
20501 #endif | |
20502 } | |
20503 CYTHON_FALLTHROUGH; | |
20504 case -3: | |
20505 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
20506 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20507 break; | |
20508 #ifdef HAVE_LONG_LONG | |
20509 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { | |
20510 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20511 goto long_long; | |
20512 #endif | |
20513 } | |
20514 CYTHON_FALLTHROUGH; | |
20515 case 3: | |
20516 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
20517 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20518 break; | |
20519 #ifdef HAVE_LONG_LONG | |
20520 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { | |
20521 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20522 goto long_long; | |
20523 #endif | |
20524 } | |
20525 CYTHON_FALLTHROUGH; | |
20526 case -4: | |
20527 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
20528 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20529 break; | |
20530 #ifdef HAVE_LONG_LONG | |
20531 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { | |
20532 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20533 goto long_long; | |
20534 #endif | |
20535 } | |
20536 CYTHON_FALLTHROUGH; | |
20537 case 4: | |
20538 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
20539 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
20540 break; | |
20541 #ifdef HAVE_LONG_LONG | |
20542 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { | |
20543 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); | |
20544 goto long_long; | |
20545 #endif | |
20546 } | |
20547 CYTHON_FALLTHROUGH; | |
20548 default: return PyLong_Type.tp_as_number->nb_add(op1, op2); | |
20549 } | |
20550 } | |
20551 x = a + b; | |
20552 return PyLong_FromLong(x); | |
20553 #ifdef HAVE_LONG_LONG | |
20554 long_long: | |
20555 llx = lla + llb; | |
20556 return PyLong_FromLongLong(llx); | |
20557 #endif | |
20558 | |
20559 | |
20560 } | |
20561 #endif | |
20562 if (PyFloat_CheckExact(op1)) { | |
20563 const long b = intval; | |
20564 double a = PyFloat_AS_DOUBLE(op1); | |
20565 double result; | |
20566 PyFPE_START_PROTECT("add", return NULL) | |
20567 result = ((double)a) + (double)b; | |
20568 PyFPE_END_PROTECT(result) | |
20569 return PyFloat_FromDouble(result); | |
20570 } | |
20571 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); | |
20572 } | |
20573 #endif | |
20574 | |
20575 /* SetItemInt */ | |
20576 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { | |
20577 int r; | |
20578 if (!j) return -1; | |
20579 r = PyObject_SetItem(o, j, v); | |
20580 Py_DECREF(j); | |
20581 return r; | |
20582 } | |
20583 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, | |
20584 CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { | |
20585 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS | |
20586 if (is_list || PyList_CheckExact(o)) { | |
20587 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); | |
20588 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { | |
20589 PyObject* old = PyList_GET_ITEM(o, n); | |
20590 Py_INCREF(v); | |
20591 PyList_SET_ITEM(o, n, v); | |
20592 Py_DECREF(old); | |
20593 return 1; | |
20594 } | |
20595 } else { | |
20596 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; | |
20597 if (likely(m && m->sq_ass_item)) { | |
20598 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { | |
20599 Py_ssize_t l = m->sq_length(o); | |
20600 if (likely(l >= 0)) { | |
20601 i += l; | |
20602 } else { | |
20603 if (!PyErr_ExceptionMatches(PyExc_OverflowError)) | |
20604 return -1; | |
20605 PyErr_Clear(); | |
20606 } | |
20607 } | |
20608 return m->sq_ass_item(o, i, v); | |
20609 } | |
20610 } | |
20611 #else | |
20612 #if CYTHON_COMPILING_IN_PYPY | |
20613 if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) | |
20614 #else | |
20615 if (is_list || PySequence_Check(o)) | |
20616 #endif | |
20617 { | |
20618 return PySequence_SetItem(o, i, v); | |
20619 } | |
20620 #endif | |
20621 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); | |
20622 } | |
20623 | |
20624 /* ArgTypeTest */ | |
20625 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) | |
20626 { | |
20627 if (unlikely(!type)) { | |
20628 PyErr_SetString(PyExc_SystemError, "Missing type object"); | |
20629 return 0; | |
20630 } | |
20631 else if (exact) { | |
20632 #if PY_MAJOR_VERSION == 2 | |
20633 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; | |
20634 #endif | |
20635 } | |
20636 else { | |
20637 if (likely(__Pyx_TypeCheck(obj, type))) return 1; | |
20638 } | |
20639 PyErr_Format(PyExc_TypeError, | |
20640 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", | |
20641 name, type->tp_name, Py_TYPE(obj)->tp_name); | |
20642 return 0; | |
20643 } | |
20644 | |
20645 /* WriteUnraisableException */ | |
20646 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, | |
20647 CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, | |
20648 int full_traceback, CYTHON_UNUSED int nogil) { | |
20649 PyObject *old_exc, *old_val, *old_tb; | |
20650 PyObject *ctx; | |
20651 __Pyx_PyThreadState_declare | |
20652 #ifdef WITH_THREAD | |
20653 PyGILState_STATE state; | |
20654 if (nogil) | |
20655 state = PyGILState_Ensure(); | |
20656 else state = (PyGILState_STATE)0; | |
20657 #endif | |
20658 __Pyx_PyThreadState_assign | |
20659 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); | |
20660 if (full_traceback) { | |
20661 Py_XINCREF(old_exc); | |
20662 Py_XINCREF(old_val); | |
20663 Py_XINCREF(old_tb); | |
20664 __Pyx_ErrRestore(old_exc, old_val, old_tb); | |
20665 PyErr_PrintEx(1); | |
20666 } | |
20667 #if PY_MAJOR_VERSION < 3 | |
20668 ctx = PyString_FromString(name); | |
20669 #else | |
20670 ctx = PyUnicode_FromString(name); | |
20671 #endif | |
20672 __Pyx_ErrRestore(old_exc, old_val, old_tb); | |
20673 if (!ctx) { | |
20674 PyErr_WriteUnraisable(Py_None); | |
20675 } else { | |
20676 PyErr_WriteUnraisable(ctx); | |
20677 Py_DECREF(ctx); | |
20678 } | |
20679 #ifdef WITH_THREAD | |
20680 if (nogil) | |
20681 PyGILState_Release(state); | |
20682 #endif | |
20683 } | |
20684 | |
20685 /* HasAttr */ | |
20686 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { | |
20687 PyObject *r; | |
20688 if (unlikely(!__Pyx_PyBaseString_Check(n))) { | |
20689 PyErr_SetString(PyExc_TypeError, | |
20690 "hasattr(): attribute name must be string"); | |
20691 return -1; | |
20692 } | |
20693 r = __Pyx_GetAttr(o, n); | |
20694 if (unlikely(!r)) { | |
20695 PyErr_Clear(); | |
20696 return 0; | |
20697 } else { | |
20698 Py_DECREF(r); | |
20699 return 1; | |
20700 } | |
20701 } | |
20702 | |
20703 /* IterNext */ | |
20704 static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { | |
20705 PyObject* exc_type; | |
20706 __Pyx_PyThreadState_declare | |
20707 __Pyx_PyThreadState_assign | |
20708 exc_type = __Pyx_PyErr_Occurred(); | |
20709 if (unlikely(exc_type)) { | |
20710 if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) | |
20711 return NULL; | |
20712 __Pyx_PyErr_Clear(); | |
20713 Py_INCREF(defval); | |
20714 return defval; | |
20715 } | |
20716 if (defval) { | |
20717 Py_INCREF(defval); | |
20718 return defval; | |
20719 } | |
20720 __Pyx_PyErr_SetNone(PyExc_StopIteration); | |
20721 return NULL; | |
20722 } | |
20723 static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) { | |
20724 PyErr_Format(PyExc_TypeError, | |
20725 "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); | |
20726 } | |
20727 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { | |
20728 PyObject* next; | |
20729 iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; | |
20730 if (likely(iternext)) { | |
20731 #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY | |
20732 next = iternext(iterator); | |
20733 if (likely(next)) | |
20734 return next; | |
20735 #if PY_VERSION_HEX >= 0x02070000 && CYTHON_COMPILING_IN_CPYTHON | |
20736 if (unlikely(iternext == &_PyObject_NextNotImplemented)) | |
20737 return NULL; | |
20738 #endif | |
20739 #else | |
20740 next = PyIter_Next(iterator); | |
20741 if (likely(next)) | |
20742 return next; | |
20743 #endif | |
20744 } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) { | |
20745 __Pyx_PyIter_Next_ErrorNoIterator(iterator); | |
20746 return NULL; | |
20747 } | |
20748 #if !CYTHON_USE_TYPE_SLOTS | |
20749 else { | |
20750 next = PyIter_Next(iterator); | |
20751 if (likely(next)) | |
20752 return next; | |
20753 } | |
20754 #endif | |
20755 return __Pyx_PyIter_Next2Default(defval); | |
20756 } | |
20757 | |
20758 /* None */ | |
20759 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { | |
20760 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); | |
20761 } | |
20762 | |
20763 /* GetAttr3 */ | |
20764 static PyObject *__Pyx_GetAttr3Default(PyObject *d) { | |
20765 __Pyx_PyThreadState_declare | |
20766 __Pyx_PyThreadState_assign | |
20767 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) | |
20768 return NULL; | |
20769 __Pyx_PyErr_Clear(); | |
20770 Py_INCREF(d); | |
20771 return d; | |
20772 } | |
20773 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { | |
20774 PyObject *r = __Pyx_GetAttr(o, n); | |
20775 return (likely(r)) ? r : __Pyx_GetAttr3Default(d); | |
20776 } | |
20777 | |
20778 /* FastTypeChecks */ | |
20779 #if CYTHON_COMPILING_IN_CPYTHON | |
20780 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { | |
20781 while (a) { | |
20782 a = a->tp_base; | |
20783 if (a == b) | |
20784 return 1; | |
20785 } | |
20786 return b == &PyBaseObject_Type; | |
20787 } | |
20788 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { | |
20789 PyObject *mro; | |
20790 if (a == b) return 1; | |
20791 mro = a->tp_mro; | |
20792 if (likely(mro)) { | |
20793 Py_ssize_t i, n; | |
20794 n = PyTuple_GET_SIZE(mro); | |
20795 for (i = 0; i < n; i++) { | |
20796 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) | |
20797 return 1; | |
20798 } | |
20799 return 0; | |
20800 } | |
20801 return __Pyx_InBases(a, b); | |
20802 } | |
20803 #if PY_MAJOR_VERSION == 2 | |
20804 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { | |
20805 PyObject *exception, *value, *tb; | |
20806 int res; | |
20807 __Pyx_PyThreadState_declare | |
20808 __Pyx_PyThreadState_assign | |
20809 __Pyx_ErrFetch(&exception, &value, &tb); | |
20810 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; | |
20811 if (unlikely(res == -1)) { | |
20812 PyErr_WriteUnraisable(err); | |
20813 res = 0; | |
20814 } | |
20815 if (!res) { | |
20816 res = PyObject_IsSubclass(err, exc_type2); | |
20817 if (unlikely(res == -1)) { | |
20818 PyErr_WriteUnraisable(err); | |
20819 res = 0; | |
20820 } | |
20821 } | |
20822 __Pyx_ErrRestore(exception, value, tb); | |
20823 return res; | |
20824 } | |
20825 #else | |
20826 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { | |
20827 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; | |
20828 if (!res) { | |
20829 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); | |
20830 } | |
20831 return res; | |
20832 } | |
20833 #endif | |
20834 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { | |
20835 Py_ssize_t i, n; | |
20836 assert(PyExceptionClass_Check(exc_type)); | |
20837 n = PyTuple_GET_SIZE(tuple); | |
20838 #if PY_MAJOR_VERSION >= 3 | |
20839 for (i=0; i<n; i++) { | |
20840 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; | |
20841 } | |
20842 #endif | |
20843 for (i=0; i<n; i++) { | |
20844 PyObject *t = PyTuple_GET_ITEM(tuple, i); | |
20845 #if PY_MAJOR_VERSION < 3 | |
20846 if (likely(exc_type == t)) return 1; | |
20847 #endif | |
20848 if (likely(PyExceptionClass_Check(t))) { | |
20849 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; | |
20850 } else { | |
20851 } | |
20852 } | |
20853 return 0; | |
20854 } | |
20855 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { | |
20856 if (likely(err == exc_type)) return 1; | |
20857 if (likely(PyExceptionClass_Check(err))) { | |
20858 if (likely(PyExceptionClass_Check(exc_type))) { | |
20859 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); | |
20860 } else if (likely(PyTuple_Check(exc_type))) { | |
20861 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); | |
20862 } else { | |
20863 } | |
20864 } | |
20865 return PyErr_GivenExceptionMatches(err, exc_type); | |
20866 } | |
20867 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { | |
20868 assert(PyExceptionClass_Check(exc_type1)); | |
20869 assert(PyExceptionClass_Check(exc_type2)); | |
20870 if (likely(err == exc_type1 || err == exc_type2)) return 1; | |
20871 if (likely(PyExceptionClass_Check(err))) { | |
20872 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); | |
20873 } | |
20874 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); | |
20875 } | |
20876 #endif | |
20877 | |
20878 /* SwapException */ | |
20879 #if CYTHON_FAST_THREAD_STATE | |
20880 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { | |
20881 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
20882 #if CYTHON_USE_EXC_INFO_STACK | |
20883 _PyErr_StackItem *exc_info = tstate->exc_info; | |
20884 tmp_type = exc_info->exc_type; | |
20885 tmp_value = exc_info->exc_value; | |
20886 tmp_tb = exc_info->exc_traceback; | |
20887 exc_info->exc_type = *type; | |
20888 exc_info->exc_value = *value; | |
20889 exc_info->exc_traceback = *tb; | |
20890 #else | |
20891 tmp_type = tstate->exc_type; | |
20892 tmp_value = tstate->exc_value; | |
20893 tmp_tb = tstate->exc_traceback; | |
20894 tstate->exc_type = *type; | |
20895 tstate->exc_value = *value; | |
20896 tstate->exc_traceback = *tb; | |
20897 #endif | |
20898 *type = tmp_type; | |
20899 *value = tmp_value; | |
20900 *tb = tmp_tb; | |
20901 } | |
20902 #else | |
20903 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { | |
20904 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
20905 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); | |
20906 PyErr_SetExcInfo(*type, *value, *tb); | |
20907 *type = tmp_type; | |
20908 *value = tmp_value; | |
20909 *tb = tmp_tb; | |
20910 } | |
20911 #endif | |
20912 | |
20913 /* Import */ | |
20914 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { | |
20915 PyObject *empty_list = 0; | |
20916 PyObject *module = 0; | |
20917 PyObject *global_dict = 0; | |
20918 PyObject *empty_dict = 0; | |
20919 PyObject *list; | |
20920 #if PY_MAJOR_VERSION < 3 | |
20921 PyObject *py_import; | |
20922 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); | |
20923 if (!py_import) | |
20924 goto bad; | |
20925 #endif | |
20926 if (from_list) | |
20927 list = from_list; | |
20928 else { | |
20929 empty_list = PyList_New(0); | |
20930 if (!empty_list) | |
20931 goto bad; | |
20932 list = empty_list; | |
20933 } | |
20934 global_dict = PyModule_GetDict(__pyx_m); | |
20935 if (!global_dict) | |
20936 goto bad; | |
20937 empty_dict = PyDict_New(); | |
20938 if (!empty_dict) | |
20939 goto bad; | |
20940 { | |
20941 #if PY_MAJOR_VERSION >= 3 | |
20942 if (level == -1) { | |
20943 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { | |
20944 module = PyImport_ImportModuleLevelObject( | |
20945 name, global_dict, empty_dict, list, 1); | |
20946 if (!module) { | |
20947 if (!PyErr_ExceptionMatches(PyExc_ImportError)) | |
20948 goto bad; | |
20949 PyErr_Clear(); | |
20950 } | |
20951 } | |
20952 level = 0; | |
20953 } | |
20954 #endif | |
20955 if (!module) { | |
20956 #if PY_MAJOR_VERSION < 3 | |
20957 PyObject *py_level = PyInt_FromLong(level); | |
20958 if (!py_level) | |
20959 goto bad; | |
20960 module = PyObject_CallFunctionObjArgs(py_import, | |
20961 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); | |
20962 Py_DECREF(py_level); | |
20963 #else | |
20964 module = PyImport_ImportModuleLevelObject( | |
20965 name, global_dict, empty_dict, list, level); | |
20966 #endif | |
20967 } | |
20968 } | |
20969 bad: | |
20970 #if PY_MAJOR_VERSION < 3 | |
20971 Py_XDECREF(py_import); | |
20972 #endif | |
20973 Py_XDECREF(empty_list); | |
20974 Py_XDECREF(empty_dict); | |
20975 return module; | |
20976 } | |
20977 | |
20978 /* ImportFrom */ | |
20979 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { | |
20980 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); | |
20981 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { | |
20982 PyErr_Format(PyExc_ImportError, | |
20983 #if PY_MAJOR_VERSION < 3 | |
20984 "cannot import name %.230s", PyString_AS_STRING(name)); | |
20985 #else | |
20986 "cannot import name %S", name); | |
20987 #endif | |
20988 } | |
20989 return value; | |
20990 } | |
20991 | |
20992 /* PyObject_GenericGetAttrNoDict */ | |
20993 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 | |
20994 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { | |
20995 PyErr_Format(PyExc_AttributeError, | |
20996 #if PY_MAJOR_VERSION >= 3 | |
20997 "'%.50s' object has no attribute '%U'", | |
20998 tp->tp_name, attr_name); | |
20999 #else | |
21000 "'%.50s' object has no attribute '%.400s'", | |
21001 tp->tp_name, PyString_AS_STRING(attr_name)); | |
21002 #endif | |
21003 return NULL; | |
21004 } | |
21005 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { | |
21006 PyObject *descr; | |
21007 PyTypeObject *tp = Py_TYPE(obj); | |
21008 if (unlikely(!PyString_Check(attr_name))) { | |
21009 return PyObject_GenericGetAttr(obj, attr_name); | |
21010 } | |
21011 assert(!tp->tp_dictoffset); | |
21012 descr = _PyType_Lookup(tp, attr_name); | |
21013 if (unlikely(!descr)) { | |
21014 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); | |
21015 } | |
21016 Py_INCREF(descr); | |
21017 #if PY_MAJOR_VERSION < 3 | |
21018 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) | |
21019 #endif | |
21020 { | |
21021 descrgetfunc f = Py_TYPE(descr)->tp_descr_get; | |
21022 if (unlikely(f)) { | |
21023 PyObject *res = f(descr, obj, (PyObject *)tp); | |
21024 Py_DECREF(descr); | |
21025 return res; | |
21026 } | |
21027 } | |
21028 return descr; | |
21029 } | |
21030 #endif | |
21031 | |
21032 /* PyObject_GenericGetAttr */ | |
21033 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 | |
21034 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { | |
21035 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { | |
21036 return PyObject_GenericGetAttr(obj, attr_name); | |
21037 } | |
21038 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); | |
21039 } | |
21040 #endif | |
21041 | |
21042 /* SetVTable */ | |
21043 static int __Pyx_SetVtable(PyObject *dict, void *vtable) { | |
21044 #if PY_VERSION_HEX >= 0x02070000 | |
21045 PyObject *ob = PyCapsule_New(vtable, 0, 0); | |
21046 #else | |
21047 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); | |
21048 #endif | |
21049 if (!ob) | |
21050 goto bad; | |
21051 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) | |
21052 goto bad; | |
21053 Py_DECREF(ob); | |
21054 return 0; | |
21055 bad: | |
21056 Py_XDECREF(ob); | |
21057 return -1; | |
21058 } | |
21059 | |
21060 /* PyObjectGetAttrStrNoError */ | |
21061 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { | |
21062 __Pyx_PyThreadState_declare | |
21063 __Pyx_PyThreadState_assign | |
21064 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) | |
21065 __Pyx_PyErr_Clear(); | |
21066 } | |
21067 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { | |
21068 PyObject *result; | |
21069 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 | |
21070 PyTypeObject* tp = Py_TYPE(obj); | |
21071 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { | |
21072 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); | |
21073 } | |
21074 #endif | |
21075 result = __Pyx_PyObject_GetAttrStr(obj, attr_name); | |
21076 if (unlikely(!result)) { | |
21077 __Pyx_PyObject_GetAttrStr_ClearAttributeError(); | |
21078 } | |
21079 return result; | |
21080 } | |
21081 | |
21082 /* SetupReduce */ | |
21083 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { | |
21084 int ret; | |
21085 PyObject *name_attr; | |
21086 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); | |
21087 if (likely(name_attr)) { | |
21088 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); | |
21089 } else { | |
21090 ret = -1; | |
21091 } | |
21092 if (unlikely(ret < 0)) { | |
21093 PyErr_Clear(); | |
21094 ret = 0; | |
21095 } | |
21096 Py_XDECREF(name_attr); | |
21097 return ret; | |
21098 } | |
21099 static int __Pyx_setup_reduce(PyObject* type_obj) { | |
21100 int ret = 0; | |
21101 PyObject *object_reduce = NULL; | |
21102 PyObject *object_getstate = NULL; | |
21103 PyObject *object_reduce_ex = NULL; | |
21104 PyObject *reduce = NULL; | |
21105 PyObject *reduce_ex = NULL; | |
21106 PyObject *reduce_cython = NULL; | |
21107 PyObject *setstate = NULL; | |
21108 PyObject *setstate_cython = NULL; | |
21109 PyObject *getstate = NULL; | |
21110 #if CYTHON_USE_PYTYPE_LOOKUP | |
21111 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); | |
21112 #else | |
21113 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); | |
21114 if (!getstate && PyErr_Occurred()) { | |
21115 goto __PYX_BAD; | |
21116 } | |
21117 #endif | |
21118 if (getstate) { | |
21119 #if CYTHON_USE_PYTYPE_LOOKUP | |
21120 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); | |
21121 #else | |
21122 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); | |
21123 if (!object_getstate && PyErr_Occurred()) { | |
21124 goto __PYX_BAD; | |
21125 } | |
21126 #endif | |
21127 if (object_getstate != getstate) { | |
21128 goto __PYX_GOOD; | |
21129 } | |
21130 } | |
21131 #if CYTHON_USE_PYTYPE_LOOKUP | |
21132 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; | |
21133 #else | |
21134 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; | |
21135 #endif | |
21136 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; | |
21137 if (reduce_ex == object_reduce_ex) { | |
21138 #if CYTHON_USE_PYTYPE_LOOKUP | |
21139 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; | |
21140 #else | |
21141 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; | |
21142 #endif | |
21143 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; | |
21144 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { | |
21145 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); | |
21146 if (likely(reduce_cython)) { | |
21147 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; | |
21148 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; | |
21149 } else if (reduce == object_reduce || PyErr_Occurred()) { | |
21150 goto __PYX_BAD; | |
21151 } | |
21152 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); | |
21153 if (!setstate) PyErr_Clear(); | |
21154 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { | |
21155 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); | |
21156 if (likely(setstate_cython)) { | |
21157 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; | |
21158 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; | |
21159 } else if (!setstate || PyErr_Occurred()) { | |
21160 goto __PYX_BAD; | |
21161 } | |
21162 } | |
21163 PyType_Modified((PyTypeObject*)type_obj); | |
21164 } | |
21165 } | |
21166 goto __PYX_GOOD; | |
21167 __PYX_BAD: | |
21168 if (!PyErr_Occurred()) | |
21169 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); | |
21170 ret = -1; | |
21171 __PYX_GOOD: | |
21172 #if !CYTHON_USE_PYTYPE_LOOKUP | |
21173 Py_XDECREF(object_reduce); | |
21174 Py_XDECREF(object_reduce_ex); | |
21175 Py_XDECREF(object_getstate); | |
21176 Py_XDECREF(getstate); | |
21177 #endif | |
21178 Py_XDECREF(reduce); | |
21179 Py_XDECREF(reduce_ex); | |
21180 Py_XDECREF(reduce_cython); | |
21181 Py_XDECREF(setstate); | |
21182 Py_XDECREF(setstate_cython); | |
21183 return ret; | |
21184 } | |
21185 | |
21186 /* TypeImport */ | |
21187 #ifndef __PYX_HAVE_RT_ImportType_0_29_37 | |
21188 #define __PYX_HAVE_RT_ImportType_0_29_37 | |
21189 static PyTypeObject *__Pyx_ImportType_0_29_37(PyObject *module, const char *module_name, const char *class_name, | |
21190 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_0_29_37 check_size) | |
21191 { | |
21192 PyObject *result = 0; | |
21193 char warning[200]; | |
21194 Py_ssize_t basicsize; | |
21195 Py_ssize_t itemsize; | |
21196 #ifdef Py_LIMITED_API | |
21197 PyObject *py_basicsize; | |
21198 PyObject *py_itemsize; | |
21199 #endif | |
21200 result = PyObject_GetAttrString(module, class_name); | |
21201 if (!result) | |
21202 goto bad; | |
21203 if (!PyType_Check(result)) { | |
21204 PyErr_Format(PyExc_TypeError, | |
21205 "%.200s.%.200s is not a type object", | |
21206 module_name, class_name); | |
21207 goto bad; | |
21208 } | |
21209 #ifndef Py_LIMITED_API | |
21210 basicsize = ((PyTypeObject *)result)->tp_basicsize; | |
21211 itemsize = ((PyTypeObject *)result)->tp_itemsize; | |
21212 #else | |
21213 py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); | |
21214 if (!py_basicsize) | |
21215 goto bad; | |
21216 basicsize = PyLong_AsSsize_t(py_basicsize); | |
21217 Py_DECREF(py_basicsize); | |
21218 py_basicsize = 0; | |
21219 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) | |
21220 goto bad; | |
21221 py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); | |
21222 if (!py_itemsize) | |
21223 goto bad; | |
21224 itemsize = PyLong_AsSsize_t(py_itemsize); | |
21225 Py_DECREF(py_itemsize); | |
21226 py_itemsize = 0; | |
21227 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) | |
21228 goto bad; | |
21229 #endif | |
21230 if (itemsize) { | |
21231 if (size % alignment) { | |
21232 alignment = size % alignment; | |
21233 } | |
21234 if (itemsize < (Py_ssize_t)alignment) | |
21235 itemsize = (Py_ssize_t)alignment; | |
21236 } | |
21237 if ((size_t)(basicsize + itemsize) < size) { | |
21238 PyErr_Format(PyExc_ValueError, | |
21239 "%.200s.%.200s size changed, may indicate binary incompatibility. " | |
21240 "Expected %zd from C header, got %zd from PyObject", | |
21241 module_name, class_name, size, basicsize); | |
21242 goto bad; | |
21243 } | |
21244 if (check_size == __Pyx_ImportType_CheckSize_Error_0_29_37 && (size_t)basicsize != size) { | |
21245 PyErr_Format(PyExc_ValueError, | |
21246 "%.200s.%.200s size changed, may indicate binary incompatibility. " | |
21247 "Expected %zd from C header, got %zd from PyObject", | |
21248 module_name, class_name, size, basicsize); | |
21249 goto bad; | |
21250 } | |
21251 else if (check_size == __Pyx_ImportType_CheckSize_Warn_0_29_37 && (size_t)basicsize > size) { | |
21252 PyOS_snprintf(warning, sizeof(warning), | |
21253 "%s.%s size changed, may indicate binary incompatibility. " | |
21254 "Expected %zd from C header, got %zd from PyObject", | |
21255 module_name, class_name, size, basicsize); | |
21256 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; | |
21257 } | |
21258 return (PyTypeObject *)result; | |
21259 bad: | |
21260 Py_XDECREF(result); | |
21261 return NULL; | |
21262 } | |
21263 #endif | |
21264 | |
21265 /* py_dict_items */ | |
21266 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { | |
21267 if (PY_MAJOR_VERSION >= 3) | |
21268 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d); | |
21269 else | |
21270 return PyDict_Items(d); | |
21271 } | |
21272 | |
21273 /* CalculateMetaclass */ | |
21274 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { | |
21275 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); | |
21276 for (i=0; i < nbases; i++) { | |
21277 PyTypeObject *tmptype; | |
21278 PyObject *tmp = PyTuple_GET_ITEM(bases, i); | |
21279 tmptype = Py_TYPE(tmp); | |
21280 #if PY_MAJOR_VERSION < 3 | |
21281 if (tmptype == &PyClass_Type) | |
21282 continue; | |
21283 #endif | |
21284 if (!metaclass) { | |
21285 metaclass = tmptype; | |
21286 continue; | |
21287 } | |
21288 if (PyType_IsSubtype(metaclass, tmptype)) | |
21289 continue; | |
21290 if (PyType_IsSubtype(tmptype, metaclass)) { | |
21291 metaclass = tmptype; | |
21292 continue; | |
21293 } | |
21294 PyErr_SetString(PyExc_TypeError, | |
21295 "metaclass conflict: " | |
21296 "the metaclass of a derived class " | |
21297 "must be a (non-strict) subclass " | |
21298 "of the metaclasses of all its bases"); | |
21299 return NULL; | |
21300 } | |
21301 if (!metaclass) { | |
21302 #if PY_MAJOR_VERSION < 3 | |
21303 metaclass = &PyClass_Type; | |
21304 #else | |
21305 metaclass = &PyType_Type; | |
21306 #endif | |
21307 } | |
21308 Py_INCREF((PyObject*) metaclass); | |
21309 return (PyObject*) metaclass; | |
21310 } | |
21311 | |
21312 /* Py3ClassCreate */ | |
21313 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, | |
21314 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { | |
21315 PyObject *ns; | |
21316 if (metaclass) { | |
21317 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); | |
21318 if (prep) { | |
21319 PyObject *pargs = PyTuple_Pack(2, name, bases); | |
21320 if (unlikely(!pargs)) { | |
21321 Py_DECREF(prep); | |
21322 return NULL; | |
21323 } | |
21324 ns = PyObject_Call(prep, pargs, mkw); | |
21325 Py_DECREF(prep); | |
21326 Py_DECREF(pargs); | |
21327 } else { | |
21328 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) | |
21329 return NULL; | |
21330 PyErr_Clear(); | |
21331 ns = PyDict_New(); | |
21332 } | |
21333 } else { | |
21334 ns = PyDict_New(); | |
21335 } | |
21336 if (unlikely(!ns)) | |
21337 return NULL; | |
21338 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; | |
21339 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; | |
21340 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; | |
21341 return ns; | |
21342 bad: | |
21343 Py_DECREF(ns); | |
21344 return NULL; | |
21345 } | |
21346 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, | |
21347 PyObject *dict, PyObject *mkw, | |
21348 int calculate_metaclass, int allow_py2_metaclass) { | |
21349 PyObject *result, *margs; | |
21350 PyObject *owned_metaclass = NULL; | |
21351 if (allow_py2_metaclass) { | |
21352 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); | |
21353 if (owned_metaclass) { | |
21354 metaclass = owned_metaclass; | |
21355 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { | |
21356 PyErr_Clear(); | |
21357 } else { | |
21358 return NULL; | |
21359 } | |
21360 } | |
21361 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { | |
21362 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); | |
21363 Py_XDECREF(owned_metaclass); | |
21364 if (unlikely(!metaclass)) | |
21365 return NULL; | |
21366 owned_metaclass = metaclass; | |
21367 } | |
21368 margs = PyTuple_Pack(3, name, bases, dict); | |
21369 if (unlikely(!margs)) { | |
21370 result = NULL; | |
21371 } else { | |
21372 result = PyObject_Call(metaclass, margs, mkw); | |
21373 Py_DECREF(margs); | |
21374 } | |
21375 Py_XDECREF(owned_metaclass); | |
21376 return result; | |
21377 } | |
21378 | |
21379 /* GetNameInClass */ | |
21380 static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) { | |
21381 PyObject *result; | |
21382 __Pyx_PyThreadState_declare | |
21383 __Pyx_PyThreadState_assign | |
21384 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) | |
21385 return NULL; | |
21386 __Pyx_PyErr_Clear(); | |
21387 __Pyx_GetModuleGlobalNameUncached(result, name); | |
21388 return result; | |
21389 } | |
21390 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { | |
21391 PyObject *result; | |
21392 result = __Pyx_PyObject_GetAttrStr(nmspace, name); | |
21393 if (!result) { | |
21394 result = __Pyx_GetGlobalNameAfterAttributeLookup(name); | |
21395 } | |
21396 return result; | |
21397 } | |
21398 | |
21399 /* CLineInTraceback */ | |
21400 #ifndef CYTHON_CLINE_IN_TRACEBACK | |
21401 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { | |
21402 PyObject *use_cline; | |
21403 PyObject *ptype, *pvalue, *ptraceback; | |
21404 #if CYTHON_COMPILING_IN_CPYTHON | |
21405 PyObject **cython_runtime_dict; | |
21406 #endif | |
21407 if (unlikely(!__pyx_cython_runtime)) { | |
21408 return c_line; | |
21409 } | |
21410 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); | |
21411 #if CYTHON_COMPILING_IN_CPYTHON | |
21412 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); | |
21413 if (likely(cython_runtime_dict)) { | |
21414 __PYX_PY_DICT_LOOKUP_IF_MODIFIED( | |
21415 use_cline, *cython_runtime_dict, | |
21416 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) | |
21417 } else | |
21418 #endif | |
21419 { | |
21420 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); | |
21421 if (use_cline_obj) { | |
21422 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; | |
21423 Py_DECREF(use_cline_obj); | |
21424 } else { | |
21425 PyErr_Clear(); | |
21426 use_cline = NULL; | |
21427 } | |
21428 } | |
21429 if (!use_cline) { | |
21430 c_line = 0; | |
21431 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); | |
21432 } | |
21433 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { | |
21434 c_line = 0; | |
21435 } | |
21436 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); | |
21437 return c_line; | |
21438 } | |
21439 #endif | |
21440 | |
21441 /* CodeObjectCache */ | |
21442 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { | |
21443 int start = 0, mid = 0, end = count - 1; | |
21444 if (end >= 0 && code_line > entries[end].code_line) { | |
21445 return count; | |
21446 } | |
21447 while (start < end) { | |
21448 mid = start + (end - start) / 2; | |
21449 if (code_line < entries[mid].code_line) { | |
21450 end = mid; | |
21451 } else if (code_line > entries[mid].code_line) { | |
21452 start = mid + 1; | |
21453 } else { | |
21454 return mid; | |
21455 } | |
21456 } | |
21457 if (code_line <= entries[mid].code_line) { | |
21458 return mid; | |
21459 } else { | |
21460 return mid + 1; | |
21461 } | |
21462 } | |
21463 static PyCodeObject *__pyx_find_code_object(int code_line) { | |
21464 PyCodeObject* code_object; | |
21465 int pos; | |
21466 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { | |
21467 return NULL; | |
21468 } | |
21469 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); | |
21470 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { | |
21471 return NULL; | |
21472 } | |
21473 code_object = __pyx_code_cache.entries[pos].code_object; | |
21474 Py_INCREF(code_object); | |
21475 return code_object; | |
21476 } | |
21477 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { | |
21478 int pos, i; | |
21479 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; | |
21480 if (unlikely(!code_line)) { | |
21481 return; | |
21482 } | |
21483 if (unlikely(!entries)) { | |
21484 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); | |
21485 if (likely(entries)) { | |
21486 __pyx_code_cache.entries = entries; | |
21487 __pyx_code_cache.max_count = 64; | |
21488 __pyx_code_cache.count = 1; | |
21489 entries[0].code_line = code_line; | |
21490 entries[0].code_object = code_object; | |
21491 Py_INCREF(code_object); | |
21492 } | |
21493 return; | |
21494 } | |
21495 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); | |
21496 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { | |
21497 PyCodeObject* tmp = entries[pos].code_object; | |
21498 entries[pos].code_object = code_object; | |
21499 Py_DECREF(tmp); | |
21500 return; | |
21501 } | |
21502 if (__pyx_code_cache.count == __pyx_code_cache.max_count) { | |
21503 int new_max = __pyx_code_cache.max_count + 64; | |
21504 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( | |
21505 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); | |
21506 if (unlikely(!entries)) { | |
21507 return; | |
21508 } | |
21509 __pyx_code_cache.entries = entries; | |
21510 __pyx_code_cache.max_count = new_max; | |
21511 } | |
21512 for (i=__pyx_code_cache.count; i>pos; i--) { | |
21513 entries[i] = entries[i-1]; | |
21514 } | |
21515 entries[pos].code_line = code_line; | |
21516 entries[pos].code_object = code_object; | |
21517 __pyx_code_cache.count++; | |
21518 Py_INCREF(code_object); | |
21519 } | |
21520 | |
21521 /* AddTraceback */ | |
21522 #include "compile.h" | |
21523 #include "frameobject.h" | |
21524 #include "traceback.h" | |
21525 #if PY_VERSION_HEX >= 0x030b00a6 | |
21526 #ifndef Py_BUILD_CORE | |
21527 #define Py_BUILD_CORE 1 | |
21528 #endif | |
21529 #include "internal/pycore_frame.h" | |
21530 #endif | |
21531 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( | |
21532 const char *funcname, int c_line, | |
21533 int py_line, const char *filename) { | |
21534 PyCodeObject *py_code = NULL; | |
21535 PyObject *py_funcname = NULL; | |
21536 #if PY_MAJOR_VERSION < 3 | |
21537 PyObject *py_srcfile = NULL; | |
21538 py_srcfile = PyString_FromString(filename); | |
21539 if (!py_srcfile) goto bad; | |
21540 #endif | |
21541 if (c_line) { | |
21542 #if PY_MAJOR_VERSION < 3 | |
21543 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); | |
21544 if (!py_funcname) goto bad; | |
21545 #else | |
21546 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); | |
21547 if (!py_funcname) goto bad; | |
21548 funcname = PyUnicode_AsUTF8(py_funcname); | |
21549 if (!funcname) goto bad; | |
21550 #endif | |
21551 } | |
21552 else { | |
21553 #if PY_MAJOR_VERSION < 3 | |
21554 py_funcname = PyString_FromString(funcname); | |
21555 if (!py_funcname) goto bad; | |
21556 #endif | |
21557 } | |
21558 #if PY_MAJOR_VERSION < 3 | |
21559 py_code = __Pyx_PyCode_New( | |
21560 0, | |
21561 0, | |
21562 0, | |
21563 0, | |
21564 0, | |
21565 __pyx_empty_bytes, /*PyObject *code,*/ | |
21566 __pyx_empty_tuple, /*PyObject *consts,*/ | |
21567 __pyx_empty_tuple, /*PyObject *names,*/ | |
21568 __pyx_empty_tuple, /*PyObject *varnames,*/ | |
21569 __pyx_empty_tuple, /*PyObject *freevars,*/ | |
21570 __pyx_empty_tuple, /*PyObject *cellvars,*/ | |
21571 py_srcfile, /*PyObject *filename,*/ | |
21572 py_funcname, /*PyObject *name,*/ | |
21573 py_line, | |
21574 __pyx_empty_bytes /*PyObject *lnotab*/ | |
21575 ); | |
21576 Py_DECREF(py_srcfile); | |
21577 #else | |
21578 py_code = PyCode_NewEmpty(filename, funcname, py_line); | |
21579 #endif | |
21580 Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline | |
21581 return py_code; | |
21582 bad: | |
21583 Py_XDECREF(py_funcname); | |
21584 #if PY_MAJOR_VERSION < 3 | |
21585 Py_XDECREF(py_srcfile); | |
21586 #endif | |
21587 return NULL; | |
21588 } | |
21589 static void __Pyx_AddTraceback(const char *funcname, int c_line, | |
21590 int py_line, const char *filename) { | |
21591 PyCodeObject *py_code = 0; | |
21592 PyFrameObject *py_frame = 0; | |
21593 PyThreadState *tstate = __Pyx_PyThreadState_Current; | |
21594 PyObject *ptype, *pvalue, *ptraceback; | |
21595 if (c_line) { | |
21596 c_line = __Pyx_CLineForTraceback(tstate, c_line); | |
21597 } | |
21598 py_code = __pyx_find_code_object(c_line ? -c_line : py_line); | |
21599 if (!py_code) { | |
21600 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); | |
21601 py_code = __Pyx_CreateCodeObjectForTraceback( | |
21602 funcname, c_line, py_line, filename); | |
21603 if (!py_code) { | |
21604 /* If the code object creation fails, then we should clear the | |
21605 fetched exception references and propagate the new exception */ | |
21606 Py_XDECREF(ptype); | |
21607 Py_XDECREF(pvalue); | |
21608 Py_XDECREF(ptraceback); | |
21609 goto bad; | |
21610 } | |
21611 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); | |
21612 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); | |
21613 } | |
21614 py_frame = PyFrame_New( | |
21615 tstate, /*PyThreadState *tstate,*/ | |
21616 py_code, /*PyCodeObject *code,*/ | |
21617 __pyx_d, /*PyObject *globals,*/ | |
21618 0 /*PyObject *locals*/ | |
21619 ); | |
21620 if (!py_frame) goto bad; | |
21621 __Pyx_PyFrame_SetLineNumber(py_frame, py_line); | |
21622 PyTraceBack_Here(py_frame); | |
21623 bad: | |
21624 Py_XDECREF(py_code); | |
21625 Py_XDECREF(py_frame); | |
21626 } | |
21627 | |
21628 /* CIntFromPyVerify */ | |
21629 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ | |
21630 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) | |
21631 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ | |
21632 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) | |
21633 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ | |
21634 {\ | |
21635 func_type value = func_value;\ | |
21636 if (sizeof(target_type) < sizeof(func_type)) {\ | |
21637 if (unlikely(value != (func_type) (target_type) value)) {\ | |
21638 func_type zero = 0;\ | |
21639 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ | |
21640 return (target_type) -1;\ | |
21641 if (is_unsigned && unlikely(value < zero))\ | |
21642 goto raise_neg_overflow;\ | |
21643 else\ | |
21644 goto raise_overflow;\ | |
21645 }\ | |
21646 }\ | |
21647 return (target_type) value;\ | |
21648 } | |
21649 | |
21650 /* CIntToPy */ | |
21651 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { | |
21652 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
21653 #pragma GCC diagnostic push | |
21654 #pragma GCC diagnostic ignored "-Wconversion" | |
21655 #endif | |
21656 const int neg_one = (int) -1, const_zero = (int) 0; | |
21657 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
21658 #pragma GCC diagnostic pop | |
21659 #endif | |
21660 const int is_unsigned = neg_one > const_zero; | |
21661 if (is_unsigned) { | |
21662 if (sizeof(int) < sizeof(long)) { | |
21663 return PyInt_FromLong((long) value); | |
21664 } else if (sizeof(int) <= sizeof(unsigned long)) { | |
21665 return PyLong_FromUnsignedLong((unsigned long) value); | |
21666 #ifdef HAVE_LONG_LONG | |
21667 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { | |
21668 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); | |
21669 #endif | |
21670 } | |
21671 } else { | |
21672 if (sizeof(int) <= sizeof(long)) { | |
21673 return PyInt_FromLong((long) value); | |
21674 #ifdef HAVE_LONG_LONG | |
21675 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { | |
21676 return PyLong_FromLongLong((PY_LONG_LONG) value); | |
21677 #endif | |
21678 } | |
21679 } | |
21680 { | |
21681 int one = 1; int little = (int)*(unsigned char *)&one; | |
21682 unsigned char *bytes = (unsigned char *)&value; | |
21683 return _PyLong_FromByteArray(bytes, sizeof(int), | |
21684 little, !is_unsigned); | |
21685 } | |
21686 } | |
21687 | |
21688 /* CIntFromPy */ | |
21689 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { | |
21690 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
21691 #pragma GCC diagnostic push | |
21692 #pragma GCC diagnostic ignored "-Wconversion" | |
21693 #endif | |
21694 const int neg_one = (int) -1, const_zero = (int) 0; | |
21695 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
21696 #pragma GCC diagnostic pop | |
21697 #endif | |
21698 const int is_unsigned = neg_one > const_zero; | |
21699 #if PY_MAJOR_VERSION < 3 | |
21700 if (likely(PyInt_Check(x))) { | |
21701 if (sizeof(int) < sizeof(long)) { | |
21702 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) | |
21703 } else { | |
21704 long val = PyInt_AS_LONG(x); | |
21705 if (is_unsigned && unlikely(val < 0)) { | |
21706 goto raise_neg_overflow; | |
21707 } | |
21708 return (int) val; | |
21709 } | |
21710 } else | |
21711 #endif | |
21712 if (likely(PyLong_Check(x))) { | |
21713 if (is_unsigned) { | |
21714 #if CYTHON_USE_PYLONG_INTERNALS | |
21715 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
21716 switch (Py_SIZE(x)) { | |
21717 case 0: return (int) 0; | |
21718 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) | |
21719 case 2: | |
21720 if (8 * sizeof(int) > 1 * PyLong_SHIFT) { | |
21721 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
21722 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21723 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { | |
21724 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); | |
21725 } | |
21726 } | |
21727 break; | |
21728 case 3: | |
21729 if (8 * sizeof(int) > 2 * PyLong_SHIFT) { | |
21730 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
21731 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21732 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { | |
21733 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); | |
21734 } | |
21735 } | |
21736 break; | |
21737 case 4: | |
21738 if (8 * sizeof(int) > 3 * PyLong_SHIFT) { | |
21739 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
21740 __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]))) | |
21741 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { | |
21742 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); | |
21743 } | |
21744 } | |
21745 break; | |
21746 } | |
21747 #endif | |
21748 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
21749 if (unlikely(Py_SIZE(x) < 0)) { | |
21750 goto raise_neg_overflow; | |
21751 } | |
21752 #else | |
21753 { | |
21754 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
21755 if (unlikely(result < 0)) | |
21756 return (int) -1; | |
21757 if (unlikely(result == 1)) | |
21758 goto raise_neg_overflow; | |
21759 } | |
21760 #endif | |
21761 if (sizeof(int) <= sizeof(unsigned long)) { | |
21762 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) | |
21763 #ifdef HAVE_LONG_LONG | |
21764 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { | |
21765 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
21766 #endif | |
21767 } | |
21768 } else { | |
21769 #if CYTHON_USE_PYLONG_INTERNALS | |
21770 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
21771 switch (Py_SIZE(x)) { | |
21772 case 0: return (int) 0; | |
21773 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) | |
21774 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) | |
21775 case -2: | |
21776 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { | |
21777 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
21778 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21779 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { | |
21780 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
21781 } | |
21782 } | |
21783 break; | |
21784 case 2: | |
21785 if (8 * sizeof(int) > 1 * PyLong_SHIFT) { | |
21786 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
21787 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21788 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { | |
21789 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
21790 } | |
21791 } | |
21792 break; | |
21793 case -3: | |
21794 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { | |
21795 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
21796 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21797 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { | |
21798 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
21799 } | |
21800 } | |
21801 break; | |
21802 case 3: | |
21803 if (8 * sizeof(int) > 2 * PyLong_SHIFT) { | |
21804 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
21805 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21806 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { | |
21807 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
21808 } | |
21809 } | |
21810 break; | |
21811 case -4: | |
21812 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { | |
21813 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
21814 __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]))) | |
21815 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { | |
21816 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
21817 } | |
21818 } | |
21819 break; | |
21820 case 4: | |
21821 if (8 * sizeof(int) > 3 * PyLong_SHIFT) { | |
21822 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
21823 __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]))) | |
21824 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { | |
21825 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
21826 } | |
21827 } | |
21828 break; | |
21829 } | |
21830 #endif | |
21831 if (sizeof(int) <= sizeof(long)) { | |
21832 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) | |
21833 #ifdef HAVE_LONG_LONG | |
21834 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { | |
21835 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
21836 #endif | |
21837 } | |
21838 } | |
21839 { | |
21840 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) | |
21841 PyErr_SetString(PyExc_RuntimeError, | |
21842 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); | |
21843 #else | |
21844 int val; | |
21845 PyObject *v = __Pyx_PyNumber_IntOrLong(x); | |
21846 #if PY_MAJOR_VERSION < 3 | |
21847 if (likely(v) && !PyLong_Check(v)) { | |
21848 PyObject *tmp = v; | |
21849 v = PyNumber_Long(tmp); | |
21850 Py_DECREF(tmp); | |
21851 } | |
21852 #endif | |
21853 if (likely(v)) { | |
21854 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
21855 unsigned char *bytes = (unsigned char *)&val; | |
21856 int ret = _PyLong_AsByteArray((PyLongObject *)v, | |
21857 bytes, sizeof(val), | |
21858 is_little, !is_unsigned); | |
21859 Py_DECREF(v); | |
21860 if (likely(!ret)) | |
21861 return val; | |
21862 } | |
21863 #endif | |
21864 return (int) -1; | |
21865 } | |
21866 } else { | |
21867 int val; | |
21868 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
21869 if (!tmp) return (int) -1; | |
21870 val = __Pyx_PyInt_As_int(tmp); | |
21871 Py_DECREF(tmp); | |
21872 return val; | |
21873 } | |
21874 raise_overflow: | |
21875 PyErr_SetString(PyExc_OverflowError, | |
21876 "value too large to convert to int"); | |
21877 return (int) -1; | |
21878 raise_neg_overflow: | |
21879 PyErr_SetString(PyExc_OverflowError, | |
21880 "can't convert negative value to int"); | |
21881 return (int) -1; | |
21882 } | |
21883 | |
21884 /* CIntFromPy */ | |
21885 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { | |
21886 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
21887 #pragma GCC diagnostic push | |
21888 #pragma GCC diagnostic ignored "-Wconversion" | |
21889 #endif | |
21890 const long neg_one = (long) -1, const_zero = (long) 0; | |
21891 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
21892 #pragma GCC diagnostic pop | |
21893 #endif | |
21894 const int is_unsigned = neg_one > const_zero; | |
21895 #if PY_MAJOR_VERSION < 3 | |
21896 if (likely(PyInt_Check(x))) { | |
21897 if (sizeof(long) < sizeof(long)) { | |
21898 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) | |
21899 } else { | |
21900 long val = PyInt_AS_LONG(x); | |
21901 if (is_unsigned && unlikely(val < 0)) { | |
21902 goto raise_neg_overflow; | |
21903 } | |
21904 return (long) val; | |
21905 } | |
21906 } else | |
21907 #endif | |
21908 if (likely(PyLong_Check(x))) { | |
21909 if (is_unsigned) { | |
21910 #if CYTHON_USE_PYLONG_INTERNALS | |
21911 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
21912 switch (Py_SIZE(x)) { | |
21913 case 0: return (long) 0; | |
21914 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) | |
21915 case 2: | |
21916 if (8 * sizeof(long) > 1 * PyLong_SHIFT) { | |
21917 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
21918 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21919 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { | |
21920 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); | |
21921 } | |
21922 } | |
21923 break; | |
21924 case 3: | |
21925 if (8 * sizeof(long) > 2 * PyLong_SHIFT) { | |
21926 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
21927 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21928 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { | |
21929 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); | |
21930 } | |
21931 } | |
21932 break; | |
21933 case 4: | |
21934 if (8 * sizeof(long) > 3 * PyLong_SHIFT) { | |
21935 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
21936 __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]))) | |
21937 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { | |
21938 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); | |
21939 } | |
21940 } | |
21941 break; | |
21942 } | |
21943 #endif | |
21944 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
21945 if (unlikely(Py_SIZE(x) < 0)) { | |
21946 goto raise_neg_overflow; | |
21947 } | |
21948 #else | |
21949 { | |
21950 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
21951 if (unlikely(result < 0)) | |
21952 return (long) -1; | |
21953 if (unlikely(result == 1)) | |
21954 goto raise_neg_overflow; | |
21955 } | |
21956 #endif | |
21957 if (sizeof(long) <= sizeof(unsigned long)) { | |
21958 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) | |
21959 #ifdef HAVE_LONG_LONG | |
21960 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { | |
21961 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
21962 #endif | |
21963 } | |
21964 } else { | |
21965 #if CYTHON_USE_PYLONG_INTERNALS | |
21966 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
21967 switch (Py_SIZE(x)) { | |
21968 case 0: return (long) 0; | |
21969 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) | |
21970 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) | |
21971 case -2: | |
21972 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { | |
21973 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
21974 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21975 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
21976 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
21977 } | |
21978 } | |
21979 break; | |
21980 case 2: | |
21981 if (8 * sizeof(long) > 1 * PyLong_SHIFT) { | |
21982 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
21983 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21984 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
21985 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
21986 } | |
21987 } | |
21988 break; | |
21989 case -3: | |
21990 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { | |
21991 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
21992 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
21993 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
21994 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
21995 } | |
21996 } | |
21997 break; | |
21998 case 3: | |
21999 if (8 * sizeof(long) > 2 * PyLong_SHIFT) { | |
22000 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22001 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22002 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
22003 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
22004 } | |
22005 } | |
22006 break; | |
22007 case -4: | |
22008 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { | |
22009 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22010 __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]))) | |
22011 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
22012 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
22013 } | |
22014 } | |
22015 break; | |
22016 case 4: | |
22017 if (8 * sizeof(long) > 3 * PyLong_SHIFT) { | |
22018 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22019 __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]))) | |
22020 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { | |
22021 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
22022 } | |
22023 } | |
22024 break; | |
22025 } | |
22026 #endif | |
22027 if (sizeof(long) <= sizeof(long)) { | |
22028 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) | |
22029 #ifdef HAVE_LONG_LONG | |
22030 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { | |
22031 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
22032 #endif | |
22033 } | |
22034 } | |
22035 { | |
22036 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) | |
22037 PyErr_SetString(PyExc_RuntimeError, | |
22038 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); | |
22039 #else | |
22040 long val; | |
22041 PyObject *v = __Pyx_PyNumber_IntOrLong(x); | |
22042 #if PY_MAJOR_VERSION < 3 | |
22043 if (likely(v) && !PyLong_Check(v)) { | |
22044 PyObject *tmp = v; | |
22045 v = PyNumber_Long(tmp); | |
22046 Py_DECREF(tmp); | |
22047 } | |
22048 #endif | |
22049 if (likely(v)) { | |
22050 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
22051 unsigned char *bytes = (unsigned char *)&val; | |
22052 int ret = _PyLong_AsByteArray((PyLongObject *)v, | |
22053 bytes, sizeof(val), | |
22054 is_little, !is_unsigned); | |
22055 Py_DECREF(v); | |
22056 if (likely(!ret)) | |
22057 return val; | |
22058 } | |
22059 #endif | |
22060 return (long) -1; | |
22061 } | |
22062 } else { | |
22063 long val; | |
22064 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
22065 if (!tmp) return (long) -1; | |
22066 val = __Pyx_PyInt_As_long(tmp); | |
22067 Py_DECREF(tmp); | |
22068 return val; | |
22069 } | |
22070 raise_overflow: | |
22071 PyErr_SetString(PyExc_OverflowError, | |
22072 "value too large to convert to long"); | |
22073 return (long) -1; | |
22074 raise_neg_overflow: | |
22075 PyErr_SetString(PyExc_OverflowError, | |
22076 "can't convert negative value to long"); | |
22077 return (long) -1; | |
22078 } | |
22079 | |
22080 /* CIntFromPy */ | |
22081 static CYTHON_INLINE CHRPOS __Pyx_PyInt_As_CHRPOS(PyObject *x) { | |
22082 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22083 #pragma GCC diagnostic push | |
22084 #pragma GCC diagnostic ignored "-Wconversion" | |
22085 #endif | |
22086 const CHRPOS neg_one = (CHRPOS) -1, const_zero = (CHRPOS) 0; | |
22087 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22088 #pragma GCC diagnostic pop | |
22089 #endif | |
22090 const int is_unsigned = neg_one > const_zero; | |
22091 #if PY_MAJOR_VERSION < 3 | |
22092 if (likely(PyInt_Check(x))) { | |
22093 if (sizeof(CHRPOS) < sizeof(long)) { | |
22094 __PYX_VERIFY_RETURN_INT(CHRPOS, long, PyInt_AS_LONG(x)) | |
22095 } else { | |
22096 long val = PyInt_AS_LONG(x); | |
22097 if (is_unsigned && unlikely(val < 0)) { | |
22098 goto raise_neg_overflow; | |
22099 } | |
22100 return (CHRPOS) val; | |
22101 } | |
22102 } else | |
22103 #endif | |
22104 if (likely(PyLong_Check(x))) { | |
22105 if (is_unsigned) { | |
22106 #if CYTHON_USE_PYLONG_INTERNALS | |
22107 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
22108 switch (Py_SIZE(x)) { | |
22109 case 0: return (CHRPOS) 0; | |
22110 case 1: __PYX_VERIFY_RETURN_INT(CHRPOS, digit, digits[0]) | |
22111 case 2: | |
22112 if (8 * sizeof(CHRPOS) > 1 * PyLong_SHIFT) { | |
22113 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22114 __PYX_VERIFY_RETURN_INT(CHRPOS, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22115 } else if (8 * sizeof(CHRPOS) >= 2 * PyLong_SHIFT) { | |
22116 return (CHRPOS) (((((CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0])); | |
22117 } | |
22118 } | |
22119 break; | |
22120 case 3: | |
22121 if (8 * sizeof(CHRPOS) > 2 * PyLong_SHIFT) { | |
22122 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22123 __PYX_VERIFY_RETURN_INT(CHRPOS, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22124 } else if (8 * sizeof(CHRPOS) >= 3 * PyLong_SHIFT) { | |
22125 return (CHRPOS) (((((((CHRPOS)digits[2]) << PyLong_SHIFT) | (CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0])); | |
22126 } | |
22127 } | |
22128 break; | |
22129 case 4: | |
22130 if (8 * sizeof(CHRPOS) > 3 * PyLong_SHIFT) { | |
22131 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22132 __PYX_VERIFY_RETURN_INT(CHRPOS, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22133 } else if (8 * sizeof(CHRPOS) >= 4 * PyLong_SHIFT) { | |
22134 return (CHRPOS) (((((((((CHRPOS)digits[3]) << PyLong_SHIFT) | (CHRPOS)digits[2]) << PyLong_SHIFT) | (CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0])); | |
22135 } | |
22136 } | |
22137 break; | |
22138 } | |
22139 #endif | |
22140 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
22141 if (unlikely(Py_SIZE(x) < 0)) { | |
22142 goto raise_neg_overflow; | |
22143 } | |
22144 #else | |
22145 { | |
22146 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
22147 if (unlikely(result < 0)) | |
22148 return (CHRPOS) -1; | |
22149 if (unlikely(result == 1)) | |
22150 goto raise_neg_overflow; | |
22151 } | |
22152 #endif | |
22153 if (sizeof(CHRPOS) <= sizeof(unsigned long)) { | |
22154 __PYX_VERIFY_RETURN_INT_EXC(CHRPOS, unsigned long, PyLong_AsUnsignedLong(x)) | |
22155 #ifdef HAVE_LONG_LONG | |
22156 } else if (sizeof(CHRPOS) <= sizeof(unsigned PY_LONG_LONG)) { | |
22157 __PYX_VERIFY_RETURN_INT_EXC(CHRPOS, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
22158 #endif | |
22159 } | |
22160 } else { | |
22161 #if CYTHON_USE_PYLONG_INTERNALS | |
22162 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
22163 switch (Py_SIZE(x)) { | |
22164 case 0: return (CHRPOS) 0; | |
22165 case -1: __PYX_VERIFY_RETURN_INT(CHRPOS, sdigit, (sdigit) (-(sdigit)digits[0])) | |
22166 case 1: __PYX_VERIFY_RETURN_INT(CHRPOS, digit, +digits[0]) | |
22167 case -2: | |
22168 if (8 * sizeof(CHRPOS) - 1 > 1 * PyLong_SHIFT) { | |
22169 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22170 __PYX_VERIFY_RETURN_INT(CHRPOS, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22171 } else if (8 * sizeof(CHRPOS) - 1 > 2 * PyLong_SHIFT) { | |
22172 return (CHRPOS) (((CHRPOS)-1)*(((((CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0]))); | |
22173 } | |
22174 } | |
22175 break; | |
22176 case 2: | |
22177 if (8 * sizeof(CHRPOS) > 1 * PyLong_SHIFT) { | |
22178 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22179 __PYX_VERIFY_RETURN_INT(CHRPOS, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22180 } else if (8 * sizeof(CHRPOS) - 1 > 2 * PyLong_SHIFT) { | |
22181 return (CHRPOS) ((((((CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0]))); | |
22182 } | |
22183 } | |
22184 break; | |
22185 case -3: | |
22186 if (8 * sizeof(CHRPOS) - 1 > 2 * PyLong_SHIFT) { | |
22187 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22188 __PYX_VERIFY_RETURN_INT(CHRPOS, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22189 } else if (8 * sizeof(CHRPOS) - 1 > 3 * PyLong_SHIFT) { | |
22190 return (CHRPOS) (((CHRPOS)-1)*(((((((CHRPOS)digits[2]) << PyLong_SHIFT) | (CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0]))); | |
22191 } | |
22192 } | |
22193 break; | |
22194 case 3: | |
22195 if (8 * sizeof(CHRPOS) > 2 * PyLong_SHIFT) { | |
22196 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22197 __PYX_VERIFY_RETURN_INT(CHRPOS, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22198 } else if (8 * sizeof(CHRPOS) - 1 > 3 * PyLong_SHIFT) { | |
22199 return (CHRPOS) ((((((((CHRPOS)digits[2]) << PyLong_SHIFT) | (CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0]))); | |
22200 } | |
22201 } | |
22202 break; | |
22203 case -4: | |
22204 if (8 * sizeof(CHRPOS) - 1 > 3 * PyLong_SHIFT) { | |
22205 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22206 __PYX_VERIFY_RETURN_INT(CHRPOS, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22207 } else if (8 * sizeof(CHRPOS) - 1 > 4 * PyLong_SHIFT) { | |
22208 return (CHRPOS) (((CHRPOS)-1)*(((((((((CHRPOS)digits[3]) << PyLong_SHIFT) | (CHRPOS)digits[2]) << PyLong_SHIFT) | (CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0]))); | |
22209 } | |
22210 } | |
22211 break; | |
22212 case 4: | |
22213 if (8 * sizeof(CHRPOS) > 3 * PyLong_SHIFT) { | |
22214 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22215 __PYX_VERIFY_RETURN_INT(CHRPOS, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22216 } else if (8 * sizeof(CHRPOS) - 1 > 4 * PyLong_SHIFT) { | |
22217 return (CHRPOS) ((((((((((CHRPOS)digits[3]) << PyLong_SHIFT) | (CHRPOS)digits[2]) << PyLong_SHIFT) | (CHRPOS)digits[1]) << PyLong_SHIFT) | (CHRPOS)digits[0]))); | |
22218 } | |
22219 } | |
22220 break; | |
22221 } | |
22222 #endif | |
22223 if (sizeof(CHRPOS) <= sizeof(long)) { | |
22224 __PYX_VERIFY_RETURN_INT_EXC(CHRPOS, long, PyLong_AsLong(x)) | |
22225 #ifdef HAVE_LONG_LONG | |
22226 } else if (sizeof(CHRPOS) <= sizeof(PY_LONG_LONG)) { | |
22227 __PYX_VERIFY_RETURN_INT_EXC(CHRPOS, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
22228 #endif | |
22229 } | |
22230 } | |
22231 { | |
22232 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) | |
22233 PyErr_SetString(PyExc_RuntimeError, | |
22234 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); | |
22235 #else | |
22236 CHRPOS val; | |
22237 PyObject *v = __Pyx_PyNumber_IntOrLong(x); | |
22238 #if PY_MAJOR_VERSION < 3 | |
22239 if (likely(v) && !PyLong_Check(v)) { | |
22240 PyObject *tmp = v; | |
22241 v = PyNumber_Long(tmp); | |
22242 Py_DECREF(tmp); | |
22243 } | |
22244 #endif | |
22245 if (likely(v)) { | |
22246 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
22247 unsigned char *bytes = (unsigned char *)&val; | |
22248 int ret = _PyLong_AsByteArray((PyLongObject *)v, | |
22249 bytes, sizeof(val), | |
22250 is_little, !is_unsigned); | |
22251 Py_DECREF(v); | |
22252 if (likely(!ret)) | |
22253 return val; | |
22254 } | |
22255 #endif | |
22256 return (CHRPOS) -1; | |
22257 } | |
22258 } else { | |
22259 CHRPOS val; | |
22260 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
22261 if (!tmp) return (CHRPOS) -1; | |
22262 val = __Pyx_PyInt_As_CHRPOS(tmp); | |
22263 Py_DECREF(tmp); | |
22264 return val; | |
22265 } | |
22266 raise_overflow: | |
22267 PyErr_SetString(PyExc_OverflowError, | |
22268 "value too large to convert to CHRPOS"); | |
22269 return (CHRPOS) -1; | |
22270 raise_neg_overflow: | |
22271 PyErr_SetString(PyExc_OverflowError, | |
22272 "can't convert negative value to CHRPOS"); | |
22273 return (CHRPOS) -1; | |
22274 } | |
22275 | |
22276 /* CIntFromPy */ | |
22277 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { | |
22278 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22279 #pragma GCC diagnostic push | |
22280 #pragma GCC diagnostic ignored "-Wconversion" | |
22281 #endif | |
22282 const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; | |
22283 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22284 #pragma GCC diagnostic pop | |
22285 #endif | |
22286 const int is_unsigned = neg_one > const_zero; | |
22287 #if PY_MAJOR_VERSION < 3 | |
22288 if (likely(PyInt_Check(x))) { | |
22289 if (sizeof(size_t) < sizeof(long)) { | |
22290 __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) | |
22291 } else { | |
22292 long val = PyInt_AS_LONG(x); | |
22293 if (is_unsigned && unlikely(val < 0)) { | |
22294 goto raise_neg_overflow; | |
22295 } | |
22296 return (size_t) val; | |
22297 } | |
22298 } else | |
22299 #endif | |
22300 if (likely(PyLong_Check(x))) { | |
22301 if (is_unsigned) { | |
22302 #if CYTHON_USE_PYLONG_INTERNALS | |
22303 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
22304 switch (Py_SIZE(x)) { | |
22305 case 0: return (size_t) 0; | |
22306 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) | |
22307 case 2: | |
22308 if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { | |
22309 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22310 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22311 } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { | |
22312 return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
22313 } | |
22314 } | |
22315 break; | |
22316 case 3: | |
22317 if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { | |
22318 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22319 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22320 } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { | |
22321 return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
22322 } | |
22323 } | |
22324 break; | |
22325 case 4: | |
22326 if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { | |
22327 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22328 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22329 } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { | |
22330 return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
22331 } | |
22332 } | |
22333 break; | |
22334 } | |
22335 #endif | |
22336 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
22337 if (unlikely(Py_SIZE(x) < 0)) { | |
22338 goto raise_neg_overflow; | |
22339 } | |
22340 #else | |
22341 { | |
22342 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
22343 if (unlikely(result < 0)) | |
22344 return (size_t) -1; | |
22345 if (unlikely(result == 1)) | |
22346 goto raise_neg_overflow; | |
22347 } | |
22348 #endif | |
22349 if (sizeof(size_t) <= sizeof(unsigned long)) { | |
22350 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) | |
22351 #ifdef HAVE_LONG_LONG | |
22352 } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { | |
22353 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
22354 #endif | |
22355 } | |
22356 } else { | |
22357 #if CYTHON_USE_PYLONG_INTERNALS | |
22358 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
22359 switch (Py_SIZE(x)) { | |
22360 case 0: return (size_t) 0; | |
22361 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) | |
22362 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) | |
22363 case -2: | |
22364 if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { | |
22365 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22366 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22367 } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { | |
22368 return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); | |
22369 } | |
22370 } | |
22371 break; | |
22372 case 2: | |
22373 if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { | |
22374 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22375 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22376 } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { | |
22377 return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); | |
22378 } | |
22379 } | |
22380 break; | |
22381 case -3: | |
22382 if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { | |
22383 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22384 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22385 } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { | |
22386 return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); | |
22387 } | |
22388 } | |
22389 break; | |
22390 case 3: | |
22391 if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { | |
22392 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22393 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22394 } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { | |
22395 return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); | |
22396 } | |
22397 } | |
22398 break; | |
22399 case -4: | |
22400 if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { | |
22401 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22402 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22403 } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { | |
22404 return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); | |
22405 } | |
22406 } | |
22407 break; | |
22408 case 4: | |
22409 if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { | |
22410 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22411 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22412 } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { | |
22413 return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); | |
22414 } | |
22415 } | |
22416 break; | |
22417 } | |
22418 #endif | |
22419 if (sizeof(size_t) <= sizeof(long)) { | |
22420 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) | |
22421 #ifdef HAVE_LONG_LONG | |
22422 } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { | |
22423 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
22424 #endif | |
22425 } | |
22426 } | |
22427 { | |
22428 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) | |
22429 PyErr_SetString(PyExc_RuntimeError, | |
22430 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); | |
22431 #else | |
22432 size_t val; | |
22433 PyObject *v = __Pyx_PyNumber_IntOrLong(x); | |
22434 #if PY_MAJOR_VERSION < 3 | |
22435 if (likely(v) && !PyLong_Check(v)) { | |
22436 PyObject *tmp = v; | |
22437 v = PyNumber_Long(tmp); | |
22438 Py_DECREF(tmp); | |
22439 } | |
22440 #endif | |
22441 if (likely(v)) { | |
22442 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
22443 unsigned char *bytes = (unsigned char *)&val; | |
22444 int ret = _PyLong_AsByteArray((PyLongObject *)v, | |
22445 bytes, sizeof(val), | |
22446 is_little, !is_unsigned); | |
22447 Py_DECREF(v); | |
22448 if (likely(!ret)) | |
22449 return val; | |
22450 } | |
22451 #endif | |
22452 return (size_t) -1; | |
22453 } | |
22454 } else { | |
22455 size_t val; | |
22456 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
22457 if (!tmp) return (size_t) -1; | |
22458 val = __Pyx_PyInt_As_size_t(tmp); | |
22459 Py_DECREF(tmp); | |
22460 return val; | |
22461 } | |
22462 raise_overflow: | |
22463 PyErr_SetString(PyExc_OverflowError, | |
22464 "value too large to convert to size_t"); | |
22465 return (size_t) -1; | |
22466 raise_neg_overflow: | |
22467 PyErr_SetString(PyExc_OverflowError, | |
22468 "can't convert negative value to size_t"); | |
22469 return (size_t) -1; | |
22470 } | |
22471 | |
22472 /* CIntToPy */ | |
22473 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_CHRPOS(CHRPOS value) { | |
22474 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22475 #pragma GCC diagnostic push | |
22476 #pragma GCC diagnostic ignored "-Wconversion" | |
22477 #endif | |
22478 const CHRPOS neg_one = (CHRPOS) -1, const_zero = (CHRPOS) 0; | |
22479 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22480 #pragma GCC diagnostic pop | |
22481 #endif | |
22482 const int is_unsigned = neg_one > const_zero; | |
22483 if (is_unsigned) { | |
22484 if (sizeof(CHRPOS) < sizeof(long)) { | |
22485 return PyInt_FromLong((long) value); | |
22486 } else if (sizeof(CHRPOS) <= sizeof(unsigned long)) { | |
22487 return PyLong_FromUnsignedLong((unsigned long) value); | |
22488 #ifdef HAVE_LONG_LONG | |
22489 } else if (sizeof(CHRPOS) <= sizeof(unsigned PY_LONG_LONG)) { | |
22490 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); | |
22491 #endif | |
22492 } | |
22493 } else { | |
22494 if (sizeof(CHRPOS) <= sizeof(long)) { | |
22495 return PyInt_FromLong((long) value); | |
22496 #ifdef HAVE_LONG_LONG | |
22497 } else if (sizeof(CHRPOS) <= sizeof(PY_LONG_LONG)) { | |
22498 return PyLong_FromLongLong((PY_LONG_LONG) value); | |
22499 #endif | |
22500 } | |
22501 } | |
22502 { | |
22503 int one = 1; int little = (int)*(unsigned char *)&one; | |
22504 unsigned char *bytes = (unsigned char *)&value; | |
22505 return _PyLong_FromByteArray(bytes, sizeof(CHRPOS), | |
22506 little, !is_unsigned); | |
22507 } | |
22508 } | |
22509 | |
22510 /* CIntToPy */ | |
22511 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { | |
22512 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22513 #pragma GCC diagnostic push | |
22514 #pragma GCC diagnostic ignored "-Wconversion" | |
22515 #endif | |
22516 const long neg_one = (long) -1, const_zero = (long) 0; | |
22517 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22518 #pragma GCC diagnostic pop | |
22519 #endif | |
22520 const int is_unsigned = neg_one > const_zero; | |
22521 if (is_unsigned) { | |
22522 if (sizeof(long) < sizeof(long)) { | |
22523 return PyInt_FromLong((long) value); | |
22524 } else if (sizeof(long) <= sizeof(unsigned long)) { | |
22525 return PyLong_FromUnsignedLong((unsigned long) value); | |
22526 #ifdef HAVE_LONG_LONG | |
22527 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { | |
22528 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); | |
22529 #endif | |
22530 } | |
22531 } else { | |
22532 if (sizeof(long) <= sizeof(long)) { | |
22533 return PyInt_FromLong((long) value); | |
22534 #ifdef HAVE_LONG_LONG | |
22535 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { | |
22536 return PyLong_FromLongLong((PY_LONG_LONG) value); | |
22537 #endif | |
22538 } | |
22539 } | |
22540 { | |
22541 int one = 1; int little = (int)*(unsigned char *)&one; | |
22542 unsigned char *bytes = (unsigned char *)&value; | |
22543 return _PyLong_FromByteArray(bytes, sizeof(long), | |
22544 little, !is_unsigned); | |
22545 } | |
22546 } | |
22547 | |
22548 /* CIntFromPy */ | |
22549 static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) { | |
22550 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22551 #pragma GCC diagnostic push | |
22552 #pragma GCC diagnostic ignored "-Wconversion" | |
22553 #endif | |
22554 const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0; | |
22555 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
22556 #pragma GCC diagnostic pop | |
22557 #endif | |
22558 const int is_unsigned = neg_one > const_zero; | |
22559 #if PY_MAJOR_VERSION < 3 | |
22560 if (likely(PyInt_Check(x))) { | |
22561 if (sizeof(unsigned long) < sizeof(long)) { | |
22562 __PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x)) | |
22563 } else { | |
22564 long val = PyInt_AS_LONG(x); | |
22565 if (is_unsigned && unlikely(val < 0)) { | |
22566 goto raise_neg_overflow; | |
22567 } | |
22568 return (unsigned long) val; | |
22569 } | |
22570 } else | |
22571 #endif | |
22572 if (likely(PyLong_Check(x))) { | |
22573 if (is_unsigned) { | |
22574 #if CYTHON_USE_PYLONG_INTERNALS | |
22575 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
22576 switch (Py_SIZE(x)) { | |
22577 case 0: return (unsigned long) 0; | |
22578 case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, digits[0]) | |
22579 case 2: | |
22580 if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) { | |
22581 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22582 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22583 } else if (8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT) { | |
22584 return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
22585 } | |
22586 } | |
22587 break; | |
22588 case 3: | |
22589 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22590 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22591 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22592 } else if (8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT) { | |
22593 return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
22594 } | |
22595 } | |
22596 break; | |
22597 case 4: | |
22598 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22599 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22600 __PYX_VERIFY_RETURN_INT(unsigned 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]))) | |
22601 } else if (8 * sizeof(unsigned long) >= 4 * PyLong_SHIFT) { | |
22602 return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); | |
22603 } | |
22604 } | |
22605 break; | |
22606 } | |
22607 #endif | |
22608 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
22609 if (unlikely(Py_SIZE(x) < 0)) { | |
22610 goto raise_neg_overflow; | |
22611 } | |
22612 #else | |
22613 { | |
22614 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
22615 if (unlikely(result < 0)) | |
22616 return (unsigned long) -1; | |
22617 if (unlikely(result == 1)) | |
22618 goto raise_neg_overflow; | |
22619 } | |
22620 #endif | |
22621 if (sizeof(unsigned long) <= sizeof(unsigned long)) { | |
22622 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x)) | |
22623 #ifdef HAVE_LONG_LONG | |
22624 } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) { | |
22625 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
22626 #endif | |
22627 } | |
22628 } else { | |
22629 #if CYTHON_USE_PYLONG_INTERNALS | |
22630 const digit* digits = ((PyLongObject*)x)->ob_digit; | |
22631 switch (Py_SIZE(x)) { | |
22632 case 0: return (unsigned long) 0; | |
22633 case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, (sdigit) (-(sdigit)digits[0])) | |
22634 case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, +digits[0]) | |
22635 case -2: | |
22636 if (8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT) { | |
22637 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22638 __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22639 } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) { | |
22640 return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); | |
22641 } | |
22642 } | |
22643 break; | |
22644 case 2: | |
22645 if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) { | |
22646 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22647 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22648 } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) { | |
22649 return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); | |
22650 } | |
22651 } | |
22652 break; | |
22653 case -3: | |
22654 if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) { | |
22655 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22656 __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22657 } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) { | |
22658 return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); | |
22659 } | |
22660 } | |
22661 break; | |
22662 case 3: | |
22663 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { | |
22664 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22665 __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
22666 } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) { | |
22667 return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); | |
22668 } | |
22669 } | |
22670 break; | |
22671 case -4: | |
22672 if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) { | |
22673 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22674 __PYX_VERIFY_RETURN_INT(unsigned 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]))) | |
22675 } else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) { | |
22676 return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); | |
22677 } | |
22678 } | |
22679 break; | |
22680 case 4: | |
22681 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { | |
22682 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { | |
22683 __PYX_VERIFY_RETURN_INT(unsigned 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]))) | |
22684 } else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) { | |
22685 return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))); | |
22686 } | |
22687 } | |
22688 break; | |
22689 } | |
22690 #endif | |
22691 if (sizeof(unsigned long) <= sizeof(long)) { | |
22692 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x)) | |
22693 #ifdef HAVE_LONG_LONG | |
22694 } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) { | |
22695 __PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
22696 #endif | |
22697 } | |
22698 } | |
22699 { | |
22700 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) | |
22701 PyErr_SetString(PyExc_RuntimeError, | |
22702 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); | |
22703 #else | |
22704 unsigned long val; | |
22705 PyObject *v = __Pyx_PyNumber_IntOrLong(x); | |
22706 #if PY_MAJOR_VERSION < 3 | |
22707 if (likely(v) && !PyLong_Check(v)) { | |
22708 PyObject *tmp = v; | |
22709 v = PyNumber_Long(tmp); | |
22710 Py_DECREF(tmp); | |
22711 } | |
22712 #endif | |
22713 if (likely(v)) { | |
22714 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
22715 unsigned char *bytes = (unsigned char *)&val; | |
22716 int ret = _PyLong_AsByteArray((PyLongObject *)v, | |
22717 bytes, sizeof(val), | |
22718 is_little, !is_unsigned); | |
22719 Py_DECREF(v); | |
22720 if (likely(!ret)) | |
22721 return val; | |
22722 } | |
22723 #endif | |
22724 return (unsigned long) -1; | |
22725 } | |
22726 } else { | |
22727 unsigned long val; | |
22728 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
22729 if (!tmp) return (unsigned long) -1; | |
22730 val = __Pyx_PyInt_As_unsigned_long(tmp); | |
22731 Py_DECREF(tmp); | |
22732 return val; | |
22733 } | |
22734 raise_overflow: | |
22735 PyErr_SetString(PyExc_OverflowError, | |
22736 "value too large to convert to unsigned long"); | |
22737 return (unsigned long) -1; | |
22738 raise_neg_overflow: | |
22739 PyErr_SetString(PyExc_OverflowError, | |
22740 "can't convert negative value to unsigned long"); | |
22741 return (unsigned long) -1; | |
22742 } | |
22743 | |
22744 /* CheckBinaryVersion */ | |
22745 static int __Pyx_check_binary_version(void) { | |
22746 char ctversion[5]; | |
22747 int same=1, i, found_dot; | |
22748 const char* rt_from_call = Py_GetVersion(); | |
22749 PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); | |
22750 found_dot = 0; | |
22751 for (i = 0; i < 4; i++) { | |
22752 if (!ctversion[i]) { | |
22753 same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); | |
22754 break; | |
22755 } | |
22756 if (rt_from_call[i] != ctversion[i]) { | |
22757 same = 0; | |
22758 break; | |
22759 } | |
22760 } | |
22761 if (!same) { | |
22762 char rtversion[5] = {'\0'}; | |
22763 char message[200]; | |
22764 for (i=0; i<4; ++i) { | |
22765 if (rt_from_call[i] == '.') { | |
22766 if (found_dot) break; | |
22767 found_dot = 1; | |
22768 } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { | |
22769 break; | |
22770 } | |
22771 rtversion[i] = rt_from_call[i]; | |
22772 } | |
22773 PyOS_snprintf(message, sizeof(message), | |
22774 "compiletime version %s of module '%.100s' " | |
22775 "does not match runtime version %s", | |
22776 ctversion, __Pyx_MODULE_NAME, rtversion); | |
22777 return PyErr_WarnEx(NULL, message, 1); | |
22778 } | |
22779 return 0; | |
22780 } | |
22781 | |
22782 /* InitStrings */ | |
22783 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { | |
22784 while (t->p) { | |
22785 #if PY_MAJOR_VERSION < 3 | |
22786 if (t->is_unicode) { | |
22787 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); | |
22788 } else if (t->intern) { | |
22789 *t->p = PyString_InternFromString(t->s); | |
22790 } else { | |
22791 *t->p = PyString_FromStringAndSize(t->s, t->n - 1); | |
22792 } | |
22793 #else | |
22794 if (t->is_unicode | t->is_str) { | |
22795 if (t->intern) { | |
22796 *t->p = PyUnicode_InternFromString(t->s); | |
22797 } else if (t->encoding) { | |
22798 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); | |
22799 } else { | |
22800 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); | |
22801 } | |
22802 } else { | |
22803 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); | |
22804 } | |
22805 #endif | |
22806 if (!*t->p) | |
22807 return -1; | |
22808 if (PyObject_Hash(*t->p) == -1) | |
22809 return -1; | |
22810 ++t; | |
22811 } | |
22812 return 0; | |
22813 } | |
22814 | |
22815 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { | |
22816 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); | |
22817 } | |
22818 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { | |
22819 Py_ssize_t ignore; | |
22820 return __Pyx_PyObject_AsStringAndSize(o, &ignore); | |
22821 } | |
22822 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT | |
22823 #if !CYTHON_PEP393_ENABLED | |
22824 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { | |
22825 char* defenc_c; | |
22826 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); | |
22827 if (!defenc) return NULL; | |
22828 defenc_c = PyBytes_AS_STRING(defenc); | |
22829 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
22830 { | |
22831 char* end = defenc_c + PyBytes_GET_SIZE(defenc); | |
22832 char* c; | |
22833 for (c = defenc_c; c < end; c++) { | |
22834 if ((unsigned char) (*c) >= 128) { | |
22835 PyUnicode_AsASCIIString(o); | |
22836 return NULL; | |
22837 } | |
22838 } | |
22839 } | |
22840 #endif | |
22841 *length = PyBytes_GET_SIZE(defenc); | |
22842 return defenc_c; | |
22843 } | |
22844 #else | |
22845 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { | |
22846 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; | |
22847 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
22848 if (likely(PyUnicode_IS_ASCII(o))) { | |
22849 *length = PyUnicode_GET_LENGTH(o); | |
22850 return PyUnicode_AsUTF8(o); | |
22851 } else { | |
22852 PyUnicode_AsASCIIString(o); | |
22853 return NULL; | |
22854 } | |
22855 #else | |
22856 return PyUnicode_AsUTF8AndSize(o, length); | |
22857 #endif | |
22858 } | |
22859 #endif | |
22860 #endif | |
22861 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { | |
22862 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT | |
22863 if ( | |
22864 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
22865 __Pyx_sys_getdefaultencoding_not_ascii && | |
22866 #endif | |
22867 PyUnicode_Check(o)) { | |
22868 return __Pyx_PyUnicode_AsStringAndSize(o, length); | |
22869 } else | |
22870 #endif | |
22871 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) | |
22872 if (PyByteArray_Check(o)) { | |
22873 *length = PyByteArray_GET_SIZE(o); | |
22874 return PyByteArray_AS_STRING(o); | |
22875 } else | |
22876 #endif | |
22877 { | |
22878 char* result; | |
22879 int r = PyBytes_AsStringAndSize(o, &result, length); | |
22880 if (unlikely(r < 0)) { | |
22881 return NULL; | |
22882 } else { | |
22883 return result; | |
22884 } | |
22885 } | |
22886 } | |
22887 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { | |
22888 int is_true = x == Py_True; | |
22889 if (is_true | (x == Py_False) | (x == Py_None)) return is_true; | |
22890 else return PyObject_IsTrue(x); | |
22891 } | |
22892 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { | |
22893 int retval; | |
22894 if (unlikely(!x)) return -1; | |
22895 retval = __Pyx_PyObject_IsTrue(x); | |
22896 Py_DECREF(x); | |
22897 return retval; | |
22898 } | |
22899 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { | |
22900 #if PY_MAJOR_VERSION >= 3 | |
22901 if (PyLong_Check(result)) { | |
22902 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, | |
22903 "__int__ returned non-int (type %.200s). " | |
22904 "The ability to return an instance of a strict subclass of int " | |
22905 "is deprecated, and may be removed in a future version of Python.", | |
22906 Py_TYPE(result)->tp_name)) { | |
22907 Py_DECREF(result); | |
22908 return NULL; | |
22909 } | |
22910 return result; | |
22911 } | |
22912 #endif | |
22913 PyErr_Format(PyExc_TypeError, | |
22914 "__%.4s__ returned non-%.4s (type %.200s)", | |
22915 type_name, type_name, Py_TYPE(result)->tp_name); | |
22916 Py_DECREF(result); | |
22917 return NULL; | |
22918 } | |
22919 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { | |
22920 #if CYTHON_USE_TYPE_SLOTS | |
22921 PyNumberMethods *m; | |
22922 #endif | |
22923 const char *name = NULL; | |
22924 PyObject *res = NULL; | |
22925 #if PY_MAJOR_VERSION < 3 | |
22926 if (likely(PyInt_Check(x) || PyLong_Check(x))) | |
22927 #else | |
22928 if (likely(PyLong_Check(x))) | |
22929 #endif | |
22930 return __Pyx_NewRef(x); | |
22931 #if CYTHON_USE_TYPE_SLOTS | |
22932 m = Py_TYPE(x)->tp_as_number; | |
22933 #if PY_MAJOR_VERSION < 3 | |
22934 if (m && m->nb_int) { | |
22935 name = "int"; | |
22936 res = m->nb_int(x); | |
22937 } | |
22938 else if (m && m->nb_long) { | |
22939 name = "long"; | |
22940 res = m->nb_long(x); | |
22941 } | |
22942 #else | |
22943 if (likely(m && m->nb_int)) { | |
22944 name = "int"; | |
22945 res = m->nb_int(x); | |
22946 } | |
22947 #endif | |
22948 #else | |
22949 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { | |
22950 res = PyNumber_Int(x); | |
22951 } | |
22952 #endif | |
22953 if (likely(res)) { | |
22954 #if PY_MAJOR_VERSION < 3 | |
22955 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { | |
22956 #else | |
22957 if (unlikely(!PyLong_CheckExact(res))) { | |
22958 #endif | |
22959 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); | |
22960 } | |
22961 } | |
22962 else if (!PyErr_Occurred()) { | |
22963 PyErr_SetString(PyExc_TypeError, | |
22964 "an integer is required"); | |
22965 } | |
22966 return res; | |
22967 } | |
22968 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { | |
22969 Py_ssize_t ival; | |
22970 PyObject *x; | |
22971 #if PY_MAJOR_VERSION < 3 | |
22972 if (likely(PyInt_CheckExact(b))) { | |
22973 if (sizeof(Py_ssize_t) >= sizeof(long)) | |
22974 return PyInt_AS_LONG(b); | |
22975 else | |
22976 return PyInt_AsSsize_t(b); | |
22977 } | |
22978 #endif | |
22979 if (likely(PyLong_CheckExact(b))) { | |
22980 #if CYTHON_USE_PYLONG_INTERNALS | |
22981 const digit* digits = ((PyLongObject*)b)->ob_digit; | |
22982 const Py_ssize_t size = Py_SIZE(b); | |
22983 if (likely(__Pyx_sst_abs(size) <= 1)) { | |
22984 ival = likely(size) ? digits[0] : 0; | |
22985 if (size == -1) ival = -ival; | |
22986 return ival; | |
22987 } else { | |
22988 switch (size) { | |
22989 case 2: | |
22990 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { | |
22991 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
22992 } | |
22993 break; | |
22994 case -2: | |
22995 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { | |
22996 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
22997 } | |
22998 break; | |
22999 case 3: | |
23000 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { | |
23001 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
23002 } | |
23003 break; | |
23004 case -3: | |
23005 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { | |
23006 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
23007 } | |
23008 break; | |
23009 case 4: | |
23010 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { | |
23011 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])); | |
23012 } | |
23013 break; | |
23014 case -4: | |
23015 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { | |
23016 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])); | |
23017 } | |
23018 break; | |
23019 } | |
23020 } | |
23021 #endif | |
23022 return PyLong_AsSsize_t(b); | |
23023 } | |
23024 x = PyNumber_Index(b); | |
23025 if (!x) return -1; | |
23026 ival = PyInt_AsSsize_t(x); | |
23027 Py_DECREF(x); | |
23028 return ival; | |
23029 } | |
23030 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { | |
23031 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { | |
23032 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); | |
23033 #if PY_MAJOR_VERSION < 3 | |
23034 } else if (likely(PyInt_CheckExact(o))) { | |
23035 return PyInt_AS_LONG(o); | |
23036 #endif | |
23037 } else { | |
23038 Py_ssize_t ival; | |
23039 PyObject *x; | |
23040 x = PyNumber_Index(o); | |
23041 if (!x) return -1; | |
23042 ival = PyInt_AsLong(x); | |
23043 Py_DECREF(x); | |
23044 return ival; | |
23045 } | |
23046 } | |
23047 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { | |
23048 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); | |
23049 } | |
23050 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { | |
23051 return PyInt_FromSize_t(ival); | |
23052 } | |
23053 | |
23054 | |
23055 #endif /* Py_PYTHON_H */ |